proper invalidation on Expose xcb event

This commit is contained in:
hippoz 2023-04-13 04:36:53 +03:00
parent 793918f86f
commit 68211499e8
Signed by: hippoz
GPG key ID: 56C4E02A85F2FBED

View file

@ -1,4 +1,5 @@
#include "cairo.h"
#include "rect.h"
#include "timeutil.h"
#include "window.h"
#include "node.h"
@ -10,6 +11,7 @@
#include <sys/poll.h>
#include <time.h>
#include <xcb/xcb.h>
#include <xcb/xproto.h>
void _window_process_xcb_event(UIWindow *window, xcb_generic_event_t *event);
@ -168,6 +170,9 @@ void _window_process_xcb_event(UIWindow *window, xcb_generic_event_t *event)
uint8_t event_type = event->response_type & ~0x80;
switch (event_type) {
case XCB_EXPOSE: {
xcb_expose_event_t *ev = (xcb_expose_event_t*)event;
UIRect region = { ev->x, ev->y, ev->width, ev->height };
window->invalid_region = ui_rect_united(&window->invalid_region, &region);
window_invalidate_node(window, window->root);
break;
}
@ -182,7 +187,6 @@ void _window_process_xcb_event(UIWindow *window, xcb_generic_event_t *event)
window->root->rect.w = ev->width;
window->root->rect.h = ev->height;
node_dispatch(window->root, UI_EVENT_RELAYOUT, 0, NULL);
window_invalidate_node(window, window->root);
node_dump(window->root, 0);
}
break;