diff --git a/source/x11-event-source.c b/source/x11-event-source.c index fe3544f6..3f307f77 100644 --- a/source/x11-event-source.c +++ b/source/x11-event-source.c @@ -10,7 +10,7 @@ typedef struct _X11EventSource // Source GSource source; // Polling field - GPollFD fd_x11; + gpointer fd_x11; Display *display; } X11EventSource; @@ -24,7 +24,7 @@ static gboolean x11_event_source_prepare ( GSource * base, gint * timeout ) static gboolean x11_event_source_check ( GSource * base ) { X11EventSource *xs = (X11EventSource *) base; - if ( xs->fd_x11.revents ) { + if ( g_source_query_unix_fd (base, xs->fd_x11) ) { return TRUE; } return FALSE; @@ -34,7 +34,7 @@ static gboolean x11_event_source_dispatch ( GSource * base, GSourceFunc callback { X11EventSource *xs = (X11EventSource *) base; if ( callback ) { - if ( xs->fd_x11.revents ) { + if ( g_source_query_unix_fd (base, xs->fd_x11) ) { callback ( data ); } } @@ -53,8 +53,6 @@ GSource * x11_event_source_new ( Display *display ) int x11_fd = ConnectionNumber ( display ); X11EventSource *source = (X11EventSource *) g_source_new ( &x11_event_source_funcs, sizeof ( X11EventSource ) ); source->display = display; - source->fd_x11.fd = x11_fd; - source->fd_x11.events = G_IO_IN | G_IO_ERR; - g_source_add_poll ( (GSource *) source, &source->fd_x11 ); + source->fd_x11 = g_source_add_unix_fd ( (GSource *)source, x11_fd, G_IO_IN | G_IO_ERR ); return (GSource *) source; }