From aa1d8b4046cde49fe9d088eef44daca6765b1bb2 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Sun, 21 Feb 2016 17:47:19 +0100 Subject: Remove x11-event-source, replaced by libgwater. --- Makefile.am | 2 -- include/x11-event-source.h | 6 ----- source/rofi.c | 1 - source/view.c | 1 - source/x11-event-source.c | 65 ---------------------------------------------- 5 files changed, 75 deletions(-) delete mode 100644 include/x11-event-source.h delete mode 100644 source/x11-event-source.c diff --git a/Makefile.am b/Makefile.am index ea2c34e2..b14f18f9 100644 --- a/Makefile.am +++ b/Makefile.am @@ -28,7 +28,6 @@ rofi_SOURCES=\ source/i3-support.c\ source/xrmoptions.c\ source/x11-helper.c\ - source/x11-event-source.c\ source/dialogs/run.c\ source/dialogs/ssh.c\ source/dialogs/drun.c\ @@ -52,7 +51,6 @@ rofi_SOURCES=\ include/xrmoptions.h\ include/i3-support.h\ include/x11-helper.h\ - include/x11-event-source.h\ include/dialogs/ssh.h\ include/dialogs/run.h\ include/dialogs/drun.h\ diff --git a/include/x11-event-source.h b/include/x11-event-source.h deleted file mode 100644 index 2c129eb0..00000000 --- a/include/x11-event-source.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef ROFI_X11_EVENT_SOURCE_H -#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 diff --git a/source/rofi.c b/source/rofi.c index 3842ee14..182be769 100644 --- a/source/rofi.c +++ b/source/rofi.c @@ -63,7 +63,6 @@ #include "helper.h" #include "textbox.h" #include "x11-helper.h" -#include "x11-event-source.h" #include "xrmoptions.h" #include "dialogs/dialogs.h" diff --git a/source/view.c b/source/view.c index 66ad22b4..2c069007 100644 --- a/source/view.c +++ b/source/view.c @@ -60,7 +60,6 @@ #include "textbox.h" #include "scrollbar.h" #include "x11-helper.h" -#include "x11-event-source.h" #include "xrmoptions.h" #include "dialogs/dialogs.h" diff --git a/source/x11-event-source.c b/source/x11-event-source.c deleted file mode 100644 index f12f883d..00000000 --- a/source/x11-event-source.c +++ /dev/null @@ -1,65 +0,0 @@ -#include -#include -#include "x11-event-source.h" - -/** - * Custom X11 Source implementation. - */ -typedef struct _X11EventSource -{ - // Source - GSource source; - // Polling field - gpointer fd_x11; - Display *display; -} X11EventSource; - -static gboolean x11_event_source_prepare ( GSource * base, gint * timeout ) -{ - X11EventSource *xs = (X11EventSource *) base; - *timeout = -1; - return /*XPending ( xs->display ) || */ g_source_query_unix_fd ( base, xs->fd_x11 ); -} - -static gboolean x11_event_source_check ( GSource * base ) -{ - X11EventSource *xs = (X11EventSource *) base; - if ( g_source_query_unix_fd ( base, xs->fd_x11 ) ) { - return TRUE; - } - return FALSE; -} - -static gboolean x11_event_source_dispatch ( GSource * base, GSourceFunc callback, gpointer data ) -{ - X11EventSource *xs = (X11EventSource *) base; - if ( callback ) { - if ( g_source_query_unix_fd ( base, xs->fd_x11 ) ) { - callback ( data ); - } - } - return G_SOURCE_CONTINUE;; -} - -static GSourceFuncs x11_event_source_funcs = { - x11_event_source_prepare, - x11_event_source_check, - x11_event_source_dispatch, - NULL -}; - -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 = 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 ); -} -- cgit v1.2.3