diff options
-rw-r--r-- | ChangeLog | 31 | ||||
-rw-r--r-- | acinclude.m4 | 87 | ||||
-rw-r--r-- | common/Makefile.am | 20 | ||||
-rw-r--r-- | configure.ac | 110 | ||||
-rw-r--r-- | daemon/Makefile.am | 60 | ||||
-rw-r--r-- | daemon/gdm-factory-slave.c | 104 | ||||
-rw-r--r-- | daemon/gdm-product-slave.c | 108 | ||||
-rw-r--r-- | daemon/gdm-simple-slave.c | 109 | ||||
-rw-r--r-- | daemon/gdm-slave.c | 91 | ||||
-rw-r--r-- | daemon/gdm-slave.h | 3 | ||||
-rw-r--r-- | gui/Makefile.am | 1 | ||||
-rw-r--r-- | gui/modules/.cvsignore | 6 | ||||
-rw-r--r-- | gui/modules/AccessDwellMouseEvents.in | 62 | ||||
-rw-r--r-- | gui/modules/AccessKeyMouseEvents.in | 91 | ||||
-rw-r--r-- | gui/modules/Makefile.am | 88 | ||||
-rw-r--r-- | gui/modules/dwellmouselistener.c | 760 | ||||
-rw-r--r-- | gui/modules/keymouselistener.c | 1010 | ||||
-rw-r--r-- | gui/simple-chooser/Makefile.am | 10 | ||||
-rw-r--r-- | gui/simple-greeter/Makefile.am | 28 | ||||
-rw-r--r-- | gui/simple-greeter/libnotificationarea/Makefile.am | 4 | ||||
-rw-r--r-- | libgreeter/Makefile.am | 4 | ||||
-rw-r--r-- | po/ChangeLog | 6 | ||||
-rw-r--r-- | po/POTFILES.in | 2 |
23 files changed, 301 insertions, 2494 deletions
@@ -1,3 +1,34 @@ +2007-10-04 William Jon McCann <mccann@jhu.edu> + + * acinclude.m4: + * common/Makefile.am: + * configure.ac: + * daemon/Makefile.am: + * daemon/gdm-factory-slave.c: (run_greeter), + (idle_connect_to_display): + * daemon/gdm-product-slave.c: (setup_server), + (idle_connect_to_display): + * daemon/gdm-simple-slave.c: (run_greeter), + (idle_connect_to_display): + * daemon/gdm-slave.c: (gdm_slave_set_busy_cursor), + (set_local_auth), (gdm_slave_connect_to_x11_display): + * daemon/gdm-slave.h: + * gui/Makefile.am: + * gui/modules/.cvsignore: + * gui/modules/AccessDwellMouseEvents.in: + * gui/modules/AccessKeyMouseEvents.in: + * gui/modules/Makefile.am: + * gui/modules/dwellmouselistener.c: + * gui/modules/keymouselistener.c: + * gui/simple-chooser/Makefile.am: + * gui/simple-greeter/Makefile.am: + * gui/simple-greeter/libnotificationarea/Makefile.am: + * libgreeter/Makefile.am: + Fix up the handling of dependencies. Make the daemon + only depend on x11, glib, gobject, dbus. Move some + things from the slaves to the base class. + Remove the unused modules for now. + 2007-10-03 William Jon McCann <mccann@jhu.edu> * gui/simple-greeter/greeter-main.c: (main): diff --git a/acinclude.m4 b/acinclude.m4 index 970dbec2..3b3bbe3f 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -286,3 +286,90 @@ fi AC_MSG_RESULT($result) ]) + +dnl EXTRA_COMPILE_WARNINGS +dnl Turn on many useful compiler warnings +dnl For now, only works on GCC +AC_DEFUN([EXTRA_COMPILE_WARNINGS],[ + dnl ****************************** + dnl More compiler warnings + dnl ****************************** + + AC_ARG_ENABLE(compile-warnings, + AC_HELP_STRING([--enable-compile-warnings=@<:@no/minimum/yes/maximum/error@:>@], + [Turn on compiler warnings]),, + [enable_compile_warnings="m4_default([$1],[yes])"]) + + warnCFLAGS= + if test "x$GCC" != xyes; then + enable_compile_warnings=no + fi + + warning_flags= + realsave_CFLAGS="$CFLAGS" + + case "$enable_compile_warnings" in + no) + warning_flags= + ;; + minimum) + warning_flags="-Wall" + ;; + yes) + warning_flags="-Wall -Wmissing-prototypes" + ;; + maximum|error) + warning_flags="-Wall -Wmissing-prototypes -Wnested-externs -Wpointer-arith" + CFLAGS="$warning_flags $CFLAGS" + for option in -Wno-sign-compare; do + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS $option" + AC_MSG_CHECKING([whether gcc understands $option]) + AC_TRY_COMPILE([], [], + has_option=yes, + has_option=no,) + CFLAGS="$SAVE_CFLAGS" + AC_MSG_RESULT($has_option) + if test $has_option = yes; then + warning_flags="$warning_flags $option" + fi + unset has_option + unset SAVE_CFLAGS + done + unset option + if test "$enable_compile_warnings" = "error" ; then + warning_flags="$warning_flags -Werror" + fi + ;; + *) + AC_MSG_ERROR(Unknown argument '$enable_compile_warnings' to --enable-compile-warnings) + ;; + esac + CFLAGS="$realsave_CFLAGS" + AC_MSG_CHECKING(what warning flags to pass to the C compiler) + AC_MSG_RESULT($warning_flags) + + AC_ARG_ENABLE(iso-c, + AC_HELP_STRING([--enable-iso-c], + [Try to warn if code is not ISO C ]),, + [enable_iso_c=no]) + + AC_MSG_CHECKING(what language compliance flags to pass to the C compiler) + complCFLAGS= + if test "x$enable_iso_c" != "xno"; then + if test "x$GCC" = "xyes"; then + case " $CFLAGS " in + *[\ \ ]-ansi[\ \ ]*) ;; + *) complCFLAGS="$complCFLAGS -ansi" ;; + esac + case " $CFLAGS " in + *[\ \ ]-pedantic[\ \ ]*) ;; + *) complCFLAGS="$complCFLAGS -pedantic" ;; + esac + fi + fi + AC_MSG_RESULT($complCFLAGS) + + WARN_CFLAGS="$warning_flags $complCFLAGS" + AC_SUBST(WARN_CFLAGS) +]) diff --git a/common/Makefile.am b/common/Makefile.am index d1b31b93..1d3afce1 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -3,9 +3,9 @@ NULL = INCLUDES = \ - -I. \ - -I.. \ - -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ + -I. \ + -I.. \ + -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ -DAUTHDIR=\"$(authdir)\" \ -DBINDIR=\"$(bindir)\" \ -DDATADIR=\"$(datadir)\" \ @@ -21,8 +21,8 @@ INCLUDES = \ -DGDM_DEFAULTS_CONF=\"$(GDM_DEFAULTS_CONF)\" \ -DGDM_CUSTOM_CONF=\"$(GDM_CUSTOM_CONF)\" \ -DGDM_OLD_CONF=\"$(GDM_OLD_CONF)\" \ - $(DBUS_CFLAGS) \ - $(GLIB_CFLAGS) + $(COMMON_CFLAGS) \ + $(NULL) noinst_LTLIBRARIES = \ libgdmcommon.la \ @@ -79,7 +79,7 @@ libgdmcommon_la_CPPFLAGS = \ $(NULL) libgdmcommon_la_CFLAGS = \ - $(DBUS_CFLAGS) \ + $(COMMON_CFLAGS) \ $(NULL) libgdmcommon_la_LIBADD = \ @@ -101,7 +101,7 @@ test_log_SOURCES = \ test_log_LDADD = \ libgdmcommon.la \ - $(GLIB_LIBS) \ + $(COMMON_LIBS) \ $(NULL) test_settings_server_SOURCES = \ @@ -110,8 +110,7 @@ test_settings_server_SOURCES = \ test_settings_server_LDADD = \ libgdmcommon.la \ - $(GLIB_LIBS) \ - $(DBUS_LIBS) \ + $(COMMON_LIBS) \ $(NULL) test_settings_client_SOURCES = \ @@ -120,8 +119,7 @@ test_settings_client_SOURCES = \ test_settings_client_LDADD = \ libgdmcommon.la \ - $(GLIB_LIBS) \ - $(DBUS_LIBS) \ + $(COMMON_LIBS) \ $(NULL) CLEANFILES = \ diff --git a/configure.ac b/configure.ac index 8c884053..97d07542 100644 --- a/configure.ac +++ b/configure.ac @@ -24,13 +24,14 @@ IT_PROG_INTLTOOL([0.35.0]) GNOME_DOC_INIT -DBUS_GLIB_REQUIRED=0.74 -GLIB_REQUIRED=2.13.0 -GTK_REQUIRED=2.10.0 -GNOME_VFS_REQUIRED=2.18.0 -PANGO_REQUIRED=1.3.0 -LIBGLADE_REQUIRED=1.99.2 -SCROLLKEEPER_REQUIRED=0.1.4 +X11_REQUIRED_VERSION=1.0.0 +DBUS_GLIB_REQUIRED_VERSION=0.74 +GLIB_REQUIRED_VERSION=2.13.0 +GTK_REQUIRED_VERSION=2.10.0 +GNOME_VFS_REQUIRED_VERSION=2.18.0 +PANGO_REQUIRED_VERSION=1.3.0 +LIBGLADE_REQUIRED_VERSION=1.99.2 +SCROLLKEEPER_REQUIRED_VERSION=0.1.4 dnl dnl Let the user configure where to look for the configuration files. @@ -159,64 +160,56 @@ dnl checks needed for Darwin compatibility to linux **environ. AC_CHECK_HEADERS(crt_externs.h) AC_CHECK_FUNCS(_NSGetEnviron) -GNOME_COMPILE_WARNINGS -CFLAGS="$CFLAGS $WARN_CFLAGS" +EXTRA_COMPILE_WARNINGS(yes) -PKG_CHECK_MODULES(COMMON, gtk+-2.0 >= $GTK_REQUIRED libglade-2.0 >= $LIBGLADE_REQUIRED) +PKG_CHECK_MODULES(COMMON, + dbus-glib-1 >= $DBUS_GLIB_REQUIRED_VERSION + gobject-2.0 >= $GLIB_REQUIRED_VERSION +) AC_SUBST(COMMON_CFLAGS) AC_SUBST(COMMON_LIBS) -PKG_CHECK_MODULES(DAEMON, gtk+-2.0 >= $GTK_REQUIRED) +PKG_CHECK_MODULES(DAEMON, + dbus-glib-1 >= $DBUS_GLIB_REQUIRED_VERSION + gobject-2.0 >= $GLIB_REQUIRED_VERSION + x11 >= $X11_REQUIRED_VERSION +) AC_SUBST(DAEMON_CFLAGS) AC_SUBST(DAEMON_LIBS) -PKG_CHECK_MODULES(GUI, gtk+-2.0 >= $GTK_REQUIRED libglade-2.0 >= $LIBGLADE_REQUIRED gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED) -AC_SUBST(GUI_CFLAGS) -AC_SUBST(GUI_LIBS) - -PKG_CHECK_MODULES(GUIGLADE, gtk+-2.0 >= $GTK_REQUIRED libglade-2.0 >= $LIBGLADE_REQUIRED) -AC_SUBST(GUIGLADE_CFLAGS) -AC_SUBST(GUIGLADE_LIBS) - -PKG_CHECK_MODULES(GUING, gtk+-2.0 >= $GTK_REQUIRED) -AC_SUBST(GUING_CFLAGS) -AC_SUBST(GUING_LIBS) - -PKG_CHECK_MODULES(GREETER, gtk+-2.0 >= $GTK_REQUIRED) +PKG_CHECK_MODULES(GREETER, + dbus-glib-1 >= $DBUS_GLIB_REQUIRED_VERSION + gtk+-2.0 >= $GTK_REQUIRED_VERSION +) AC_SUBST(GREETER_CFLAGS) AC_SUBST(GREETER_LIBS) -dnl libbackground -PKG_CHECK_MODULES(CAPPLET, "gtk+-2.0 gconf-2.0") -dnl ========================================================================== - -PKG_CHECK_MODULES(UTILS, gtk+-2.0 >= $GTK_REQUIRED libglade-2.0 >= $LIBGLADE_REQUIRED) -AC_SUBST(UTILS_CFLAGS) -AC_SUBST(UTILS_LIBS) - -PKG_CHECK_MODULES(GLIB, glib-2.0 >= $GLIB_REQUIRED) -AC_SUBST(GLIB_CFLAGS) -AC_SUBST(GLIB_LIBS) - -PKG_CHECK_MODULES(GOBJECT, gobject-2.0 >= $GLIB_REQUIRED) -AC_SUBST(GOBJECT_CFLAGS) -AC_SUBST(GOBJECT_LIBS) - -PKG_CHECK_MODULES(PANGO, pango >= $PANGO_REQUIRED) -AC_SUBST(PANGO_CFLAGS) -AC_SUBST(PANGO_LIBS) - -PKG_CHECK_MODULES(PANGOFT, pangoft2 >= $PANGO_REQUIRED) -AC_SUBST(PANGOFT_CFLAGS) -AC_SUBST(PANGOFT_LIBS) +PKG_CHECK_MODULES(SIMPLE_GREETER, + dbus-glib-1 >= $DBUS_GLIB_REQUIRED_VERSION + gtk+-2.0 >= $GTK_REQUIRED_VERSION + libglade-2.0 >= $LIBGLADE_REQUIRED_VERSION + gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED_VERSION +) +AC_SUBST(SIMPLE_GREETER_CFLAGS) +AC_SUBST(SIMPLE_GREETER_LIBS) -PKG_CHECK_MODULES(GDK, gdk-2.0 >= $GTK_REQUIRED) -AC_SUBST(GDK_CFLAGS) -AC_SUBST(GDK_LIBS) +PKG_CHECK_MODULES(CHOOSER, + dbus-glib-1 >= $DBUS_GLIB_REQUIRED_VERSION + gtk+-2.0 >= $GTK_REQUIRED_VERSION +) +AC_SUBST(CHOOSER_CFLAGS) +AC_SUBST(CHOOSER_LIBS) + +PKG_CHECK_MODULES(SIMPLE_CHOOSER, + dbus-glib-1 >= $DBUS_GLIB_REQUIRED_VERSION + gtk+-2.0 >= $GTK_REQUIRED_VERSION + libglade-2.0 >= $LIBGLADE_REQUIRED_VERSION + gnome-vfs-2.0 >= $GNOME_VFS_REQUIRED_VERSION +) +AC_SUBST(SIMPLE_CHOOSER_CFLAGS) +AC_SUBST(SIMPLE_CHOOSER_LIBS) -PKG_CHECK_MODULES(GDKPIXBUF, gdk-pixbuf-2.0 >= $GTK_REQUIRED) -AC_SUBST(GDKPIXBUF_CFLAGS) -AC_SUBST(GDKPIXBUF_LIBS) +dnl ========================================================================== dnl Allow users to run gdmsetup using the console helper PAM stuff. if test "x$enable_console_helper" = "xyes"; then @@ -266,9 +259,6 @@ AC_CHECK_FUNC(inet_aton,,[ AC_CHECK_LIB(resolv,inet_aton, [ EXTRA_CHOOSER_LIBS="$EXTRA_CHOOSER_LIBS -lresolv"])]) -COMMON_GNOME_LIBS="libgdmcommon-ui.a" -AC_SUBST(COMMON_GNOME_LIBS) - dnl ***************************** dnl IPv6 specific checks dnl ***************************** @@ -844,14 +834,7 @@ dnl --------------------------------------------------------------------------- dnl - D-Bus dnl --------------------------------------------------------------------------- -PKG_CHECK_MODULES(DBUS, dbus-glib-1 >= $DBUS_GLIB_REQUIRED) -AC_SUBST(DBUS_CFLAGS) -AC_SUBST(DBUS_LIBS) - -dnl --------------------------------------------------------------------------- dnl - Are we specifying a different dbus root ? -dnl --------------------------------------------------------------------------- - AC_ARG_WITH(dbus-sys, [AC_HELP_STRING([--with-dbus-sys=<dir>], [where D-BUS system.d directory is])]) @@ -1329,7 +1312,6 @@ Makefile daemon/Makefile libgreeter/Makefile gui/Makefile -gui/modules/Makefile gui/simple-greeter/Makefile gui/simple-greeter/libnotificationarea/Makefile gui/simple-chooser/Makefile diff --git a/daemon/Makefile.am b/daemon/Makefile.am index afaaf7ad..fdf9b967 100644 --- a/daemon/Makefile.am +++ b/daemon/Makefile.am @@ -1,7 +1,5 @@ NULL = -# Note that we have cflags for just about everything even if -# we don't link to everything INCLUDES = \ -I. \ -I.. \ @@ -21,12 +19,11 @@ INCLUDES = \ -DGDM_DEFAULTS_CONF=\"$(GDM_DEFAULTS_CONF)\" \ -DGDM_CUSTOM_CONF=\"$(GDM_CUSTOM_CONF)\" \ -DGDM_OLD_CONF=\"$(GDM_OLD_CONF)\" \ - $(GUI_CFLAGS) \ + $(DISABLE_DEPRECATED_CFLAGS) \ $(DAEMON_CFLAGS) \ + $(WARN_CFLAGS) \ + $(DEBUG_CFLAGS) \ -DLANG_CONFIG_FILE=\"$(LANG_CONFIG_FILE)\" \ - $(GNOME_INCLUDEDIR) \ - -DGREETERTHEMEDIR=\""$(datadir)/gdm/themes"\" \ - $(DBUS_CFLAGS) \ $(NULL) BUILT_SOURCES = \ @@ -74,10 +71,8 @@ test_session_SOURCES = \ $(NULL) test_session_LDADD = \ - $(GLIB_LIBS) \ - $(GOBJECT_LIBS) \ + $(DAEMON_LIBS) \ $(PAM_LIBS) \ - $(DBUS_LIBS) \ $(NULL) libexec_PROGRAMS = \ @@ -113,23 +108,12 @@ gdm_simple_slave_SOURCES = \ $(NULL) gdm_simple_slave_LDFLAGS = \ - $(EXTRA_SLAVE_LIBS) \ $(PAM_LIBS) \ $(NULL) gdm_simple_slave_LDADD = \ $(DAEMON_LIBS) \ - $(INTLLIBS) \ - $(GLIB_LIBS) \ - $(GOBJECT_LIBS) \ - $(GDK_LIBS) \ $(top_builddir)/common/libgdmcommon.la \ - $(X_LIBS) \ - $(XINERAMA_LIBS) \ - $(DBUS_LIBS) \ - -lXau \ - -lX11 \ - -lXext \ $(NULL) gdm_factory_slave_SOURCES = \ @@ -159,17 +143,7 @@ gdm_factory_slave_LDFLAGS = \ gdm_factory_slave_LDADD = \ $(DAEMON_LIBS) \ - $(INTLLIBS) \ - $(GLIB_LIBS) \ - $(GOBJECT_LIBS) \ - $(GDK_LIBS) \ $(top_builddir)/common/libgdmcommon.la \ - $(X_LIBS) \ - $(XINERAMA_LIBS) \ - $(DBUS_LIBS) \ - -lXau \ - -lX11 \ - -lXext \ $(NULL) gdm_product_slave_SOURCES = \ @@ -192,23 +166,12 @@ gdm_product_slave_SOURCES = \ $(NULL) gdm_product_slave_LDFLAGS = \ - $(EXTRA_SLAVE_LIBS) \ $(PAM_LIBS) \ $(NULL) gdm_product_slave_LDADD = \ $(DAEMON_LIBS) \ - $(INTLLIBS) \ - $(GLIB_LIBS) \ - $(GOBJECT_LIBS) \ - $(GDK_LIBS) \ $(top_builddir)/common/libgdmcommon.la \ - $(X_LIBS) \ - $(XINERAMA_LIBS) \ - $(DBUS_LIBS) \ - -lXau \ - -lX11 \ - -lXext \ $(NULL) gdm_session_worker_SOURCES = \ @@ -222,10 +185,8 @@ gdm_session_worker_LDFLAGS = \ $(NULL) gdm_session_worker_LDADD = \ - $(GLIB_LIBS) \ - $(GOBJECT_LIBS) \ + $(DAEMON_LIBS) \ $(top_builddir)/common/libgdmcommon.la \ - $(DBUS_LIBS) \ $(NULL) sbin_PROGRAMS = \ @@ -289,18 +250,7 @@ gdm_binary_LDFLAGS = \ gdm_binary_LDADD = \ $(DAEMON_LIBS) \ - $(INTLLIBS) \ - $(GLIB_LIBS) \ - $(GOBJECT_LIBS) \ - $(GDK_LIBS) \ $(top_builddir)/common/libgdmcommon.la \ - $(X_LIBS) \ - $(XINERAMA_LIBS) \ - $(XDMCP_LIBS) \ - $(DBUS_LIBS) \ - -lXau \ - -lX11 \ - -lXext \ $(NULL) if WITH_CONSOLE_KIT diff --git a/daemon/gdm-factory-slave.c b/daemon/gdm-factory-slave.c index f0215859..13549486 100644 --- a/daemon/gdm-factory-slave.c +++ b/daemon/gdm-factory-slave.c @@ -34,8 +34,6 @@ #include <glib.h> #include <glib/gi18n.h> #include <glib-object.h> -#include <gdk/gdkx.h> -#include <gtk/gtk.h> #define DBUS_API_SUBJECT_TO_CHANGE #include <dbus/dbus-glib.h> @@ -93,21 +91,6 @@ static void gdm_factory_slave_finalize (GObject *object); G_DEFINE_TYPE (GdmFactorySlave, gdm_factory_slave, GDM_TYPE_SLAVE) static void -set_busy_cursor (GdmFactorySlave *factory_slave) -{ - if (factory_slave->priv->server_display != NULL) { - Cursor xcursor; - - xcursor = XCreateFontCursor (factory_slave->priv->server_display, GDK_WATCH); - XDefineCursor (factory_slave->priv->server_display, - DefaultRootWindow (factory_slave->priv->server_display), - xcursor); - XFreeCursor (factory_slave->priv->server_display, xcursor); - XSync (factory_slave->priv->server_display, False); - } -} - -static void gdm_factory_slave_whack_temp_auth_file (GdmFactorySlave *factory_slave) { #if 0 @@ -627,7 +610,7 @@ run_greeter (GdmFactorySlave *slave) } /* Set the busy cursor */ - set_busy_cursor (slave); + gdm_slave_set_busy_cursor (GDM_SLAVE (slave)); /* FIXME: send a signal back to the master */ @@ -709,89 +692,6 @@ run_greeter (GdmFactorySlave *slave) g_free (auth_file); } -static void -set_local_auth (GdmFactorySlave *slave) -{ - GString *binary_cookie; - GString *cookie; - char *display_x11_cookie; - - g_object_get (slave, - "display-x11-cookie", &display_x11_cookie, - NULL); - - g_debug ("Setting authorization key for display %s", display_x11_cookie); - - cookie = g_string_new (display_x11_cookie); - binary_cookie = g_string_new (NULL); - if (! gdm_string_hex_decode (cookie, - 0, - NULL, - binary_cookie, - 0)) { - g_warning ("Unable to decode hex cookie"); - goto out; - } - - g_debug ("Decoded cookie len %d", binary_cookie->len); - - XSetAuthorization ("MIT-MAGIC-COOKIE-1", - (int) strlen ("MIT-MAGIC-COOKIE-1"), - (char *)binary_cookie->str, - binary_cookie->len); - - out: - g_string_free (binary_cookie, TRUE); - g_string_free (cookie, TRUE); - g_free (display_x11_cookie); -} - -static gboolean -connect_to_display (GdmFactorySlave *slave) -{ - char *display_name; - gboolean ret; - - ret = FALSE; - - g_object_get (slave, - "display-name", &display_name, - NULL); - - /* We keep our own (windowless) connection (dsp) open to avoid the - * X server resetting due to lack of active connections. */ - - g_debug ("Server is ready - opening display %s", display_name); - - g_setenv ("DISPLAY", display_name, TRUE); - g_unsetenv ("XAUTHORITY"); /* just in case it's set */ - - set_local_auth (slave); - -#if 0 - /* X error handlers to avoid the default one (i.e. exit (1)) */ - do_xfailed_on_xio_error = TRUE; - XSetErrorHandler (gdm_factory_slave_xerror_handler); - XSetIOErrorHandler (gdm_factory_slave_xioerror_handler); -#endif - - gdm_sigchld_block_push (); - slave->priv->server_display = XOpenDisplay (display_name); - gdm_sigchld_block_pop (); - - if (slave->priv->server_display == NULL) { - g_warning ("Unable to connect to display %s", display_name); - ret = FALSE; - } else { - g_debug ("Connected to display %s", display_name); - ret = TRUE; - } - - g_free (display_name); - - return ret; -} - static gboolean idle_connect_to_display (GdmFactorySlave *slave) { @@ -801,7 +701,7 @@ idle_connect_to_display (GdmFactorySlave *slave) g_debug ("Connect to display"); - res = connect_to_display (slave); + res = gdm_slave_connect_to_x11_display (GDM_SLAVE (slave)); if (res) { /* FIXME: handle wait-for-go */ diff --git a/daemon/gdm-product-slave.c b/daemon/gdm-product-slave.c index 524e3a96..fee17a35 100644 --- a/daemon/gdm-product-slave.c +++ b/daemon/gdm-product-slave.c @@ -34,8 +34,6 @@ #include <glib.h> #include <glib/gi18n.h> #include <glib-object.h> -#include <gdk/gdkx.h> -#include <gtk/gtk.h> #define DBUS_API_SUBJECT_TO_CHANGE #include <dbus/dbus-glib.h> @@ -101,21 +99,6 @@ static void gdm_product_slave_finalize (GObject *object); G_DEFINE_TYPE (GdmProductSlave, gdm_product_slave, GDM_TYPE_SLAVE) static void -set_busy_cursor (GdmProductSlave *product_slave) -{ - if (product_slave->priv->server_display != NULL) { - Cursor xcursor; - - xcursor = XCreateFontCursor (product_slave->priv->server_display, GDK_WATCH); - XDefineCursor (product_slave->priv->server_display, - DefaultRootWindow (product_slave->priv->server_display), - xcursor); - XFreeCursor (product_slave->priv->server_display, xcursor); - XSync (product_slave->priv->server_display, False); - } -} - -static void gdm_product_slave_whack_temp_auth_file (GdmProductSlave *product_slave) { #if 0 @@ -615,7 +598,7 @@ setup_server (GdmProductSlave *slave) NULL); /* Set the busy cursor */ - set_busy_cursor (slave); + gdm_slave_set_busy_cursor (GDM_SLAVE (slave)); /* FIXME: send a signal back to the master */ @@ -633,96 +616,13 @@ setup_server (GdmProductSlave *slave) /* Run the init script. gdmslave suspends until script has terminated */ gdm_product_slave_exec_script (slave, - GDMCONFDIR"/Init", - "gdm"); + GDMCONFDIR"/Init", + "gdm"); g_free (display_name); g_free (auth_file); } -static void -set_local_auth (GdmProductSlave *slave) -{ - GString *binary_cookie; - GString *cookie; - char *display_x11_cookie; - - g_object_get (slave, - "display-x11-cookie", &display_x11_cookie, - NULL); - - g_debug ("Setting authorization key for display %s", display_x11_cookie); - - cookie = g_string_new (display_x11_cookie); - binary_cookie = g_string_new (NULL); - if (! gdm_string_hex_decode (cookie, - 0, - NULL, - binary_cookie, - 0)) { - g_warning ("Unable to decode hex cookie"); - goto out; - } - - g_debug ("Decoded cookie len %d", binary_cookie->len); - - XSetAuthorization ("MIT-MAGIC-COOKIE-1", - (int) strlen ("MIT-MAGIC-COOKIE-1"), - (char *)binary_cookie->str, - binary_cookie->len); - - out: - g_string_free (binary_cookie, TRUE); - g_string_free (cookie, TRUE); - g_free (display_x11_cookie); -} - -static gboolean -connect_to_display (GdmProductSlave *slave) -{ - char *display_name; - gboolean ret; - - ret = FALSE; - - g_object_get (slave, - "display-name", &display_name, - NULL); - - /* We keep our own (windowless) connection (dsp) open to avoid the - * X server resetting due to lack of active connections. */ - - g_debug ("Server is ready - opening display %s", display_name); - - g_setenv ("DISPLAY", display_name, TRUE); - g_unsetenv ("XAUTHORITY"); /* just in case it's set */ - - set_local_auth (slave); - -#if 0 - /* X error handlers to avoid the default one (i.e. exit (1)) */ - do_xfailed_on_xio_error = TRUE; - XSetErrorHandler (gdm_product_slave_xerror_handler); - XSetIOErrorHandler (gdm_product_slave_xioerror_handler); -#endif - - gdm_sigchld_block_push (); - slave->priv->server_display = XOpenDisplay (display_name); - gdm_sigchld_block_pop (); - - if (slave->priv->server_display == NULL) { - g_warning ("Unable to connect to display %s", display_name); - ret = FALSE; - } else { - g_debug ("Connected to display %s", display_name); - ret = TRUE; - } - - g_free (display_name); - - return ret; -} - static gboolean setup_session (GdmProductSlave *slave) { @@ -767,7 +667,7 @@ idle_connect_to_display (GdmProductSlave *slave) slave->priv->connection_attempts++; - res = connect_to_display (slave); + res = gdm_slave_connect_to_x11_display (GDM_SLAVE (slave)); if (res) { /* FIXME: handle wait-for-go */ diff --git a/daemon/gdm-simple-slave.c b/daemon/gdm-simple-slave.c index 03caea31..13be3de1 100644 --- a/daemon/gdm-simple-slave.c +++ b/daemon/gdm-simple-slave.c @@ -34,8 +34,6 @@ #include <glib.h> #include <glib/gi18n.h> #include <glib-object.h> -#include <gdk/gdkx.h> -#include <gtk/gtk.h> #define DBUS_API_SUBJECT_TO_CHANGE #include <dbus/dbus-glib.h> @@ -74,7 +72,6 @@ struct GdmSimpleSlavePrivate int ping_interval; GPid server_pid; - Display *server_display; guint connection_attempts; /* user selected */ @@ -110,21 +107,6 @@ static void gdm_simple_slave_finalize (GObject *object); G_DEFINE_TYPE (GdmSimpleSlave, gdm_simple_slave, GDM_TYPE_SLAVE) static void -set_busy_cursor (GdmSimpleSlave *simple_slave) -{ - if (simple_slave->priv->server_display != NULL) { - Cursor xcursor; - - xcursor = XCreateFontCursor (simple_slave->priv->server_display, GDK_WATCH); - XDefineCursor (simple_slave->priv->server_display, - DefaultRootWindow (simple_slave->priv->server_display), - xcursor); - XFreeCursor (simple_slave->priv->server_display, xcursor); - XSync (simple_slave->priv->server_display, False); - } -} - -static void gdm_simple_slave_whack_temp_auth_file (GdmSimpleSlave *simple_slave) { #if 0 @@ -999,7 +981,7 @@ run_greeter (GdmSimpleSlave *slave) } /* Set the busy cursor */ - set_busy_cursor (slave); + gdm_slave_set_busy_cursor (GDM_SLAVE (slave)); /* FIXME: send a signal back to the master */ @@ -1086,89 +1068,6 @@ run_greeter (GdmSimpleSlave *slave) g_free (auth_file); } -static void -set_local_auth (GdmSimpleSlave *slave) -{ - GString *binary_cookie; - GString *cookie; - char *display_x11_cookie; - - g_object_get (slave, - "display-x11-cookie", &display_x11_cookie, - NULL); - - g_debug ("Setting authorization key for display %s", display_x11_cookie); - - cookie = g_string_new (display_x11_cookie); - binary_cookie = g_string_new (NULL); - if (! gdm_string_hex_decode (cookie, - 0, - NULL, - binary_cookie, - 0)) { - g_warning ("Unable to decode hex cookie"); - goto out; - } - - g_debug ("Decoded cookie len %d", binary_cookie->len); - - XSetAuthorization ("MIT-MAGIC-COOKIE-1", - (int) strlen ("MIT-MAGIC-COOKIE-1"), - (char *)binary_cookie->str, - binary_cookie->len); - - out: - g_string_free (binary_cookie, TRUE); - g_string_free (cookie, TRUE); - g_free (display_x11_cookie); -} - -static gboolean -connect_to_display (GdmSimpleSlave *slave) -{ - char *display_name; - gboolean ret; - - ret = FALSE; - - g_object_get (slave, - "display-name", &display_name, - NULL); - - /* We keep our own (windowless) connection (dsp) open to avoid the - * X server resetting due to lack of active connections. */ - - g_debug ("Server is ready - opening display %s", display_name); - - g_setenv ("DISPLAY", display_name, TRUE); - g_unsetenv ("XAUTHORITY"); /* just in case it's set */ - - set_local_auth (slave); - -#if 0 - /* X error handlers to avoid the default one (i.e. exit (1)) */ - do_xfailed_on_xio_error = TRUE; - XSetErrorHandler (gdm_simple_slave_xerror_handler); - XSetIOErrorHandler (gdm_simple_slave_xioerror_handler); -#endif - - gdm_sigchld_block_push (); - slave->priv->server_display = XOpenDisplay (display_name); - gdm_sigchld_block_pop (); - - if (slave->priv->server_display == NULL) { - g_warning ("Unable to connect to display %s", display_name); - ret = FALSE; - } else { - g_debug ("Connected to display %s", display_name); - ret = TRUE; - } - - g_free (display_name); - - return ret; -} - static gboolean idle_connect_to_display (GdmSimpleSlave *slave) { @@ -1176,7 +1075,7 @@ idle_connect_to_display (GdmSimpleSlave *slave) slave->priv->connection_attempts++; - res = connect_to_display (slave); + res = gdm_slave_connect_to_x11_display (GDM_SLAVE (slave)); if (res) { /* FIXME: handle wait-for-go */ @@ -1192,8 +1091,8 @@ idle_connect_to_display (GdmSimpleSlave *slave) } static void -server_ready_cb (GdmServer *server, - GdmSimpleSlave *slave) +server_ready_cb (GdmServer *server, + GdmSimpleSlave *slave) { g_timeout_add (500, (GSourceFunc)idle_connect_to_display, slave); } diff --git a/daemon/gdm-slave.c b/daemon/gdm-slave.c index 83518754..e6e0bdd5 100644 --- a/daemon/gdm-slave.c +++ b/daemon/gdm-slave.c @@ -34,14 +34,13 @@ #include <glib.h> #include <glib/gi18n.h> #include <glib-object.h> -#include <gdk/gdkx.h> -#include <gtk/gtk.h> #define DBUS_API_SUBJECT_TO_CHANGE #include <dbus/dbus-glib.h> #include <dbus/dbus-glib-lowlevel.h> #include <X11/Xlib.h> /* for Display */ +#include <X11/cursorfont.h> /* for watch cursor */ #include "gdm-common.h" @@ -65,6 +64,8 @@ struct GdmSlavePrivate guint output_watch_id; guint error_watch_id; + Display *server_display; + /* cached display values */ char *display_id; char *display_name; @@ -109,6 +110,92 @@ static void gdm_slave_finalize (GObject *object); G_DEFINE_ABSTRACT_TYPE (GdmSlave, gdm_slave, G_TYPE_OBJECT) +#define CURSOR_WATCH XC_watch +void +gdm_slave_set_busy_cursor (GdmSlave *slave) +{ + if (slave->priv->server_display != NULL) { + Cursor xcursor; + + xcursor = XCreateFontCursor (slave->priv->server_display, CURSOR_WATCH); + XDefineCursor (slave->priv->server_display, + DefaultRootWindow (slave->priv->server_display), + xcursor); + XFreeCursor (slave->priv->server_display, xcursor); + XSync (slave->priv->server_display, False); + } +} + +static void +set_local_auth (GdmSlave *slave) +{ + GString *binary_cookie; + GString *cookie; + + g_debug ("Setting authorization key for display %s", slave->priv->display_x11_cookie); + + cookie = g_string_new (slave->priv->display_x11_cookie); + binary_cookie = g_string_new (NULL); + if (! gdm_string_hex_decode (cookie, + 0, + NULL, + binary_cookie, + 0)) { + g_warning ("Unable to decode hex cookie"); + goto out; + } + + g_debug ("Decoded cookie len %d", binary_cookie->len); + + XSetAuthorization ("MIT-MAGIC-COOKIE-1", + (int) strlen ("MIT-MAGIC-COOKIE-1"), + (char *)binary_cookie->str, + binary_cookie->len); + + out: + g_string_free (binary_cookie, TRUE); + g_string_free (cookie, TRUE); +} + +gboolean +gdm_slave_connect_to_x11_display (GdmSlave *slave) +{ + gboolean ret; + + ret = FALSE; + + /* We keep our own (windowless) connection (dsp) open to avoid the + * X server resetting due to lack of active connections. */ + + g_debug ("Server is ready - opening display %s", slave->priv->display_name); + + g_setenv ("DISPLAY", slave->priv->display_name, TRUE); + g_unsetenv ("XAUTHORITY"); /* just in case it's set */ + + set_local_auth (slave); + +#if 0 + /* X error handlers to avoid the default one (i.e. exit (1)) */ + do_xfailed_on_xio_error = TRUE; + XSetErrorHandler (gdm_slave_xerror_handler); + XSetIOErrorHandler (gdm_slave_xioerror_handler); +#endif + + gdm_sigchld_block_push (); + slave->priv->server_display = XOpenDisplay (slave->priv->display_name); + gdm_sigchld_block_pop (); + + if (slave->priv->server_display == NULL) { + g_warning ("Unable to connect to display %s", slave->priv->display_name); + ret = FALSE; + } else { + g_debug ("Connected to display %s", slave->priv->display_name); + ret = TRUE; + } + + return ret; +} + static void display_proxy_destroyed_cb (DBusGProxy *display_proxy, GdmSlave *slave) diff --git a/daemon/gdm-slave.h b/daemon/gdm-slave.h index 1ef8a88c..eaa4cc3b 100644 --- a/daemon/gdm-slave.h +++ b/daemon/gdm-slave.h @@ -60,7 +60,8 @@ gboolean gdm_slave_stop (GdmSlave *slave); gboolean gdm_slave_add_user_authorization (GdmSlave *slave, const char *username, char **filename); - +gboolean gdm_slave_connect_to_x11_display (GdmSlave *slave); +void gdm_slave_set_busy_cursor (GdmSlave *slave); void gdm_slave_stopped (GdmSlave *slave); G_END_DECLS diff --git a/gui/Makefile.am b/gui/Makefile.am index d141a30c..2f054d98 100644 --- a/gui/Makefile.am +++ b/gui/Makefile.am @@ -1,7 +1,6 @@ NULL = SUBDIRS = \ - modules \ simple-chooser \ simple-greeter \ $(NULL) diff --git a/gui/modules/.cvsignore b/gui/modules/.cvsignore deleted file mode 100644 index a843dfe9..00000000 --- a/gui/modules/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -Makefile -Makefile.in -.deps -.libs -AccessDwellMouseEvents -AccessKeyMouseEvents diff --git a/gui/modules/AccessDwellMouseEvents.in b/gui/modules/AccessDwellMouseEvents.in deleted file mode 100644 index cb19a6ea..00000000 --- a/gui/modules/AccessDwellMouseEvents.in +++ /dev/null @@ -1,62 +0,0 @@ -# This is the configuration file for the keymouselistener.so module. -# The confiuration syntax is as follows: -# -# crossing inital_direction timeout executable_path +args -# -# For executable_path give the full executable path path of the program or the -# DefaultPath is used. -# -# where: -# -# + crossing is a string that includes any combination of TBLR characters, where -# T means Top, B means Bottom, L means Left, and R means Right. -# -# + initial_direction can be either the I or O character which indicates -# that the initial crossing is a motion In or Out of the window. -# -# e.g. -# TBLR I 10000 @AT_BINDIR@/gok --login --access-method=dwellselection -# -# Means the user crosses into the top border, out the bottom border, into the left -# border, and then out the right border (in that order). The initial_direction -# value of I is what specifies that the first crossing is into the top border -# rather than out of the top border. Each border crossing must occur within -# 10000ms of the last border crossing for the gesture to be valid. -# -# It is possible to invoke multiple actions from a single gesture using the <Add> -# keyword. Action specified with <Add> are invoked by the previous gesture -# defined in the file. If the <Add> action is the first action defined in the -# file, then it is ignored. -# -# e.g. -# -# <Add> @AT_BINDIR@/orca -n -d main-window -# - -# AT Progarm - GOK (GNOME On-screen Keyboard) -# -# Support several different options for different user needs. Note these -# gestures all start by moving the mouse into the top window border. -# -TBLR I 10000 @AT_BINDIR@/gok --login --access-method=dwellselection -TLBR I 10000 @AT_BINDIR@/gok --login --access-method=automaticscanning --scan-action=switch1 --select-action=switch1 -TRBL I 10000 @AT_BINDIR@/gok --login --access-method=inversescanning --scan-action=switch1 --select-action=switch2 -TBRL I 10000 @AT_BINDIR@/gok --login --access-method=automaticscanning --scan-action=switch3 --select-action=switch3 - -# AT Program - ORCA -# -# Note these gestures all start by moving the mouse into the bottom window -# border. -# -# Speech -# -BTRL I 10000 @AT_BINDIR@/orca -n -d main-window - -# Magnifier -# -BTLR I 10000 @AT_BINDIR@/orca -n -d main-window -d speech -e magnifier - -# Speech and Magnifier -# -BRTL I 10000 @AT_BINDIR@/orca -n -d main-window -e magnifier - diff --git a/gui/modules/AccessKeyMouseEvents.in b/gui/modules/AccessKeyMouseEvents.in deleted file mode 100644 index a70be06a..00000000 --- a/gui/modules/AccessKeyMouseEvents.in +++ /dev/null @@ -1,91 +0,0 @@ -# This is the configuration file for the keymouselistener.so module. -# The confiuration syntax is as follows: -# -# For keyboard gestures: -# -# <modifier>[<modifier>...]key #times duration timeout executable_path +args -# -# For executable_path give the full executable path path of the program or the -# DefaultPath is used. For key, this can be one of the normal keys such as 'k' -# for the letter 'k', or 'F10' for the F10 key. If you wish to use one of the -# 'modifier' keys you have to specify which one exactly, meaning usually -# appending _L or _R depending on if it's the left or right one. The useful -# ones are: Shift_L, Shift_R, Control_L, Control_R, Meta_L, Meta_R, Alt_L, Alt_R. -# Do note that the modifier is optional. -# -# e.g. -# -# <Control>k 1 1000 10000 @AT_BINDIR@/gok --login --access-method=directselection -# -# Means press Contol-k 5 times, holding each keypress down for at least 1000ms -# (1s) each time and with no greater interval than 10000ms (10s) between each -# event in the sequence. A duration value of 0 indicates that a keypress of -# any length is accepted. The timeout value is only meaningful if the #times -# value is > 1. Completing the above example sequence will invoke the gnome on -# screen keyboard program, gok. Note that you cannot release the <Control> key -# while pressing otherwise the sequence will be lost. -# -# e.g. -# Shift_L 5 1000 10000 @AT_BINDIR@/gok --login --access-method=directselection -# Shift_R 5 1000 10000 @AT_BINDIR@/gok --login --access-method=directselection -# -# Will start gok if you press either shift key 5 times holding it down for more -# then 1 second each time. -# -# For mouse button gestures the format is the same except the mouse button number -# is specified instead of a key gesture: -# -# <Mouse#> #times duration timeout executable_path +args -# -# e.g. -# -# <Mouse2> 4 3000 6000 @AT_BINDIR@/orca -n -d main-window -# -# Note that mouse numbers are 1-based so <Mouse1> is the left mouse button, -# <Mouse3> is the right mouse button and <Mouse2> is the middle mouse button. -# -# It is possible to invoke multiple actions from a single gesture using the <Add> -# keyword. Actions specified with <Add> are invoked by the previous gesture -# defined in the file. If the <Add> action is the first action defined in the -# file, then it is ignored. -# -# e.g. -# -# <Add> @AT_BINDIR@/gnome-mag -# - -# AT Program - GOK (GNOME On-screen Keyboard) -# -# Include a gesture for both right and left mouse button, for both right -# and left handed users. -# -# hold right or left mouse button 3 times for 3 seconds each time. -<Mouse1> 3 3000 10000 @AT_BINDIR@/gok --login --access-method=directselection -<Mouse3> 3 3000 10000 @AT_BINDIR@/gok --login --access-method=directselection - -# Also support Xinput switches -# -<Switch1> 1 5000 0 @AT_BINDIR@/gok --login --access-method=automaticscanning --scan-action=switch1 --select-action=switch1 -<Switch2> 3 50 3000 @AT_BINDIR@/gok --login --access-method=inversescanning --scan-action=switch1 --select-action=switch2 -<Switch3> 3 1000 10000 @AT_BINDIR@/gok --login --access-method=automaticscanning --scan-action=switch3 --select-action=switch3 - -# Although most GOK users would want to use a mouse/switch button to start GOK, -# also include a keybinding for starting GOK with direct selection mode. -# -<Control>k 1 1000 10000 @AT_BINDIR@/gok --login --access-method=directselection - -# AT Program - ORCA -# -# press ctrl-s for 1 second to launch orca in speech mode -# -<Control>s 1 1000 10000 @AT_BINDIR@/orca -n -d main-window - -# press ctrl-m for 1 second to launch orca in mag mode -# -<Control>m 1 1000 10000 @AT_BINDIR@/orca -n -d main-window -d speech -e magnifier - -# press ctrl-o or ctrl-g for 1 second to launch orca in speech and mag mode -# -<Control>o 1 1000 10000 @AT_BINDIR@/orca -n -d main-window -e magnifier -<Control>g 1 1000 10000 @AT_BINDIR@/orca -n -d main-window -e magnifier - diff --git a/gui/modules/Makefile.am b/gui/modules/Makefile.am deleted file mode 100644 index 868d0db9..00000000 --- a/gui/modules/Makefile.am +++ /dev/null @@ -1,88 +0,0 @@ -## Process this file with automake to produce makefile.in - -INCLUDES = \ - -I. \ - -I.. \ - -DGDMCONFDIR=\"${gdmconfdir}\" \ - -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ - $(GUI_CFLAGS) - -# -# -DG_DISABLE_DEPRECATED \ -# -DGDK_DISABLE_DEPRECATED \ -# -DGDK_PIXBUF_DISABLE_DEPRECATED \ -# -DGTK_DISABLE_DEPRECATED \ -# -DGNOME_DISABLE_DEPRECATED \ -# - -libkeymouselistener_la_SOURCES = \ - keymouselistener.c - -libkeymouselistener_la_LDFLAGS = \ - -rpath $(moduledir) -module -avoid-version \ - $(GUI_LIBS) \ - $(X_LIBS) \ - $(X_EXTRA_LIBS) - -libdwellmouselistener_la_SOURCES = \ - dwellmouselistener.c - -libdwellmouselistener_la_LDFLAGS = \ - -rpath $(moduledir) -module -avoid-version \ - $(GUI_LIBS) \ - $(X_LIBS) \ - $(X_EXTRA_LIBS) - -moduledir = $(libdir)/gtk-2.0/modules - -module_LTLIBRARIES = \ - libkeymouselistener.la \ - libdwellmouselistener.la - -moduleconfdir = $(gdmconfdir)/modules - -noinst_DATA = \ - AccessKeyMouseEvents \ - AccessDwellMouseEvents - -EXTRA_DIST = \ - AccessKeyMouseEvents.in \ - AccessDwellMouseEvents.in - -CLEANFILES = AccessKeyMouseEvents AccessDwellMouseEvents - -AccessKeyMouseEvents: $(srcdir)/AccessKeyMouseEvents.in - sed -e 's,[@]AT_BINDIR[@],$(AT_BINDIR),g' \ - <$(srcdir)/AccessKeyMouseEvents.in >AccessKeyMouseEvents - -AccessDwellMouseEvents: $(srcdir)/AccessDwellMouseEvents.in - sed -e 's,[@]AT_BINDIR[@],$(AT_BINDIR),g' \ - <$(srcdir)/AccessDwellMouseEvents.in >AccessDwellMouseEvents - -uninstall-hook: - rm -f $(DESTDIR)$(moduleconfdir)/AccessKeyMouseEvents \ - $(DESTDIR)$(moduleconfdir)/factory-AccessKeyMouseEvents \ - $(DESTDIR)$(moduleconfdir)/AccessDwellMouseEvents \ - $(DESTDIR)$(moduleconfdir)/factory-AccessDwellMouseEvents - -install-data-hook: AccessKeyMouseEvents AccessDwellMouseEvents - if test '!' -d $(DESTDIR)$(moduleconfdir); then \ - $(mkinstalldirs) $(DESTDIR)$(moduleconfdir); \ - chmod 755 $(DESTDIR)$(moduleconfdir); \ - fi - -if cmp -s $(DESTDIR)$(moduleconfdir)/AccessKeyMouseEvents $(DESTDIR)$(moduleconfdir)/factory-AccessKeyMouseEvents 2>&1 /dev/null ; then \ - cp -f $(DESTDIR)$(moduleconfdir)/AccessKeyMouseEvents $(DESTDIR)$(moduleconfdir)/AccessKeyMouseEvents.orig; \ - $(INSTALL_DATA) AccessKeyMouseEvents $(DESTDIR)$(moduleconfdir)/AccessKeyMouseEvents; \ - fi - if test '!' -f $(DESTDIR)$(moduleconfdir)/AccessKeyMouseEvents; then \ - $(INSTALL_DATA) AccessKeyMouseEvents $(DESTDIR)$(moduleconfdir)/AccessKeyMouseEvents; \ - fi - $(INSTALL_DATA) AccessKeyMouseEvents $(DESTDIR)$(moduleconfdir)/factory-AccessKeyMouseEvents - -if cmp -s $(DESTDIR)$(moduleconfdir)/AccessDwellMouseEvents $(DESTDIR)$(moduleconfdir)/factory-AccessDwellMouseEvents 2>&1 /dev/null ; then \ - cp -f $(DESTDIR)$(moduleconfdir)/AccessDwellMouseEvents $(DESTDIR)$(moduleconfdir)/AccessDwellMouseEvents.orig; \ - $(INSTALL_DATA) AccessDwellMouseEvents $(DESTDIR)$(moduleconfdir)/AccessDwellMouseEvents; \ - fi - if test '!' -f $(DESTDIR)$(moduleconfdir)/AccessDwellMouseEvents; then \ - $(INSTALL_DATA) AccessDwellMouseEvents $(DESTDIR)$(moduleconfdir)/AccessDwellMouseEvents; \ - fi - $(INSTALL_DATA) AccessDwellMouseEvents $(DESTDIR)$(moduleconfdir)/factory-AccessDwellMouseEvents diff --git a/gui/modules/dwellmouselistener.c b/gui/modules/dwellmouselistener.c deleted file mode 100644 index 419b30ae..00000000 --- a/gui/modules/dwellmouselistener.c +++ /dev/null @@ -1,760 +0,0 @@ -/* GDM - The Gnome Display Manager - * Copyright (C) 1999, 2000 Martin K. Petersen <mkp@mkp.net> - * - * This file Copyright (c) 2003 Sun Microsystems Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "config.h" - -#include <ctype.h> -#include <string.h> -#include <stdlib.h> -#include <syslog.h> -#include <math.h> - -#include <glib.h> -#include <gmodule.h> -#include <gdk/gdk.h> -#include <gdk/gdkx.h> -#include <gtk/gtk.h> -#include <glib/gi18n.h> - -#include <X11/Xlib.h> - -#ifdef HAVE_XINPUT -#include <X11/extensions/XInput.h> -#endif - -/* - * Note that CONFIGFILE will have to be changed to something more generic - * if this module is ever moved outside of gdm. - */ - -#define CONFIGFILE GDMCONFDIR "/modules/AccessDwellMouseEvents" -#define iseol(ch) ((ch) == '\r' || (ch) == '\f' || (ch) == '\0' || \ - (ch) == '\n') - -typedef enum -{ - BINDING_DWELL_BORDER_TOP = 1 << 0, - BINDING_DWELL_BORDER_BOTTOM = 1 << 1, - BINDING_DWELL_BORDER_RIGHT = 1 << 2, - BINDING_DWELL_BORDER_LEFT = 1 << 3, - BINDING_DWELL_BORDER_ERROR = 1 << 4 -} BindingType; - -typedef enum -{ - BINDING_DWELL_DIRECTION_IN = 1 << 0, - BINDING_DWELL_DIRECTION_OUT = 1 << 1, - BINDING_DWELL_DIRECTION_ERROR = 1 << 2 -} BindingDirection; - -typedef struct { - int num_gestures; - BindingType *gesture; - BindingDirection start_direction; -} Dwell; - -typedef struct { - Dwell input; - char *binding_str; - GSList *actions; - guint timeout; -} Binding; - -typedef struct { - BindingType type; - BindingDirection direction; - guint32 time; -} Crossings; - -static int lineno = 0; -static GSList *binding_list = NULL; - -extern char **environ; - -static guint enter_signal_id = 0; -static guint leave_signal_id = 0; -static int xinput_type_motion = 0; - -static Crossings *crossings = NULL; -static int cross_pos = 0; -static guint max_crossings = 0; -static XID *ext_input_devices = NULL; -static gint ext_device_count = 0; -static gboolean latch_core_pointer = TRUE; - -static void create_event_watcher (void); -static void load_bindings(gchar *path); -static gchar * screen_exec_display_string (GdkScreen *screen, const char *old); -static gchar ** get_exec_environment (GdkScreen *screen); -static Binding * parse_line(gchar *buf); -static gboolean binding_already_used (Binding *binding); -static gboolean debug_gestures = FALSE; - -BindingType get_binding_type(char c); -BindingDirection get_binding_direction(char c); - -static gboolean -is_ext_device (XID id) -{ - gint i; - for (i=0; i < ext_device_count; i++) - if (id == ext_input_devices[i]) - return TRUE; - - if (debug_gestures) - syslog (LOG_WARNING, "is-ext-device failed for %d", (int) id); - - return FALSE; -} - -static void -init_xinput (GdkDisplay *display, GdkWindow *root) -{ -#ifdef HAVE_XINPUT - XEventClass event_list[40]; - int i, j, number = 0, num_devices; - XDeviceInfo *devices = NULL; - XDevice *device = NULL; - - devices = XListInputDevices (GDK_DISPLAY_XDISPLAY (display), - &num_devices); - - if (debug_gestures) - syslog (LOG_WARNING, "Checking %d input devices...", - num_devices); - - for (i=0; i < num_devices; i++) { - if (devices[i].use == IsXExtensionDevice) { - device = XOpenDevice (GDK_DISPLAY_XDISPLAY (display), - devices[i].id); - for (j=0; j < device->num_classes && number < 39; j++) { - switch (device->classes[j].input_class) - { - case ValuatorClass: - DeviceMotionNotify (device, - xinput_type_motion, - event_list[number]); - number++; - default: - break; - } - } - ++ext_device_count; - - if (ext_input_devices) { - ext_input_devices = g_realloc (ext_input_devices, - sizeof (XID *) * ext_device_count); - } else { - ext_input_devices = g_malloc (sizeof (XID *)); - } - ext_input_devices[ext_device_count - 1] = devices[i].id; - } - } - - if (debug_gestures) - syslog (LOG_WARNING, "%d event types available", number); - - if (XSelectExtensionEvent (GDK_WINDOW_XDISPLAY (root), - GDK_WINDOW_XWINDOW (root), - event_list, number)) { - if (debug_gestures) - syslog (LOG_WARNING, - "Can't select input device events!"); - } -#endif -} - -static gchar * -screen_exec_display_string (GdkScreen *screen, const char *old) -{ - GString *str; - const gchar *old_display; - gchar *retval; - gchar *p; - - g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); - - old_display = gdk_display_get_name (gdk_screen_get_display (screen)); - - str = g_string_new ("DISPLAY="); - g_string_append (str, old_display); - - p = strrchr (str->str, '.'); - if (p && p > strchr (str->str, ':')) - g_string_truncate (str, p - str->str); - - g_string_append_printf (str, ".%d", gdk_screen_get_number (screen)); - - retval = str->str; - - g_string_free (str, FALSE); - - return retval; -} - -/** - * get_exec_environment: - * - * Description: Modifies the current program environment to - * ensure that $DISPLAY is set such that a launched application - * inheriting this environment would appear on screen. - * - * Returns: a newly-allocated %NULL-terminated array of strings or - * %NULL on error. Use g_strfreev() to free it. - * - * mainly ripped from egg_screen_exec_display_string in - * gnome-panel/egg-screen-exec.c - **/ -static gchar ** -get_exec_environment (GdkScreen *screen) -{ - gchar **retval = NULL; - gint i; - gint display_index = -1; - - g_assert (GDK_IS_SCREEN (screen)); - - for (i=0; environ [i]; i++) - if (strncmp (environ [i], "DISPLAY", 7) == 0) - display_index = i; - - if (display_index == -1) - display_index = i++; - - retval = g_new0 (char *, i + 1); - - for (i=0; environ [i]; i++) - if (i == display_index) - retval [i] = screen_exec_display_string (screen, - environ[i]); - else - retval [i] = g_strdup (environ [i]); - - retval [i] = NULL; - - return retval; -} - -BindingType -get_binding_type(char c) -{ - BindingType rc; - - if (c == toupper ('T')) - rc = BINDING_DWELL_BORDER_TOP; - else if (c == toupper ('B')) - rc = BINDING_DWELL_BORDER_BOTTOM; - else if (c == toupper ('R')) - rc = BINDING_DWELL_BORDER_RIGHT; - else if (c == toupper ('L')) - rc = BINDING_DWELL_BORDER_LEFT; - else - rc = BINDING_DWELL_BORDER_ERROR; - - return rc; -} - -BindingDirection -get_binding_direction(char c) -{ - BindingDirection rc; - - if (c == toupper ('I')) - rc = BINDING_DWELL_DIRECTION_IN; - else if (c == toupper ('O')) - rc = BINDING_DWELL_DIRECTION_OUT; - else - rc = BINDING_DWELL_DIRECTION_ERROR; - - return rc; -} - -static void -free_binding (Binding *binding) -{ - if (binding == NULL) - return; - - g_slist_foreach (binding->actions, (GFunc)g_free, NULL); - g_slist_free (binding->actions); - g_free (binding->binding_str); - g_free (binding->input.gesture); - g_free (binding); -} - -static Binding * -parse_line(gchar *buf) -{ - gchar *keystring, *keyservice; - Binding *tmp_binding = NULL; - static GdkDisplay *display = NULL; - - lineno++; - - if (!display) { - if ((display = gdk_display_get_default ()) == NULL) - return NULL; - } - - if ((*buf == '#') || (iseol (*buf)) || (buf == NULL)) - return NULL; - - /* Find the binding name */ - keystring = strtok (buf, " \t\n\r\f"); - if (keystring == NULL) { - /* TODO - Add an error message */ - return NULL; - } - - tmp_binding = g_new0 (Binding, 1); - tmp_binding->binding_str = g_strdup (keystring); - - if (strcmp (tmp_binding->binding_str, "<Add>") != 0) { - BindingType bt; - BindingDirection bd; - guint timeout; - gchar *tmp_string; - int i, j; - - tmp_binding->input.gesture = g_new0 (BindingType, - strlen (tmp_binding->binding_str)); - - j=0; - for (i=0; i < strlen(tmp_binding->binding_str); i++) { - bt = get_binding_type (tmp_binding->binding_str[i]); - - if (bt == BINDING_DWELL_BORDER_ERROR) { - if (debug_gestures) - syslog (LOG_WARNING, - "Invalid value in binding %s", - tmp_binding->binding_str); - - continue; - } - - tmp_binding->input.gesture[j++] = bt; - } - tmp_binding->input.num_gestures = j; - - if (j > max_crossings) - max_crossings = j; - - /* [TODO] Need to clean up here. */ - tmp_string = strtok (NULL, " \t\n\r\f"); - if (tmp_string == NULL) { - /* TODO - Add an error message */ - free_binding (tmp_binding); - return NULL; - } - - bd = get_binding_direction (tmp_string[0]); - - if (bd == BINDING_DWELL_DIRECTION_ERROR) { - if (debug_gestures) - syslog (LOG_WARNING, "Invalid value in binding %s", - tmp_binding->binding_str); - } else { - tmp_binding->input.start_direction = bd; - } - - /* - * Find the timeout duration (in ms). Timeout value is the - * time within which consecutive keypress actions must be - * performed by the user before the sequence is discarded. - */ - - tmp_string = strtok (NULL, " \t\n\r\f"); - if (tmp_string == NULL) { - /* TODO - Add an error message */ - free_binding (tmp_binding); - return NULL; - } - - timeout = atoi (tmp_string); - if (timeout <= 0) { - /* TODO - Add an error message */; - free_binding (tmp_binding); - return NULL; - } - tmp_binding->timeout = timeout; - } - - /* Find service. Permit blank space so arguments can be supplied. */ - keyservice = strtok (NULL, "\n\r\f"); - if (keyservice == NULL) { - /* TODO - Add an error message */ - free_binding (tmp_binding); - return NULL; - } - - /* skip over initial whitespace */ - while (*keyservice && isspace (*keyservice)) - keyservice++; - - tmp_binding->actions = g_slist_append (tmp_binding->actions, - g_strdup (keyservice)); - - return tmp_binding; -} - -static gboolean -binding_already_used (Binding *binding) -{ - GSList *li; - - for (li=binding_list; li != NULL; li = li->next) { - Binding *tmp_binding = (Binding*) li->data; - - if (tmp_binding != binding && - tmp_binding->input.start_direction == binding->input.start_direction) - { - int i; - - for (i=0; i < tmp_binding->input.num_gestures; i++) { - if (tmp_binding->input.gesture != - binding->input.gesture) - break; - } - - if (i == tmp_binding->input.num_gestures) - return TRUE; - } - } - return FALSE; -} - -static void -load_bindings(gchar *path) -{ - FILE *fp; - Binding *tmp_binding; - gchar buf[1024]; - - fp = fopen (path, "r"); - if (fp == NULL) { - /* TODO - I18n */ - if (debug_gestures) - syslog (LOG_WARNING, - "Cannot open bindings file: %s", path); - return; - } - - while (fgets (buf, sizeof (buf), fp) != NULL) { - tmp_binding = (Binding *)parse_line (buf); - - if (tmp_binding) { - /* Is the key already associated with an existing */ - /* binding? */ - if (strcmp (tmp_binding->binding_str, "<Add>") == 0) { - /* Add another action to the last binding */ - Binding *last_binding; - GSList *last_item = g_slist_last (binding_list); - - /* If there is no last_item to add onto */ - /* ignore the entry */ - if (last_item) { - last_binding = (Binding *)last_item->data; - - /* Add the action to the last */ - /* binding's actions list */ - last_binding->actions = - g_slist_append (last_binding->actions, - g_strdup ((gchar *)tmp_binding->actions->data)); - } - free_binding (tmp_binding); - - /* Ignore duplicate bindings */ - } else if (!binding_already_used (tmp_binding)) - binding_list = g_slist_append (binding_list, - tmp_binding); - else - free_binding (tmp_binding); - } - } - fclose (fp); -} - -static gboolean -change_cursor_back (gpointer data) -{ - GdkCursor *cursor = gdk_cursor_new (GDK_LEFT_PTR); - gdk_window_set_cursor (gdk_get_default_root_window (), cursor); - gdk_cursor_unref (cursor); - - return FALSE; -} - - -static gboolean -leave_enter_emission_hook (GSignalInvocationHint *ihint, - guint n_param_values, - const GValue *param_values, - gpointer data) -{ - GObject *object; - GtkWidget *widget; - GtkWindow *window; - GdkEventCrossing *event; - GdkRectangle rect; - GSList *li; - double mid_x, mid_y; - int i; - - object = g_value_get_object (param_values + 0); - event = g_value_get_boxed (param_values + 1); - widget = GTK_WIDGET (object); - window = GTK_WINDOW (object); - - if (event->detail == GDK_NOTIFY_INFERIOR || - !GTK_IS_WINDOW (object) || !GTK_WIDGET_TOPLEVEL (object)) { - return TRUE; - } - - gdk_window_get_frame_extents (widget->window, &rect); - - mid_x = rect.x + (rect.width / 2); - mid_y = rect.y + (rect.height / 2); - - /* avoid division by 0 */ - if (fabs (event->x_root - mid_x) <= 0.001) { - if (event->x_root < mid_x) - crossings[cross_pos].type = BINDING_DWELL_BORDER_LEFT; - else - crossings[cross_pos].type = BINDING_DWELL_BORDER_RIGHT; - } else { - double slope = (event->y_root - mid_y) / (event->x_root - mid_x); - - if (event->y_root < mid_y) { - if (slope > 1 || slope < -1) - crossings[cross_pos].type = BINDING_DWELL_BORDER_TOP; - else if (slope >= 0) - crossings[cross_pos].type = BINDING_DWELL_BORDER_LEFT; - else - crossings[cross_pos].type = BINDING_DWELL_BORDER_RIGHT; - } else { - if (slope > 1 || slope < -1) - crossings[cross_pos].type = BINDING_DWELL_BORDER_BOTTOM; - else if (slope >= 0) - crossings[cross_pos].type = BINDING_DWELL_BORDER_RIGHT; - else - crossings[cross_pos].type = BINDING_DWELL_BORDER_LEFT; - } - } - - if (ihint->signal_id == enter_signal_id) - crossings[cross_pos].direction = BINDING_DWELL_DIRECTION_IN; - else if (ihint->signal_id == leave_signal_id) - crossings[cross_pos].direction = BINDING_DWELL_DIRECTION_OUT; - - if (debug_gestures) { - if (crossings[cross_pos].type == BINDING_DWELL_BORDER_BOTTOM) - syslog (LOG_WARNING, "Crossing bottom."); - else if (crossings[cross_pos].type == BINDING_DWELL_BORDER_TOP) - syslog (LOG_WARNING, "Crossing top."); - else if (crossings[cross_pos].type == BINDING_DWELL_BORDER_LEFT) - syslog (LOG_WARNING, "Crossing left."); - else if (crossings[cross_pos].type == BINDING_DWELL_BORDER_RIGHT) - syslog (LOG_WARNING, "Crossing right."); - - if (crossings[cross_pos].direction == BINDING_DWELL_DIRECTION_IN) - syslog (LOG_WARNING, "Crossing in."); - else if (crossings[cross_pos].direction == BINDING_DWELL_DIRECTION_OUT) - syslog (LOG_WARNING, "Crossing out."); - } - - crossings[cross_pos].time = event->time; - - /* Check to see if a gesture has been completed */ - for (li=binding_list; li != NULL; li = li->next) { - Binding *curr_binding = (Binding *) li->data; - GSList *act_li; - gboolean retval; - gchar **argv = NULL; - gchar **envp = NULL; - int start_pos = (cross_pos - curr_binding->input.num_gestures + 1 + - max_crossings) % max_crossings; - - if (debug_gestures) { - syslog (LOG_WARNING, "Checking against registered gestures"); - } - - /* being anal here */ - if (start_pos < 0) - start_pos = 0; - - /* check direction */ - if (curr_binding->input.start_direction != crossings[start_pos].direction) - continue; - - /* check borders */ - for (i=0; i < curr_binding->input.num_gestures; i++) { - if (curr_binding->input.gesture[i] != - crossings[(start_pos + i) % max_crossings].type) - break; - } - - if (i != curr_binding->input.num_gestures) - continue; - - /* check timeout values */ - for (i=1; i < curr_binding->input.num_gestures; i++) { - int cur_pos = (start_pos + i) % max_crossings; - int prev_pos = (start_pos + i - 1) % max_crossings; - guint32 diff_time = crossings[cur_pos].time - - crossings[prev_pos].time; - - if (curr_binding->timeout != 0 && - curr_binding->timeout < diff_time) - break; - } - - if (i != curr_binding->input.num_gestures) - continue; - - /* gesture recognized */ - if (debug_gestures) { - syslog (LOG_WARNING, "Found gesture"); - } - - for (act_li=curr_binding->actions; act_li != NULL; act_li=act_li->next) { - gchar *action = (gchar *)act_li->data; - - g_return_val_if_fail (action != NULL, TRUE); - - if (!g_shell_parse_argv (action, NULL, &argv, NULL)) - continue; - - envp = get_exec_environment (gtk_window_get_screen(window)); - - if (debug_gestures) - syslog (LOG_WARNING, "Action is %s", action); - - retval = g_spawn_async (NULL, argv, envp, - G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL); - - g_strfreev (argv); - g_strfreev (envp); - - if ( ! retval) { - GtkWidget *dialog = gtk_message_dialog_new (NULL, - 0, GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, - _("Error while trying to run (%s)\n"\ - "which is linked to (%s)"), - action, curr_binding->binding_str); - gtk_dialog_set_has_separator (GTK_DIALOG (dialog), - FALSE); - g_signal_connect (dialog, "response", - G_CALLBACK (gtk_widget_destroy), NULL); - gtk_widget_show (dialog); - } else { - GdkCursor *cursor = gdk_cursor_new (GDK_WATCH); - gdk_window_set_cursor (gdk_get_default_root_window (), - cursor); - gdk_cursor_unref (cursor); - g_timeout_add (2000, change_cursor_back, NULL); - latch_core_pointer = FALSE; - /* once we've recognized a gesture, we need to * - * leave the pointer alone */ - } - } - } - - cross_pos = (cross_pos + 1) % max_crossings; - - return TRUE; -} - -static GdkFilterReturn -gestures_filter (GdkXEvent *gdk_xevent, - GdkEvent *event, - gpointer data) -{ - XEvent *xevent = (XEvent *)gdk_xevent; - - if (xevent->type == xinput_type_motion) { - XDeviceMotionEvent *motion = (XDeviceMotionEvent *) xevent; - if ((motion->axes_count < 2) || !is_ext_device (motion->deviceid)) - return GDK_FILTER_CONTINUE; - if (latch_core_pointer) - XWarpPointer (motion->display, None, - motion->root, - 0, 0, 0, 0, motion->axis_data[0], motion->axis_data[1]); - } - return GDK_FILTER_CONTINUE; -} - -static void -create_event_watcher (void) -{ - GdkDisplay *display; - gint i; - - display = gdk_display_get_default (); - if (!display) - return; - - load_bindings(CONFIGFILE); - - crossings = g_new0(Crossings, max_crossings); - - for (i=0; i < max_crossings; i++) { - crossings[i].type = BINDING_DWELL_BORDER_ERROR; - crossings[i].direction = BINDING_DWELL_DIRECTION_ERROR; - crossings[i].time = 0; - } - - init_xinput (display, - gdk_screen_get_root_window ( - gdk_display_get_default_screen (display))); - - gdk_window_add_filter (NULL, gestures_filter, NULL); - - /* set up emission hook */ - gtk_type_class (GTK_TYPE_WIDGET); - enter_signal_id = g_signal_lookup ("enter-notify-event", GTK_TYPE_WIDGET); - leave_signal_id = g_signal_lookup ("leave-notify-event", GTK_TYPE_WIDGET); - - g_signal_add_emission_hook (enter_signal_id, 0, - leave_enter_emission_hook, NULL, (GDestroyNotify) NULL); - g_signal_add_emission_hook (leave_signal_id, 0, - leave_enter_emission_hook, NULL, (GDestroyNotify) NULL); -} - -/* The init function for this gtk module */ -G_MODULE_EXPORT void gtk_module_init (int *argc, char* argv[]); - -void gtk_module_init (int *argc, char* argv[]) -{ - if (g_getenv ("GDM_DEBUG_GESTURES") != NULL) - debug_gestures = TRUE; - - if (debug_gestures) { - /* If not running under GDM, then need to openlog ourselves */ - if (g_getenv ("RUNNING_UNDER_GDM") == NULL) - openlog ("gesturelistener", LOG_PID, LOG_DAEMON); - - syslog (LOG_WARNING, "dwellmouselistener loaded."); - } - - create_event_watcher (); -} - -/* EOF */ diff --git a/gui/modules/keymouselistener.c b/gui/modules/keymouselistener.c deleted file mode 100644 index 759034df..00000000 --- a/gui/modules/keymouselistener.c +++ /dev/null @@ -1,1010 +0,0 @@ -/* GDM - The Gnome Display Manager - * Copyright (C) 1999, 2000 Martin K. Petersen <mkp@mkp.net> - * - * This file Copyright (c) 2003 Sun Microsystems Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "config.h" - -#include <stdio.h> -#include <stdlib.h> -#include <ctype.h> -#include <string.h> -#include <syslog.h> - -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#include <X11/keysym.h> - -#include <glib.h> -#include <gmodule.h> -#include <gdk/gdk.h> -#include <gdk/gdkx.h> -#include <gtk/gtk.h> -#include <glib/gi18n.h> - -#ifdef HAVE_XINPUT -#include <X11/extensions/XInput.h> -#endif - -/* - * Note that CONFIGFILE will have to be moved to somewhere more generic - * if this module is ever moved outside of gdm. - */ -#define CONFIGFILE GDMCONFDIR "/modules/AccessKeyMouseEvents" -#define iseol(ch) ((ch) == '\r' || (ch) == '\f' || (ch) == '\0' || \ - (ch) == '\n') - -#define N_INPUT_TYPES 40 - -typedef enum -{ - GESTURE_TYPE_KEY = 1 << 0, - GESTURE_TYPE_MOUSE = 1 << 1, - GESTURE_TYPE_BUTTON = 1 << 2 -} GestureType; - -typedef enum { - XINPUT_TYPE_MOTION = 0, - XINPUT_TYPE_BUTTON_PRESS = 1, - XINPUT_TYPE_BUTTON_RELEASE = 2, - XINPUT_TYPE_KEY_PRESS = 3, - XINPUT_TYPE_KEY_RELEASE = 4 -} XInputEventType; - -typedef struct { - guint keysym; - GdkModifierType state; - guint keycode; -} Key; - -typedef struct { - guint number; - GdkModifierType state; -} Button; - -union Input { - Key key; - Button button; -}; - -typedef struct { - GestureType type; - union Input input; - char *gesture_str; - GSList *actions; - guint n_times; - guint duration; - guint timeout; - gint start_time; - gint seq_count; -} Gesture; - -static int xinput_types[N_INPUT_TYPES]; - -extern char **environ; - -static gboolean debug_gestures = FALSE; -static GSList *gesture_list = NULL; -static int lineno = 0; - -static gchar * screen_exec_display_string (GdkScreen *screen, const char *old); -static void create_event_watcher (void); -static void load_gestures(gchar *path); -static gchar ** get_exec_environment (XEvent *xevent); -static Gesture * parse_line(gchar *buf); -static GdkFilterReturn gestures_filter (GdkXEvent *gdk_xevent, GdkEvent *event, gpointer data); -static gint is_mouseX (const gchar *string); -static gint is_switchX (const gchar *string); - -#define gesture_list_get_matches(a, b, c) (g_slist_find_custom (a, b, c)) - -static void -free_gesture (Gesture *gesture) -{ - if (gesture == NULL) - return; - - g_slist_foreach (gesture->actions, (GFunc)g_free, NULL); - g_slist_free (gesture->actions); - g_free (gesture->gesture_str); - g_free (gesture); -} - -static gchar * -screen_exec_display_string (GdkScreen *screen, const char *old) -{ - GString *str; - const gchar *old_display; - gchar *retval; - gchar *p; - - g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); - - old_display = gdk_display_get_name (gdk_screen_get_display (screen)); - - str = g_string_new ("DISPLAY="); - g_string_append (str, old_display); - - p = strrchr (str->str, '.'); - if (p && p > strchr (str->str, ':')) - g_string_truncate (str, p - str->str); - - g_string_append_printf (str, ".%d", gdk_screen_get_number (screen)); - - retval = str->str; - - g_string_free (str, FALSE); - - return retval; -} - -static void -init_xinput (GdkDisplay *display, GdkWindow *root) -{ -#ifdef HAVE_XINPUT - XEventClass event_list[40]; - int i, j, number = 0, num_devices; - XDeviceInfo *devices = NULL; - XDevice *device = NULL; - - devices = XListInputDevices (GDK_DISPLAY_XDISPLAY (display), - &num_devices); - - if (debug_gestures) - syslog (LOG_WARNING, "checking %d input devices...", num_devices); - - for (i=0; i < num_devices; i++) { - if (devices[i].use == IsXExtensionDevice) - { - device = XOpenDevice (GDK_DISPLAY_XDISPLAY (display), - devices[i].id); - - for (j=0; j < device->num_classes && number < 39; j++) { - - switch (device->classes[j].input_class) - { - case KeyClass: - DeviceKeyPress (device, - xinput_types[XINPUT_TYPE_KEY_PRESS], - event_list[number]); - number++; - DeviceKeyRelease (device, - xinput_types[XINPUT_TYPE_KEY_RELEASE], - event_list[number]); - number++; - break; - case ButtonClass: - DeviceButtonPress (device, - xinput_types[XINPUT_TYPE_BUTTON_PRESS], - event_list[number]); - number++; - DeviceButtonRelease (device, - xinput_types[XINPUT_TYPE_BUTTON_RELEASE], - event_list[number]); - number++; - break; - case ValuatorClass: - DeviceMotionNotify (device, - xinput_types[XINPUT_TYPE_MOTION], - event_list[number]); - number++; - } - } - } - } - - if (debug_gestures) - syslog (LOG_WARNING, "%d event types available", number); - - if (XSelectExtensionEvent(GDK_WINDOW_XDISPLAY (root), - GDK_WINDOW_XWINDOW (root), - event_list, number)) { - if (debug_gestures) - syslog (LOG_WARNING, - "Can't select input device events!"); - } -#endif -} - -static void create_event_watcher (void) -{ - GdkDisplay *display; - - display = gdk_display_get_default(); - if (!display) - return; - - load_gestures(CONFIGFILE); - - init_xinput (display, gdk_screen_get_root_window ( - gdk_display_get_default_screen (display))); - - gdk_window_add_filter (NULL, gestures_filter, NULL); - - return; -} - - -static void -load_gestures(gchar *path) -{ - FILE *fp; - Gesture *tmp_gesture; - gchar buf[1024]; - - fp = fopen (path, "r"); - if (fp == NULL) { - /* TODO - I18n */ - if (debug_gestures) - syslog (LOG_WARNING, _("Cannot open gestures file: %s"), - path); - return; - } - - while (fgets (buf, sizeof (buf), fp) != NULL) { - - tmp_gesture = (Gesture *)parse_line(buf); - if (tmp_gesture) { - - /* Is the key already associated with an existing - gesture? */ - if (strcmp (tmp_gesture->gesture_str, "<Add>") == 0) { - - /* Add another action to the last gesture */ - Gesture *last_gesture; - GSList *last_item = g_slist_last (gesture_list); - - /* If there is no last_item to add onto ignore - the entry */ - if (last_item) { - last_gesture = (Gesture *) - last_item->data; - - /* Add the action to the last gesture's - actions list */ - last_gesture->actions = - g_slist_append (last_gesture->actions, - g_strdup ((gchar *)tmp_gesture->actions->data)); - } - free_gesture (tmp_gesture); - - /* We must be able to deal with multiple - unambiguous gestures attached to one - switch/button */ - } else { - gesture_list = g_slist_append (gesture_list, - tmp_gesture); - } - } - } - fclose (fp); -} - - -/** - * get_exec_environment: - * - * Description: Modifies the current program environment to - * ensure that $DISPLAY is set such that a launched application - * inheriting this environment would appear on screen. - * - * Returns: a newly-allocated %NULL-terminated array of strings or - * %NULL on error. Use g_strfreev() to free it. - * - * mainly ripped from egg_screen_exec_display_string in - * gnome-panel/egg-screen-exec.c - **/ -static gchar ** -get_exec_environment (XEvent *xevent) -{ - gchar **retval = NULL; - gint i; - gint display_index = -1; - - GdkScreen *screen = NULL; - GdkWindow *window = gdk_xid_table_lookup (xevent->xkey.root); - - if (window) - screen = gdk_drawable_get_screen (GDK_DRAWABLE (window)); - - /* TODO: revisit this fallback, it's suspect since Xi events might not - have xkey.root set */ - - else - screen = gdk_display_get_default_screen (gdk_display_get_default ()); - - g_assert (GDK_IS_SCREEN (screen)); - - for (i=0; environ [i]; i++) - if (!strncmp (environ [i], "DISPLAY", 7)) - display_index = i; - - if (display_index == -1) - display_index = i++; - - retval = g_new0 (char *, i + 1); - - for (i=0; environ [i]; i++) { - if (i == display_index) - retval [i] = screen_exec_display_string (screen, - environ[i]); - else - retval [i] = g_strdup (environ [i]); - } - - retval [i] = NULL; - - return retval; -} - -static Gesture * -parse_line (gchar *buf) -{ - static GdkDisplay *display = NULL; - Gesture *tmp_gesture = NULL; - gchar *keystring; - gchar *keyservice; - gint button = 0; - - if (!display) { - if ((display = gdk_display_get_default()) == NULL) - return NULL; - } - lineno++; - - if ((*buf == '#') || (iseol(*buf)) || (buf == NULL)) - return NULL; - - /* Find the key name */ - keystring = strtok (buf, " \t\n\r\f"); - if (keystring == NULL) { - /* TODO - Error messages */ - return NULL; - } - - tmp_gesture = g_new0 (Gesture, 1); - tmp_gesture->gesture_str = g_strdup (keystring); - - if (strcmp (tmp_gesture->gesture_str, "<Add>") != 0) { - guint n, duration, timeout; - gchar *tmp_string; - - tmp_gesture->start_time = 0; - tmp_gesture->seq_count = 0; - - button = is_mouseX (tmp_gesture->gesture_str); - if (button > 0) { - tmp_gesture->type = GESTURE_TYPE_MOUSE; - tmp_gesture->input.button.number = button; - } else if ((button = is_switchX (tmp_gesture->gesture_str)) == TRUE) { - tmp_gesture->type = GESTURE_TYPE_BUTTON; - tmp_gesture->input.button.number = button; - } else { - tmp_gesture->type = GESTURE_TYPE_KEY; - gtk_accelerator_parse (tmp_gesture->gesture_str, - &(tmp_gesture->input.key.keysym), - &(tmp_gesture->input.key.state)); - if (tmp_gesture->input.key.keysym == 0 && - tmp_gesture->input.key.state == 0) { - /* TODO - Error messages here */ - free_gesture (tmp_gesture); - return NULL; - } - tmp_gesture->input.key.keycode = - XKeysymToKeycode (GDK_DISPLAY_XDISPLAY (display), - tmp_gesture->input.key.keysym); - } - - if (tmp_gesture->type == 0) { - /* TODO - Error messages here */ - free_gesture (tmp_gesture); - return NULL; - } - /* [TODO] Need to clean up here. */ - - /* Find the repetition number */ - tmp_string = strtok (NULL, " \t\n\r\f"); - if (tmp_string == NULL) { - /* TODO - Error messages */ - free_gesture (tmp_gesture); - return NULL; - } - - /* TODO - the above doesn't check for the string to - be all digits */ - if ((n=atoi (tmp_string)) <= 0) { - /* Add an error message */ - free_gesture (tmp_gesture); - return NULL; - } - tmp_gesture->n_times = n; - - /* - * Find the key press duration (in ms) - */ - tmp_string = strtok (NULL, " \t\n\r\f"); - if (tmp_string == NULL) { - /* TODO - Error messages */ - free_gesture (tmp_gesture); - return NULL; - } - /* TODO - the above doesn't check for the string to - be all digits */ - - duration = atoi (tmp_string); - if (duration < 0) { - /* Add an error message */ - free_gesture (tmp_gesture); - return NULL; - } - tmp_gesture->duration = duration; - - /* - * Find the timeout duration (in ms). Timeout value is the - * time within which consecutive keypress actions must be - * performed by the user before the sequence is discarded. - */ - tmp_string = strtok (NULL, " \t\n\r\f"); - if (tmp_string == NULL) { - /* TODO - Error messages */ - free_gesture (tmp_gesture); - return NULL; - } - - /* - * A gesture with an n_times value greater than 1 and a - * non-positive timeout can never be triggered, so do not - * accept such gestures. The value of timeout is not used - * if n_times is 1, so don't bother setting the timeout in - * this case. - */ - tmp_gesture->timeout = 0; - if (tmp_gesture->n_times > 1) { - if ((timeout=atoi (tmp_string)) <= 0) { - /* Add an error message */; - free_gesture (tmp_gesture); - return NULL; - } - tmp_gesture->timeout = timeout; - } - } - - /* - * Find service. Permit blank space so arguments can be supplied. - */ - keyservice = strtok (NULL, "\n\r\f"); - if (keyservice == NULL) { - /* TODO - Error messages */ - free_gesture (tmp_gesture); - return NULL; - } - /* skip over initial whitespace */ - while (*keyservice && isspace (*keyservice)) - keyservice++; - - tmp_gesture->actions = g_slist_append(tmp_gesture->actions, - g_strdup(keyservice)); - - if (debug_gestures) - syslog (LOG_WARNING, "gesture parsed for %s button %d", - (tmp_gesture->type == GESTURE_TYPE_MOUSE) ? "mouse" : - ((tmp_gesture->type == GESTURE_TYPE_BUTTON) ? "switch" : - "key"), tmp_gesture->input.button.number); - - return tmp_gesture; -} - -/* - * These modifiers are ignored because they make no sense. - * .eg <NumLock>x - * - * FIXME: [sadly, NumLock isn't always mapped to the same modifier, so the logic - * below is faulty - bill] - */ -#define IGNORED_MODS (GDK_LOCK_MASK | GDK_MOD2_MASK | GDK_MOD3_MASK) -#define USED_MODS (GDK_SHIFT_MASK | GDK_CONTROL_MASK | GDK_MOD1_MASK | \ - GDK_MOD4_MASK | GDK_MOD5_MASK) - -static gboolean -change_cursor_back (gpointer data) -{ - GdkCursor *cursor = gdk_cursor_new (GDK_LEFT_PTR); - gdk_window_set_cursor (gdk_get_default_root_window (), cursor); - gdk_cursor_unref (cursor); - - return FALSE; -} - -static gint -event_time (XEvent *ev) -{ - if ((ev->type == KeyPress) || - (ev->type == KeyRelease)) - return ((XKeyEvent *) ev)->time; - else if ((ev->type == ButtonPress) || - (ev->type == ButtonRelease)) - return ((XButtonEvent *) ev)->time; - else if ((ev->type == xinput_types[XINPUT_TYPE_KEY_PRESS]) || - (ev->type == xinput_types[XINPUT_TYPE_KEY_RELEASE])) - return ((XDeviceKeyEvent *) ev)->time; - else if ((ev->type == xinput_types[XINPUT_TYPE_BUTTON_PRESS]) || - (ev->type == xinput_types[XINPUT_TYPE_BUTTON_RELEASE])) - return ((XDeviceButtonEvent *) ev)->time; - else - return 0; -} - -static gint -elapsed_time (XEvent *ev1, XEvent *ev2) -{ - return event_time (ev2) - event_time (ev1); -} - -static gboolean -keycodes_equal (XEvent *ev1, XEvent *ev2) -{ - if (ev1->type == ev2->type) - { - if (ev1->type == KeyPress || ev1->type == KeyRelease) - { - return (((XKeyEvent *) ev1)->keycode == ((XKeyEvent *) ev2)->keycode); - } - else if (ev1->type == xinput_types[XINPUT_TYPE_KEY_PRESS] || - ev1->type == xinput_types[XINPUT_TYPE_KEY_RELEASE]) - { - return (((XDeviceKeyEvent *) ev1)->keycode == ((XDeviceKeyEvent *) ev2)->keycode); - } - } - return FALSE; -} - -static gint -key_gesture_compare_func (gconstpointer a, gconstpointer b) -{ - const Gesture *gesture = a; - const XEvent *xev = b; - - if (gesture->type == GESTURE_TYPE_KEY) - { - if (((xev->type == KeyPress) || (xev->type == KeyRelease)) && - (xev->xkey.keycode == gesture->input.key.keycode) && - ((xev->xkey.state & USED_MODS) == gesture->input.key.state)) - return 0; - else if (((xev->type == xinput_types[XINPUT_TYPE_KEY_PRESS]) || - (xev->type == xinput_types[XINPUT_TYPE_KEY_RELEASE])) && - (xev->xkey.keycode == gesture->input.key.keycode) && - ((xev->xkey.state & USED_MODS) == gesture->input.key.state)) - return 0; - else - return 1; - } - else if ((gesture->type == GESTURE_TYPE_MOUSE) && - ((xev->type == ButtonPress) || (xev->type == ButtonRelease)) && - (xev->xbutton.button == gesture->input.button.number)) - return 0; - else if ((gesture->type == GESTURE_TYPE_BUTTON) && - ((xev->type == xinput_types[XINPUT_TYPE_BUTTON_PRESS]) || - (xev->type == xinput_types[XINPUT_TYPE_BUTTON_RELEASE])) && - ((XDeviceButtonEvent *) xev)->button == gesture->input.button.number) - return 0; - else - return 1; -} - -#define event_is_gesture_type(xevent) (xevent->type == KeyPress ||\ - xevent->type == KeyRelease ||\ - xevent->type == ButtonPress ||\ - xevent->type == ButtonRelease ||\ - xevent->type == xinput_types[XINPUT_TYPE_KEY_PRESS] ||\ - xevent->type == xinput_types[XINPUT_TYPE_KEY_RELEASE] ||\ - xevent->type == xinput_types[XINPUT_TYPE_BUTTON_PRESS] ||\ - xevent->type == xinput_types[XINPUT_TYPE_BUTTON_RELEASE]) - -static GdkFilterReturn -gestures_filter (GdkXEvent *gdk_xevent, - GdkEvent *event, - gpointer data) -{ - XEvent *xevent = (XEvent *)gdk_xevent; - GSList *li, *act_li; - Gesture *curr_gesture = NULL; - XID xinput_device = None; - - static XEvent *last_event = NULL; - static gint seq_count = 0; - - if (!event_is_gesture_type (xevent)) - return GDK_FILTER_CONTINUE; - - if (!last_event) - last_event = g_new0(XEvent, 1); - - if ((xevent->type == KeyPress) || - (xevent->type == xinput_types[XINPUT_TYPE_KEY_PRESS])) - { - - if (debug_gestures) - syslog (LOG_WARNING, "key press"); - - if (last_event->type == KeyPress && - last_event->xkey.keycode == xevent->xkey.keycode) { - /* these come from auto key-repeat */ - - if (debug_gestures) - syslog (LOG_WARNING, "rejecting repeat"); - - return GDK_FILTER_CONTINUE; - } - - if (seq_count > 0 && - last_event->type != KeyRelease) { - - if (debug_gestures) - syslog (LOG_WARNING, - "last event wasn't a release, resetting seq"); - seq_count = 0; - } - else if (seq_count > 0 && - keycodes_equal (last_event, xevent)) { - - if (debug_gestures) - syslog (LOG_WARNING, - "keycode doesn't match last event, resetting seq"); - seq_count = 0; - } - - /* Find the associated gesture for this keycode & state */ - li = gesture_list_get_matches (gesture_list, xevent, - key_gesture_compare_func); - - if (li) { - curr_gesture = li->data; - if (debug_gestures) - syslog (LOG_WARNING, - "found a press match [%s]", - curr_gesture->gesture_str); - - /* xevent time values are in milliseconds. */ - /* The config file spec is in ms */ - if (curr_gesture->timeout > 0 && seq_count > 0 && - elapsed_time (last_event, xevent) > - curr_gesture->timeout) { - - if (debug_gestures) - syslog (LOG_WARNING, - "timeout exceeded: reset seq and gesture"); - - /* The timeout has been exceeded. - Reset the sequence. */ - seq_count = 0; - curr_gesture = NULL; - } - } - } - else if ((xevent->type == KeyRelease) || - (xevent->type == xinput_types[XINPUT_TYPE_KEY_RELEASE])) - { - if (debug_gestures) - syslog (LOG_WARNING, "key release"); - - if (seq_count > 0 && - ((last_event->type != KeyPress && - last_event->type != xinput_types[XINPUT_TYPE_KEY_PRESS]) || - ! keycodes_equal (last_event, xevent))) { - - if (debug_gestures) - syslog (LOG_WARNING, - "either last event not a keypress, or keycodes don't match. Resetting seq."); - - seq_count = 0; - } - - /* - * Find the associated gesture for this keycode & state - * - * Note that here we check the state against the last_event, - * otherwise key gestures based on modifier keys such as - * Control_R won't work. - */ - li = gesture_list_get_matches (gesture_list, xevent, - key_gesture_compare_func); - - if (li) { - curr_gesture = li->data; - - if (debug_gestures) - syslog (LOG_WARNING, "found a release match [%s]", - curr_gesture->gesture_str); - - if ((curr_gesture->duration > 0) && - (elapsed_time (last_event, xevent) < curr_gesture->duration)) { - - seq_count = 0; - curr_gesture = NULL; - - if (debug_gestures) - syslog (LOG_WARNING, "setting current gesture to NULL"); - } else { - seq_count++; - - if (debug_gestures) - syslog (LOG_WARNING, "incrementing seq_count"); - } - } - } - else if ((xevent->type == ButtonPress) || - (xevent->type == xinput_types[XINPUT_TYPE_BUTTON_PRESS])) { - gint button = 0; - gint time = 0; - - if (xevent->type == ButtonPress) { - button = xevent->xbutton.button; - time = xevent->xbutton.time; - - if (debug_gestures) - syslog (LOG_WARNING, "button press: %d", button); - - if (seq_count > 0 && (last_event->type != ButtonRelease)) - seq_count = 0; - else if (seq_count > 0 && last_event->xbutton.button != button) { - seq_count = 0; - } - } -#ifdef HAVE_XINPUT - else { - button = ((XDeviceButtonEvent *) xevent)->button; - time = ((XDeviceButtonEvent *) xevent)->time; - if (debug_gestures) - syslog (LOG_WARNING, "xinput button press: %d", button); - if (seq_count > 0 && - last_event->type != xinput_types[XINPUT_TYPE_BUTTON_RELEASE]) { - seq_count = 0; - } - else if (seq_count > 0 && - ((XDeviceButtonEvent *) last_event)->button != button) { - seq_count = 0; - } - } -#endif - - /* - * Find the associated gesture for this button. - */ - li = gesture_list_get_matches (gesture_list, xevent, - key_gesture_compare_func); - if (li) { - if (debug_gestures) - syslog (LOG_WARNING, "found match for press"); - - curr_gesture = li->data; - - if (curr_gesture->timeout > 0 && seq_count > 0) { - - /* xevent time values are in milliseconds. */ - /* The config file spec is in ms */ - if (elapsed_time (last_event, xevent) > curr_gesture->timeout) { - - /* Timeout has elapsed. Reset the sequence. */ - seq_count = 0; - curr_gesture = NULL; - - if (debug_gestures) - syslog (LOG_WARNING, "gesture timed out."); - } - } - } - else if (debug_gestures) - syslog (LOG_WARNING, "no match for press %d", button); - } - else if ((xevent->type == ButtonRelease) || - (xevent->type == xinput_types[XINPUT_TYPE_BUTTON_RELEASE])) - { - gint button = 0; - gint time = 0; - - if (xevent->type == ButtonRelease) - { - button = xevent->xbutton.button; - time = xevent->xbutton.time; - if (seq_count > 0 && - (last_event->type != ButtonPress || - last_event->xbutton.button != button)) { - if (debug_gestures) - syslog (LOG_WARNING, - "resetting count to zero, based on failure to match last event."); - seq_count = 0; - } - } -#ifdef HAVE_XINPUT - else - { - button = ((XDeviceButtonEvent *)(xevent))->button; - time = ((XDeviceButtonEvent *)(xevent))->time; - xinput_device = ((XDeviceButtonEvent *)(xevent))->deviceid; - - if (seq_count > 0 && - (last_event->type != xinput_types[XINPUT_TYPE_BUTTON_PRESS] || - ((XDeviceButtonEvent *) last_event)->button != button)) { - - if (debug_gestures) - syslog (LOG_WARNING, - "resetting count to zero, based on failure to match last input event."); - - seq_count = 0; - } - } -#endif - - li = gesture_list_get_matches (gesture_list, xevent, - key_gesture_compare_func); - - if (li) { - if (debug_gestures) - syslog (LOG_WARNING, "found match for release"); - curr_gesture = li->data; - if ((curr_gesture->duration > 0) && - (elapsed_time (last_event, xevent) < curr_gesture->duration)) { - seq_count = 0; - curr_gesture = NULL; - if (debug_gestures) - syslog (LOG_WARNING, "insufficient duration."); - } else { - if (debug_gestures) - syslog (LOG_WARNING, "duration OK"); - seq_count++; - } - } - else if (debug_gestures) - syslog (LOG_WARNING, "no match for release - button %d", - button); - } - - /* - * Did this event complete any gesture sequences? - */ - last_event = memcpy (last_event, xevent, sizeof(XEvent)); - if (curr_gesture) { - if (seq_count != curr_gesture->n_times) { - - if (debug_gestures) - syslog (LOG_WARNING, - "waiting for %d more repetitions...", - curr_gesture->n_times - seq_count); - - return GDK_FILTER_CONTINUE; - } else { - gboolean retval; - gchar **argv = NULL; - gchar **envp = NULL; - - if (debug_gestures) - syslog (LOG_WARNING, "gesture complete!"); - - seq_count = 0; - for (act_li = curr_gesture->actions; - act_li != NULL; act_li = act_li->next) { - - gchar *action = (gchar *)act_li->data; - g_return_val_if_fail (action != NULL, GDK_FILTER_CONTINUE); - if (!g_shell_parse_argv (action, NULL, &argv, NULL)) - continue; - - envp = get_exec_environment (xevent); - - if (debug_gestures) - syslog (LOG_WARNING, "Action is %s", action); - - retval = g_spawn_async (NULL, - argv, - envp, - G_SPAWN_SEARCH_PATH, - NULL, - NULL, - NULL, - NULL); - - g_strfreev (argv); - g_strfreev (envp); - - if ( ! retval) { - GtkWidget *dialog = - gtk_message_dialog_new (NULL, 0, - GTK_MESSAGE_ERROR, - GTK_BUTTONS_OK, - _("Error while trying to run (%s)\n"\ - "which is linked to (%s)"), - action, - curr_gesture->gesture_str); - gtk_dialog_set_has_separator (GTK_DIALOG (dialog), - FALSE); - g_signal_connect (dialog, "response", - G_CALLBACK (gtk_widget_destroy), - NULL); - gtk_widget_show (dialog); - } else { - GdkCursor *cursor = gdk_cursor_new (GDK_WATCH); - gdk_window_set_cursor (gdk_get_default_root_window (), - cursor); - gdk_cursor_unref (cursor); - g_timeout_add (2000, - change_cursor_back, - NULL); - } - } - return GDK_FILTER_CONTINUE; - } - } - return GDK_FILTER_CONTINUE; -} - - -static gint -is_mouseX (const gchar *string) -{ - if ((string[0] == '<') && - (string[1] == 'm' || string[1] == 'M') && - (string[2] == 'o' || string[2] == 'O') && - (string[3] == 'u' || string[3] == 'U') && - (string[4] == 's' || string[4] == 'S') && - (string[5] == 'e' || string[5] == 'E') && - (isdigit(string[6]) && - (atoi(&string[6]) > 0) && - (atoi(&string[6]) < 6)) && - (string[7] == '>')) - return atoi(&string[6]); - else - return 0; -} - -static gint -is_switchX (const gchar *string) -{ - if ((string[0] == '<') && - (string[1] == 's' || string[1] == 'S') && - (string[2] == 'w' || string[2] == 'W') && - (string[3] == 'i' || string[3] == 'I') && - (string[4] == 't' || string[4] == 'T') && - (string[5] == 'c' || string[5] == 'C') && - (string[6] == 'h' || string[6] == 'H') && - (isdigit(string[7]) && - (atoi(&string[7]) > 0) && - (atoi(&string[7]) < 6)) && - (string[8] == '>')) - return atoi(&string[7]); - else - return 0; -} - -/* The init function for this gtk module */ -G_MODULE_EXPORT void gtk_module_init(int *argc, char* argv[]); - -void gtk_module_init(int *argc, char* argv[]) -{ - if (g_getenv ("GDM_DEBUG_GESTURES") != NULL) - debug_gestures = TRUE; - - if (debug_gestures) { - /* If not running under GDM, then need to openlog ourselves */ - if (g_getenv ("RUNNING_UNDER_GDM") == NULL) - openlog ("gesturelistener", LOG_PID, LOG_DAEMON); - - syslog (LOG_WARNING, "keymouselistener loaded."); - } - - create_event_watcher (); -} diff --git a/gui/simple-chooser/Makefile.am b/gui/simple-chooser/Makefile.am index 7822e312..aa5e44c6 100644 --- a/gui/simple-chooser/Makefile.am +++ b/gui/simple-chooser/Makefile.am @@ -11,9 +11,7 @@ INCLUDES = \ -DLIBEXECDIR=\""$(libexecdir)"\" \ -DSBINDIR=\""$(sbindir)"\" \ -DPIXMAPDIR=\""$(pixmapdir)"\" \ - $(GUI_CFLAGS) \ - $(DBUS_CFLAGS) \ - $(CHOOSER_CFLAGS) \ + $(SIMPLE_CHOOSER_CFLAGS) \ $(NULL) libexec_PROGRAMS = \ @@ -29,11 +27,7 @@ gdm_simple_chooser_SOURCES = \ gdm_simple_chooser_LDADD = \ $(EXTRA_CHOOSER_LIBS) \ - $(GLIB_LIBS) \ - $(DBUS_LIBS) \ - $(GOBJECT_LIBS) \ - $(GUI_LIBS) \ - $(CHOOSER_LIBS) \ + $(SIMPLE_CHOOSER_LIBS) \ $(XDMCP_LIBS) \ $(top_builddir)/common/libgdmcommon.la \ $(NULL) diff --git a/gui/simple-greeter/Makefile.am b/gui/simple-greeter/Makefile.am index 0ee66155..4f83e98d 100644 --- a/gui/simple-greeter/Makefile.am +++ b/gui/simple-greeter/Makefile.am @@ -16,10 +16,8 @@ INCLUDES = \ -DGLADEDIR=\""$(pkgdatadir)"\" \ -DLIBEXECDIR=\""$(libexecdir)"\" \ -DSBINDIR=\""$(sbindir)"\" \ - $(GUI_CFLAGS) \ - $(DBUS_CFLAGS) \ $(GREETER_CFLAGS) \ - $(CAPPLET_CFLAGS) \ + $(SIMPLE_GREETER_CFLAGS) \ $(NULL) noinst_PROGRAMS = \ @@ -38,8 +36,7 @@ test_greeter_background_SOURCES = \ $(NULL) test_greeter_background_LDADD = \ - $(CAPPLET_LIBS) \ - $(GUI_LIBS) \ + $(SIMPLE_GREETER_LIBS) \ $(NULL) test_greeter_panel_SOURCES = \ @@ -49,8 +46,8 @@ test_greeter_panel_SOURCES = \ $(NULL) test_greeter_panel_LDADD = \ + $(GREETER_LIBS) \ $(top_builddir)/gui/simple-greeter/libnotificationarea/libnotificationarea.la \ - $(GUI_LIBS) \ $(NULL) test_language_chooser_SOURCES = \ @@ -63,7 +60,7 @@ test_language_chooser_SOURCES = \ $(NULL) test_language_chooser_LDADD = \ - $(GUI_LIBS) \ + $(GREETER_LIBS) \ $(NULL) test_session_chooser_SOURCES = \ @@ -74,11 +71,11 @@ test_session_chooser_SOURCES = \ gdm-session-chooser-dialog.c \ $(NULL) -test_session_chooser_LDADD = \ - $(GUI_LIBS) \ +test_session_chooser_LDADD = \ + $(GREETER_LIBS) \ $(NULL) -test_user_chooser_SOURCES = \ +test_user_chooser_SOURCES = \ test-user-chooser.c \ gdm-user-chooser-widget.h \ gdm-user-chooser-widget.c \ @@ -92,7 +89,7 @@ test_user_chooser_SOURCES = \ $(NULL) test_user_chooser_LDADD = \ - $(GUI_LIBS) \ + $(SIMPLE_GREETER_LIBS) \ $(NULL) test_user_manager_SOURCES = \ @@ -105,7 +102,7 @@ test_user_manager_SOURCES = \ $(NULL) test_user_manager_LDADD = \ - $(GUI_LIBS) \ + $(SIMPLE_GREETER_LIBS) \ $(NULL) libexec_PROGRAMS = \ @@ -133,12 +130,7 @@ gdm_simple_greeter_LDADD = \ -L$(top_builddir)/libgreeter \ -lgreeter \ $(top_builddir)/gui/simple-greeter/libnotificationarea/libnotificationarea.la \ - $(GLIB_LIBS) \ - $(DBUS_LIBS) \ - $(GOBJECT_LIBS) \ - $(GUI_LIBS) \ - $(GREETER_LIBS) \ - $(CAPPLET_LIBS) \ + $(SIMPLE_GREETER_LIBS) \ $(NULL) gladedir = $(pkgdatadir) diff --git a/gui/simple-greeter/libnotificationarea/Makefile.am b/gui/simple-greeter/libnotificationarea/Makefile.am index 5f766e1a..d1c82e34 100644 --- a/gui/simple-greeter/libnotificationarea/Makefile.am +++ b/gui/simple-greeter/libnotificationarea/Makefile.am @@ -10,7 +10,7 @@ INCLUDES = \ -DLOGDIR=\"$(logdir)\" \ -DPIXMAPDIR=\"$(pixmapdir)\" \ -DSBINDIR=\"$(sbindir)\" \ - $(GUI_CFLAGS) \ + $(GREETER_CFLAGS) \ $(NULL) noinst_LTLIBRARIES = \ @@ -62,5 +62,5 @@ testtray_SOURCES = \ testtray_LDADD = \ libnotificationarea.la \ - $(GUI_LIBS) \ + $(GREETER_LIBS) \ $(NULL) diff --git a/libgreeter/Makefile.am b/libgreeter/Makefile.am index 9f129dda..cdc71cc7 100644 --- a/libgreeter/Makefile.am +++ b/libgreeter/Makefile.am @@ -14,12 +14,12 @@ libgreeter_la_SOURCES = \ $(NULL) libgreeter_la_CPPFLAGS = \ + $(WARN_CFLAGS) \ $(DISABLE_DEPRECATED_CFLAGS) \ $(NULL) libgreeter_la_CFLAGS = \ - $(DBUS_CFLAGS) \ - $(GUI_CFLAGS) \ + $(GREETER_CFLAGS) \ -I$(top_srcdir)/common/ \ $(NULL) diff --git a/po/ChangeLog b/po/ChangeLog index 5a545355..a0133714 100644 --- a/po/ChangeLog +++ b/po/ChangeLog @@ -1,3 +1,9 @@ +2007-10-04 William Jon McCann <mccann@jhu.edu> + + reviewed by: <delete if not using a buddy> + + * POTFILES.in: + 2007-10-03 William Jon McCann <mccann@jhu.edu> * POTFILES.in: Add new files. diff --git a/po/POTFILES.in b/po/POTFILES.in index e0d462d1..ba4dc33b 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -48,8 +48,6 @@ daemon/session-worker-main.c daemon/simple-slave-main.c daemon/test-session.c data/gdm.schemas.in.in -gui/modules/dwellmouselistener.c -gui/modules/keymouselistener.c gui/simple-chooser/gdm-host-chooser-widget.c gui/simple-greeter/gdm-session-chooser-widget.c gui/simple-greeter/gdm-simple-greeter.c |