mirror of
https://github.com/davatorium/rofi.git
synced 2025-03-24 17:16:46 -04:00
Take SardemFF7 feedback on putting g_source_[attach|add_callback] inside factory.
This commit is contained in:
parent
874f587021
commit
4b7a29a26f
3 changed files with 15 additions and 8 deletions
|
@ -2,4 +2,5 @@
|
|||
#define ROFI_X11_EVENT_SOURCE_H
|
||||
|
||||
GSource * x11_event_source_new ( Display *display );
|
||||
void x11_event_source_set_callback ( GSource *source, GSourceFunc callback );
|
||||
#endif // ROFI_X11_EVENT_SOURCE_H
|
||||
|
|
|
@ -2436,8 +2436,7 @@ int main ( int argc, char *argv[] )
|
|||
XFlush ( display );
|
||||
main_loop = g_main_loop_new ( NULL, FALSE );
|
||||
GSource *source = x11_event_source_new ( display );
|
||||
g_source_attach ( source, NULL );
|
||||
g_source_set_callback ( source, main_loop_x11_event_handler, NULL, NULL );
|
||||
x11_event_source_set_callback ( source, main_loop_x11_event_handler );
|
||||
|
||||
// Setup signal handling sources.
|
||||
// SIGHup signal.
|
||||
|
|
|
@ -54,5 +54,12 @@ GSource * x11_event_source_new ( Display *display )
|
|||
X11EventSource *source = (X11EventSource *) g_source_new ( &x11_event_source_funcs, sizeof ( X11EventSource ) );
|
||||
source->display = display;
|
||||
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;
|
||||
}
|
||||
void x11_event_source_set_callback ( GSource *source, GSourceFunc callback )
|
||||
{
|
||||
g_source_set_callback ( source, callback, NULL, NULL );
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue