]> git.sur5r.net Git - i3/i3/commitdiff
Bugfix: Fix drag&drop in GTK applications (firefox, thunderbird)
authorMichael Stapelberg <michael+x200@stapelberg.de>
Sat, 2 May 2009 18:51:55 +0000 (20:51 +0200)
committerMichael Stapelberg <michael+x200@stapelberg.de>
Sat, 2 May 2009 18:51:55 +0000 (20:51 +0200)
Thanks to Daniel Wäber’s contribution to wmii:
http://code.suckless.org/hg/wmii/rev/f4f25de0de54

include/i3.h
include/xcb.h
src/mainx.c
src/xcb.c

index a3dfc4c0ad312ea89c01f3d0c6136c1757ae425d..02df999610fbd1efbc4b1e3d4291616aca3e59f2 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef _I3_H
 #define _I3_H
 
-#define NUM_ATOMS 12
+#define NUM_ATOMS 13
 
 extern char **start_argv;
 extern Display *xkbdpy;
index bcdd19a144268f567cd47a87cb154001092ca39d..4001cad71ca5a661d153d6a7c0b1956bb1821c3f 100644 (file)
@@ -36,8 +36,9 @@
 #define FRAME_EVENT_MASK (XCB_EVENT_MASK_BUTTON_PRESS |          /* …mouse is pressed/released */ \
                           XCB_EVENT_MASK_BUTTON_RELEASE | \
                           XCB_EVENT_MASK_EXPOSURE |              /* …our window needs to be redrawn */ \
-                          XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | /* …user moves cursor inside our window */ \
-                          XCB_EVENT_MASK_ENTER_WINDOW)           /* …the application tries to resize itself */
+                          XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | /* …the application tries to resize itself */ \
+                          XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY |   /* …subwindows get notifies */ \
+                          XCB_EVENT_MASK_ENTER_WINDOW)           /* …user moves cursor inside our window */
 
 
 enum { _NET_SUPPORTED = 0,
@@ -51,7 +52,8 @@ enum { _NET_SUPPORTED = 0,
         _NET_WM_STRUT_PARTIAL,
         WM_PROTOCOLS,
         WM_DELETE_WINDOW,
-        UTF8_STRING
+        UTF8_STRING,
+        WM_STATE
 };
 
 extern unsigned int xcb_numlock_mask;
index 03390f9087383e2ea5ddf33e42b74920712bbf24..38ae2511bf898422ae52d4e57b9fa46f9195490e 100644 (file)
@@ -187,6 +187,9 @@ void reparent_window(xcb_connection_t *conn, xcb_window_t child,
         /* Yo dawg, I heard you like windows, so I create a window around your window… */
         new->frame = create_window(conn, framerect, XCB_WINDOW_CLASS_INPUT_OUTPUT, XCB_CURSOR_LEFT_PTR, mask, values);
 
+        long data[] = { XCB_WM_STATE_NORMAL, XCB_NONE };
+        xcb_change_property(conn, XCB_PROP_MODE_REPLACE, new->child, atoms[WM_STATE], atoms[WM_STATE], 32, 2, data);
+
         /* Put the client inside the save set. Upon termination (whether killed or normal exit
            does not matter) of the window manager, these clients will be correctly reparented
            to their most closest living ancestor (= cleanup) */
@@ -381,6 +384,7 @@ int main(int argc, char *argv[], char *env[]) {
         REQUEST_ATOM(WM_PROTOCOLS);
         REQUEST_ATOM(WM_DELETE_WINDOW);
         REQUEST_ATOM(UTF8_STRING);
+        REQUEST_ATOM(WM_STATE);
 
         /* TODO: this has to be more beautiful somewhen */
         int major, minor, error;
@@ -483,6 +487,7 @@ int main(int argc, char *argv[], char *env[]) {
         GET_ATOM(WM_PROTOCOLS);
         GET_ATOM(WM_DELETE_WINDOW);
         GET_ATOM(UTF8_STRING);
+        GET_ATOM(WM_STATE);
 
         xcb_property_set_handler(&prophs, atoms[_NET_WM_WINDOW_TYPE], UINT_MAX, handle_window_type, NULL);
         /* TODO: In order to comply with EWMH, we have to watch _NET_WM_STRUT_PARTIAL */
index 708e1eadadaf4a7e549437af4fa705e62acdc68a..10608ac4fc733e5f367512d54d26830afcfb31b2 100644 (file)
--- a/src/xcb.c
+++ b/src/xcb.c
@@ -220,8 +220,8 @@ void fake_configure_notify(xcb_connection_t *conn, Rect r, xcb_window_t window)
 void fake_absolute_configure_notify(xcb_connection_t *conn, Client *client) {
         Rect absolute;
 
-        absolute.x = client->rect.x;
-        absolute.y = client->rect.y;
+        absolute.x = client->rect.x + client->child_rect.x;
+        absolute.y = client->rect.y + client->child_rect.y;
         absolute.width = client->rect.width - (2 * client->child_rect.x);
         absolute.height = client->rect.height - client->child_rect.y - 1;