[PATCH xserver 12/20] hw/xwayland: Use NotifyFd handler to monitor wayland socket
Keith Packard
keithp at keithp.com
Wed Nov 11 22:02:12 PST 2015
Replace the block/wakeup handler with a NotifyFd callback instead.
Signed-off-by: Keith Packard <keithp at keithp.com>
---
hw/xwayland/xwayland.c | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index e31becf..bea2164 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;
@@ -428,17 +430,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));
@@ -451,7 +447,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)
+{
+}
+
+static void
+block_handler(void *data)
{
struct xwl_screen *xwl_screen = data;
int ret;
@@ -626,7 +627,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;
--
2.6.1
More information about the xorg-devel
mailing list