Keith Packard <[email protected]> writes:

> Replace the block/wakeup handler with a NotifyFd callback instead.

Adam noticed that this patch generated some warnings, which were cleaned
up in a later patch. Let's make this one right too.

From b8d837f24f23eb0199da1dad8d9f84d1a2d7c631 Mon Sep 17 00:00:00 2001
From: Keith Packard <[email protected]>
Date: Thu, 27 Aug 2015 11:50:36 -0700
Subject: [PATCH xserver 12/22] hw/xwayland: Use NotifyFd handler to monitor
 wayland socket

Replace the block/wakeup handler with a NotifyFd callback instead.

Signed-off-by: Keith Packard <[email protected]>
---
 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..e48b81b 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, void *pRead)
+{
+}
+
+static void
+block_handler(void *data, OSTimePtr pTimeout, void *pRead)
 {
     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

-- 
-keith

Attachment: signature.asc
Description: PGP signature

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to