mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-04-09 08:21:37 -04:00
xwayland/xwm: extract read loop to separate function
This commit is contained in:
parent
95d25d833f
commit
c9fe96102d
1 changed files with 14 additions and 8 deletions
|
|
@ -1736,16 +1736,10 @@ static void xwm_handle_unhandled_event(struct wlr_xwm *xwm, xcb_generic_event_t
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static int x11_event_handler(int fd, uint32_t mask, void *data) {
|
static int read_x11_events(struct wlr_xwm *xwm) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
xcb_generic_event_t *event;
|
xcb_generic_event_t *event;
|
||||||
struct wlr_xwm *xwm = data;
|
|
||||||
|
|
||||||
if ((mask & WL_EVENT_HANGUP) || (mask & WL_EVENT_ERROR)) {
|
|
||||||
xwm_destroy(xwm);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
while ((event = xcb_poll_for_event(xwm->xcb_conn))) {
|
while ((event = xcb_poll_for_event(xwm->xcb_conn))) {
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
|
|
@ -1804,6 +1798,18 @@ static int x11_event_handler(int fd, uint32_t mask, void *data) {
|
||||||
free(event);
|
free(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int x11_event_handler(int fd, uint32_t mask, void *data) {
|
||||||
|
struct wlr_xwm *xwm = data;
|
||||||
|
|
||||||
|
if ((mask & WL_EVENT_HANGUP) || (mask & WL_EVENT_ERROR)) {
|
||||||
|
xwm_destroy(xwm);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int count = read_x11_events(xwm);
|
||||||
if (count) {
|
if (count) {
|
||||||
xcb_flush(xwm->xcb_conn);
|
xcb_flush(xwm->xcb_conn);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue