diff options
| author | Dana Jansens <danakj@orodu.net> | 2010-04-16 18:55:33 -0400 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2010-04-16 21:32:38 -0400 |
| commit | 77ee361f5cedb415c1189b0a75bde83a1a275f35 (patch) | |
| tree | 40f07ac06f38478cfa0767ccad1e4ea79234c80b /openbox/moveresize.c | |
| parent | b05ac359b8a5a91cd2a115ba4612e8acfdf1d8d6 (diff) | |
allow warping the mouse pointer when switching desktops by bumping into the edge of the monitor with a window
based on a patch by Nathaniel Gephart <computinchuck@gmail.com>
Diffstat (limited to 'openbox/moveresize.c')
| -rw-r--r-- | openbox/moveresize.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/openbox/moveresize.c b/openbox/moveresize.c index 8609d3be..aa1957af 100644 --- a/openbox/moveresize.c +++ b/openbox/moveresize.c @@ -529,6 +529,34 @@ static void calc_resize(gboolean keyboard, gint keydist, gint *dw, gint *dh, *dh = nh - oh; } +static void edge_warp_move_ptr(void) +{ + gint x, y; + const Rect* a; + + screen_pointer_pos(&x, &y); + a = screen_physical_area_all_monitors(); + + switch (edge_warp_dir) { + case OB_DIRECTION_NORTH: + y = a->height - 1; + break; + case OB_DIRECTION_EAST: + x = a->x; + break; + case OB_DIRECTION_SOUTH: + y = a->y; + break; + case OB_DIRECTION_WEST: + x = a->width - 1; + break; + default: + g_assert_not_reached(); + } + + XWarpPointer(obt_display, 0, obt_root(ob_screen), 0, 0, 0, 0, x, y); +} + static gboolean edge_warp_delay_func(gpointer data) { guint d; @@ -537,7 +565,10 @@ static gboolean edge_warp_delay_func(gpointer data) after that */ if (edge_warp_odd) { d = screen_find_desktop(screen_desktop, edge_warp_dir, TRUE, FALSE); - if (d != screen_desktop) screen_set_desktop(d, TRUE); + if (d != screen_desktop) { + if (config_mouse_screenedgewarp) edge_warp_move_ptr(); + screen_set_desktop(d, TRUE); + } } edge_warp_odd = !edge_warp_odd; |
