My favorites | Sign in
Project Home Issues
New issue   Search
for
  Advanced search   Search tips   Subscriptions

Issue 177 attachment: takefocus2.darcs-patch (12.9 KB)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
Sun Jun 21 21:56:49 MDT 2009 Geoff Reedy <geoff@programmer-monk.net>
* track currently processing event

Sun Jun 21 23:19:11 MDT 2009 Geoff Reedy <geoff@programmer-monk.net>
* implement the ICCCM WM_TAKE_FOCUS protocol

Sat Oct 10 17:19:07 MDT 2009 Geoff Reedy <geoff@programmer-monk.net>
* Give focus to windows that don't set the input hint

New patches:

[track currently processing event
Geoff Reedy <geoff@programmer-monk.net>**20090622035649
Ignore-this: da2e82037548ab176a4333056c94a07a
] {
hunk ./XMonad/Core.hs 83
, mousePosition :: !(Maybe (Position, Position))
-- ^ position of the mouse according to
-- the event currently being processed
+ , currentEvent :: !(Maybe Event)
+ -- ^ event currently being processed
}

-- todo, better name
hunk ./XMonad/Main.hsc 116
, keyActions = keys xmc xmc
, buttonActions = mouseBindings xmc xmc
, mouseFocused = False
- , mousePosition = Nothing }
+ , mousePosition = Nothing
+ , currentEvent = Nothing }
st = XState
{ windowset = initialWinset
, mapped = S.empty
hunk ./XMonad/Main.hsc 157
prehandle e = let mouse = do guard (ev_event_type e `elem` evs)
return (fromIntegral (ev_x_root e)
,fromIntegral (ev_y_root e))
- in local (\c -> c { mousePosition = mouse }) (handleWithHook e)
+ in local (\c -> c { mousePosition = mouse, currentEvent = Just e }) (handleWithHook e)
evs = [ keyPress, keyRelease, enterNotify, leaveNotify
, buttonPress, buttonRelease]

}
[implement the ICCCM WM_TAKE_FOCUS protocol
Geoff Reedy <geoff@programmer-monk.net>**20090622051911
Ignore-this: 5b397417dfcf9014ac515a64484cc314
] {
hunk ./XMonad/Core.hs 30
runX, catchX, userCode, userCodeDef, io, catchIO, installSignalHandlers, uninstallSignalHandlers,
withDisplay, withWindowSet, isRoot, runOnWorkspaces,
getAtom, spawn, spawnPID, getXMonadDir, recompile, trace, whenJust, whenX,
- 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
) where

import XMonad.StackSet hiding (modify)
hunk ./XMonad/Core.hs 206
getAtom str = withDisplay $ \dpy -> io $ internAtom dpy str False

-- | Common non-predefined atoms
-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
atom_WM_PROTOCOLS = getAtom "WM_PROTOCOLS"
atom_WM_DELETE_WINDOW = getAtom "WM_DELETE_WINDOW"
atom_WM_STATE = getAtom "WM_STATE"
hunk ./XMonad/Core.hs 210
+atom_WM_TAKE_FOCUS = getAtom "WM_TAKE_FOCUS"

------------------------------------------------------------------------
-- LayoutClass handling. See particular instances in Operations.hs
hunk ./XMonad/Operations.hs 330

-- If we ungrab buttons on the root window, we lose our mouse bindings.
whenX (not <$> isRoot w) $ setButtonGrab False w
- io $ do setInputFocus dpy w revertToPointerRoot 0
- -- raiseWindow dpy w
+
+ hints <- io $ getWMHints dpy w
+ protocols <- io $ getWMProtocols dpy w
+ wmprot <- atom_WM_PROTOCOLS
+ wmtf <- atom_WM_TAKE_FOCUS
+ currevt <- asks currentEvent
+
+ when (wmh_input hints) $ io $ do setInputFocus dpy w revertToPointerRoot 0
+ when (wmtf `elem` protocols) $
+ io $ allocaXEvent $ \ev -> do
+ setEventType ev clientMessage
+ setClientMessageEvent ev w wmprot 32 wmtf $ maybe currentTime event_time currevt
+ sendEvent dpy w False noEventMask ev
+ where event_time ev =
+ if (ev_event_type ev) `elem` timedEvents then
+ ev_time ev
+ else
+ currentTime
+ timedEvents = [ keyPress, keyRelease, buttonPress, buttonRelease, enterNotify, leaveNotify, selectionRequest ]

