darcs patch: Correctly implement section 4.1.7 of ICCCM

Mon Nov 24 20:46:32 EET 2008 Roman Cheplyaka

roma:
Mon Nov 24 20:46:32 EET 2008 Roman Cheplyaka
* Correctly implement section 4.1.7 of ICCCM Based on patch and investigation by Ivan Tarasov. Fixes #177. - do setInputFocus iff 'input' field of WM_HINTS is True - send WM_TAKE_FOCUS if needed
Good work. Do you need testing?

* Don Stewart
roma:
Mon Nov 24 20:46:32 EET 2008 Roman Cheplyaka
* Correctly implement section 4.1.7 of ICCCM Based on patch and investigation by Ivan Tarasov. Fixes #177. - do setInputFocus iff 'input' field of WM_HINTS is True - send WM_TAKE_FOCUS if needed Good work. Do you need testing?
Well, it never hurts. :) -- Roman I. Cheplyaka :: http://ro-che.info/ kzm: My program contains a bug. How ungrateful, after all I've done for it.

* Roman Cheplyaka
Mon Nov 24 20:46:32 EET 2008 Roman Cheplyaka
* Correctly implement section 4.1.7 of ICCCM Based on patch and investigation by Ivan Tarasov. Fixes #177. - do setInputFocus iff 'input' field of WM_HINTS is True - send WM_TAKE_FOCUS if needed
I need help with this patch. As I wrote, according to section 4.1.7 of ICCCM window manager should only setInputFocus on window in the case when input field of WM_HINTS is True. However, some applications do not set WM_HINTS at all. Famous 'xev' is among them. In this case getWMHints returns False for input field. But in practice xev really wants WM to give it focus. So, I see two ways to proceed: - either we ignore that part of ICCCM and setInputFocus on every window, as we did earlier (it doesn't seem to cause any problems) - or we follow the standard with this workaround: make minimal change to X11 to set input field to True by default. The second choice will bring some inconvenience to our users until the next X11 is released. OTOH I don't know any useful apps except xev which doesn't set WM_HINTS. What do you suggest? -- Roman I. Cheplyaka (aka Feuerbach @ IRC)

On Tue, Nov 25, 2008 at 10:54:31AM +0200, Roman Cheplyaka wrote:
* Roman Cheplyaka
[2008-11-24 21:02:01+0200] Mon Nov 24 20:46:32 EET 2008 Roman Cheplyaka
* Correctly implement section 4.1.7 of ICCCM Based on patch and investigation by Ivan Tarasov. Fixes #177. - do setInputFocus iff 'input' field of WM_HINTS is True - send WM_TAKE_FOCUS if needed I need help with this patch. As I wrote, according to section 4.1.7 of ICCCM window manager should only setInputFocus on window in the case when input field of WM_HINTS is True. However, some applications do not set WM_HINTS at all. Famous 'xev' is among them. In this case getWMHints returns False for input field. But in practice xev really wants WM to give it focus. So, I see two ways to proceed: - either we ignore that part of ICCCM and setInputFocus on every window, as we did earlier (it doesn't seem to cause any problems) - or we follow the standard with this workaround: make minimal change to X11 to set input field to True by default. The second choice will bring some inconvenience to our users until the next X11 is released. OTOH I don't know any useful apps except xev which doesn't set WM_HINTS. What do you suggest?
-- Roman I. Cheplyaka (aka Feuerbach @ IRC)
WMHints has a bitmask that indicates which WM_HINTS are actually present. I believe the correct solution is to simply check whether inputHintBit is set on wmh_flags. Cheers, Spencer Janssen

* Spencer Janssen
WMHints has a bitmask that indicates which WM_HINTS are actually present. I believe the correct solution is to simply check whether inputHintBit is set on wmh_flags.
Here's amended patch. 2 all: feel free to test/use it, but be aware that it will leak memory until getWMHints is fixed in X11. -- Roman I. Cheplyaka (aka Feuerbach @ IRC)

Oh? Is there a patch to getWMHints I should be applying? roma:
* Spencer Janssen
[2008-11-25 04:57:47-0600] WMHints has a bitmask that indicates which WM_HINTS are actually present. I believe the correct solution is to simply check whether inputHintBit is set on wmh_flags.
Here's amended patch.
2 all: feel free to test/use it, but be aware that it will leak memory until getWMHints is fixed in X11.
-- Roman I. Cheplyaka (aka Feuerbach @ IRC)
Tue Nov 25 23:19:44 EET 2008 Roman Cheplyaka
* Correctly implement section 4.1.7 of ICCCM Based on patch and investigation by Ivan Tarasov. Fixes #177. - do setInputFocus unless application explicitly asks not to do so - send WM_TAKE_FOCUS if needed New patches:
[Correctly implement section 4.1.7 of ICCCM Roman Cheplyaka
**20081125211944 Based on patch and investigation by Ivan Tarasov. Fixes #177. - do setInputFocus unless application explicitly asks not to do so - send WM_TAKE_FOCUS if needed ] { hunk ./XMonad/Core.hs 30 - atom_WM_STATE, atom_WM_PROTOCOLS, atom_WM_DELETE_WINDOW, ManageHook, Query(..), runQuery + atom_WM_STATE, atom_WM_PROTOCOLS, atom_WM_DELETE_WINDOW, atom_WM_TAKE_FOCUS, ManageHook, Query(..), runQuery hunk ./XMonad/Core.hs 189 -atom_WM_PROTOCOLS, atom_WM_DELETE_WINDOW, atom_WM_STATE :: X Atom +atom_WM_PROTOCOLS, atom_WM_DELETE_WINDOW, atom_WM_STATE, atom_WM_TAKE_FOCUS :: X Atom hunk ./XMonad/Core.hs 193 +atom_WM_TAKE_FOCUS = getAtom "WM_TAKE_FOCUS" hunk ./XMonad/Operations.hs 28 -import Data.Bits ((.|.), (.&.), complement) +import Data.Bits ((.|.), (.&.), complement, testBit) hunk ./XMonad/Operations.hs 325 - io $ do setInputFocus dpy w revertToPointerRoot 0 + -- do setInputFocus unless application explicitly asks not to do so + wmhints <- io $ getWMHints dpy w + when (not (testBit (wmh_flags wmhints) inputHintBit) || wmh_input wmhints) $ + io $ setInputFocus dpy w revertToPointerRoot 0 hunk ./XMonad/Operations.hs 330 + + -- send WM_TAKE_FOCUS if needed + wmtakef <- atom_WM_TAKE_FOCUS + wmprot <- atom_WM_PROTOCOLS + + protocols <- io $ getWMProtocols dpy w + when (wmtakef `elem` protocols) $ do + io $ allocaXEvent $ \ev -> do + setEventType ev clientMessage + setClientMessageEvent ev w wmprot 32 wmtakef currentTime + sendEvent dpy w False noEventMask ev } Context:
[Fix #192. Spencer Janssen
**20081021220059] [select base < 4 for building on ghc 6.10 Adam Vogt **20081013214509] [add killWindow function Joachim Breitner **20081005001804 This is required to kill anything that is not focused, without having to focus it first. ] [add'l documentation Devin Mullins **20080927234639] [Regression: ungrab buttons on *non* root windows Spencer Janssen **20081007214351] [Partial fix for #40 Spencer Janssen **20081007212053 Improvements: - clicking on the root will change focus to that screen - moving the mouse from a window on a screen to an empty screen changes focus to that screen The only remaining issue is that moving the mouse between two empty screens does not change focus. In order to solve this, we'd have to select motion events on the root window, which is potentially expensive. ] [Track mouse position via events received Spencer Janssen **20081007203953] [Fix haddock Spencer Janssen **20081007094641] [Move screen locating code into pointScreen Spencer Janssen **20081007094207] [Make pointWithin a top-level binding Spencer Janssen **20081007090229] [sp README, CONFIG, STYLE, TODO gwern0@gmail.com**20080913024457] [Use the same X11 dependency as xmonad-contrib Spencer Janssen **20080921061508] [Export focusUp' and focusDown' -- work entirely on stacks Spencer Janssen **20080911214803] [add W.shiftMaster, fix float/tile-reordering bug Devin Mullins **20080911053909] [TAG 0.8 Spencer Janssen **20080905195412] [Spelling. Any bets on how long this has been there? Spencer Janssen **20080905195211] [Bump version to 0.8 Spencer Janssen **20080905194225] [Remove obsolete comments about darcs X11 Spencer Janssen **20080905194915] [Recommend latest packages rather than specific versions Spencer Janssen **20080905194837] [Also remove -optl from the executable section Spencer Janssen **20080820210023] [-optl-Wl,-s is not needed with recent Cabal versions Spencer Janssen **20080820204102] [Haddock links Malebria **20080601212515] [Haddock syntax for enumeration Malebria **20080601204951] [I prefer the spencerjanssen@gmail.com address now Spencer Janssen **20080714202650] [Raise windows in the floating layer when moving or resizing Trevor Elliott **20080521215057] [add currentTag convenience function Devin Mullins **20080511224258] [Make Mirror a newtype Spencer Janssen **20080508104640] [Comments Spencer Janssen **20080507013122] [Break long line Spencer Janssen **20080507012608] [Style Spencer Janssen **20080507012519] [Simplify Spencer Janssen **20080507011309] [Overhaul Choose, fixes issue 183 Spencer Janssen **20080506220809] [Remember if focus changes were caused by mouse actions or by key commands Klaus Weidner **20080502175603 If the user used the mouse to change window focus (moving into or clicking on a window), this should be handled differently than focus changes due to keyboard commands. Specifically, it's inappropriate to discard window enter/leave events while the mouse is moving. This fixes the bug where a fast mouse motion across multiple windows resulted in the wrong window keeping focus.
It's also helpful information for contrib modules such as UpdatePointer - it's supposed to move the mouse pointer only in response to keyboard actions, not if the user was moving the mouse. ] [Wibble Spencer Janssen
**20080506203840] [Added doShift function for more user-friendly hooks Ivan N. Veselov **20080506185757] [use named colours. fixes startup failure on the XO Don Stewart **20080502210149] [Set focus *after* revealing windows Spencer Janssen **20080407222559] [Reveal windows after moving/resizing them. Spencer Janssen **20080407220756 This should reduce the number of repaints for newly visible windows. ] [Hide newly created but non-visible windows (fixes bug #172) Spencer Janssen **20080430014012] [formatting, eta expansion Don Stewart **20080418184337] [XMonad.ManageHook: add 'appName', another name for 'resource' Lukas Mai **20080406012006] [XMonad.ManageHook: make 'title' locale-aware; haddock cleanup Lukas Mai **20080406011338 The code for 'title' was stolen from getname.patch (bug #44). ] [XMonad.Main: call setlocale on startup Lukas Mai
**20080406011234] [floats always use current screen (with less bugs) robreim@bobturf.org**20080405135009] [XMonad.Operations: applySizeHint reshuffle Lukas Mai **20080404215615 Make applySizeHints take window borders into account. Move old functionality to applySizeHintsContents. Add new mkAdjust function that generates a custom autohinter for a window. ] [XMonad.Layout: documentation cleanup Lukas Mai
**20080404215444] [Remove gaps from the example config Spencer Janssen **20080329232959] [Remove gaps Spencer Janssen **20080325091526] [TAG 0.7 Spencer Janssen **20080329210249] Patch bundle hash: 895e2b0a4240849ced9aaf3bdb9165b6943d610e
_______________________________________________ xmonad mailing list xmonad@haskell.org http://www.haskell.org/mailman/listinfo/xmonad

* Don Stewart
Oh? Is there a patch to getWMHints I should be applying?
We discussed it with Spencer today. It should be a matter of several minutes, but if he wants I can prepare the patch. -- Roman I. Cheplyaka :: http://ro-che.info/ kzm: My program contains a bug. How ungrateful, after all I've done for it.
participants (3)
-
Don Stewart
-
Roman Cheplyaka
-
Spencer Janssen