From af3972aa9fd691a9723bb816a954704d50794ad6 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Tue, 4 Aug 2009 22:47:42 +0200 Subject: [PATCH] Bugfix: Recognize clicks as client clicks (opposed to border_clicks) when clients send them for their parent window See comment, happened for example with xfontsel. You normally got to see the resize bar (when having >1 column, of course). --- src/handlers.c | 12 ++++++++++++ src/resize.c | 2 ++ 2 files changed, 14 insertions(+) diff --git a/src/handlers.c b/src/handlers.c index a667628c..ee47141a 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -354,6 +354,18 @@ int handle_button_press(void *ignored, xcb_connection_t *conn, xcb_button_press_ LOG("event->event_x = %d, client->rect.width = %d\n", event->event_x, client->rect.width); + /* Some clients (xfontsel for example) seem to pass clicks on their + * window to the parent window, thus we receive an event here which in + * reality is a border_click. Check for the position and fix state. */ + if (border_click && + event->event_x >= client->child_rect.x && + event->event_x <= (client->child_rect.x + client->child_rect.width) && + event->event_y >= client->child_rect.y && + event->event_y <= (client->child_rect.y + client->child_rect.height)) { + LOG("Fixing border_click = false because of click in child\n"); + border_click = false; + } + if (!border_click) { LOG("client. done.\n"); xcb_allow_events(conn, XCB_ALLOW_REPLAY_POINTER, event->time); diff --git a/src/resize.c b/src/resize.c index 52b064b4..09a8d083 100644 --- a/src/resize.c +++ b/src/resize.c @@ -43,6 +43,8 @@ int resize_graphical_handler(xcb_connection_t *conn, Workspace *ws, int first, i return 1; } + LOG("event->event_x = %d, event->root_x = %d\n", event->event_x, event->root_x); + LOG("Screen dimensions: (%d, %d) %d x %d\n", screen->rect.x, screen->rect.y, screen->rect.width, screen->rect.height); /* FIXME: horizontal resizing causes empty spaces to exist */ -- 2.39.5