------------------------------------------------------------------------
-- Message handling
}
[Give focus to windows that don't set the input hint
Geoff Reedy <geoff@programmer-monk.net>**20091010231907
Ignore-this: 4ffb55dd97b59234703e0411c06b4901
] {
hunk ./XMonad/Operations.hs 28
import Data.Maybe
import Data.Monoid (Endo(..))
import Data.List (nub, (\\), find)
-import Data.Bits ((.|.), (.&.), complement)
+import Data.Bits ((.|.), (.&.), complement, testBit)
import Data.Ratio
import qualified Data.Map as M
import qualified Data.Set as S
hunk ./XMonad/Operations.hs 336
wmprot <- atom_WM_PROTOCOLS
wmtf <- atom_WM_TAKE_FOCUS
currevt <- asks currentEvent
+ let inputHintSet = wmh_flags hints `testBit` inputHintBit

hunk ./XMonad/Operations.hs 338
- when (wmh_input hints) $ io $ do setInputFocus dpy w revertToPointerRoot 0
+ when ((inputHintSet && wmh_input hints) || (not inputHintSet)) $
+ io $ do setInputFocus dpy w revertToPointerRoot 0
when (wmtf `elem` protocols) $
io $ allocaXEvent $ \ev -> do
setEventType ev clientMessage
}

Context:

