处理 expose 事件

This commit is contained in:
2025-08-24 11:44:56 +08:00
parent 0039cd2c43
commit 165dd0733c
3 changed files with 17 additions and 2 deletions

View File

@@ -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,