diff options
| author | Dana Jansens <danakj@orodu.net> | 2007-08-04 23:35:36 -0400 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2007-08-04 23:35:36 -0400 |
| commit | f55ae9e56945892825928cfb021b5e739d0d5224 (patch) | |
| tree | 19a26efae2532bc046160289adca8a8dc45ac3a7 /openbox/moveresize.c | |
| parent | 98b9ed97ebbcf22185359c8f6f1d539a105cd258 (diff) | |
| parent | fa085b73389de3af8236919f4e39c4c20d16ed7c (diff) | |
Merge branch 'backport'
Diffstat (limited to 'openbox/moveresize.c')
| -rw-r--r-- | openbox/moveresize.c | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/openbox/moveresize.c b/openbox/moveresize.c index dd0605c6..1a8550a9 100644 --- a/openbox/moveresize.c +++ b/openbox/moveresize.c @@ -55,6 +55,7 @@ static gint cur_x, cur_y, cur_w, cur_h; static guint button; static guint32 corner; static ObDirection edge_warp_dir = -1; +static gboolean edge_warp_odd = FALSE; static ObDirection key_resize_edge = -1; #ifdef SYNC static gboolean waiting_for_sync; @@ -120,6 +121,8 @@ void moveresize_start(ObClient *c, gint x, gint y, guint b, guint32 cnr) ObCursor cur; gboolean mv = (cnr == prop_atoms.net_wm_moveresize_move || cnr == prop_atoms.net_wm_moveresize_move_keyboard); + gint up = 1; + gint left = 1; if (moveresize_in_progress || !c->frame->visible || !(mv ? @@ -127,23 +130,28 @@ void moveresize_start(ObClient *c, gint x, gint y, guint b, guint32 cnr) (c->functions & OB_CLIENT_FUNC_RESIZE))) return; - if (cnr == prop_atoms.net_wm_moveresize_size_topleft) + if (cnr == prop_atoms.net_wm_moveresize_size_topleft) { cur = OB_CURSOR_NORTHWEST; - else if (cnr == prop_atoms.net_wm_moveresize_size_top) + up = left = -1; + } else if (cnr == prop_atoms.net_wm_moveresize_size_top) { cur = OB_CURSOR_NORTH; - else if (cnr == prop_atoms.net_wm_moveresize_size_topright) + up = -1; + } else if (cnr == prop_atoms.net_wm_moveresize_size_topright) { cur = OB_CURSOR_NORTHEAST; - else if (cnr == prop_atoms.net_wm_moveresize_size_right) + up = -1; + } else if (cnr == prop_atoms.net_wm_moveresize_size_right) cur = OB_CURSOR_EAST; else if (cnr == prop_atoms.net_wm_moveresize_size_bottomright) cur = OB_CURSOR_SOUTHEAST; else if (cnr == prop_atoms.net_wm_moveresize_size_bottom) cur = OB_CURSOR_SOUTH; - else if (cnr == prop_atoms.net_wm_moveresize_size_bottomleft) + else if (cnr == prop_atoms.net_wm_moveresize_size_bottomleft) { cur = OB_CURSOR_SOUTHWEST; - else if (cnr == prop_atoms.net_wm_moveresize_size_left) + left = -1; + } else if (cnr == prop_atoms.net_wm_moveresize_size_left) { cur = OB_CURSOR_WEST; - else if (cnr == prop_atoms.net_wm_moveresize_size_keyboard) + left = -1; + } else if (cnr == prop_atoms.net_wm_moveresize_size_keyboard) cur = OB_CURSOR_SOUTHEAST; else if (cnr == prop_atoms.net_wm_moveresize_move) cur = OB_CURSOR_MOVE; @@ -172,8 +180,8 @@ void moveresize_start(ObClient *c, gint x, gint y, guint b, guint32 cnr) friendly. you essentially start the resize in the middle of the increment instead of at 0, so you have to move half an increment either way instead of a full increment one and 1 px the other. */ - start_x = x - (mv ? 0 : c->size_inc.width / 2); - start_y = y - (mv ? 0 : c->size_inc.height / 2); + start_x = x - (mv ? 0 : left * c->size_inc.width / 2); + start_y = y - (mv ? 0 : up * c->size_inc.height / 2); corner = cnr; button = b; key_resize_edge = -1; @@ -476,12 +484,15 @@ static gboolean edge_warp_delay_func(gpointer data) { guint d; - d = screen_find_desktop(screen_desktop, edge_warp_dir, TRUE, FALSE); - if (d != screen_desktop) screen_set_desktop(d, TRUE); - - edge_warp_dir = -1; + /* only fire every second time. so it's fast the first time, but slower + 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); + } + edge_warp_odd = !edge_warp_odd; - return FALSE; /* don't repeat */ + return TRUE; /* do repeat ! */ } static void do_edge_warp(gint x, gint y) @@ -515,13 +526,14 @@ static void do_edge_warp(gint x, gint y) } if (dir != edge_warp_dir) { - if (dir == (ObDirection)-1) - cancel_edge_warp(); - else + cancel_edge_warp(); + if (dir != (ObDirection)-1) { + edge_warp_odd = TRUE; /* switch on the first timeout */ ob_main_loop_timeout_add(ob_main_loop, config_mouse_screenedgetime * 1000, edge_warp_delay_func, NULL, NULL, NULL); + } edge_warp_dir = dir; } } |