[Note in manpage that 'exec xmonad' should be used
Adam Vogt <vogt.adam@gmail.com>**20090901040538
Ignore-this: 5c829442916c7390fc80e836272c6933
]
[Manual page spelling: maximise -> maximize, utilising -> utilizing
Adam Vogt <vogt.adam@gmail.com>**20090901040217
Ignore-this: 59cce0620bdb28147dbb3032fbec73a9
]
[Describe modular configuration in the manual page
Adam Vogt <vogt.adam@gmail.com>**20090901040046
Ignore-this: 4f4832d44d86773d1f81cb86026811b1
]
[Remove redundant parens
Spencer Janssen <spencerjanssen@gmail.com>**20090918035547
Ignore-this: aefa46cdb3ad8496e20d15a7e6b5fa52
]
[man_xmonad.hs: import Data.Monoid for mempty, keybinding edits
wirtwolff@gmail.com**20090320024624
Ignore-this: dc8477ffcfdd404f4f60d2cdaf3812d9
Bring mempty into scope. Add commented ToggleStruts binding.
Replace shadowed modMask in keybindings with modm instead.
]
[Only watch mtime for .hs, .lhs, .hsc for ~/.xmonad/lib
Adam Vogt <vogt.adam@gmail.com>**20090503235415
Ignore-this: e3b1847edf3e07a8182f7fcfc23b00c8

Previously xmonad would force a recompile due to the object files being too
new, so only look at files which may contain haskell code.
]
[Add lib to ghc searchpath with recompilation check
Adam Vogt <vogt.adam@gmail.com>**20090321232907
Ignore-this: 8827fb02fe1101d7b66f05d363bef038
]
[Remove tabs from ManageHook.hs
Adam Vogt <vogt.adam@gmail.com>**20090710011424
Ignore-this: 13903f39b052c025a7bfa50fb701959c
]
[Set infix 0 --> to reduce parentheses in ManageHooks
Adam Vogt <vogt.adam@gmail.com>**20090710011308
Ignore-this: 75804147fffeceddd328869cbca0d20f

What was previously:
> (appName ?= x <&&> classname ?= y) --> (doFloat <+> doIgnore)

Can now be:
> appName ?= x <&&> classname ?= y --> doFloat <+> doIgnore
]
[Pester the user with one (not two) xmessages on config errors
Adam Vogt <vogt.adam@gmail.com>**20090321233736
Ignore-this: f481f7d3ba5fca5c53a0b3a87daa32bb
]
[Minor bugfix in the creation of new StackSets.
Wouter Swierstra <wouter@chalmers.se>**20090503154321]
[Avoid deadly cycle in man/xmonad.hs
Spencer Janssen <spencerjanssen@gmail.com>**20090319081918
Ignore-this: adcba110caad465a2cbb4b9dca7cb612
]
[X.Config.hs, ./man/xmonad.hs: update Event Hook doc
wirtwolff@gmail.com**20090209183837
Ignore-this: 3792043278932e371e3e2858913a2b17
]
[Use records to document Tall's arguments
Spencer Janssen <spencerjanssen@gmail.com>**20090221230628
Ignore-this: 253c09de793715c18a029406795a42fd
]
[Fix possible head []
Joachim Breitner <mail@joachim-breitner.de>**20090106192026
This seems to be a rare case, but I just got hit by it.
]
[ManageHook.doShift: use shiftWin instead of shift
Spencer Janssen <spencerjanssen@gmail.com>**20090219041458
Ignore-this: 4d7f348d6d394c581ab2809bbc45a2c6
]
[Express shift in terms of shiftWin
Spencer Janssen <spencerjanssen@gmail.com>**20090217235343
Ignore-this: 8f213bca20065a39e7c16027f7b398cf
]
[Use standard -fforce-recomp instead of undocumented -no-recomp
Don Stewart <dons@galois.com>**20090208165518]
[Support for custom event hooks
Daniel Schoepe <asgaroth_@gmx.de>**20090203155536
Ignore-this: f22f1a7ae2d958ba1b3625aa923b7efd
]
[Make X an instance of Typeable
Daniel Schoepe <asgaroth_@gmx.de>**20090128215406
Ignore-this: bb155e62ea4e451460e3b94508dc49d2
]
[Add uninstallSignalHandlers, use in spawn
Spencer Janssen <spencerjanssen@gmail.com>**20090122002643
Ignore-this: d91bde6f965341a2619fe2dde83cc099
]
[Create a new session for forked processes
Spencer Janssen <spencerjanssen@gmail.com>**20090122000423
Ignore-this: f5d9cf254a0b07ddbf204457b7783880
]
[TAG 0.8.1
Spencer Janssen <spencerjanssen@gmail.com>**20090118083910]
[Close stdin in spawned processes
Spencer Janssen <spencerjanssen@gmail.com>**20090117040024
Ignore-this: 2e372ed6215160adae8da1c44cdede3d
]
[Document spawnPID
Spencer Janssen <spencerjanssen@gmail.com>**20090117035907
Ignore-this: 1641bdcf5055b2ec7b9455265f5b1d52
]
[Asynchronously recompile/restart xmonad on mod-q
Spencer Janssen <spencerjanssen@gmail.com>**20090117035300
Ignore-this: 753d8746034f818b81df79003ae5ee0d
]
[Add --restart, a command line flag to cause a running xmonad process to restart
Spencer Janssen <spencerjanssen@gmail.com>**20090117034959
Ignore-this: 45c8c8aba7cc7391b95c7e3fb01e5bf9
]
[Bump version to 0.8.1
Spencer Janssen <spencerjanssen@gmail.com>**20090116223621
Ignore-this: 2e8e9dc7b6ca725542f4afe04253dc57
]
[Remove doubleFork, handle SIGCHLD
Spencer Janssen <spencerjanssen@gmail.com>**20090116204742
Ignore-this: f9b1a65b4f0622922f80ad2ab6c5a52f
This is a rather big change. Rather than make spawned processes become
children of init, we handle them in xmonad. As a side effect of this change,
we never need to use waitForProcess in any contrib module -- in fact, doing so
will raise an exception. The main benefit to handling SIGCHLD is that xmonad
can now be started with 'exec', and will correctly clean up after inherited
child processes.
]
[Main.hs: escape / in Haddocks
gwern0@gmail.com**20081207020915
Ignore-this: 2c4525280fbe73c46f3abd8fc13628e9
This lets haddocks for Main.hs, at least, to build with 2.3.0.
]
[More flexible userCode function
Daniel Schoepe <asgaroth_@gmx.de>**20090110221852]
[Call logHook as the very last action in windows
Spencer Janssen <spencerjanssen@gmail.com>**20081209233700
Ignore-this: 4396ad891b607780f8e4b3b6bbce87e
]
[Accept inferior crossing events. This patch enables fmouse-focus-follows-screen
Spencer Janssen <spencerjanssen@gmail.com>**20081205045130
Ignore-this: 3ac329fb92839827aed0a4370784cabd
]
[Tile all windows at once
Spencer Janssen <spencerjanssen@gmail.com>**20081118074447]
[Factor rational rect scaling into a separate function
Spencer Janssen <spencerjanssen@gmail.com>**20081118072849]
[Change screen focus by clicking on the root window.
Spencer Janssen <spencerjanssen@gmail.com>**20081106224031
This is a modification of a patch from Joachim Breitner.
]
[Fix #192.
Spencer Janssen <spencerjanssen@gmail.com>**20081021220059]
[select base < 4 for building on ghc 6.10
Adam Vogt <vogt.adam@gmail.com>**20081013214509]
[add killWindow function
Joachim Breitner <mail@joachim-breitner.de>**20081005001804
This is required to kill anything that is not focused, without
having to focus it first.
]
[add'l documentation
Devin Mullins <me@twifkak.com>**20080927234639]
[Regression: ungrab buttons on *non* root windows
Spencer Janssen <spencerjanssen@gmail.com>**20081007214351]
[Partial fix for #40
Spencer Janssen <spencerjanssen@gmail.com>**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 <spencerjanssen@gmail.com>**20081007203953]
[Fix haddock
Spencer Janssen <spencerjanssen@gmail.com>**20081007094641]
[Move screen locating code into pointScreen
Spencer Janssen <spencerjanssen@gmail.com>**20081007094207]
[Make pointWithin a top-level binding
Spencer Janssen <spencerjanssen@gmail.com>**20081007090229]
[sp README, CONFIG, STYLE, TODO
gwern0@gmail.com**20080913024457]
[Use the same X11 dependency as xmonad-contrib
Spencer Janssen <spencerjanssen@gmail.com>**20080921061508]
[Export focusUp' and focusDown' -- work entirely on stacks
Spencer Janssen <spencerjanssen@gmail.com>**20080911214803]
[add W.shiftMaster, fix float/tile-reordering bug
Devin Mullins <me@twifkak.com>**20080911053909]
[TAG 0.8
Spencer Janssen <spencerjanssen@gmail.com>**20080905195412]
Patch bundle hash:
e3dcd8d7ad4afad438ecfed59141a52f874bc73b
Powered by Google Project Hosting