diff options
author | Keith Packard <keithp@keithp.com> | 2015-11-23 17:36:53 -0800 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2015-12-01 13:55:28 -0500 |
commit | f933a1b38ed1c65cc39fce1ee37aa18e3022c3f0 (patch) | |
tree | 94a41afe6fbac0183728a92d72fdd94185adfcc6 /hw | |
parent | 8543d4d8bc0526d1c910913b76259e5dee108e74 (diff) |
hw/xwayland: Use NotifyFd handler to monitor wayland socket
Replace the block/wakeup handler with a NotifyFd callback instead.
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/xwayland/xwayland.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c index 55bf6d069..3d362054f 100644 --- a/hw/xwayland/xwayland.c +++ b/hw/xwayland/xwayland.c @@ -115,6 +115,8 @@ xwl_close_screen(ScreenPtr screen) &xwl_screen->seat_list, link) xwl_seat_destroy(xwl_seat); + RemoveNotifyFd(xwl_screen->wayland_fd); + wl_display_disconnect(xwl_screen->display); screen->CloseScreen = xwl_screen->CloseScreen; @@ -453,17 +455,11 @@ static const struct wl_registry_listener registry_listener = { }; static void -wakeup_handler(void *data, int err, void *read_mask) +socket_handler(int fd, int ready, void *data) { struct xwl_screen *xwl_screen = data; int ret; - if (err < 0) - return; - - if (!FD_ISSET(xwl_screen->wayland_fd, (fd_set *) read_mask)) - return; - ret = wl_display_read_events(xwl_screen->display); if (ret == -1) FatalError("failed to dispatch Wayland events: %s\n", strerror(errno)); @@ -476,7 +472,12 @@ wakeup_handler(void *data, int err, void *read_mask) } static void -block_handler(void *data, struct timeval **tv, void *read_mask) +wakeup_handler(void *data, int err, void *pRead) +{ +} + +static void +block_handler(void *data, OSTimePtr pTimeout, void *pRead) { struct xwl_screen *xwl_screen = data; int ret; @@ -651,7 +652,7 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv) #endif xwl_screen->wayland_fd = wl_display_get_fd(xwl_screen->display); - AddGeneralSocket(xwl_screen->wayland_fd); + SetNotifyFd(xwl_screen->wayland_fd, socket_handler, X_NOTIFY_READ, xwl_screen); RegisterBlockAndWakeupHandlers(block_handler, wakeup_handler, xwl_screen); pScreen->SaveScreen = xwl_save_screen; |