1From 61c1d48cd54903c4767cb2d5bd42cf04cb29127b Mon Sep 17 00:00:00 2001
2From: Jeffy Chen <jeffy.chen@rock-chips.com>
3Date: Mon, 8 Jul 2019 14:54:25 +0800
4Subject: [PATCH 3/3] Support move timeout when outline moving
5
6Move the window after idling for 400ms in outline moving mode.
7
8Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
9---
10 openbox/moveresize.c | 24 ++++++++++++++++++++++++
11 1 file changed, 24 insertions(+)
12
13diff --git a/openbox/moveresize.c b/openbox/moveresize.c
14index 1db4726c..d75901e8 100644
15--- a/openbox/moveresize.c
16+++ b/openbox/moveresize.c
17@@ -70,6 +70,7 @@ static guint sync_timer = 0;
18 #endif
19 static glong last_move_time = 0;
20 static guint move_timer = 0;
21+static guint move_timeout_timer = 0;
22
23 static GC outline_gc = NULL;
24 static gint outline_x = 0;
25@@ -339,6 +340,8 @@ void moveresize_end(gboolean cancel)
26     } else {
27         if (move_timer) g_source_remove(move_timer);
28         move_timer = 0;
29+        if (move_timeout_timer) g_source_remove(move_timeout_timer);
30+        move_timeout_timer = 0;
31
32         moveresize_clear_outline();
33     }
34@@ -475,6 +478,22 @@ static gboolean move_func(gpointer data)
35     return FALSE; /* don't repeat */
36 }
37
38+static gboolean move_timeout_func(gpointer data)
39+{
40+    if (move_timer) g_source_remove(move_timer);
41+    move_timer = 0;
42+
43+    moveresize_clear_outline();
44+    client_configure(moveresize_client, cur_x, cur_y, cur_w, cur_h,
45+                     TRUE, FALSE, FALSE);
46+
47+    popup_hide(popup);
48+    popup->client = NULL;
49+
50+    move_timeout_timer = 0;
51+    return FALSE; /* don't repeat */
52+}
53+
54 static void do_move(gboolean keyboard, gint keydist)
55 {
56     gint resist;
57@@ -504,6 +523,11 @@ static void do_move(gboolean keyboard, gint keydist)
58             last_move_time = next_ms;
59         }
60     }
61+
62+    if (!config_resize_redraw) {
63+        if (move_timeout_timer) g_source_remove(move_timeout_timer);
64+        move_timeout_timer = g_timeout_add(400, move_timeout_func, NULL);
65+    }
66 }
67
68 static void do_resize(void)
69--
702.17.1
71
72