From 61c1d48cd54903c4767cb2d5bd42cf04cb29127b Mon Sep 17 00:00:00 2001 From: Jeffy Chen Date: Mon, 8 Jul 2019 14:54:25 +0800 Subject: [PATCH 3/3] Support move timeout when outline moving Move the window after idling for 400ms in outline moving mode. Signed-off-by: Jeffy Chen --- openbox/moveresize.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/openbox/moveresize.c b/openbox/moveresize.c index 1db4726c..d75901e8 100644 --- a/openbox/moveresize.c +++ b/openbox/moveresize.c @@ -70,6 +70,7 @@ static guint sync_timer = 0; #endif static glong last_move_time = 0; static guint move_timer = 0; +static guint move_timeout_timer = 0; static GC outline_gc = NULL; static gint outline_x = 0; @@ -339,6 +340,8 @@ void moveresize_end(gboolean cancel) } else { if (move_timer) g_source_remove(move_timer); move_timer = 0; + if (move_timeout_timer) g_source_remove(move_timeout_timer); + move_timeout_timer = 0; moveresize_clear_outline(); } @@ -475,6 +478,22 @@ static gboolean move_func(gpointer data) return FALSE; /* don't repeat */ } +static gboolean move_timeout_func(gpointer data) +{ + if (move_timer) g_source_remove(move_timer); + move_timer = 0; + + moveresize_clear_outline(); + client_configure(moveresize_client, cur_x, cur_y, cur_w, cur_h, + TRUE, FALSE, FALSE); + + popup_hide(popup); + popup->client = NULL; + + move_timeout_timer = 0; + return FALSE; /* don't repeat */ +} + static void do_move(gboolean keyboard, gint keydist) { gint resist; @@ -504,6 +523,11 @@ static void do_move(gboolean keyboard, gint keydist) last_move_time = next_ms; } } + + if (!config_resize_redraw) { + if (move_timeout_timer) g_source_remove(move_timeout_timer); + move_timeout_timer = g_timeout_add(400, move_timeout_func, NULL); + } } static void do_resize(void) -- 2.17.1