From 246d4627be4ced1375b8735828bb7e0d992f67fa Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Mon, 31 May 2010 23:00:36 +0200 Subject: [PATCH] re-enable sending fake configure notifies --- include/xcb.h | 4 +--- src/x.c | 8 ++++++++ src/xcb.c | 16 ++++++++-------- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/include/xcb.h b/include/xcb.h index a7aeaf21..3f4b735c 100644 --- a/include/xcb.h +++ b/include/xcb.h @@ -127,14 +127,12 @@ void xcb_draw_rect(xcb_connection_t *conn, xcb_drawable_t drawable, */ void fake_configure_notify(xcb_connection_t *conn, Rect r, xcb_window_t window); -#if 0 /** * Generates a configure_notify_event with absolute coordinates (relative to * the X root window, not to the client’s frame) for the given client. * */ -void fake_absolute_configure_notify(xcb_connection_t *conn, Client *client); -#endif +void fake_absolute_configure_notify(Con *con); /** * Finds out which modifier mask is the one for numlock, as the user may diff --git a/src/x.c b/src/x.c index f73fc846..5e0ce71c 100644 --- a/src/x.c +++ b/src/x.c @@ -239,11 +239,13 @@ static void x_push_node(Con *con) { state->mapped = con->mapped; } + bool fake_notify = false; /* set new position if rect changed */ if (memcmp(&(state->rect), &(con->rect), sizeof(Rect)) != 0) { LOG("setting rect (%d, %d, %d, %d)\n", con->rect.x, con->rect.y, con->rect.width, con->rect.height); xcb_set_window_rect(conn, con->frame, con->rect); memcpy(&(state->rect), &(con->rect), sizeof(Rect)); + fake_notify = true; } /* dito, but for child windows */ @@ -252,6 +254,12 @@ static void x_push_node(Con *con) { con->window_rect.x, con->window_rect.y, con->window_rect.width, con->window_rect.height); xcb_set_window_rect(conn, con->window->id, con->window_rect); memcpy(&(state->rect), &(con->rect), sizeof(Rect)); + fake_notify = true; + } + + if (fake_notify) { + LOG("Sending fake configure notify\n"); + fake_absolute_configure_notify(con); } /* handle all children and floating windows of this node */ diff --git a/src/xcb.c b/src/xcb.c index 3da1081d..78b7a3b1 100644 --- a/src/xcb.c +++ b/src/xcb.c @@ -172,23 +172,23 @@ void fake_configure_notify(xcb_connection_t *conn, Rect r, xcb_window_t window) xcb_flush(conn); } -#if 0 /* * Generates a configure_notify_event with absolute coordinates (relative to the X root * window, not to the client’s frame) for the given client. * */ -void fake_absolute_configure_notify(xcb_connection_t *conn, Client *client) { +void fake_absolute_configure_notify(Con *con) { Rect absolute; + if (con->window == NULL) + return; - absolute.x = client->rect.x + client->child_rect.x; - absolute.y = client->rect.y + client->child_rect.y; - absolute.width = client->child_rect.width; - absolute.height = client->child_rect.height; + absolute.x = con->rect.x + con->window_rect.x; + absolute.y = con->rect.y + con->window_rect.y; + absolute.width = con->window_rect.width; + absolute.height = con->window_rect.height; - fake_configure_notify(conn, absolute, client->child); + fake_configure_notify(conn, absolute, con->window->id); } -#endif /* * Finds out which modifier mask is the one for numlock, as the user may change this. -- 2.39.5