summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Davenport <qball@gmpclient.org>2016-01-20 19:03:09 +0100
committerDave Davenport <qball@gmpclient.org>2016-01-20 19:03:09 +0100
commit348989e52ca6bb52b046deb448da05c556e9564b (patch)
treeca1bd5a7f52ed85a42aff707119cbe61f900be64
parentd9ac267960daee42bd815e91d3ed79b8a37b2dc5 (diff)
Take SardemFF7 (or so) feedback into account about sources polling unix fd.
-rw-r--r--source/x11-event-source.c10
1 files changed, 4 insertions, 6 deletions
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;
}