1
0
Fork 0
mirror of https://github.com/davatorium/rofi.git synced 2024-11-11 13:50:48 -05:00

Take SardemFF7 feedback on putting g_source_[attach|add_callback] inside factory.

This commit is contained in:
Dave Davenport 2016-01-20 19:11:19 +01:00
parent 874f587021
commit 4b7a29a26f
3 changed files with 15 additions and 8 deletions

View file

@ -2,4 +2,5 @@
#define ROFI_X11_EVENT_SOURCE_H #define ROFI_X11_EVENT_SOURCE_H
GSource * x11_event_source_new ( Display *display ); GSource * x11_event_source_new ( Display *display );
void x11_event_source_set_callback ( GSource *source, GSourceFunc callback );
#endif // ROFI_X11_EVENT_SOURCE_H #endif // ROFI_X11_EVENT_SOURCE_H

View file

@ -2436,8 +2436,7 @@ int main ( int argc, char *argv[] )
XFlush ( display ); XFlush ( display );
main_loop = g_main_loop_new ( NULL, FALSE ); main_loop = g_main_loop_new ( NULL, FALSE );
GSource *source = x11_event_source_new ( display ); GSource *source = x11_event_source_new ( display );
g_source_attach ( source, NULL ); x11_event_source_set_callback ( source, main_loop_x11_event_handler );
g_source_set_callback ( source, main_loop_x11_event_handler, NULL, NULL );
// Setup signal handling sources. // Setup signal handling sources.
// SIGHup signal. // SIGHup signal.

View file

@ -54,5 +54,12 @@ GSource * x11_event_source_new ( Display *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 = g_source_add_unix_fd ( (GSource *) source, x11_fd, G_IO_IN | G_IO_ERR ); source->fd_x11 = g_source_add_unix_fd ( (GSource *) source, x11_fd, G_IO_IN | G_IO_ERR );
// Attach it to main loop.
g_source_attach ( (GSource *) source, NULL );
return (GSource *) source; return (GSource *) source;
} }
void x11_event_source_set_callback ( GSource *source, GSourceFunc callback )
{
g_source_set_callback ( source, callback, NULL, NULL );
}