Bugfix: Fix drag&drop in GTK applications (firefox, thunderbird)

Thanks to Daniel Wäber’s contribution to wmii:
http://code.suckless.org/hg/wmii/rev/f4f25de0de54
This commit is contained in:
Michael Stapelberg 2009-05-02 20:51:55 +02:00
parent 06ec4d66ae
commit 99054fb50f
4 changed files with 13 additions and 6 deletions

View File

@ -20,7 +20,7 @@
#ifndef _I3_H #ifndef _I3_H
#define _I3_H #define _I3_H
#define NUM_ATOMS 12 #define NUM_ATOMS 13
extern char **start_argv; extern char **start_argv;
extern Display *xkbdpy; extern Display *xkbdpy;

View File

@ -36,8 +36,9 @@
#define FRAME_EVENT_MASK (XCB_EVENT_MASK_BUTTON_PRESS | /* …mouse is pressed/released */ \ #define FRAME_EVENT_MASK (XCB_EVENT_MASK_BUTTON_PRESS | /* …mouse is pressed/released */ \
XCB_EVENT_MASK_BUTTON_RELEASE | \ XCB_EVENT_MASK_BUTTON_RELEASE | \
XCB_EVENT_MASK_EXPOSURE | /* …our window needs to be redrawn */ \ XCB_EVENT_MASK_EXPOSURE | /* …our window needs to be redrawn */ \
XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | /* …user moves cursor inside our window */ \ XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT | /* …the application tries to resize itself */ \
XCB_EVENT_MASK_ENTER_WINDOW) /* …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, enum { _NET_SUPPORTED = 0,
@ -51,7 +52,8 @@ enum { _NET_SUPPORTED = 0,
_NET_WM_STRUT_PARTIAL, _NET_WM_STRUT_PARTIAL,
WM_PROTOCOLS, WM_PROTOCOLS,
WM_DELETE_WINDOW, WM_DELETE_WINDOW,
UTF8_STRING UTF8_STRING,
WM_STATE
}; };
extern unsigned int xcb_numlock_mask; extern unsigned int xcb_numlock_mask;

View 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… */ /* 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); 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 /* 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 does not matter) of the window manager, these clients will be correctly reparented
to their most closest living ancestor (= cleanup) */ 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_PROTOCOLS);
REQUEST_ATOM(WM_DELETE_WINDOW); REQUEST_ATOM(WM_DELETE_WINDOW);
REQUEST_ATOM(UTF8_STRING); REQUEST_ATOM(UTF8_STRING);
REQUEST_ATOM(WM_STATE);
/* TODO: this has to be more beautiful somewhen */ /* TODO: this has to be more beautiful somewhen */
int major, minor, error; int major, minor, error;
@ -483,6 +487,7 @@ int main(int argc, char *argv[], char *env[]) {
GET_ATOM(WM_PROTOCOLS); GET_ATOM(WM_PROTOCOLS);
GET_ATOM(WM_DELETE_WINDOW); GET_ATOM(WM_DELETE_WINDOW);
GET_ATOM(UTF8_STRING); GET_ATOM(UTF8_STRING);
GET_ATOM(WM_STATE);
xcb_property_set_handler(&prophs, atoms[_NET_WM_WINDOW_TYPE], UINT_MAX, handle_window_type, NULL); 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 */ /* TODO: In order to comply with EWMH, we have to watch _NET_WM_STRUT_PARTIAL */

View File

@ -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) { void fake_absolute_configure_notify(xcb_connection_t *conn, Client *client) {
Rect absolute; Rect absolute;
absolute.x = client->rect.x; absolute.x = client->rect.x + client->child_rect.x;
absolute.y = client->rect.y; absolute.y = client->rect.y + client->child_rect.y;
absolute.width = client->rect.width - (2 * client->child_rect.x); absolute.width = client->rect.width - (2 * client->child_rect.x);
absolute.height = client->rect.height - client->child_rect.y - 1; absolute.height = client->rect.height - client->child_rect.y - 1;