mirror of https://github.com/davatorium/rofi.git
Take SardemFF7 (or so) feedback into account about sources polling unix fd.
This commit is contained in:
parent
d9ac267960
commit
348989e52c
|
@ -10,7 +10,7 @@ typedef struct _X11EventSource
|
||||||
// Source
|
// Source
|
||||||
GSource source;
|
GSource source;
|
||||||
// Polling field
|
// Polling field
|
||||||
GPollFD fd_x11;
|
gpointer fd_x11;
|
||||||
Display *display;
|
Display *display;
|
||||||
} X11EventSource;
|
} X11EventSource;
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ static gboolean x11_event_source_prepare ( GSource * base, gint * timeout )
|
||||||
static gboolean x11_event_source_check ( GSource * base )
|
static gboolean x11_event_source_check ( GSource * base )
|
||||||
{
|
{
|
||||||
X11EventSource *xs = (X11EventSource *) base;
|
X11EventSource *xs = (X11EventSource *) base;
|
||||||
if ( xs->fd_x11.revents ) {
|
if ( g_source_query_unix_fd (base, xs->fd_x11) ) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -34,7 +34,7 @@ static gboolean x11_event_source_dispatch ( GSource * base, GSourceFunc callback
|
||||||
{
|
{
|
||||||
X11EventSource *xs = (X11EventSource *) base;
|
X11EventSource *xs = (X11EventSource *) base;
|
||||||
if ( callback ) {
|
if ( callback ) {
|
||||||
if ( xs->fd_x11.revents ) {
|
if ( g_source_query_unix_fd (base, xs->fd_x11) ) {
|
||||||
callback ( data );
|
callback ( data );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -53,8 +53,6 @@ GSource * x11_event_source_new ( Display *display )
|
||||||
int x11_fd = ConnectionNumber ( display );
|
int x11_fd = ConnectionNumber ( display );
|
||||||
X11EventSource *source = (X11EventSource *) g_source_new ( &x11_event_source_funcs, sizeof ( X11EventSource ) );
|
X11EventSource *source = (X11EventSource *) g_source_new ( &x11_event_source_funcs, sizeof ( X11EventSource ) );
|
||||||
source->display = display;
|
source->display = display;
|
||||||
source->fd_x11.fd = x11_fd;
|
source->fd_x11 = g_source_add_unix_fd ( (GSource *)source, x11_fd, G_IO_IN | G_IO_ERR );
|
||||||
source->fd_x11.events = G_IO_IN | G_IO_ERR;
|
|
||||||
g_source_add_poll ( (GSource *) source, &source->fd_x11 );
|
|
||||||
return (GSource *) source;
|
return (GSource *) source;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue