]>
Dogcows Code - chaz/openbox/blob - plugins/focus.c
1 #include "../kernel/dispatch.h"
2 #include "../kernel/screen.h"
3 #include "../kernel/client.h"
4 #include "../kernel/focus.h"
5 #include "../kernel/stacking.h"
6 #include "../kernel/openbox.h"
8 static int skip_enter
= 0;
10 static void focus_fallback(guint desk
, gboolean warp
)
14 for (it
= focus_order
[desk
]; it
!= NULL
; it
= it
->next
)
15 if (client_focus(it
->data
)) {
16 if (warp
) { /* XXX make this configurable */
20 /* skip the next enter event from the desktop switch so focus
21 doesn't skip briefly to what was under the pointer */
22 if (XCheckTypedEvent(ob_display
, EnterNotify
, &e
)) {
23 XPutBackEvent(ob_display
, &e
);
27 XWarpPointer(ob_display
, None
, c
->window
, 0, 0, 0, 0,
28 c
->area
.width
/ 2, c
->area
.height
/ 2);
29 XWarpPointer(ob_display
, None
, c
->window
, 0, 0, 0, 0,
30 c
->area
.width
/ 2, c
->area
.height
/ 2);
36 static void events(ObEvent
*e
, void *foo
)
39 case Event_Client_Mapped
:
40 /* focus new normal windows */
41 if (client_normal(e
->data
.c
.client
))
42 client_focus(e
->data
.c
.client
);
45 case Event_Ob_Desktop
:
46 /* focus the next available target */
47 focus_fallback(e
->data
.o
.num
[0], TRUE
);
50 case Event_Client_Unfocus
:
51 /* dont do this shit with sloppy focus... */
53 /\* nothing is left with focus! *\/
54 if (focus_client == NULL)
55 /\* focus the next available target *\/
56 focus_fallback(screen_desktop, FALSE);
60 case Event_X_EnterNotify
:
63 else if (e
->data
.x
.client
&& client_normal(e
->data
.x
.client
))
64 client_focus(e
->data
.x
.client
);
68 g_assert_not_reached();
74 dispatch_register(Event_Client_Mapped
|
76 Event_Client_Unfocus
|
78 (EventHandler
)events
, NULL
);
81 void plugin_shutdown()
83 dispatch_register(0, (EventHandler
)events
, NULL
);
This page took 0.042823 seconds and 5 git commands to generate.