diff --git a/src/include/event-adapter.h b/src/include/event-adapter.h index 09a6b85..8a05a44 100644 --- a/src/include/event-adapter.h +++ b/src/include/event-adapter.h @@ -89,6 +89,8 @@ typedef struct destroy_notify_event_t { typedef struct expose_event_t { event_type_t type; + xcb_window_t window; + uint32_t count; } expose_event_t; typedef struct motion_notify_event_t { diff --git a/src/main.c b/src/main.c index a9b7fc0..2992d9c 100644 --- a/src/main.c +++ b/src/main.c @@ -40,6 +40,7 @@ static void configure_request(configure_request_event_t *event); static void map_request(map_request_event_t *event); static void unmap_notify(unmap_notify_event_t *event); static void destroy_notify(destroy_notify_event_t *event); +static void expose(expose_event_t *event); static void motion_notify(motion_notify_event_t *event); static void enter_notify(enter_notify_event_t *event); static void focus_in(focus_in_event_t *event); @@ -468,6 +469,7 @@ void xcb_event_handler(generic_event_t *event, void *user_data) { EVENT(EVENT_TYPE_MAP_REQUEST, map_request); EVENT(EVENT_TYPE_UNMAP_NOTIFY, unmap_notify); EVENT(EVENT_TYPE_DESTROY_NOTIFY, destroy_notify); + EVENT(EVENT_TYPE_EXPOSE, expose); EVENT(EVENT_TYPE_MOTION_NOTIFY, motion_notify); EVENT(EVENT_TYPE_ENTER_NOTIFY, enter_notify); EVENT(EVENT_TYPE_FOCUS_IN, focus_in); @@ -528,6 +530,13 @@ void destroy_notify(destroy_notify_event_t *event) { if (c) unmanage_client(c, true); } +void expose(expose_event_t *event) { + monitor_t *m = NULL; + if (event->count == 0 && (m = get_monitor_of_window(event->window))) { + draw_monitor_bar(m); + } +} + void motion_notify(motion_notify_event_t *event) { logger("motion: window: 0x%x, root: 0x%x\n", event->window, event->root); logger("x: %d, y: %d, root_x: %d, root_y: %d\n", event->x, event->y, diff --git a/src/xcb/event.c b/src/xcb/event.c index 4439d5c..c61c1ca 100644 --- a/src/xcb/event.c +++ b/src/xcb/event.c @@ -73,9 +73,13 @@ static void convert_event(xcb_generic_event_t *xcb_event, event->destroy_notify.window = ev->window; break; } - case XCB_EXPOSE: - event->type = EVENT_TYPE_EXPOSE; + case XCB_EXPOSE: { + xcb_expose_event_t *ev = (xcb_expose_event_t *)xcb_event; + event->expose.type = EVENT_TYPE_EXPOSE; + event->expose.window = ev->window; + event->expose.count = ev->count; break; + } case XCB_MOTION_NOTIFY: { xcb_motion_notify_event_t *ev = (xcb_motion_notify_event_t *)xcb_event; event->motiion_notify.type = EVENT_TYPE_MOTION_NOTIFY;