[PATCH xserver 17/24] hw/xwayland: Use NotifyFd handler to monitor wayland socket
Keith Packard
keithp at keithp.com
Sun Sep 20 23:16:28 PDT 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 bc92beb..685e352 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;
@@ -419,17 +421,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));
@@ -442,7 +438,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;
@@ -617,7 +618,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.5.0
More information about the xorg-devel
mailing list