warp the pointer on a workspace change to the focused window
This commit is contained in:
parent
a91a6f97da
commit
65abaf0d50
1 changed files with 20 additions and 10 deletions
|
@ -3,14 +3,29 @@
|
||||||
#include "../kernel/client.h"
|
#include "../kernel/client.h"
|
||||||
#include "../kernel/focus.h"
|
#include "../kernel/focus.h"
|
||||||
#include "../kernel/stacking.h"
|
#include "../kernel/stacking.h"
|
||||||
|
#include "../kernel/openbox.h"
|
||||||
|
|
||||||
static GSList **focus_order = NULL;
|
static GSList **focus_order = NULL;
|
||||||
|
|
||||||
|
static void focus_fallback(guint desk, gboolean warp)
|
||||||
|
{
|
||||||
|
GSList *it;
|
||||||
|
|
||||||
|
for (it = focus_order[desk]; it != NULL; it = it->next)
|
||||||
|
if (client_focus(it->data)) {
|
||||||
|
if (warp) { /* XXX make this configurable */
|
||||||
|
Client *c = it->data;
|
||||||
|
XWarpPointer(ob_display, None, c->window, 0, 0, 0, 0,
|
||||||
|
c->area.width / 2, c->area.height / 2);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void events(ObEvent *e, void *foo)
|
static void events(ObEvent *e, void *foo)
|
||||||
{
|
{
|
||||||
guint i;
|
guint i;
|
||||||
guint new, old;
|
guint new, old;
|
||||||
GSList *it;
|
|
||||||
|
|
||||||
switch (e->type) {
|
switch (e->type) {
|
||||||
case Event_Client_Mapped:
|
case Event_Client_Mapped:
|
||||||
|
@ -50,19 +65,14 @@ static void events(ObEvent *e, void *foo)
|
||||||
|
|
||||||
case Event_Ob_Desktop:
|
case Event_Ob_Desktop:
|
||||||
/* focus the next available target */
|
/* focus the next available target */
|
||||||
new = e->data.o.num[0];
|
focus_fallback(e->data.o.num[0], TRUE);
|
||||||
for (it = focus_order[new]; it != NULL; it = it->next)
|
|
||||||
if (client_focus(it->data))
|
|
||||||
break;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Event_Client_Unfocus:
|
case Event_Client_Unfocus:
|
||||||
if (focus_client == NULL) { /* nothing is left with focus! */
|
/* nothing is left with focus! */
|
||||||
|
if (focus_client == NULL)
|
||||||
/* focus the next available target */
|
/* focus the next available target */
|
||||||
for (it = focus_order[screen_desktop]; it != NULL; it = it->next)
|
focus_fallback(screen_desktop, FALSE);
|
||||||
if (client_focus(it->data))
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Event_Client_Focus:
|
case Event_Client_Focus:
|
||||||
|
|
Loading…
Reference in a new issue