hc
2024-08-09 7e81648b513354a6e48db198b3772366e077ffa1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
From 61c1d48cd54903c4767cb2d5bd42cf04cb29127b Mon Sep 17 00:00:00 2001
From: Jeffy Chen <jeffy.chen@rock-chips.com>
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 <jeffy.chen@rock-chips.com>
---
 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