9 Client
*focus_client
= NULL
;
11 Window focus_backup
= None
;
13 void focus_set_client(Client
*client
);
17 /* create the window which gets focus when no clients get it. Have to
18 make it override-redirect so we don't try manage it, since it is
20 XSetWindowAttributes attrib
;
22 attrib
.override_redirect
= TRUE
;
23 focus_backup
= XCreateWindow(ob_display
, ob_root
,
24 -100, -100, 1, 1, 0, 0, InputOnly
,
25 CopyFromParent
, CWOverrideRedirect
, &attrib
);
26 XMapRaised(ob_display
, focus_backup
);
28 /* start with nothing focused */
29 focus_set_client(NULL
);
32 void focus_set_client(Client
*client
)
37 /* sometimes this is called with the already-focused window, this is
38 important for the python scripts to work (eg, c = 0 twice). don't just
39 return if _focused_client == c */
41 /* uninstall the old colormap, and install the new one */
42 screen_install_colormap(focus_client
, FALSE
);
43 screen_install_colormap(client
, TRUE
);
47 /* when nothing will be focused, send focus to the backup target */
48 XSetInputFocus(ob_display
, focus_backup
, RevertToNone
, CurrentTime
);
52 focus_client
= client
;
54 /* set the NET_ACTIVE_WINDOW hint */
55 active
= client
? client
->window
: None
;
56 PROP_SET32(ob_root
, net_active_window
, window
, active
);
58 if (focus_client
!= NULL
)
59 dispatch_client(Event_Client_Focus
, focus_client
, 0, 0);
61 dispatch_client(Event_Client_Unfocus
, old
, 0, 0);