Suppport _NET_WM_MOVERESIZE
Patch status: needinfo
Patch by Lukas K
Long description:
fixes #1432
To apply this patch, use:
curl http://cr.i3wm.org/patch/699/raw.patch | git am
b/include/atoms.xmacro
15 |
@@ -1,6 +1,7 @@ |
16 |
xmacro(_NET_SUPPORTED) |
17 |
xmacro(_NET_SUPPORTING_WM_CHECK) |
18 |
xmacro(_NET_WM_NAME) |
19 |
+xmacro(_NET_WM_MOVERESIZE) |
20 |
xmacro(_NET_WM_STATE_FULLSCREEN) |
21 |
xmacro(_NET_WM_STATE_DEMANDS_ATTENTION) |
22 |
xmacro(_NET_WM_STATE_MODAL) |
b/src/handlers.c
27 |
@@ -651,6 +651,20 @@ static void handle_expose_event(xcb_expose_event_t *event) { |
28 |
return; |
29 |
} |
30 |
|
31 |
+ |
32 |
+#define _NET_WM_MOVERESIZE_SIZE_TOPLEFT 0 |
33 |
+#define _NET_WM_MOVERESIZE_SIZE_TOP 1 |
34 |
+#define _NET_WM_MOVERESIZE_SIZE_TOPRIGHT 2 |
35 |
+#define _NET_WM_MOVERESIZE_SIZE_RIGHT 3 |
36 |
+#define _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT 4 |
37 |
+#define _NET_WM_MOVERESIZE_SIZE_BOTTOM 5 |
38 |
+#define _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT 6 |
39 |
+#define _NET_WM_MOVERESIZE_SIZE_LEFT 7 |
40 |
+#define _NET_WM_MOVERESIZE_MOVE 8 /* movement only */ |
41 |
+#define _NET_WM_MOVERESIZE_SIZE_KEYBOARD 9 /* size via keyboard */ |
42 |
+#define _NET_WM_MOVERESIZE_MOVE_KEYBOARD 10 /* move via keyboard */ |
43 |
+#define _NET_WM_MOVERESIZE_CANCEL 11 /* cancel operation */ |
44 |
+ |
45 |
/* |
46 |
* Handle client messages (EWMH) |
47 |
* |
48 |
@@ -856,6 +870,33 @@ static void handle_client_message(xcb_client_message_event_t *event) { |
49 |
} else { |
50 |
DLOG("Couldn't find con for _NET_CLOSE_WINDOW request. (window = %d)\n", event->window); |
51 |
} |
52 |
+ } |
53 |
+ else if (event->type == A__NET_WM_MOVERESIZE) { |
54 |
+ /* |
55 |
+ * Client-side decorated Gtk3 windows emit this signal when being |
56 |
+ * dragged by their GtkHeaderBar |
57 |
+ */ |
58 |
+ Con *con = con_by_window_id(event->window); |
59 |
+ if (con && con_is_floating(con)) { |
60 |
+ DLOG("Handling _NET_WM_MOVERESIZE request (con = %p)\n", con); |
61 |
+ uint32_t direction = event->data.data32[2]; |
62 |
+ uint32_t x_root = event->data.data32[0]; |
63 |
+ uint32_t y_root = event->data.data32[1]; |
64 |
+ if(direction == _NET_WM_MOVERESIZE_MOVE) { |
65 |
+ /* construct fake xcb_button_press_event_t */ |
66 |
+ xcb_button_press_event_t fake = { |
67 |
+ .root_x = x_root, |
68 |
+ .root_y = y_root |
69 |
+ }; |
70 |
+ floating_drag_window(con->parent, &fake); |
71 |
+ |
72 |
+ } else { |
73 |
+ DLOG("_NET_WM_MOVERESIZE direction %d not implemented\n", direction); |
74 |
+ } |
75 |
+ |
76 |
+ } else { |
77 |
+ DLOG("Couldn't find con for _NET_WM_MOVERESIZE request. or con not floating (window = %d)\n", event->window); |
78 |
+ } |
79 |
} else { |
80 |
DLOG("unhandled clientmessage\n"); |
81 |
return; |