kbgwm

sucklessy floating window manager
git clone https://git.neuralcrash.com/kbgwm.git
Log | Files | Refs | README | LICENSE

commit 5bff1bbca0fac32a40850bcee6f9eb24c872720d
parent 4ef0fde5bcae5ec088f04b0c90e67533e3789a94
Author: Kebigon <git@kebigon.xyz>
Date:   Sun, 15 Aug 2021 15:14:17 +0900

Handle configure_notify events to catch the root window size changes

Diffstat:
Mevents.c | 16++++++++++++++++
1 file changed, 16 insertions(+), 0 deletions(-)

diff --git a/events.c b/events.c @@ -180,6 +180,21 @@ static void handle_map_request(xcb_generic_event_t *e) client_create(event->window); } +static void handle_configure_notify(xcb_generic_event_t *e) +{ + xcb_configure_notify_event_t *event = (xcb_configure_notify_event_t *)e; + + // When updating the monitors configuration with randr, we get a notification that the root + // window changed + if (event->window == screen->root) + { + if (event->width != screen->width_in_pixels) + screen->width_in_pixels = event->width; + if (event->height != screen->height_in_pixels) + screen->height_in_pixels = event->height; + } +} + static void handle_configure_request(xcb_generic_event_t *e) { xcb_configure_request_event_t *event = (xcb_configure_request_event_t *)e; @@ -290,6 +305,7 @@ void setup_events() event_handlers[XCB_DESTROY_NOTIFY] = handle_destroy_notify; event_handlers[XCB_UNMAP_NOTIFY] = handle_unmap_notify; event_handlers[XCB_MAP_REQUEST] = handle_map_request; + event_handlers[XCB_CONFIGURE_NOTIFY] = handle_configure_notify; event_handlers[XCB_CONFIGURE_REQUEST] = handle_configure_request; /*