Commit 1d1b1b00 authored by Nick Schermer's avatar Nick Schermer

* dialogs/mouse-settings/mouse-dialog.glade,

	  dialogs/mouse-settings/main.c,
	  dialogs/mouse-settings/Makefile.am,
	  xfce4-settings-helper/pointers.h,
	  xfce4-settings-helper/pointers.c: Merge multi pointer
	  branch code.
	* dialogs/keyboard-settings/main.c: Release the channels
	  after running the dialog.
	* xfce4-settings-helper/accessx.c, 
	  xfce4-settings-helper/accessx.h,
	  xfce4-settings-helper/xkb.c,
	  xfce4-settings-helper/xkb.h: Move code into objects. Will
	  make things look nice and allows the code to cleanup when
	  the objects are released in main.c.
	* xfce4-settings-helper/main.c: Use the objects and do some
	  more checking before running the dialog.
	* xfce4-settings-helper/accessx.c: Make disabling the mouse
	  keys work; don't call channel_get functions when not needed.
	* dialogs/keyboard-settings/main.c: Release the channels after
	  running the dialog, also destroy the dialog after using it.

(Old svn revision: 27274)
parent 82f323d3
2008-07-13 Nick Schermer <nick@xfce.org>
* dialogs/mouse-settings/mouse-dialog.glade,
dialogs/mouse-settings/main.c,
dialogs/mouse-settings/Makefile.am,
xfce4-settings-helper/pointers.h,
xfce4-settings-helper/pointers.c: Merge multi pointer
branch code.
* dialogs/keyboard-settings/main.c: Release the channels
after running the dialog.
* xfce4-settings-helper/accessx.c,
xfce4-settings-helper/accessx.h,
xfce4-settings-helper/xkb.c,
xfce4-settings-helper/xkb.h: Move code into objects. Will
make things look nice and allows the code to cleanup when
the objects are released in main.c.
* xfce4-settings-helper/main.c: Use the objects and do some
more checking before running the dialog.
* xfce4-settings-helper/accessx.c: Make disabling the mouse
keys work; don't call channel_get functions when not needed.
* dialogs/keyboard-settings/main.c: Release the channels after
running the dialog, also destroy the dialog after using it.
2008-07-11 Nick Schermer <nick@xfce.org>
* dialogs/mouse-settings/mouse-dialog.glade: Add some tooltips
......
......@@ -9,8 +9,6 @@ Keyboard settings (Jannis)
Mouse settings (Nick)
------------------------------------------------------------------------
* Integrate multi pointer branch.
* Make hal and libxcursor an optional dependency.
* Check dependency versions of libxi and libxcursor.
* Make it work a bit better with onyl 1 pointer.
* Move the device information into a separate xfconf channel.
* Fixup some of the Makefiles.
* Add signal watch to xfce4-setting-helper to quit the main loop when
receiving a sigterm.
dnl
dnl Copyright (c) 2006
dnl Copyright (c) 2006 - 2008
dnl The Xfce development team. All rights reserved.
dnl
dnl Originally written for Xfce by Benedikt Meurer <benny@xfce.org>
......@@ -21,52 +21,183 @@ dnl *** Debugging support for SVN snapshots ***
dnl *******************************************
m4_define([xfce4_settings_debug_default], [ifelse(xfce4_settings_version_tag(), [svn], [full], [minimum])])
dnl ***************************
dnl *** Initialize autoconf ***
dnl ***************************
AC_COPYRIGHT([Copyright (c) 2008
The Xfce development team. All rights reserved.
Written for Xfce by Stephan Arts <stephan@xfce.org>.])
The Xfce development team. All rights reserved.])
AC_INIT([xfce4-settings], [xfce4_settings_version], [http://bugzilla.xfce.org/])
AC_PREREQ([2.50])
AC_REVISION([$Id])
XFCE4_SETTINGS_VERSION=xfce4_settings_version
AM_INIT_AUTOMAKE([xfce4-settings], [$XFCE4_SETTINGS_VERSION])
dnl ***************************
dnl *** Initialize automake ***
dnl ***************************
AM_INIT_AUTOMAKE([1.8 dist-bzip2 tar-ustar])
AM_CONFIG_HEADER([config.h])
AM_MAINTAINER_MODE
dnl check for UNIX variants
AC_AIX
AC_ISC_POSIX
AC_MINIX
AM_CONDITIONAL([HAVE_CYGWIN], [test "`uname | grep \"CYGWIN\"`" != ""])
dnl check for standard header files
AC_PROG_CC
AM_MAINTAINER_MODE()
dnl *******************************
dnl *** Check for UNIX variants ***
dnl *******************************
AC_AIX()
AC_ISC_POSIX()
AC_MINIX()
dnl ********************************
dnl *** Check for basic programs ***
dnl ********************************
AC_PROG_CC()
AC_PROG_LD()
AC_PROG_INSTALL()
AC_PROG_INTLTOOL([0.31], [no-xml])
AC_HEADER_STDC
AC_CHECK_HEADERS([string.h math.h stdio.h stdlib.h])
dnl **************************
dnl *** Initialize libtool ***
dnl **************************
AC_PROG_LIBTOOL()
dnl Check for i18n support
XDT_I18N([@LINGUAS@])
dnl **********************************
dnl *** Check for standard headers ***
dnl **********************************
AC_CHECK_HEADERS([errno.h memory.h math.h stdlib.h stdio.h string.h unistd.h])
dnl ******************************
dnl *** Check for i18n support ***
dnl ******************************
XDT_I18N([@LINGUAS@])
dnl ***********************************
dnl *** Check for required packages ***
dnl ***********************************
XDT_CHECK_PACKAGE([EXO], [exo-0.3], [0.3.0])
XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.10.0])
XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.12.0])
XDT_CHECK_PACKAGE([GOBJECT], [gobject-2.0], [2.12.0])
XDT_CHECK_PACKAGE([DBUS_GLIB], [dbus-glib-1], [0.34])
XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [0])
XDT_CHECK_PACKAGE([LIBXFCEGUI4], [libxfcegui4-1.0], [4.4.0])
XDT_CHECK_PACKAGE([GTHREAD], [gthread-2.0], [2.12.0])
XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.4.0])
XDT_CHECK_PACKAGE([EXO], [exo-0.3], [0.3.0])
XDT_CHECK_OPTIONAL_PACKAGE([GLADE], [libglade-2.0], [2.0.0])
XDT_CHECK_PACKAGE([LIBNOTIFY], [libnotify], [0.1.3])
dnl check for debugging support
XDT_FEATURE_DEBUG
XDT_CHECK_PACKAGE([LIBXFCEGUI4], [libxfcegui4-1.0], [4.4.0])
XDT_CHECK_PACKAGE([GLADE], [libglade-2.0], [2.0.0])
XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [0])
XDT_CHECK_PACKAGE([DBUS_GLIB], [dbus-glib-1], [0.34])
XDT_CHECK_PACKAGE([XI], [xi], [1.1.0])
XDT_CHECK_PACKAGE([LIBX11], [x11], [1.1.0])
dnl **************************************
dnl *** Optional support for Libnotify ***
dnl **************************************
XDT_CHECK_OPTIONAL_PACKAGE([LIBNOTIFY], [libnotify], [0.1.3],
[libnotify], [Notification support])
dnl ********************************
dnl *** Optional support for HAL ***
dnl ********************************
XDT_CHECK_OPTIONAL_PACKAGE([HAL], [hal], [0.5.0],
[hal], [Hotplugging support])
dnl ************************************
dnl *** Optional support for Xcursor ***
dnl ************************************
XDT_CHECK_OPTIONAL_PACKAGE([XCURSOR], [xcursor], [1.1.0],
[xcursor], [Cursor themes support])
dnl *************************************
dnl *** Optional support for Xf86misc ***
dnl *************************************
XDT_CHECK_OPTIONAL_PACKAGE([XF86MISC], [libxxf86misc], [0.9.0],
[xf86misc], [Support for the X Miscellaneous extension wire protocol])
dnl ***********************************
dnl *** Check for debugging support ***
dnl ***********************************
AC_ARG_ENABLE([debug],
AC_HELP_STRING([--enable-debug=@<:@no/minimum/yes/full@:>@], [Turn on debugging @<:@default=xfce4_settings_debug_default@:>@]),
[], [enable_debug=xfce4_settings_debug_default])
AC_MSG_CHECKING([whether to enable debugging support])
if test x"$enable_debug" = x"full" -o x"$enable_debug" = x"yes"; then
dnl Print the result
AC_MSG_RESULT([$enable_debug])
dnl Make sure we detect possible errors (if supported)
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wall -Werror"
AC_MSG_CHECKING([whether $CC accepts -Wall -Werror])
AC_COMPILE_IFELSE(AC_LANG_SOURCE([int x;]), [
AC_MSG_RESULT([yes])
PLATFORM_CFLAGS="$PLATFORM_CFLAGS -Wall -Werror"
], [
AC_MSG_RESULT([no])
])
CFLAGS="$save_CFLAGS"
dnl Paranoia for --enable-debug=full
if test x"$enable_debug" = x"full"; then
dnl Enable extensive debugging
PLATFORM_CPPFLAGS="$PLATFORM_CPPFLAGS -DG_ENABLE_DEBUG"
dnl Use -O0 -g3 if the compiler supports it
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -O0 -g3"
AC_MSG_CHECKING([whether $CC accepts -O0 -g3])
AC_COMPILE_IFELSE(AC_LANG_SOURCE([int x;]), [
AC_MSG_RESULT([yes])
PLATFORM_CFLAGS="$PLATFORM_CFLAGS -O0 -g3"
], [
AC_MSG_RESULT([no])
])
CFLAGS="$save_CFLAGS"
fi
else
dnl Print the result
AC_MSG_RESULT([$enable_debug])
dnl Disable debugging (release build)
PLATFORM_CPPFLAGS="$PLATFORM_CPPFLAGS -DNDEBUG"
dnl Disable object cast checks
PLATFORM_CPPFLAGS="$PLATFORM_CPPFLAGS -DG_DISABLE_CAST_CHECKS"
dnl Disable all checks for --enable-debug=no
if test x"$enable_debug" = x"no"; then
PLATFORM_CPPFLAGS="$PLATFORM_CPPFLAGS -DG_DISABLE_ASSERT -DG_DISABLE_CHECKS"
fi
fi
dnl **************************************
dnl *** Check for linker optimizations ***
dnl **************************************
AC_MSG_CHECKING([whether $LD accepts --as-needed])
case `$LD --as-needed -v 2>&1 </dev/null` in
*GNU* | *'with BFD'*)
LDFLAGS="$LDFLAGS -Wl,--as-needed"
AC_MSG_RESULT([yes])
;;
*)
AC_MSG_RESULT([no])
;;
esac
AC_MSG_CHECKING([whether $LD accepts -O1])
case `$LD -O1 -v 2>&1 </dev/null` in
*GNU* | *'with BFD'*)
PLATFORM_LDFLAGS="$PLATFORM_LDFLAGS -Wl,-O1"
AC_MSG_RESULT([yes])
;;
*)
AC_MSG_RESULT([no])
;;
esac
dnl *********************************
dnl *** Substitute platform flags ***
dnl *********************************
AC_MSG_CHECKING([PLATFORM_CPPFLAGS])
AC_MSG_RESULT([$PLATFORM_CPPFLAGS])
AC_SUBST([PLATFORM_CPPFLAGS])
AC_MSG_CHECKING([PLATFORM_CFLAGS])
AC_MSG_RESULT([$PLATFORM_CFLAGS])
AC_SUBST([PLATFORM_CFLAGS])
AC_MSG_CHECKING([PLATFORM_LDFLAGS])
AC_MSG_RESULT([$PLATFORM_LDFLAGS])
AC_SUBST([PLATFORM_LDFLAGS])
AC_OUTPUT([
Makefile
......@@ -80,9 +211,27 @@ xfce4-settings-helper/Makefile
xfce4-settings-manager/Makefile
])
echo "----------------------------------------"
echo "$PACKAGE $VERSION"
echo ""
echo "The binary will be installed in $prefix/bin"
echo ""
echo "Configure finished, type 'make' to build."
dnl ***************************
dnl *** Print configuration ***
dnl ***************************
echo
echo "Build Configuration:"
echo
echo "* Installation prefix: $prefix"
echo "* Debug Support: $enable_debug"
if test x"$LIBNOTIFY_FOUND" = x"yes"; then
echo "* Libnotify support: yes"
else
echo "* Libnotify support: no"
fi
if test x"$HAL_FOUND" = x"yes"; then
echo "* HAL support: yes"
else
echo "* HAL support: no"
fi
if test x"$XCURSOR_FOUND" = x"yes"; then
echo "* Xcursor support: yes"
else
echo "* Xcursor support: no"
fi
echo
......@@ -479,10 +479,6 @@ keyboard_settings_dialog_new_from_xml (GladeXML *gxml)
gtk_widget_show_all(dialog);
gtk_widget_hide(dialog);
g_object_unref (xsettings_channel);
g_object_unref (xkb_channel);
g_object_unref (kbd_channel);
return dialog;
}
......@@ -523,6 +519,13 @@ main(int argc, char **argv)
/* Create settings dialog and run it */
dialog = keyboard_settings_dialog_new_from_xml (gxml);
gtk_dialog_run(GTK_DIALOG(dialog));
gtk_widget_destroy (dialog);
g_object_unref (xsettings_channel);
g_object_unref (xkb_channel);
g_object_unref (kbd_channel);
xfconf_shutdown();
......
bin_PROGRAMS = xfce4-mouse-settings
xfce4_mouse_settings_SOURCES = \
main.c \
mouse-dialog_glade.h
mouse-dialog-glade.h
xfce4_mouse_settings_CFLAGS = \
$(GTK_CFLAGS) \
......@@ -10,6 +10,10 @@ xfce4_mouse_settings_CFLAGS = \
$(DBUS_GLIB_CFLAGS) \
$(LIBXFCEGUI4_CFLAGS) \
$(XFCONF_CFLAGS) \
$(XI_CFLAGS) \
$(XCURSOR_CFLAGS) \
$(HAL_CFLAGS) \
$(XFCONF_CFLAGS) \
-DDATADIR=\"$(datadir)\" \
-DSRCDIR=\"$(top_srcdir)\" \
-DLOCALEDIR=\"$(localedir)\"
......@@ -20,7 +24,10 @@ xfce4_mouse_settings_LDADD = \
$(GLADE_LIBS) \
$(DBUS_GLIB_LIBS) \
$(LIBXFCEGUI4_LIBS) \
$(XFCONF_LIBS)
$(XFCONF_LIBS) \
$(HAL_LIBS) \
$(XI_LIBS) \
$(XCURSOR_LIBS)
INCLUDES = \
-I${top_srcdir} \
......@@ -29,9 +36,9 @@ INCLUDES = \
if MAINTAINER_MODE
BUILT_SOURCES = \
mouse-dialog_glade.h
mouse-dialog-glade.h
mouse-dialog_glade.h: mouse-dialog.glade
mouse-dialog-glade.h: mouse-dialog.glade
exo-csource --static --name=mouse_dialog_glade $< >$@
endif
......
This diff is collapsed.
This diff is collapsed.
bin_PROGRAMS = xfce4-settings-helper
xfce4_settings_helper_SOURCES = \
main.c \
accessx.c accessx.h \
xkb.c xkb.h
xfce4_settings_helper_CFLAGS = \
$(GTK_CFLAGS) \
$(GLIB_CFLAGS) \
$(DBUS_GLIB_CFLAGS) \
$(LIBNOTIFY_CFLAGS) \
$(XFCONF_CFLAGS) \
$(LIBXFCE4UTIL_CFLAGS) \
-DDATADIR=\"$(datadir)\" \
-DSRCDIR=\"$(top_srcdir)\" \
-DLOCALEDIR=\"$(localedir)\"
xfce4_settings_helper_LDADD = \
$(GTK_LIBS) \
$(GLIB_LIBS) \
$(DBUS_GLIB_LIBS) \
$(LIBNOTIFY_LIBS) \
$(XFCONF_LIBS) \
$(LIBXFCE4UTIL_LIBS)
INCLUDES = \
-I$(top_srcdir)
# $Id$
INCLUDES = \
-I$(top_builddir) \
-I$(top_srcdir) \
-DBINDIR=\"$(bindir)\" \
-DDATADIR=\"$(datadir)\" \
-DG_LOG_DOMAIN=\"Xfce4-settings-helper\" \
-DLIBDIR=\"$(libdir)\" \
-DLIBEXECDIR=\"$(libexecdir)\" \
-DPACKAGE_LOCALE_DIR=\"$(localedir)\" \
$(PLATFORM_CPPFLAGS)
bin_PROGRAMS = \
xfce4-settings-helper
xfce4_settings_helper_SOURCES = \
main.c \
accessx.c \
accessx.h \
xkb.c \
xkb.h \
pointers.c \
pointers.h
xfce4_settings_helper_CFLAGS = \
$(GTK_CFLAGS) \
$(GLIB_CFLAGS) \
$(GTHREAD_CFLAGS) \
$(DBUS_GLIB_CFLAGS) \
$(XFCONF_CFLAGS) \
$(LIBXFCE4UTIL_CFLAGS) \
$(XI_CFLAGS) \
$(LIBX11_CFLAGS)
xfce4_settings_helper_LDFLAGS = \
-no-undefined \
$(PLATFORM_LDFLAGS)
xfce4_settings_helper_LDADD = \
$(GTK_LIBS) \
$(GLIB_LIBS) \
$(GTHREAD_LIBS) \
$(DBUS_GLIB_LIBS) \
$(XFCONF_LIBS) \
$(LIBXFCE4UTIL_LIBS) \
$(XI_LIBS) \
$(LIBX11_LIBS)
if HAVE_LIBNOTIFY
xfce4_settings_helper_CFLAGS += \
$(LIBNOTIFY_CFLAGS)
xfce4_settings_helper_LDADD += \
$(LIBNOTIFY_LIBS)
endif
if HAVE_HAL
xfce4_settings_helper_CFLAGS += \
$(HAL_CFLAGS)
xfce4_settings_helper_LDADD += \
$(HAL_LIBS)
endif
clean-local:
rm -f *.core core core.*
# vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
......@@ -28,236 +28,355 @@
#endif
#include <X11/Xlib.h>
#include <X11/XKBlib.h>
#ifdef HAVE_XF86MISC
#include <X11/extensions/xf86misc.h>
#endif
#include <glib.h>
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include <libxfce4util/libxfce4util.h>
#include <xfconf/xfconf.h>
#include <libxfce4util/libxfce4util.h>
#ifdef HAVE_LIBNOTIFY
#include <libnotify/notify.h>
#endif /* !HAVE_LIBNOTIFY */
#include <xfce4-settings-helper/accessx.h>
#include "xkb.h"
static NotifyNotification *accessx_notification = NULL;
static XfconfChannel *accessx_channel;
static void xfce_accessx_helper_class_init (XfceAccessxHelperClass *klass);
static void xfce_accessx_helper_init (XfceAccessxHelper *helper);
static void xfce_accessx_helper_finalize (GObject *object);
static void xfce_accessx_helper_set_xkb (XfceAccessxHelper *helper);
static void xfce_accessx_helper_channel_property_changed (XfconfChannel *channel,
const gchar *property_name,
const GValue *value,
XfceAccessxHelper *helper);
#ifdef HAVE_LIBNOTIFY
static GdkFilterReturn xfce_accessx_helper_event_filter (GdkXEvent *xevent,
GdkEvent *gdk_event,
gpointer user_data);
static void xfce_accessx_helper_notification_closed (NotifyNotification *notification,
XfceAccessxHelper *helper);
static void xfce_accessx_helper_notification_show (XfceAccessxHelper *helper,
const gchar *summary,
const gchar *body);
#endif /* !HAVE_LIBNOTIFY */
struct _XfceAccessxHelperClass
{
GObjectClass __parent__;
};
struct _XfceAccessxHelper
{
GObject __parent__;
/* xfconf channel */
XfconfChannel *channel;
#ifdef HAVE_LIBNOTIFY
NotifyNotification *notification;
#endif /* !HAVE_LIBNOTIFY */
};
G_DEFINE_TYPE (XfceAccessxHelper, xfce_accessx_helper, G_TYPE_OBJECT);
static gboolean accessx_initialized = FALSE;
static void
toggle_accessx (XfconfChannel *channel);
xfce_accessx_helper_class_init (XfceAccessxHelperClass *klass)
{
GObjectClass *gobject_class;
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = xfce_accessx_helper_finalize;
}
GdkFilterReturn
accessx_event_filter (GdkXEvent *xevent,
GdkEvent *g_event,
gpointer data)
static void
xfce_accessx_helper_init (XfceAccessxHelper *helper)
{
XkbEvent *event = xevent;
gint dummy;
switch(event->any.xkb_type)
helper->channel = NULL;
#ifdef HAVE_LIBNOTIFY
helper->notification = NULL;
#endif /* !HAVE_LIBNOTIFY */
if (XkbQueryExtension (GDK_DISPLAY (), &dummy, &dummy, &dummy, &dummy, &dummy))
{
case XkbBellNotify:
break;
case XkbControlsNotify:
{
if(event->ctrls.enabled_ctrl_changes & XkbStickyKeysMask)
{
if(event->ctrls.enabled_ctrls & XkbStickyKeysMask)
{
notify_notification_update(accessx_notification,
_("Sticky keys"),
_("Sticky keys are enabled"),
"keyboard");
}
else
{
notify_notification_update(accessx_notification,
_("Sticky keys"),
_("Sticky keys are disabled"),
"keyboard");
}
notify_notification_show(accessx_notification, NULL);
}
if(event->ctrls.enabled_ctrl_changes & XkbSlowKeysMask)
{
if(event->ctrls.enabled_ctrls & XkbSlowKeysMask)
{
notify_notification_update(accessx_notification,
_("Slow keys"),
_("Slow keys are enabled"),
"keyboard");
}
else
{
notify_notification_update(accessx_notification,
_("Slow keys"),
_("Slow keys are disabled"),
"keyboard");
}
notify_notification_show(accessx_notification, NULL);
}
if(event->ctrls.enabled_ctrl_changes & XkbBounceKeysMask)
{
if(event->ctrls.enabled_ctrls & XkbBounceKeysMask)
{
notify_notification_update(accessx_notification,
_("Bounce keys"),
_("Bounce keys are enabled"),
"keyboard");
}
else
{
notify_notification_update(accessx_notification,
_("Bounce keys"),
_("Bounce keys are disabled"),
"keyboard");
}
notify_notification_show(accessx_notification, NULL);
}
}
break;
default:
break;
/* open the channel */
helper->channel = xfconf_channel_new ("accessx");
/* monitor channel changes */
g_signal_connect (G_OBJECT (helper->channel), "property-changed", G_CALLBACK (xfce_accessx_helper_channel_property_changed), helper);
/* restore the xbd configuration */
xfce_accessx_helper_set_xkb (helper);
#ifdef HAVE_LIBNOTIFY
/* setup a connection with the notification daemon */
if (!notify_init ("xfce4-settings-helper"))
g_critical ("Failed to connect to the notification daemon.");
/* add event filter */
XkbSelectEvents (GDK_DISPLAY (), XkbUseCoreKbd, XkbControlsNotifyMask, XkbControlsNotifyMask);
/* monitor all window events */
gdk_window_add_filter (NULL, xfce_accessx_helper_event_filter, helper);
#endif /* !HAVE_LIBNOTIFY */
}
else
{
/* warning */
g_critical ("Failed to initialize the Xkb extension.");
}
return GDK_FILTER_CONTINUE;
}