summaryrefslogtreecommitdiff
path: root/plugins/mouse
diff options
context:
space:
mode:
authorPerberos <[email protected]>2011-12-01 23:53:21 -0300
committerPerberos <[email protected]>2011-12-01 23:53:21 -0300
commit505cabbd3036081f26586cabc64c26e7769c0ec9 (patch)
tree09e0498bf572128f5c9ab551531cb28d6d75e992 /plugins/mouse
downloadmate-settings-daemon-505cabbd3036081f26586cabc64c26e7769c0ec9.tar.bz2
mate-settings-daemon-505cabbd3036081f26586cabc64c26e7769c0ec9.tar.xz
moving from https://github.com/perberos/mate-desktop-environment
Diffstat (limited to 'plugins/mouse')
-rw-r--r--plugins/mouse/Makefile.am52
-rw-r--r--plugins/mouse/Makefile.in768
-rw-r--r--plugins/mouse/gsd-locate-pointer.c504
-rw-r--r--plugins/mouse/gsd-locate-pointer.h24
-rw-r--r--plugins/mouse/gsd-mouse-manager.c1124
-rw-r--r--plugins/mouse/gsd-mouse-manager.h61
-rw-r--r--plugins/mouse/gsd-mouse-plugin.c104
-rw-r--r--plugins/mouse/gsd-mouse-plugin.h63
-rw-r--r--plugins/mouse/gsd-timeline.c848
-rw-r--r--plugins/mouse/gsd-timeline.h127
-rw-r--r--plugins/mouse/mouse.mate-settings-plugin.in8
11 files changed, 3683 insertions, 0 deletions
diff --git a/plugins/mouse/Makefile.am b/plugins/mouse/Makefile.am
new file mode 100644
index 0000000..f99aefc
--- /dev/null
+++ b/plugins/mouse/Makefile.am
@@ -0,0 +1,52 @@
+plugin_LTLIBRARIES = libmouse.la
+
+libmouse_la_SOURCES = \
+ gsd-mouse-plugin.h \
+ gsd-mouse-plugin.c \
+ gsd-mouse-manager.h \
+ gsd-mouse-manager.c
+
+libmouse_la_CPPFLAGS = \
+ -I$(top_srcdir)/mate-settings-daemon \
+ -DMATE_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \
+ -DLIBEXECDIR=\""$(libexecdir)"\" \
+ $(AM_CPPFLAGS)
+
+libmouse_la_CFLAGS = \
+ $(SETTINGS_PLUGIN_CFLAGS) \
+ $(AM_CFLAGS)
+
+libmouse_la_LDFLAGS = \
+ $(GSD_PLUGIN_LDFLAGS)
+
+libmouse_la_LIBADD = \
+ $(SETTINGS_PLUGIN_LIBS) \
+ $(X11_LIBS) \
+ $(XINPUT_LIBS)
+
+plugin_in_files = mouse.mate-settings-plugin.in
+
+plugin_DATA = $(plugin_in_files:.mate-settings-plugin.in=.mate-settings-plugin)
+
+libexec_PROGRAMS = gsd-locate-pointer
+
+gsd_locate_pointer_SOURCES = \
+ gsd-locate-pointer.h \
+ gsd-locate-pointer.c \
+ gsd-timeline.h \
+ gsd-timeline.c
+
+gsd_locate_pointer_CFLAGS = \
+ $(SETTINGS_PLUGIN_CFLAGS) \
+ $(AM_CFLAGS)
+
+gsd_locate_pointer_LDADD = \
+ $(SETTINGS_PLUGIN_LIBS) \
+ $(X11_LIBS) \
+ -lm
+
+EXTRA_DIST = $(plugin_in_files)
+CLEANFILES = $(plugin_DATA)
+DISTCLEANFILES = $(plugin_DATA)
+
+@GSD_INTLTOOL_PLUGIN_RULE@
diff --git a/plugins/mouse/Makefile.in b/plugins/mouse/Makefile.in
new file mode 100644
index 0000000..c4bc74c
--- /dev/null
+++ b/plugins/mouse/Makefile.in
@@ -0,0 +1,768 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+build_triplet = @build@
+host_triplet = @host@
+libexec_PROGRAMS = gsd-locate-pointer$(EXEEXT)
+subdir = plugins/mouse
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" \
+ "$(DESTDIR)$(plugindir)"
+LTLIBRARIES = $(plugin_LTLIBRARIES)
+am__DEPENDENCIES_1 =
+libmouse_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+am_libmouse_la_OBJECTS = libmouse_la-gsd-mouse-plugin.lo \
+ libmouse_la-gsd-mouse-manager.lo
+libmouse_la_OBJECTS = $(am_libmouse_la_OBJECTS)
+libmouse_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libmouse_la_CFLAGS) \
+ $(CFLAGS) $(libmouse_la_LDFLAGS) $(LDFLAGS) -o $@
+PROGRAMS = $(libexec_PROGRAMS)
+am_gsd_locate_pointer_OBJECTS = \
+ gsd_locate_pointer-gsd-locate-pointer.$(OBJEXT) \
+ gsd_locate_pointer-gsd-timeline.$(OBJEXT)
+gsd_locate_pointer_OBJECTS = $(am_gsd_locate_pointer_OBJECTS)
+gsd_locate_pointer_DEPENDENCIES = $(am__DEPENDENCIES_1) \
+ $(am__DEPENDENCIES_1)
+gsd_locate_pointer_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) \
+ $(gsd_locate_pointer_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(libmouse_la_SOURCES) $(gsd_locate_pointer_SOURCES)
+DIST_SOURCES = $(libmouse_la_SOURCES) $(gsd_locate_pointer_SOURCES)
+DATA = $(plugin_DATA)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+ALL_LINGUAS = @ALL_LINGUAS@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CATALOGS = @CATALOGS@
+CATOBJEXT = @CATOBJEXT@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DATADIRNAME = @DATADIRNAME@
+DBUS_SYS_DIR = @DBUS_SYS_DIR@
+DEBUG_CFLAGS = @DEBUG_CFLAGS@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@
+FONTCONFIG_LIBS = @FONTCONFIG_LIBS@
+GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
+GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@
+GIOUNIX_LIBS = @GIOUNIX_LIBS@
+GLIB_GENMARSHAL = @GLIB_GENMARSHAL@
+GMOFILES = @GMOFILES@
+GMSGFMT = @GMSGFMT@
+GREP = @GREP@
+GSD_INTLTOOL_PLUGIN_RULE = @GSD_INTLTOOL_PLUGIN_RULE@
+GSD_PLUGIN_LDFLAGS = @GSD_PLUGIN_LDFLAGS@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+INSTOBJEXT = @INSTOBJEXT@
+INTLLIBS = @INTLLIBS@
+INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
+INTLTOOL_MERGE = @INTLTOOL_MERGE@
+INTLTOOL_PERL = @INTLTOOL_PERL@
+INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
+LD = @LD@
+LDFLAGS = @LDFLAGS@
+LIBEXECDIR = @LIBEXECDIR@
+LIBMATEKBDUI_CFLAGS = @LIBMATEKBDUI_CFLAGS@
+LIBMATEKBDUI_LIBS = @LIBMATEKBDUI_LIBS@
+LIBMATENOTIFY_CFLAGS = @LIBMATENOTIFY_CFLAGS@
+LIBMATENOTIFY_LIBS = @LIBMATENOTIFY_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MANIFEST_TOOL = @MANIFEST_TOOL@
+MATECONFTOOL = @MATECONFTOOL@
+MATECONF_SCHEMA_CONFIG_SOURCE = @MATECONF_SCHEMA_CONFIG_SOURCE@
+MATECONF_SCHEMA_FILE_DIR = @MATECONF_SCHEMA_FILE_DIR@
+MATE_KEYBINDINGS_KEYSDIR = @MATE_KEYBINDINGS_KEYSDIR@
+MKDIR_P = @MKDIR_P@
+MKINSTALLDIRS = @MKINSTALLDIRS@
+MSGFMT = @MSGFMT@
+MSGFMT_OPTS = @MSGFMT_OPTS@
+MSGMERGE = @MSGMERGE@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NSS_CFLAGS = @NSS_CFLAGS@
+NSS_DATABASE = @NSS_DATABASE@
+NSS_LIBS = @NSS_LIBS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+POFILES = @POFILES@
+POLKIT_CFLAGS = @POLKIT_CFLAGS@
+POLKIT_LIBS = @POLKIT_LIBS@
+POSUB = @POSUB@
+PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@
+PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@
+PULSE_CFLAGS = @PULSE_CFLAGS@
+PULSE_LIBS = @PULSE_LIBS@
+RANLIB = @RANLIB@
+SED = @SED@
+SETTINGS_DAEMON_CFLAGS = @SETTINGS_DAEMON_CFLAGS@
+SETTINGS_DAEMON_LIBS = @SETTINGS_DAEMON_LIBS@
+SETTINGS_PLUGIN_CFLAGS = @SETTINGS_PLUGIN_CFLAGS@
+SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+USE_NLS = @USE_NLS@
+VERSION = @VERSION@
+WARN_CFLAGS = @WARN_CFLAGS@
+X11_LIBS = @X11_LIBS@
+XF86MISC_LIBS = @XF86MISC_LIBS@
+XGETTEXT = @XGETTEXT@
+XINPUT_LIBS = @XINPUT_LIBS@
+XMKMF = @XMKMF@
+X_CFLAGS = @X_CFLAGS@
+X_EXTRA_LIBS = @X_EXTRA_LIBS@
+X_LIBS = @X_LIBS@
+X_PRE_LIBS = @X_PRE_LIBS@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_AR = @ac_ct_AR@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+plugindir = @plugindir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+plugin_LTLIBRARIES = libmouse.la
+libmouse_la_SOURCES = \
+ gsd-mouse-plugin.h \
+ gsd-mouse-plugin.c \
+ gsd-mouse-manager.h \
+ gsd-mouse-manager.c
+
+libmouse_la_CPPFLAGS = \
+ -I$(top_srcdir)/mate-settings-daemon \
+ -DMATE_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \
+ -DLIBEXECDIR=\""$(libexecdir)"\" \
+ $(AM_CPPFLAGS)
+
+libmouse_la_CFLAGS = \
+ $(SETTINGS_PLUGIN_CFLAGS) \
+ $(AM_CFLAGS)
+
+libmouse_la_LDFLAGS = \
+ $(GSD_PLUGIN_LDFLAGS)
+
+libmouse_la_LIBADD = \
+ $(SETTINGS_PLUGIN_LIBS) \
+ $(X11_LIBS) \
+ $(XINPUT_LIBS)
+
+plugin_in_files = mouse.mate-settings-plugin.in
+plugin_DATA = $(plugin_in_files:.mate-settings-plugin.in=.mate-settings-plugin)
+gsd_locate_pointer_SOURCES = \
+ gsd-locate-pointer.h \
+ gsd-locate-pointer.c \
+ gsd-timeline.h \
+ gsd-timeline.c
+
+gsd_locate_pointer_CFLAGS = \
+ $(SETTINGS_PLUGIN_CFLAGS) \
+ $(AM_CFLAGS)
+
+gsd_locate_pointer_LDADD = \
+ $(SETTINGS_PLUGIN_LIBS) \
+ $(X11_LIBS) \
+ -lm
+
+EXTRA_DIST = $(plugin_in_files)
+CLEANFILES = $(plugin_DATA)
+DISTCLEANFILES = $(plugin_DATA)
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu plugins/mouse/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu plugins/mouse/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES)
+ @$(NORMAL_INSTALL)
+ test -z "$(plugindir)" || $(MKDIR_P) "$(DESTDIR)$(plugindir)"
+ @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \
+ list2=; for p in $$list; do \
+ if test -f $$p; then \
+ list2="$$list2 $$p"; \
+ else :; fi; \
+ done; \
+ test -z "$$list2" || { \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \
+ }
+
+uninstall-pluginLTLIBRARIES:
+ @$(NORMAL_UNINSTALL)
+ @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \
+ done
+
+clean-pluginLTLIBRARIES:
+ -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES)
+ @list='$(plugin_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" != "$$p" || dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libmouse.la: $(libmouse_la_OBJECTS) $(libmouse_la_DEPENDENCIES)
+ $(libmouse_la_LINK) -rpath $(plugindir) $(libmouse_la_OBJECTS) $(libmouse_la_LIBADD) $(LIBS)
+install-libexecPROGRAMS: $(libexec_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(libexecdir)" || $(MKDIR_P) "$(DESTDIR)$(libexecdir)"
+ @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p || test -f $$p1; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(libexecdir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(libexecdir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-libexecPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(libexec_PROGRAMS)'; test -n "$(libexecdir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(libexecdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(libexecdir)" && rm -f $$files
+
+clean-libexecPROGRAMS:
+ @list='$(libexec_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+gsd-locate-pointer$(EXEEXT): $(gsd_locate_pointer_OBJECTS) $(gsd_locate_pointer_DEPENDENCIES)
+ @rm -f gsd-locate-pointer$(EXEEXT)
+ $(gsd_locate_pointer_LINK) $(gsd_locate_pointer_OBJECTS) $(gsd_locate_pointer_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_locate_pointer-gsd-locate-pointer.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gsd_locate_pointer-gsd-timeline.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmouse_la-gsd-mouse-manager.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libmouse_la-gsd-mouse-plugin.Plo@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
+
+libmouse_la-gsd-mouse-plugin.lo: gsd-mouse-plugin.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmouse_la_CPPFLAGS) $(CPPFLAGS) $(libmouse_la_CFLAGS) $(CFLAGS) -MT libmouse_la-gsd-mouse-plugin.lo -MD -MP -MF $(DEPDIR)/libmouse_la-gsd-mouse-plugin.Tpo -c -o libmouse_la-gsd-mouse-plugin.lo `test -f 'gsd-mouse-plugin.c' || echo '$(srcdir)/'`gsd-mouse-plugin.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libmouse_la-gsd-mouse-plugin.Tpo $(DEPDIR)/libmouse_la-gsd-mouse-plugin.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gsd-mouse-plugin.c' object='libmouse_la-gsd-mouse-plugin.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmouse_la_CPPFLAGS) $(CPPFLAGS) $(libmouse_la_CFLAGS) $(CFLAGS) -c -o libmouse_la-gsd-mouse-plugin.lo `test -f 'gsd-mouse-plugin.c' || echo '$(srcdir)/'`gsd-mouse-plugin.c
+
+libmouse_la-gsd-mouse-manager.lo: gsd-mouse-manager.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmouse_la_CPPFLAGS) $(CPPFLAGS) $(libmouse_la_CFLAGS) $(CFLAGS) -MT libmouse_la-gsd-mouse-manager.lo -MD -MP -MF $(DEPDIR)/libmouse_la-gsd-mouse-manager.Tpo -c -o libmouse_la-gsd-mouse-manager.lo `test -f 'gsd-mouse-manager.c' || echo '$(srcdir)/'`gsd-mouse-manager.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libmouse_la-gsd-mouse-manager.Tpo $(DEPDIR)/libmouse_la-gsd-mouse-manager.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gsd-mouse-manager.c' object='libmouse_la-gsd-mouse-manager.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libmouse_la_CPPFLAGS) $(CPPFLAGS) $(libmouse_la_CFLAGS) $(CFLAGS) -c -o libmouse_la-gsd-mouse-manager.lo `test -f 'gsd-mouse-manager.c' || echo '$(srcdir)/'`gsd-mouse-manager.c
+
+gsd_locate_pointer-gsd-locate-pointer.o: gsd-locate-pointer.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_locate_pointer_CFLAGS) $(CFLAGS) -MT gsd_locate_pointer-gsd-locate-pointer.o -MD -MP -MF $(DEPDIR)/gsd_locate_pointer-gsd-locate-pointer.Tpo -c -o gsd_locate_pointer-gsd-locate-pointer.o `test -f 'gsd-locate-pointer.c' || echo '$(srcdir)/'`gsd-locate-pointer.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/gsd_locate_pointer-gsd-locate-pointer.Tpo $(DEPDIR)/gsd_locate_pointer-gsd-locate-pointer.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gsd-locate-pointer.c' object='gsd_locate_pointer-gsd-locate-pointer.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_locate_pointer_CFLAGS) $(CFLAGS) -c -o gsd_locate_pointer-gsd-locate-pointer.o `test -f 'gsd-locate-pointer.c' || echo '$(srcdir)/'`gsd-locate-pointer.c
+
+gsd_locate_pointer-gsd-locate-pointer.obj: gsd-locate-pointer.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_locate_pointer_CFLAGS) $(CFLAGS) -MT gsd_locate_pointer-gsd-locate-pointer.obj -MD -MP -MF $(DEPDIR)/gsd_locate_pointer-gsd-locate-pointer.Tpo -c -o gsd_locate_pointer-gsd-locate-pointer.obj `if test -f 'gsd-locate-pointer.c'; then $(CYGPATH_W) 'gsd-locate-pointer.c'; else $(CYGPATH_W) '$(srcdir)/gsd-locate-pointer.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/gsd_locate_pointer-gsd-locate-pointer.Tpo $(DEPDIR)/gsd_locate_pointer-gsd-locate-pointer.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gsd-locate-pointer.c' object='gsd_locate_pointer-gsd-locate-pointer.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_locate_pointer_CFLAGS) $(CFLAGS) -c -o gsd_locate_pointer-gsd-locate-pointer.obj `if test -f 'gsd-locate-pointer.c'; then $(CYGPATH_W) 'gsd-locate-pointer.c'; else $(CYGPATH_W) '$(srcdir)/gsd-locate-pointer.c'; fi`
+
+gsd_locate_pointer-gsd-timeline.o: gsd-timeline.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_locate_pointer_CFLAGS) $(CFLAGS) -MT gsd_locate_pointer-gsd-timeline.o -MD -MP -MF $(DEPDIR)/gsd_locate_pointer-gsd-timeline.Tpo -c -o gsd_locate_pointer-gsd-timeline.o `test -f 'gsd-timeline.c' || echo '$(srcdir)/'`gsd-timeline.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/gsd_locate_pointer-gsd-timeline.Tpo $(DEPDIR)/gsd_locate_pointer-gsd-timeline.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gsd-timeline.c' object='gsd_locate_pointer-gsd-timeline.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_locate_pointer_CFLAGS) $(CFLAGS) -c -o gsd_locate_pointer-gsd-timeline.o `test -f 'gsd-timeline.c' || echo '$(srcdir)/'`gsd-timeline.c
+
+gsd_locate_pointer-gsd-timeline.obj: gsd-timeline.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_locate_pointer_CFLAGS) $(CFLAGS) -MT gsd_locate_pointer-gsd-timeline.obj -MD -MP -MF $(DEPDIR)/gsd_locate_pointer-gsd-timeline.Tpo -c -o gsd_locate_pointer-gsd-timeline.obj `if test -f 'gsd-timeline.c'; then $(CYGPATH_W) 'gsd-timeline.c'; else $(CYGPATH_W) '$(srcdir)/gsd-timeline.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/gsd_locate_pointer-gsd-timeline.Tpo $(DEPDIR)/gsd_locate_pointer-gsd-timeline.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gsd-timeline.c' object='gsd_locate_pointer-gsd-timeline.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(gsd_locate_pointer_CFLAGS) $(CFLAGS) -c -o gsd_locate_pointer-gsd-timeline.obj `if test -f 'gsd-timeline.c'; then $(CYGPATH_W) 'gsd-timeline.c'; else $(CYGPATH_W) '$(srcdir)/gsd-timeline.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-pluginDATA: $(plugin_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(plugindir)" || $(MKDIR_P) "$(DESTDIR)$(plugindir)"
+ @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(plugindir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(plugindir)" || exit $$?; \
+ done
+
+uninstall-pluginDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(plugindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(plugindir)" && rm -f $$files
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(libexecdir)" "$(DESTDIR)$(plugindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+ -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libexecPROGRAMS clean-libtool \
+ clean-pluginLTLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-pluginDATA install-pluginLTLIBRARIES
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-libexecPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-libexecPROGRAMS uninstall-pluginDATA \
+ uninstall-pluginLTLIBRARIES
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libexecPROGRAMS clean-libtool clean-pluginLTLIBRARIES \
+ ctags distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-libexecPROGRAMS install-man \
+ install-pdf install-pdf-am install-pluginDATA \
+ install-pluginLTLIBRARIES install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ pdf pdf-am ps ps-am tags uninstall uninstall-am \
+ uninstall-libexecPROGRAMS uninstall-pluginDATA \
+ uninstall-pluginLTLIBRARIES
+
+
+@GSD_INTLTOOL_PLUGIN_RULE@
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/plugins/mouse/gsd-locate-pointer.c b/plugins/mouse/gsd-locate-pointer.c
new file mode 100644
index 0000000..acb2445
--- /dev/null
+++ b/plugins/mouse/gsd-locate-pointer.c
@@ -0,0 +1,504 @@
+/* gsd-locate-pointer.c
+ *
+ * Copyright (C) 2008 Carlos Garnacho <[email protected]>
+ *
+ * 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 <gtk/gtk.h>
+#include "gsd-timeline.h"
+#include "gsd-locate-pointer.h"
+
+#include <gdk/gdkkeysyms.h>
+#include <gdk/gdkx.h>
+#include <X11/keysym.h>
+
+#define ANIMATION_LENGTH 750
+#define WINDOW_SIZE 101
+#define N_CIRCLES 4
+
+/* All circles are supposed to be moving when progress
+ * reaches 0.5, and each of them are supposed to long
+ * for half of the progress, hence the need of 0.5 to
+ * get the circles interval, and the multiplication
+ * by 2 to know a circle progress */
+#define CIRCLES_PROGRESS_INTERVAL (0.5 / N_CIRCLES)
+#define CIRCLE_PROGRESS(p) (MIN (1., ((gdouble) (p) * 2.)))
+
+typedef struct GsdLocatePointerData GsdLocatePointerData;
+
+struct GsdLocatePointerData
+{
+ GsdTimeline *timeline;
+ GtkWidget *widget;
+ GdkWindow *window;
+
+ gdouble progress;
+};
+
+static GsdLocatePointerData *data = NULL;
+
+static void
+locate_pointer_paint (GsdLocatePointerData *data,
+ cairo_t *cr,
+ gboolean composite)
+{
+ GdkColor color;
+ gdouble progress, circle_progress;
+ gint width, height, i;
+ GtkStyle *style;
+
+ progress = data->progress;
+
+ #if GTK_CHECK_VERSION(3, 0, 0)
+ width = gdk_window_get_width(GDK_WINDOW(data->window));
+ height = gdk_window_get_height(GDK_WINDOW(data->window));
+ #else
+ gdk_drawable_get_size(data->window, &width, &height);
+ #endif
+
+ style = gtk_widget_get_style (data->widget);
+ color = style->bg[GTK_STATE_SELECTED];
+
+ cairo_set_source_rgba (cr, 1., 1., 1., 0.);
+ cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
+ cairo_paint (cr);
+
+ for (i = 0; i <= N_CIRCLES; i++)
+ {
+ if (progress < 0.)
+ break;
+
+ circle_progress = MIN (1., (progress * 2));
+ progress -= CIRCLES_PROGRESS_INTERVAL;
+
+ if (circle_progress >= 1.)
+ continue;
+
+ if (composite)
+ {
+ cairo_set_source_rgba (cr,
+ color.red / 65535.,
+ color.green / 65535.,
+ color.blue / 65535.,
+ 1 - circle_progress);
+ cairo_arc (cr,
+ width / 2,
+ height / 2,
+ circle_progress * width / 2,
+ 0, 2 * G_PI);
+
+ cairo_fill (cr);
+ cairo_stroke (cr);
+ }
+ else
+ {
+ cairo_set_source_rgb (cr, 0., 0., 0.);
+ cairo_set_line_width (cr, 3.);
+ cairo_arc (cr,
+ width / 2,
+ height / 2,
+ circle_progress * width / 2,
+ 0, 2 * G_PI);
+ cairo_stroke (cr);
+
+ cairo_set_source_rgb (cr, 1., 1., 1.);
+ cairo_set_line_width (cr, 1.);
+ cairo_arc (cr,
+ width / 2,
+ height / 2,
+ circle_progress * width / 2,
+ 0, 2 * G_PI);
+ cairo_stroke (cr);
+ }
+ }
+}
+
+static gboolean
+locate_pointer_expose (GtkWidget *widget,
+ GdkEventExpose *event,
+ gpointer user_data)
+{
+ GsdLocatePointerData *data = (GsdLocatePointerData *) user_data;
+ cairo_t *cr;
+
+ if (event->window != data->window)
+ return FALSE;
+
+ cr = gdk_cairo_create (data->window);
+ locate_pointer_paint (data, cr, gtk_widget_is_composited (data->widget));
+ cairo_destroy (cr);
+
+ return TRUE;
+}
+
+static void
+update_shape (GsdLocatePointerData *data)
+{
+ cairo_t *cr;
+ GdkBitmap *mask;
+
+ mask = gdk_pixmap_new (data->window, WINDOW_SIZE, WINDOW_SIZE, 1);
+ cr = gdk_cairo_create (mask);
+ locate_pointer_paint (data, cr, FALSE);
+ gdk_window_shape_combine_mask (data->window, mask, 0, 0);
+ g_object_unref (mask);
+ cairo_destroy (cr);
+}
+
+static void
+timeline_frame_cb (GsdTimeline *timeline,
+ gdouble progress,
+ gpointer user_data)
+{
+ GsdLocatePointerData *data = (GsdLocatePointerData *) user_data;
+ GdkScreen *screen;
+ gint cursor_x, cursor_y;
+
+ if (gtk_widget_is_composited (data->widget))
+ {
+ gdk_window_invalidate_rect (data->window, NULL, FALSE);
+ data->progress = progress;
+ }
+ else if (progress >= data->progress + CIRCLES_PROGRESS_INTERVAL)
+ {
+ /* only invalidate window each circle interval */
+ update_shape (data);
+ gdk_window_invalidate_rect (data->window, NULL, FALSE);
+ data->progress += CIRCLES_PROGRESS_INTERVAL;
+ }
+
+ screen = gdk_drawable_get_screen (data->window);
+ gdk_window_get_pointer (gdk_screen_get_root_window (screen),
+ &cursor_x, &cursor_y, NULL);
+ gdk_window_move (data->window,
+ cursor_x - WINDOW_SIZE / 2,
+ cursor_y - WINDOW_SIZE / 2);
+}
+
+static void
+set_transparent_shape (GdkWindow *window)
+{
+ GdkBitmap *mask;
+ cairo_t *cr;
+
+ mask = gdk_pixmap_new (data->window, WINDOW_SIZE, WINDOW_SIZE, 1);
+ cr = gdk_cairo_create (mask);
+
+ cairo_set_source_rgba (cr, 1., 1., 1., 0.);
+ cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
+ cairo_paint (cr);
+
+ gdk_window_shape_combine_mask (data->window, mask, 0, 0);
+ g_object_unref (mask);
+ cairo_destroy (cr);
+}
+
+static void
+unset_transparent_shape (GdkWindow *window)
+{
+ gdk_window_shape_combine_mask (data->window, NULL, 0, 0);
+}
+
+static void
+composited_changed (GtkWidget *widget,
+ GsdLocatePointerData *data)
+{
+ if (!gtk_widget_is_composited (widget))
+ set_transparent_shape (data->window);
+ else
+ unset_transparent_shape (data->window);
+}
+
+static void
+timeline_finished_cb (GsdTimeline *timeline,
+ gpointer user_data)
+{
+ GsdLocatePointerData *data = (GsdLocatePointerData *) user_data;
+
+ /* set transparent shape and hide window */
+ if (!gtk_widget_is_composited (data->widget))
+ set_transparent_shape (data->window);
+
+ gdk_window_hide (data->window);
+}
+
+static void
+create_window (GsdLocatePointerData *data,
+ GdkScreen *screen)
+{
+ GdkColormap *colormap;
+ GdkVisual *visual;
+ GdkWindowAttr attributes;
+
+ colormap = gdk_screen_get_rgba_colormap (screen);
+ visual = gdk_screen_get_rgba_visual (screen);
+
+ if (!colormap)
+ {
+ colormap = gdk_screen_get_rgb_colormap (screen);
+ visual = gdk_screen_get_rgb_visual (screen);
+ }
+
+ attributes.window_type = GDK_WINDOW_TEMP;
+ attributes.wclass = GDK_INPUT_OUTPUT;
+ attributes.visual = visual;
+ attributes.colormap = colormap;
+ attributes.event_mask = GDK_VISIBILITY_NOTIFY_MASK | GDK_EXPOSURE_MASK;
+ attributes.width = 1;
+ attributes.height = 1;
+
+ data->window = gdk_window_new (gdk_screen_get_root_window (screen),
+ &attributes,
+ GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP);
+
+ gdk_window_set_user_data (data->window, data->widget);
+}
+
+static GsdLocatePointerData *
+gsd_locate_pointer_data_new (GdkScreen *screen)
+{
+ GsdLocatePointerData *data;
+
+ data = g_new0 (GsdLocatePointerData, 1);
+
+ /* this widget will never be shown, it's
+ * mainly used to get signals/events from
+ */
+ data->widget = gtk_window_new (GTK_WINDOW_POPUP);
+ gtk_widget_realize (data->widget);
+
+ g_signal_connect (G_OBJECT (data->widget), "expose_event",
+ G_CALLBACK (locate_pointer_expose),
+ data);
+
+ data->timeline = gsd_timeline_new (ANIMATION_LENGTH);
+ g_signal_connect (data->timeline, "frame",
+ G_CALLBACK (timeline_frame_cb), data);
+ g_signal_connect (data->timeline, "finished",
+ G_CALLBACK (timeline_finished_cb), data);
+
+ create_window (data, screen);
+
+ return data;
+}
+
+static void
+move_locate_pointer_window (GsdLocatePointerData *data,
+ GdkScreen *screen)
+{
+ gint cursor_x, cursor_y;
+ GdkBitmap *mask;
+ GdkColor col;
+ GdkGC *gc;
+
+ gdk_window_get_pointer (gdk_screen_get_root_window (screen), &cursor_x, &cursor_y, NULL);
+
+ gdk_window_move_resize (data->window,
+ cursor_x - WINDOW_SIZE / 2,
+ cursor_y - WINDOW_SIZE / 2,
+ WINDOW_SIZE, WINDOW_SIZE);
+
+ col.pixel = 0;
+ mask = gdk_pixmap_new (data->window, WINDOW_SIZE, WINDOW_SIZE, 1);
+
+ gc = gdk_gc_new (mask);
+ gdk_gc_set_foreground (gc, &col);
+ gdk_draw_rectangle (mask, gc, TRUE, 0, 0, WINDOW_SIZE, WINDOW_SIZE);
+
+ /* allow events to happen through the window */
+ gdk_window_input_shape_combine_mask (data->window, mask, 0, 0);
+
+ g_object_unref (mask);
+ g_object_unref (gc);
+}
+
+void
+gsd_locate_pointer (GdkScreen *screen)
+{
+ if (!data)
+ data = gsd_locate_pointer_data_new (screen);
+
+ gsd_timeline_pause (data->timeline);
+ gsd_timeline_rewind (data->timeline);
+
+ /* Create again the window if it is not for the current screen */
+ if (gdk_screen_get_number (screen) != gdk_screen_get_number (gdk_drawable_get_screen (data->window)))
+ {
+ gdk_window_set_user_data (data->window, NULL);
+ gdk_window_destroy (data->window);
+
+ create_window (data, screen);
+ }
+
+ data->progress = 0.;
+
+ g_signal_connect (data->widget, "composited-changed",
+ G_CALLBACK (composited_changed), data);
+
+ move_locate_pointer_window (data, screen);
+ composited_changed (data->widget, data);
+ gdk_window_show (data->window);
+
+ gsd_timeline_start (data->timeline);
+}
+
+
+#define KEYBOARD_GROUP_SHIFT 13
+#define KEYBOARD_GROUP_MASK ((1 << 13) | (1 << 14))
+
+/* Owen magic */
+static GdkFilterReturn
+filter (GdkXEvent *xevent,
+ GdkEvent *event,
+ gpointer data)
+{
+ XEvent *xev = (XEvent *) xevent;
+ guint keyval;
+ gint group;
+
+ GdkScreen *screen = (GdkScreen *)data;
+
+ if (xev->type == KeyPress || xev->type == KeyRelease)
+ {
+ /* get the keysym */
+ group = (xev->xkey.state & KEYBOARD_GROUP_MASK) >> KEYBOARD_GROUP_SHIFT;
+ gdk_keymap_translate_keyboard_state (gdk_keymap_get_default (),
+ xev->xkey.keycode,
+ xev->xkey.state,
+ group,
+ &keyval,
+ NULL, NULL, NULL);
+ if (keyval == GDK_Control_L || keyval == GDK_Control_R)
+ {
+ if (xev->type == KeyPress)
+ {
+ XAllowEvents (xev->xkey.display,
+ SyncKeyboard,
+ xev->xkey.time);
+ }
+ else
+ {
+ XAllowEvents (xev->xkey.display,
+ AsyncKeyboard,
+ xev->xkey.time);
+ gsd_locate_pointer (screen);
+ }
+ }
+ else
+ {
+ XAllowEvents (xev->xkey.display,
+ ReplayKeyboard,
+ xev->xkey.time);
+ XUngrabKeyboard (gdk_x11_get_default_xdisplay (),
+ xev->xkey.time);
+ }
+ }
+
+ return GDK_FILTER_CONTINUE;
+}
+
+static void
+set_locate_pointer (void)
+{
+ GdkKeymapKey *keys;
+ GdkDisplay *display;
+ int n_screens;
+ int n_keys;
+ gboolean has_entries;
+ static const guint keyvals[] = { GDK_Control_L, GDK_Control_R };
+ unsigned j;
+
+ display = gdk_display_get_default ();
+ n_screens = gdk_display_get_n_screens (display);
+
+ for (j = 0 ; j < G_N_ELEMENTS (keyvals) ; j++)
+ {
+ has_entries = gdk_keymap_get_entries_for_keyval (gdk_keymap_get_default (),
+ keyvals[j],
+ &keys,
+ &n_keys);
+ if (has_entries)
+ {
+ gint i, j;
+ for (i = 0; i < n_keys; i++)
+ {
+ for (j=0; j< n_screens; j++)
+ {
+ GdkScreen *screen;
+ Window xroot;
+
+ screen = gdk_display_get_screen (display, j);
+ xroot = gdk_x11_drawable_get_xid (gdk_screen_get_root_window (screen));
+
+ XGrabKey (GDK_DISPLAY_XDISPLAY (display),
+ keys[i].keycode,
+ 0,
+ xroot,
+ False,
+ GrabModeAsync,
+ GrabModeSync);
+ XGrabKey (GDK_DISPLAY_XDISPLAY (display),
+ keys[i].keycode,
+ LockMask,
+ xroot,
+ False,
+ GrabModeAsync,
+ GrabModeSync);
+ XGrabKey (GDK_DISPLAY_XDISPLAY (display),
+ keys[i].keycode,
+ Mod2Mask,
+ xroot,
+ False,
+ GrabModeAsync,
+ GrabModeSync);
+ XGrabKey (GDK_DISPLAY_XDISPLAY (display),
+ keys[i].keycode,
+ Mod4Mask,
+ xroot,
+ False,
+ GrabModeAsync,
+ GrabModeSync);
+ }
+ }
+
+ g_free (keys);
+
+ for (i = 0; i < n_screens; i++)
+ {
+ GdkScreen *screen;
+
+ screen = gdk_display_get_screen (display, i);
+ gdk_window_add_filter (gdk_screen_get_root_window (screen),
+ filter,
+ screen);
+ }
+ }
+ }
+}
+
+
+int
+main (int argc, char *argv[])
+{
+ gtk_init (&argc, &argv);
+
+ set_locate_pointer ();
+
+ gtk_main ();
+
+ return 0;
+}
+
diff --git a/plugins/mouse/gsd-locate-pointer.h b/plugins/mouse/gsd-locate-pointer.h
new file mode 100644
index 0000000..3b261a5
--- /dev/null
+++ b/plugins/mouse/gsd-locate-pointer.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright � 2001 Jonathan Blandford <[email protected]>
+ *
+ * Permission to use, copy, modify, distribute, and sell this software and its
+ * documentation for any purpose is hereby granted without fee, provided that
+ * the above copyright notice appear in all copies and that both that
+ * copyright notice and this permission notice appear in supporting
+ * documentation, and that the name of Red Hat not be used in advertising or
+ * publicity pertaining to distribution of the software without specific,
+ * written prior permission. Red Hat makes no representations about the
+ * suitability of this software for any purpose. It is provided "as is"
+ * without express or implied warranty.
+ *
+ * Authors: Jonathan Blandford
+ */
+
+#ifndef LOCATE_POINTER_H
+#define LOCATE_POINTER_H
+
+#include <gdk/gdk.h>
+
+void gsd_locate_pointer (GdkScreen *screen);
+
+#endif
diff --git a/plugins/mouse/gsd-mouse-manager.c b/plugins/mouse/gsd-mouse-manager.c
new file mode 100644
index 0000000..124653a
--- /dev/null
+++ b/plugins/mouse/gsd-mouse-manager.c
@@ -0,0 +1,1124 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 William Jon McCann <[email protected]>
+ *
+ * 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 <sys/types.h>
+#include <sys/wait.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+#include <math.h>
+
+#include <locale.h>
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+#include <gdk/gdk.h>
+#include <gdk/gdkx.h>
+#include <gdk/gdkkeysyms.h>
+#include <X11/keysym.h>
+#include <X11/Xatom.h>
+
+#ifdef HAVE_X11_EXTENSIONS_XINPUT_H
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/XIproto.h>
+#endif
+#include <mateconf/mateconf.h>
+#include <mateconf/mateconf-client.h>
+
+#include "mate-settings-profile.h"
+#include "gsd-mouse-manager.h"
+
+#define GSD_MOUSE_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSD_TYPE_MOUSE_MANAGER, GsdMouseManagerPrivate))
+
+#define MATECONF_MOUSE_DIR "/desktop/mate/peripherals/mouse"
+#define MATECONF_MOUSE_A11Y_DIR "/desktop/mate/accessibility/mouse"
+#define MATECONF_TOUCHPAD_DIR "/desktop/mate/peripherals/touchpad"
+
+#define KEY_LEFT_HANDED MATECONF_MOUSE_DIR "/left_handed"
+#define KEY_MOTION_ACCELERATION MATECONF_MOUSE_DIR "/motion_acceleration"
+#define KEY_MOTION_THRESHOLD MATECONF_MOUSE_DIR "/motion_threshold"
+#define KEY_LOCATE_POINTER MATECONF_MOUSE_DIR "/locate_pointer"
+#define KEY_DWELL_ENABLE MATECONF_MOUSE_A11Y_DIR "/dwell_enable"
+#define KEY_DELAY_ENABLE MATECONF_MOUSE_A11Y_DIR "/delay_enable"
+#define KEY_TOUCHPAD_DISABLE_W_TYPING MATECONF_TOUCHPAD_DIR "/disable_while_typing"
+#ifdef HAVE_X11_EXTENSIONS_XINPUT_H
+#define KEY_TAP_TO_CLICK MATECONF_TOUCHPAD_DIR "/tap_to_click"
+#define KEY_SCROLL_METHOD MATECONF_TOUCHPAD_DIR "/scroll_method"
+#define KEY_PAD_HORIZ_SCROLL MATECONF_TOUCHPAD_DIR "/horiz_scroll_enabled"
+#define KEY_TOUCHPAD_ENABLED MATECONF_TOUCHPAD_DIR "/touchpad_enabled"
+#endif
+
+struct GsdMouseManagerPrivate
+{
+ guint notify;
+ guint notify_a11y;
+ guint notify_touchpad;
+
+ gboolean mousetweaks_daemon_running;
+ gboolean syndaemon_spawned;
+ GPid syndaemon_pid;
+ gboolean locate_pointer_spawned;
+ GPid locate_pointer_pid;
+};
+
+static void gsd_mouse_manager_class_init (GsdMouseManagerClass *klass);
+static void gsd_mouse_manager_init (GsdMouseManager *mouse_manager);
+static void gsd_mouse_manager_finalize (GObject *object);
+static void set_mouse_settings (GsdMouseManager *manager);
+#ifdef HAVE_X11_EXTENSIONS_XINPUT_H
+static int set_tap_to_click (gboolean state, gboolean left_handed);
+static XDevice* device_is_touchpad (XDeviceInfo deviceinfo);
+#endif
+
+G_DEFINE_TYPE (GsdMouseManager, gsd_mouse_manager, G_TYPE_OBJECT)
+
+static gpointer manager_object = NULL;
+
+static void
+gsd_mouse_manager_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GsdMouseManager *self;
+
+ self = GSD_MOUSE_MANAGER (object);
+
+ switch (prop_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gsd_mouse_manager_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GsdMouseManager *self;
+
+ self = GSD_MOUSE_MANAGER (object);
+
+ switch (prop_id) {
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static GObject *
+gsd_mouse_manager_constructor (GType type,
+ guint n_construct_properties,
+ GObjectConstructParam *construct_properties)
+{
+ GsdMouseManager *mouse_manager;
+ GsdMouseManagerClass *klass;
+
+ klass = GSD_MOUSE_MANAGER_CLASS (g_type_class_peek (GSD_TYPE_MOUSE_MANAGER));
+
+ mouse_manager = GSD_MOUSE_MANAGER (G_OBJECT_CLASS (gsd_mouse_manager_parent_class)->constructor (type,
+ n_construct_properties,
+ construct_properties));
+
+ return G_OBJECT (mouse_manager);
+}
+
+static void
+gsd_mouse_manager_dispose (GObject *object)
+{
+ GsdMouseManager *mouse_manager;
+
+ mouse_manager = GSD_MOUSE_MANAGER (object);
+
+ G_OBJECT_CLASS (gsd_mouse_manager_parent_class)->dispose (object);
+}
+
+static void
+gsd_mouse_manager_class_init (GsdMouseManagerClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->get_property = gsd_mouse_manager_get_property;
+ object_class->set_property = gsd_mouse_manager_set_property;
+ object_class->constructor = gsd_mouse_manager_constructor;
+ object_class->dispose = gsd_mouse_manager_dispose;
+ object_class->finalize = gsd_mouse_manager_finalize;
+
+ g_type_class_add_private (klass, sizeof (GsdMouseManagerPrivate));
+}
+
+
+#ifdef HAVE_X11_EXTENSIONS_XINPUT_H
+static gboolean
+supports_xinput_devices (void)
+{
+ gint op_code, event, error;
+
+ return XQueryExtension (GDK_DISPLAY (),
+ "XInputExtension",
+ &op_code,
+ &event,
+ &error);
+}
+#endif
+
+static void
+configure_button_layout (guchar *buttons,
+ gint n_buttons,
+ gboolean left_handed)
+{
+ const gint left_button = 1;
+ gint right_button;
+ gint i;
+
+ /* if the button is higher than 2 (3rd button) then it's
+ * probably one direction of a scroll wheel or something else
+ * uninteresting
+ */
+ right_button = MIN (n_buttons, 3);
+
+ /* If we change things we need to make sure we only swap buttons.
+ * If we end up with multiple physical buttons assigned to the same
+ * logical button the server will complain. This code assumes physical
+ * button 0 is the physical left mouse button, and that the physical
+ * button other than 0 currently assigned left_button or right_button
+ * is the physical right mouse button.
+ */
+
+ /* check if the current mapping satisfies the above assumptions */
+ if (buttons[left_button - 1] != left_button &&
+ buttons[left_button - 1] != right_button)
+ /* The current mapping is weird. Swapping buttons is probably not a
+ * good idea.
+ */
+ return;
+
+ /* check if we are left_handed and currently not swapped */
+ if (left_handed && buttons[left_button - 1] == left_button) {
+ /* find the right button */
+ for (i = 0; i < n_buttons; i++) {
+ if (buttons[i] == right_button) {
+ buttons[i] = left_button;
+ break;
+ }
+ }
+ /* swap the buttons */
+ buttons[left_button - 1] = right_button;
+ }
+ /* check if we are not left_handed but are swapped */
+ else if (!left_handed && buttons[left_button - 1] == right_button) {
+ /* find the right button */
+ for (i = 0; i < n_buttons; i++) {
+ if (buttons[i] == left_button) {
+ buttons[i] = right_button;
+ break;
+ }
+ }
+ /* swap the buttons */
+ buttons[left_button - 1] = left_button;
+ }
+}
+
+#ifdef HAVE_X11_EXTENSIONS_XINPUT_H
+static gboolean
+xinput_device_has_buttons (XDeviceInfo *device_info)
+{
+ int i;
+ XAnyClassInfo *class_info;
+
+ class_info = device_info->inputclassinfo;
+ for (i = 0; i < device_info->num_classes; i++) {
+ if (class_info->class == ButtonClass) {
+ XButtonInfo *button_info;
+
+ button_info = (XButtonInfo *) class_info;
+ if (button_info->num_buttons > 0)
+ return TRUE;
+ }
+
+ class_info = (XAnyClassInfo *) (((guchar *) class_info) +
+ class_info->length);
+ }
+ return FALSE;
+}
+
+static gboolean
+touchpad_has_single_button (XDevice *device)
+{
+ Atom type, prop;
+ int format;
+ unsigned long nitems, bytes_after;
+ unsigned char *data;
+ gboolean is_single_button = FALSE;
+ int rc;
+
+ prop = XInternAtom (GDK_DISPLAY (), "Synaptics Capabilities", False);
+ if (!prop)
+ return FALSE;
+
+ gdk_error_trap_push ();
+ rc = XGetDeviceProperty (GDK_DISPLAY (), device, prop, 0, 1, False,
+ XA_INTEGER, &type, &format, &nitems,
+ &bytes_after, &data);
+ if (rc == Success && type == XA_INTEGER && format == 8 && nitems >= 3)
+ is_single_button = (data[0] == 1 && data[1] == 0 && data[2] == 0);
+
+ if (rc == Success)
+ XFree (data);
+
+ gdk_error_trap_pop ();
+
+ return is_single_button;
+}
+
+
+static void
+set_xinput_devices_left_handed (gboolean left_handed)
+{
+ XDeviceInfo *device_info;
+ gint n_devices;
+ guchar *buttons;
+ gsize buttons_capacity = 16;
+ gint n_buttons;
+ gint i;
+
+ device_info = XListInputDevices (GDK_DISPLAY (), &n_devices);
+
+ if (n_devices > 0)
+ buttons = g_new (guchar, buttons_capacity);
+ else
+ buttons = NULL;
+
+ for (i = 0; i < n_devices; i++) {
+ XDevice *device = NULL;
+
+ if ((device_info[i].use == IsXPointer) ||
+ (device_info[i].use == IsXKeyboard) ||
+ (!xinput_device_has_buttons (&device_info[i])))
+ continue;
+
+ /* If the device is a touchpad, swap tap buttons
+ * around too, otherwise a tap would be a right-click */
+ device = device_is_touchpad (device_info[i]);
+ if (device != NULL) {
+ MateConfClient *client = mateconf_client_get_default ();
+ gboolean tap = mateconf_client_get_bool (client, KEY_TAP_TO_CLICK, NULL);
+ gboolean single_button = touchpad_has_single_button (device);
+
+ if (tap && !single_button)
+ set_tap_to_click (tap, left_handed);
+ XCloseDevice (GDK_DISPLAY (), device);
+ g_object_unref (client);
+
+ if (single_button)
+ continue;
+ }
+
+ gdk_error_trap_push ();
+
+ device = XOpenDevice (GDK_DISPLAY (), device_info[i].id);
+
+ if ((gdk_error_trap_pop () != 0) ||
+ (device == NULL))
+ continue;
+
+ n_buttons = XGetDeviceButtonMapping (GDK_DISPLAY (), device,
+ buttons,
+ buttons_capacity);
+
+ while (n_buttons > buttons_capacity) {
+ buttons_capacity = n_buttons;
+ buttons = (guchar *) g_realloc (buttons,
+ buttons_capacity * sizeof (guchar));
+
+ n_buttons = XGetDeviceButtonMapping (GDK_DISPLAY (), device,
+ buttons,
+ buttons_capacity);
+ }
+
+ configure_button_layout (buttons, n_buttons, left_handed);
+
+ XSetDeviceButtonMapping (GDK_DISPLAY (), device, buttons, n_buttons);
+ XCloseDevice (GDK_DISPLAY (), device);
+ }
+ g_free (buttons);
+
+ if (device_info != NULL)
+ XFreeDeviceList (device_info);
+}
+
+static GdkFilterReturn
+devicepresence_filter (GdkXEvent *xevent,
+ GdkEvent *event,
+ gpointer data)
+{
+ XEvent *xev = (XEvent *) xevent;
+ XEventClass class_presence;
+ int xi_presence;
+
+ DevicePresence (gdk_x11_get_default_xdisplay (), xi_presence, class_presence);
+
+ if (xev->type == xi_presence)
+ {
+ XDevicePresenceNotifyEvent *dpn = (XDevicePresenceNotifyEvent *) xev;
+ if (dpn->devchange == DeviceEnabled)
+ set_mouse_settings ((GsdMouseManager *) data);
+ }
+ return GDK_FILTER_CONTINUE;
+}
+
+static void
+set_devicepresence_handler (GsdMouseManager *manager)
+{
+ Display *display;
+ XEventClass class_presence;
+ int xi_presence;
+
+ if (!supports_xinput_devices ())
+ return;
+
+ display = gdk_x11_get_default_xdisplay ();
+
+ gdk_error_trap_push ();
+ DevicePresence (display, xi_presence, class_presence);
+ XSelectExtensionEvent (display,
+ RootWindow (display, DefaultScreen (display)),
+ &class_presence, 1);
+
+ gdk_flush ();
+ if (!gdk_error_trap_pop ())
+ gdk_window_add_filter (NULL, devicepresence_filter, manager);
+}
+#endif
+
+static void
+set_left_handed (GsdMouseManager *manager,
+ gboolean left_handed)
+{
+ guchar *buttons ;
+ gsize buttons_capacity = 16;
+ gint n_buttons, i;
+
+#ifdef HAVE_X11_EXTENSIONS_XINPUT_H
+ if (supports_xinput_devices ()) {
+ /* When XInput support is available, never set the
+ * button ordering on the core pointer as that would
+ * revert the changes we make on the devices themselves */
+ set_xinput_devices_left_handed (left_handed);
+ return;
+ }
+#endif
+
+ buttons = g_new (guchar, buttons_capacity);
+ n_buttons = XGetPointerMapping (GDK_DISPLAY (),
+ buttons,
+ (gint) buttons_capacity);
+ while (n_buttons > buttons_capacity) {
+ buttons_capacity = n_buttons;
+ buttons = (guchar *) g_realloc (buttons,
+ buttons_capacity * sizeof (guchar));
+
+ n_buttons = XGetPointerMapping (GDK_DISPLAY (),
+ buttons,
+ (gint) buttons_capacity);
+ }
+
+ configure_button_layout (buttons, n_buttons, left_handed);
+
+ /* X refuses to change the mapping while buttons are engaged,
+ * so if this is the case we'll retry a few times
+ */
+ for (i = 0;
+ i < 20 && XSetPointerMapping (GDK_DISPLAY (), buttons, n_buttons) == MappingBusy;
+ ++i) {
+ g_usleep (300);
+ }
+
+ g_free (buttons);
+}
+
+static void
+set_motion_acceleration (GsdMouseManager *manager,
+ gfloat motion_acceleration)
+{
+ gint numerator, denominator;
+
+ if (motion_acceleration >= 1.0) {
+ /* we want to get the acceleration, with a resolution of 0.5
+ */
+ if ((motion_acceleration - floor (motion_acceleration)) < 0.25) {
+ numerator = floor (motion_acceleration);
+ denominator = 1;
+ } else if ((motion_acceleration - floor (motion_acceleration)) < 0.5) {
+ numerator = ceil (2.0 * motion_acceleration);
+ denominator = 2;
+ } else if ((motion_acceleration - floor (motion_acceleration)) < 0.75) {
+ numerator = floor (2.0 *motion_acceleration);
+ denominator = 2;
+ } else {
+ numerator = ceil (motion_acceleration);
+ denominator = 1;
+ }
+ } else if (motion_acceleration < 1.0 && motion_acceleration > 0) {
+ /* This we do to 1/10ths */
+ numerator = floor (motion_acceleration * 10) + 1;
+ denominator= 10;
+ } else {
+ numerator = -1;
+ denominator = -1;
+ }
+
+ XChangePointerControl (GDK_DISPLAY (), True, False,
+ numerator, denominator,
+ 0);
+}
+
+static void
+set_motion_threshold (GsdMouseManager *manager,
+ int motion_threshold)
+{
+ XChangePointerControl (GDK_DISPLAY (), False, True,
+ 0, 0, motion_threshold);
+}
+
+#ifdef HAVE_X11_EXTENSIONS_XINPUT_H
+static XDevice*
+device_is_touchpad (XDeviceInfo deviceinfo)
+{
+ XDevice *device;
+ Atom realtype, prop;
+ int realformat;
+ unsigned long nitems, bytes_after;
+ unsigned char *data;
+
+ if (deviceinfo.type != XInternAtom (GDK_DISPLAY (), XI_TOUCHPAD, False))
+ return NULL;
+
+ prop = XInternAtom (GDK_DISPLAY (), "Synaptics Off", False);
+ if (!prop)
+ return NULL;
+
+ gdk_error_trap_push ();
+ device = XOpenDevice (GDK_DISPLAY (), deviceinfo.id);
+ if (gdk_error_trap_pop () || (device == NULL))
+ return NULL;
+
+ gdk_error_trap_push ();
+ if ((XGetDeviceProperty (GDK_DISPLAY (), device, prop, 0, 1, False,
+ XA_INTEGER, &realtype, &realformat, &nitems,
+ &bytes_after, &data) == Success) && (realtype != None)) {
+ gdk_error_trap_pop ();
+ XFree (data);
+ return device;
+ }
+ gdk_error_trap_pop ();
+
+ XCloseDevice (GDK_DISPLAY (), device);
+ return NULL;
+}
+#endif
+
+static int
+set_disable_w_typing (GsdMouseManager *manager, gboolean state)
+{
+
+ if (state) {
+ GError *error = NULL;
+ char *args[5];
+
+ if (manager->priv->syndaemon_spawned)
+ return 0;
+
+ args[0] = "syndaemon";
+ args[1] = "-i";
+ args[2] = "0.5";
+ args[3] = "-k";
+ args[4] = NULL;
+
+ if (!g_find_program_in_path (args[0]))
+ return 0;
+
+ g_spawn_async (g_get_home_dir (), args, NULL,
+ G_SPAWN_SEARCH_PATH, NULL, NULL,
+ &manager->priv->syndaemon_pid, &error);
+
+ manager->priv->syndaemon_spawned = (error == NULL);
+
+ if (error) {
+ MateConfClient *client;
+ client = mateconf_client_get_default ();
+ mateconf_client_set_bool (client, KEY_TOUCHPAD_DISABLE_W_TYPING, FALSE, NULL);
+ g_object_unref (client);
+ g_error_free (error);
+ }
+
+ } else if (manager->priv->syndaemon_spawned)
+ {
+ kill (manager->priv->syndaemon_pid, SIGHUP);
+ g_spawn_close_pid (manager->priv->syndaemon_pid);
+ manager->priv->syndaemon_spawned = FALSE;
+ }
+
+ return 0;
+}
+
+#ifdef HAVE_X11_EXTENSIONS_XINPUT_H
+static int
+set_tap_to_click (gboolean state, gboolean left_handed)
+{
+ int numdevices, i, format, rc;
+ unsigned long nitems, bytes_after;
+ XDeviceInfo *devicelist = XListInputDevices (GDK_DISPLAY (), &numdevices);
+ XDevice * device;
+ unsigned char* data;
+ Atom prop, type;
+
+ if (devicelist == NULL)
+ return 0;
+
+ prop = XInternAtom (GDK_DISPLAY (), "Synaptics Tap Action", False);
+
+ if (!prop)
+ return 0;
+
+ for (i = 0; i < numdevices; i++) {
+ if ((device = device_is_touchpad (devicelist[i]))) {
+ gdk_error_trap_push ();
+ rc = XGetDeviceProperty (GDK_DISPLAY (), device, prop, 0, 2,
+ False, XA_INTEGER, &type, &format, &nitems,
+ &bytes_after, &data);
+
+ if (rc == Success && type == XA_INTEGER && format == 8 && nitems >= 7)
+ {
+ /* Set RLM mapping for 1/2/3 fingers*/
+ data[4] = (state) ? ((left_handed) ? 3 : 1) : 0;
+ data[5] = (state) ? ((left_handed) ? 1 : 3) : 0;
+ data[6] = (state) ? 2 : 0;
+ XChangeDeviceProperty (GDK_DISPLAY (), device, prop, XA_INTEGER, 8,
+ PropModeReplace, data, nitems);
+ }
+
+ if (rc == Success)
+ XFree (data);
+ XCloseDevice (GDK_DISPLAY (), device);
+ if (gdk_error_trap_pop ()) {
+ g_warning ("Error in setting tap to click on \"%s\"", devicelist[i].name);
+ continue;
+ }
+ }
+ }
+
+ XFreeDeviceList (devicelist);
+ return 0;
+}
+
+static int
+set_horiz_scroll (gboolean state)
+{
+ int numdevices, i, rc;
+ XDeviceInfo *devicelist = XListInputDevices (GDK_DISPLAY (), &numdevices);
+ XDevice *device;
+ Atom act_type, prop_edge, prop_twofinger;
+ int act_format;
+ unsigned long nitems, bytes_after;
+ unsigned char *data;
+
+ if (devicelist == NULL)
+ return 0;
+
+ prop_edge = XInternAtom (GDK_DISPLAY (), "Synaptics Edge Scrolling", False);
+ prop_twofinger = XInternAtom (GDK_DISPLAY (), "Synaptics Two-Finger Scrolling", False);
+
+ if (!prop_edge || !prop_twofinger)
+ return 0;
+
+ for (i = 0; i < numdevices; i++) {
+ if ((device = device_is_touchpad (devicelist[i]))) {
+ gdk_error_trap_push ();
+ rc = XGetDeviceProperty (GDK_DISPLAY (), device,
+ prop_edge, 0, 1, False,
+ XA_INTEGER, &act_type, &act_format, &nitems,
+ &bytes_after, &data);
+ if (rc == Success && act_type == XA_INTEGER &&
+ act_format == 8 && nitems >= 2) {
+ data[1] = (state && data[0]);
+ XChangeDeviceProperty (GDK_DISPLAY (), device,
+ prop_edge, XA_INTEGER, 8,
+ PropModeReplace, data, nitems);
+ }
+
+ XFree (data);
+
+ rc = XGetDeviceProperty (GDK_DISPLAY (), device,
+ prop_twofinger, 0, 1, False,
+ XA_INTEGER, &act_type, &act_format, &nitems,
+ &bytes_after, &data);
+ if (rc == Success && act_type == XA_INTEGER &&
+ act_format == 8 && nitems >= 2) {
+ data[1] = (state && data[0]);
+ XChangeDeviceProperty (GDK_DISPLAY (), device,
+ prop_twofinger, XA_INTEGER, 8,
+ PropModeReplace, data, nitems);
+ }
+
+ XFree (data);
+ XCloseDevice (GDK_DISPLAY (), device);
+ if (gdk_error_trap_pop ()) {
+ g_warning ("Error in setting horiz scroll on \"%s\"", devicelist[i].name);
+ continue;
+ }
+ }
+ }
+
+ XFreeDeviceList (devicelist);
+ return 0;
+}
+
+
+/**
+ * Scroll methods are: 0 - disabled, 1 - edge scrolling, 2 - twofinger
+ * scrolling
+ */
+static int
+set_edge_scroll (int method)
+{
+ int numdevices, i, rc;
+ XDeviceInfo *devicelist = XListInputDevices (GDK_DISPLAY (), &numdevices);
+ XDevice *device;
+ Atom act_type, prop_edge, prop_twofinger;
+ int act_format;
+ unsigned long nitems, bytes_after;
+ unsigned char *data;
+
+ if (devicelist == NULL)
+ return 0;
+
+ prop_edge = XInternAtom (GDK_DISPLAY (), "Synaptics Edge Scrolling", False);
+ prop_twofinger = XInternAtom (GDK_DISPLAY (), "Synaptics Two-Finger Scrolling", False);
+
+ if (!prop_edge || !prop_twofinger)
+ return 0;
+
+ for (i = 0; i < numdevices; i++) {
+ if ((device = device_is_touchpad (devicelist[i]))) {
+ gdk_error_trap_push ();
+ rc = XGetDeviceProperty (GDK_DISPLAY (), device,
+ prop_edge, 0, 1, False,
+ XA_INTEGER, &act_type, &act_format, &nitems,
+ &bytes_after, &data);
+ if (rc == Success && act_type == XA_INTEGER &&
+ act_format == 8 && nitems >= 2) {
+ data[0] = (method == 1) ? 1 : 0;
+ XChangeDeviceProperty (GDK_DISPLAY (), device,
+ prop_edge, XA_INTEGER, 8,
+ PropModeReplace, data, nitems);
+ }
+
+ XFree (data);
+
+ rc = XGetDeviceProperty (GDK_DISPLAY (), device,
+ prop_twofinger, 0, 1, False,
+ XA_INTEGER, &act_type, &act_format, &nitems,
+ &bytes_after, &data);
+ if (rc == Success && act_type == XA_INTEGER &&
+ act_format == 8 && nitems >= 2) {
+ data[0] = (method == 2) ? 1 : 0;
+ XChangeDeviceProperty (GDK_DISPLAY (), device,
+ prop_twofinger, XA_INTEGER, 8,
+ PropModeReplace, data, nitems);
+ }
+
+ XFree (data);
+ XCloseDevice (GDK_DISPLAY (), device);
+ if (gdk_error_trap_pop ()) {
+ g_warning ("Error in setting edge scroll on \"%s\"", devicelist[i].name);
+ continue;
+ }
+ }
+ }
+
+ XFreeDeviceList (devicelist);
+ return 0;
+}
+
+static int
+set_touchpad_enabled (gboolean state)
+{
+ int numdevices, i;
+ XDeviceInfo *devicelist = XListInputDevices (GDK_DISPLAY (), &numdevices);
+ XDevice *device;
+ Atom prop_enabled;
+
+ if (devicelist == NULL)
+ return 0;
+
+ prop_enabled = XInternAtom (GDK_DISPLAY (), "Device Enabled", False);
+
+ if (!prop_enabled)
+ return 0;
+
+ for (i = 0; i < numdevices; i++) {
+ if ((device = device_is_touchpad (devicelist[i]))) {
+ unsigned char data = state;
+ gdk_error_trap_push ();
+ XChangeDeviceProperty (GDK_DISPLAY (), device,
+ prop_enabled, XA_INTEGER, 8,
+ PropModeReplace, &data, 1);
+ XCloseDevice (GDK_DISPLAY (), device);
+ gdk_flush ();
+ if (gdk_error_trap_pop ()) {
+ g_warning ("Error %s device \"%s\"",
+ (state) ? "enabling" : "disabling",
+ devicelist[i].name);
+ continue;
+ }
+ }
+ }
+
+ XFreeDeviceList (devicelist);
+ return 0;
+}
+#endif
+
+static void
+set_locate_pointer (GsdMouseManager *manager,
+ gboolean state)
+{
+ if (state) {
+ GError *error = NULL;
+ char *args[2];
+
+ if (manager->priv->locate_pointer_spawned)
+ return;
+
+ args[0] = LIBEXECDIR "/gsd-locate-pointer";
+ args[1] = NULL;
+
+ g_spawn_async (NULL, args, NULL,
+ 0, NULL, NULL,
+ &manager->priv->locate_pointer_pid, &error);
+
+ manager->priv->locate_pointer_spawned = (error == NULL);
+
+ if (error) {
+ MateConfClient *client;
+ client = mateconf_client_get_default ();
+ mateconf_client_set_bool (client, KEY_LOCATE_POINTER, FALSE, NULL);
+ g_object_unref (client);
+ g_error_free (error);
+ }
+
+ }
+ else if (manager->priv->locate_pointer_spawned) {
+ kill (manager->priv->locate_pointer_pid, SIGHUP);
+ g_spawn_close_pid (manager->priv->locate_pointer_pid);
+ manager->priv->locate_pointer_spawned = FALSE;
+ }
+}
+
+static void
+set_mousetweaks_daemon (GsdMouseManager *manager,
+ gboolean dwell_enable,
+ gboolean delay_enable)
+{
+ GError *error = NULL;
+ gchar *comm;
+ gboolean run_daemon = dwell_enable || delay_enable;
+
+ if (run_daemon || manager->priv->mousetweaks_daemon_running)
+ comm = g_strdup_printf ("mousetweaks %s",
+ run_daemon ? "" : "-s");
+ else
+ return;
+
+ if (run_daemon)
+ manager->priv->mousetweaks_daemon_running = TRUE;
+
+
+ if (! g_spawn_command_line_async (comm, &error)) {
+ if (error->code == G_SPAWN_ERROR_NOENT &&
+ (dwell_enable || delay_enable)) {
+ GtkWidget *dialog;
+ MateConfClient *client;
+
+ client = mateconf_client_get_default ();
+ if (dwell_enable)
+ mateconf_client_set_bool (client,
+ KEY_DWELL_ENABLE,
+ FALSE, NULL);
+ else if (delay_enable)
+ mateconf_client_set_bool (client,
+ KEY_DELAY_ENABLE,
+ FALSE, NULL);
+ g_object_unref (client);
+
+ dialog = gtk_message_dialog_new (NULL, 0,
+ GTK_MESSAGE_WARNING,
+ GTK_BUTTONS_OK,
+ _("Could not enable mouse accessibility features"));
+ gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+ _("Mouse accessibility requires Mousetweaks "
+ "to be installed on your system."));
+ gtk_window_set_title (GTK_WINDOW (dialog),
+ _("Mouse Preferences"));
+ gtk_window_set_icon_name (GTK_WINDOW (dialog),
+ "input-mouse");
+ gtk_dialog_run (GTK_DIALOG (dialog));
+ gtk_widget_destroy (dialog);
+ }
+ g_error_free (error);
+ }
+ g_free (comm);
+}
+
+static void
+set_mouse_settings (GsdMouseManager *manager)
+{
+ MateConfClient *client = mateconf_client_get_default ();
+ gboolean left_handed = mateconf_client_get_bool (client, KEY_LEFT_HANDED, NULL);
+
+ set_left_handed (manager, left_handed);
+ set_motion_acceleration (manager, mateconf_client_get_float (client, KEY_MOTION_ACCELERATION , NULL));
+ set_motion_threshold (manager, mateconf_client_get_int (client, KEY_MOTION_THRESHOLD, NULL));
+
+ set_disable_w_typing (manager, mateconf_client_get_bool (client, KEY_TOUCHPAD_DISABLE_W_TYPING, NULL));
+#ifdef HAVE_X11_EXTENSIONS_XINPUT_H
+ set_tap_to_click (mateconf_client_get_bool (client, KEY_TAP_TO_CLICK, NULL), left_handed);
+ set_edge_scroll (mateconf_client_get_int (client, KEY_SCROLL_METHOD, NULL));
+ set_horiz_scroll (mateconf_client_get_bool (client, KEY_PAD_HORIZ_SCROLL, NULL));
+ set_touchpad_enabled (mateconf_client_get_bool (client, KEY_TOUCHPAD_ENABLED, NULL));
+#endif
+
+ g_object_unref (client);
+}
+
+static void
+mouse_callback (MateConfClient *client,
+ guint cnxn_id,
+ MateConfEntry *entry,
+ GsdMouseManager *manager)
+{
+ if (! strcmp (entry->key, KEY_LEFT_HANDED)) {
+ if (entry->value->type == MATECONF_VALUE_BOOL) {
+ set_left_handed (manager, mateconf_value_get_bool (entry->value));
+ }
+ } else if (! strcmp (entry->key, KEY_MOTION_ACCELERATION)) {
+ if (entry->value->type == MATECONF_VALUE_FLOAT) {
+ set_motion_acceleration (manager, mateconf_value_get_float (entry->value));
+ }
+ } else if (! strcmp (entry->key, KEY_MOTION_THRESHOLD)) {
+ if (entry->value->type == MATECONF_VALUE_INT) {
+ set_motion_threshold (manager, mateconf_value_get_int (entry->value));
+ }
+ } else if (! strcmp (entry->key, KEY_TOUCHPAD_DISABLE_W_TYPING)) {
+ if (entry->value->type == MATECONF_VALUE_BOOL)
+ set_disable_w_typing (manager, mateconf_value_get_bool (entry->value));
+#ifdef HAVE_X11_EXTENSIONS_XINPUT_H
+ } else if (! strcmp (entry->key, KEY_TAP_TO_CLICK)) {
+ if (entry->value->type == MATECONF_VALUE_BOOL) {
+ set_tap_to_click (mateconf_value_get_bool (entry->value),
+ mateconf_client_get_bool (client, KEY_LEFT_HANDED, NULL));
+ }
+ } else if (! strcmp (entry->key, KEY_SCROLL_METHOD)) {
+ if (entry->value->type == MATECONF_VALUE_INT) {
+ set_edge_scroll (mateconf_value_get_int (entry->value));
+ set_horiz_scroll (mateconf_client_get_bool (client, KEY_PAD_HORIZ_SCROLL, NULL));
+ }
+ } else if (! strcmp (entry->key, KEY_PAD_HORIZ_SCROLL)) {
+ if (entry->value->type == MATECONF_VALUE_BOOL)
+ set_horiz_scroll (mateconf_value_get_bool (entry->value));
+#endif
+ } else if (! strcmp (entry->key, KEY_LOCATE_POINTER)) {
+ if (entry->value->type == MATECONF_VALUE_BOOL) {
+ set_locate_pointer (manager, mateconf_value_get_bool (entry->value));
+ }
+#ifdef HAVE_X11_EXTENSIONS_XINPUT_H
+ } else if (! strcmp (entry->key, KEY_TOUCHPAD_ENABLED)) {
+ if (entry->value->type == MATECONF_VALUE_BOOL) {
+ set_touchpad_enabled (mateconf_value_get_bool (entry->value));
+ }
+#endif
+ } else if (! strcmp (entry->key, KEY_DWELL_ENABLE)) {
+ if (entry->value->type == MATECONF_VALUE_BOOL) {
+ set_mousetweaks_daemon (manager,
+ mateconf_value_get_bool (entry->value),
+ mateconf_client_get_bool (client, KEY_DELAY_ENABLE, NULL));
+ }
+ } else if (! strcmp (entry->key, KEY_DELAY_ENABLE)) {
+ if (entry->value->type == MATECONF_VALUE_BOOL) {
+ set_mousetweaks_daemon (manager,
+ mateconf_client_get_bool (client, KEY_DWELL_ENABLE, NULL),
+ mateconf_value_get_bool (entry->value));
+ }
+ }
+}
+
+static guint
+register_config_callback (GsdMouseManager *manager,
+ MateConfClient *client,
+ const char *path,
+ MateConfClientNotifyFunc func)
+{
+ mateconf_client_add_dir (client, path, MATECONF_CLIENT_PRELOAD_ONELEVEL, NULL);
+ return mateconf_client_notify_add (client, path, func, manager, NULL, NULL);
+}
+
+static void
+gsd_mouse_manager_init (GsdMouseManager *manager)
+{
+ manager->priv = GSD_MOUSE_MANAGER_GET_PRIVATE (manager);
+}
+
+static gboolean
+gsd_mouse_manager_idle_cb (GsdMouseManager *manager)
+{
+ MateConfClient *client;
+
+ mate_settings_profile_start (NULL);
+
+ client = mateconf_client_get_default ();
+
+ manager->priv->notify =
+ register_config_callback (manager,
+ client,
+ MATECONF_MOUSE_DIR,
+ (MateConfClientNotifyFunc) mouse_callback);
+ manager->priv->notify_a11y =
+ register_config_callback (manager,
+ client,
+ MATECONF_MOUSE_A11Y_DIR,
+ (MateConfClientNotifyFunc) mouse_callback);
+ manager->priv->notify_touchpad =
+ register_config_callback (manager,
+ client,
+ MATECONF_TOUCHPAD_DIR,
+ (MateConfClientNotifyFunc) mouse_callback);
+ manager->priv->syndaemon_spawned = FALSE;
+
+#ifdef HAVE_X11_EXTENSIONS_XINPUT_H
+ set_devicepresence_handler (manager);
+#endif
+ set_mouse_settings (manager);
+ set_locate_pointer (manager, mateconf_client_get_bool (client, KEY_LOCATE_POINTER, NULL));
+ set_mousetweaks_daemon (manager,
+ mateconf_client_get_bool (client, KEY_DWELL_ENABLE, NULL),
+ mateconf_client_get_bool (client, KEY_DELAY_ENABLE, NULL));
+
+ set_disable_w_typing (manager, mateconf_client_get_bool (client, KEY_TOUCHPAD_DISABLE_W_TYPING, NULL));
+#ifdef HAVE_X11_EXTENSIONS_XINPUT_H
+ set_tap_to_click (mateconf_client_get_bool (client, KEY_TAP_TO_CLICK, NULL),
+ mateconf_client_get_bool (client, KEY_LEFT_HANDED, NULL));
+ set_edge_scroll (mateconf_client_get_int (client, KEY_SCROLL_METHOD, NULL));
+ set_horiz_scroll (mateconf_client_get_bool (client, KEY_PAD_HORIZ_SCROLL, NULL));
+ set_touchpad_enabled (mateconf_client_get_bool (client, KEY_TOUCHPAD_ENABLED, NULL));
+#endif
+
+ g_object_unref (client);
+
+ mate_settings_profile_end (NULL);
+
+ return FALSE;
+}
+
+gboolean
+gsd_mouse_manager_start (GsdMouseManager *manager,
+ GError **error)
+{
+ mate_settings_profile_start (NULL);
+
+ g_idle_add ((GSourceFunc) gsd_mouse_manager_idle_cb, manager);
+
+ mate_settings_profile_end (NULL);
+
+ return TRUE;
+}
+
+void
+gsd_mouse_manager_stop (GsdMouseManager *manager)
+{
+ GsdMouseManagerPrivate *p = manager->priv;
+ MateConfClient *client;
+
+ g_debug ("Stopping mouse manager");
+
+ client = mateconf_client_get_default ();
+
+ if (p->notify != 0) {
+ mateconf_client_remove_dir (client, MATECONF_MOUSE_DIR, NULL);
+ mateconf_client_notify_remove (client, p->notify);
+ p->notify = 0;
+ }
+
+ if (p->notify_a11y != 0) {
+ mateconf_client_remove_dir (client, MATECONF_MOUSE_A11Y_DIR, NULL);
+ mateconf_client_notify_remove (client, p->notify_a11y);
+ p->notify_a11y = 0;
+ }
+
+ if (p->notify_touchpad != 0) {
+ mateconf_client_remove_dir (client, MATECONF_TOUCHPAD_DIR, NULL);
+ mateconf_client_notify_remove (client, p->notify_touchpad);
+ p->notify_touchpad = 0;
+ }
+
+ g_object_unref (client);
+
+ set_locate_pointer (manager, FALSE);
+
+#ifdef HAVE_X11_EXTENSIONS_XINPUT_H
+ gdk_window_remove_filter (NULL, devicepresence_filter, manager);
+#endif
+}
+
+static void
+gsd_mouse_manager_finalize (GObject *object)
+{
+ GsdMouseManager *mouse_manager;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (GSD_IS_MOUSE_MANAGER (object));
+
+ mouse_manager = GSD_MOUSE_MANAGER (object);
+
+ g_return_if_fail (mouse_manager->priv != NULL);
+
+ G_OBJECT_CLASS (gsd_mouse_manager_parent_class)->finalize (object);
+}
+
+GsdMouseManager *
+gsd_mouse_manager_new (void)
+{
+ if (manager_object != NULL) {
+ g_object_ref (manager_object);
+ } else {
+ manager_object = g_object_new (GSD_TYPE_MOUSE_MANAGER, NULL);
+ g_object_add_weak_pointer (manager_object,
+ (gpointer *) &manager_object);
+ }
+
+ return GSD_MOUSE_MANAGER (manager_object);
+}
diff --git a/plugins/mouse/gsd-mouse-manager.h b/plugins/mouse/gsd-mouse-manager.h
new file mode 100644
index 0000000..f8f513c
--- /dev/null
+++ b/plugins/mouse/gsd-mouse-manager.h
@@ -0,0 +1,61 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 William Jon McCann <[email protected]>
+ *
+ * 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.
+ *
+ */
+
+#ifndef __GSD_MOUSE_MANAGER_H
+#define __GSD_MOUSE_MANAGER_H
+
+#include <glib-object.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define GSD_TYPE_MOUSE_MANAGER (gsd_mouse_manager_get_type ())
+#define GSD_MOUSE_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_MOUSE_MANAGER, GsdMouseManager))
+#define GSD_MOUSE_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_MOUSE_MANAGER, GsdMouseManagerClass))
+#define GSD_IS_MOUSE_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_MOUSE_MANAGER))
+#define GSD_IS_MOUSE_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_MOUSE_MANAGER))
+#define GSD_MOUSE_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_MOUSE_MANAGER, GsdMouseManagerClass))
+
+typedef struct GsdMouseManagerPrivate GsdMouseManagerPrivate;
+
+typedef struct
+{
+ GObject parent;
+ GsdMouseManagerPrivate *priv;
+} GsdMouseManager;
+
+typedef struct
+{
+ GObjectClass parent_class;
+} GsdMouseManagerClass;
+
+GType gsd_mouse_manager_get_type (void);
+
+GsdMouseManager * gsd_mouse_manager_new (void);
+gboolean gsd_mouse_manager_start (GsdMouseManager *manager,
+ GError **error);
+void gsd_mouse_manager_stop (GsdMouseManager *manager);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __GSD_MOUSE_MANAGER_H */
diff --git a/plugins/mouse/gsd-mouse-plugin.c b/plugins/mouse/gsd-mouse-plugin.c
new file mode 100644
index 0000000..900a6d5
--- /dev/null
+++ b/plugins/mouse/gsd-mouse-plugin.c
@@ -0,0 +1,104 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 William Jon McCann <[email protected]>
+ *
+ * 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, 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 <glib/gi18n-lib.h>
+#include <gmodule.h>
+
+#include "mate-settings-plugin.h"
+#include "gsd-mouse-plugin.h"
+#include "gsd-mouse-manager.h"
+
+struct GsdMousePluginPrivate {
+ GsdMouseManager *manager;
+};
+
+#define GSD_MOUSE_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GSD_TYPE_MOUSE_PLUGIN, GsdMousePluginPrivate))
+
+MATE_SETTINGS_PLUGIN_REGISTER (GsdMousePlugin, gsd_mouse_plugin)
+
+static void
+gsd_mouse_plugin_init (GsdMousePlugin *plugin)
+{
+ plugin->priv = GSD_MOUSE_PLUGIN_GET_PRIVATE (plugin);
+
+ g_debug ("GsdMousePlugin initializing");
+
+ plugin->priv->manager = gsd_mouse_manager_new ();
+}
+
+static void
+gsd_mouse_plugin_finalize (GObject *object)
+{
+ GsdMousePlugin *plugin;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (GSD_IS_MOUSE_PLUGIN (object));
+
+ g_debug ("GsdMousePlugin finalizing");
+
+ plugin = GSD_MOUSE_PLUGIN (object);
+
+ g_return_if_fail (plugin->priv != NULL);
+
+ if (plugin->priv->manager != NULL) {
+ g_object_unref (plugin->priv->manager);
+ }
+
+ G_OBJECT_CLASS (gsd_mouse_plugin_parent_class)->finalize (object);
+}
+
+static void
+impl_activate (MateSettingsPlugin *plugin)
+{
+ gboolean res;
+ GError *error;
+
+ g_debug ("Activating mouse plugin");
+
+ error = NULL;
+ res = gsd_mouse_manager_start (GSD_MOUSE_PLUGIN (plugin)->priv->manager, &error);
+ if (! res) {
+ g_warning ("Unable to start mouse manager: %s", error->message);
+ g_error_free (error);
+ }
+}
+
+static void
+impl_deactivate (MateSettingsPlugin *plugin)
+{
+ g_debug ("Deactivating mouse plugin");
+ gsd_mouse_manager_stop (GSD_MOUSE_PLUGIN (plugin)->priv->manager);
+}
+
+static void
+gsd_mouse_plugin_class_init (GsdMousePluginClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ MateSettingsPluginClass *plugin_class = MATE_SETTINGS_PLUGIN_CLASS (klass);
+
+ object_class->finalize = gsd_mouse_plugin_finalize;
+
+ plugin_class->activate = impl_activate;
+ plugin_class->deactivate = impl_deactivate;
+
+ g_type_class_add_private (klass, sizeof (GsdMousePluginPrivate));
+}
diff --git a/plugins/mouse/gsd-mouse-plugin.h b/plugins/mouse/gsd-mouse-plugin.h
new file mode 100644
index 0000000..e442450
--- /dev/null
+++ b/plugins/mouse/gsd-mouse-plugin.h
@@ -0,0 +1,63 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
+ *
+ * Copyright (C) 2007 William Jon McCann <[email protected]>
+ *
+ * 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, 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.
+ *
+ */
+
+#ifndef __GSD_MOUSE_PLUGIN_H__
+#define __GSD_MOUSE_PLUGIN_H__
+
+#include <glib.h>
+#include <glib-object.h>
+#include <gmodule.h>
+
+#include "mate-settings-plugin.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define GSD_TYPE_MOUSE_PLUGIN (gsd_mouse_plugin_get_type ())
+#define GSD_MOUSE_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_MOUSE_PLUGIN, GsdMousePlugin))
+#define GSD_MOUSE_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_MOUSE_PLUGIN, GsdMousePluginClass))
+#define GSD_IS_MOUSE_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_MOUSE_PLUGIN))
+#define GSD_IS_MOUSE_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_MOUSE_PLUGIN))
+#define GSD_MOUSE_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_MOUSE_PLUGIN, GsdMousePluginClass))
+
+typedef struct GsdMousePluginPrivate GsdMousePluginPrivate;
+
+typedef struct
+{
+ MateSettingsPlugin parent;
+ GsdMousePluginPrivate *priv;
+} GsdMousePlugin;
+
+typedef struct
+{
+ MateSettingsPluginClass parent_class;
+} GsdMousePluginClass;
+
+GType gsd_mouse_plugin_get_type (void) G_GNUC_CONST;
+
+/* All the plugins must implement this function */
+G_MODULE_EXPORT GType register_mate_settings_plugin (GTypeModule *module);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __GSD_MOUSE_PLUGIN_H__ */
diff --git a/plugins/mouse/gsd-timeline.c b/plugins/mouse/gsd-timeline.c
new file mode 100644
index 0000000..748a0ad
--- /dev/null
+++ b/plugins/mouse/gsd-timeline.c
@@ -0,0 +1,848 @@
+/* gsd-timeline.c
+ *
+ * Copyright (C) 2008 Carlos Garnacho <[email protected]>
+ *
+ * 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 <glib.h>
+#include <gtk/gtk.h>
+#include <math.h>
+#include "gsd-timeline.h"
+
+#define GSD_TIMELINE_GET_PRIV(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), GSD_TYPE_TIMELINE, GsdTimelinePriv))
+#define MSECS_PER_SEC 1000
+#define FRAME_INTERVAL(nframes) (MSECS_PER_SEC / nframes)
+#define DEFAULT_FPS 30
+
+typedef struct GsdTimelinePriv GsdTimelinePriv;
+
+struct GsdTimelinePriv
+{
+ guint duration;
+ guint fps;
+ guint source_id;
+
+ GTimer *timer;
+
+ GdkScreen *screen;
+ GsdTimelineProgressType progress_type;
+ GsdTimelineProgressFunc progress_func;
+
+ guint loop : 1;
+ guint direction : 1;
+};
+
+enum {
+ PROP_0,
+ PROP_FPS,
+ PROP_DURATION,
+ PROP_LOOP,
+ PROP_DIRECTION,
+ PROP_SCREEN,
+ PROP_PROGRESS_TYPE,
+};
+
+enum {
+ STARTED,
+ PAUSED,
+ FINISHED,
+ FRAME,
+ LAST_SIGNAL
+};
+
+static guint signals [LAST_SIGNAL] = { 0, };
+
+
+static void gsd_timeline_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gsd_timeline_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec);
+static void gsd_timeline_finalize (GObject *object);
+
+
+G_DEFINE_TYPE (GsdTimeline, gsd_timeline, G_TYPE_OBJECT)
+
+
+GType
+gsd_timeline_direction_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0))
+ {
+ static const GEnumValue values[] = {
+ { GSD_TIMELINE_DIRECTION_FORWARD, "GSD_TIMELINE_DIRECTION_FORWARD", "forward" },
+ { GSD_TIMELINE_DIRECTION_BACKWARD, "GSD_TIMELINE_DIRECTION_BACKWARD", "backward" },
+ { 0, NULL, NULL }
+ };
+
+ type = g_enum_register_static (g_intern_static_string ("GsdTimelineDirection"), values);
+ }
+
+ return type;
+}
+
+GType
+gsd_timeline_progress_type_get_type (void)
+{
+ static GType type = 0;
+
+ if (G_UNLIKELY (type == 0))
+ {
+ static const GEnumValue values[] = {
+ { GSD_TIMELINE_PROGRESS_LINEAR, "GSD_TIMELINE_PROGRESS_LINEAR", "linear" },
+ { GSD_TIMELINE_PROGRESS_SINUSOIDAL, "GSD_TIMELINE_PROGRESS_SINUSOIDAL", "sinusoidal" },
+ { GSD_TIMELINE_PROGRESS_EXPONENTIAL, "GSD_TIMELINE_PROGRESS_EXPONENTIAL", "exponential" },
+ { 0, NULL, NULL }
+ };
+
+ type = g_enum_register_static (g_intern_static_string ("GsdTimelineProgressType"), values);
+ }
+
+ return type;
+}
+
+static void
+gsd_timeline_class_init (GsdTimelineClass *class)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (class);
+
+ object_class->set_property = gsd_timeline_set_property;
+ object_class->get_property = gsd_timeline_get_property;
+ object_class->finalize = gsd_timeline_finalize;
+
+ g_object_class_install_property (object_class,
+ PROP_FPS,
+ g_param_spec_uint ("fps",
+ "FPS",
+ "Frames per second for the timeline",
+ 1,
+ G_MAXUINT,
+ DEFAULT_FPS,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_DURATION,
+ g_param_spec_uint ("duration",
+ "Animation Duration",
+ "Animation Duration",
+ 0,
+ G_MAXUINT,
+ 0,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_LOOP,
+ g_param_spec_boolean ("loop",
+ "Loop",
+ "Whether the timeline loops or not",
+ FALSE,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_DIRECTION,
+ g_param_spec_enum ("direction",
+ "Direction",
+ "Whether the timeline moves forward or backward in time",
+ GSD_TYPE_TIMELINE_DIRECTION,
+ GSD_TIMELINE_DIRECTION_FORWARD,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_DIRECTION,
+ g_param_spec_enum ("progress-type",
+ "Progress type",
+ "Type of progress through the timeline",
+ GSD_TYPE_TIMELINE_PROGRESS_TYPE,
+ GSD_TIMELINE_PROGRESS_LINEAR,
+ G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_SCREEN,
+ g_param_spec_object ("screen",
+ "Screen",
+ "Screen to get the settings from",
+ GDK_TYPE_SCREEN,
+ G_PARAM_READWRITE));
+
+ signals[STARTED] =
+ g_signal_new ("started",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GsdTimelineClass, started),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals[PAUSED] =
+ g_signal_new ("paused",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GsdTimelineClass, paused),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals[FINISHED] =
+ g_signal_new ("finished",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GsdTimelineClass, finished),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals[FRAME] =
+ g_signal_new ("frame",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GsdTimelineClass, frame),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__DOUBLE,
+ G_TYPE_NONE, 1,
+ G_TYPE_DOUBLE);
+
+ g_type_class_add_private (class, sizeof (GsdTimelinePriv));
+}
+
+static void
+gsd_timeline_init (GsdTimeline *timeline)
+{
+ GsdTimelinePriv *priv;
+
+ priv = GSD_TIMELINE_GET_PRIV (timeline);
+
+ priv->fps = DEFAULT_FPS;
+ priv->duration = 0;
+ priv->direction = GSD_TIMELINE_DIRECTION_FORWARD;
+ priv->screen = gdk_screen_get_default ();
+}
+
+static void
+gsd_timeline_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ GsdTimeline *timeline;
+ GsdTimelinePriv *priv;
+
+ timeline = GSD_TIMELINE (object);
+ priv = GSD_TIMELINE_GET_PRIV (timeline);
+
+ switch (prop_id)
+ {
+ case PROP_FPS:
+ gsd_timeline_set_fps (timeline, g_value_get_uint (value));
+ break;
+ case PROP_DURATION:
+ gsd_timeline_set_duration (timeline, g_value_get_uint (value));
+ break;
+ case PROP_LOOP:
+ gsd_timeline_set_loop (timeline, g_value_get_boolean (value));
+ break;
+ case PROP_DIRECTION:
+ gsd_timeline_set_direction (timeline, g_value_get_enum (value));
+ break;
+ case PROP_SCREEN:
+ gsd_timeline_set_screen (timeline,
+ GDK_SCREEN (g_value_get_object (value)));
+ break;
+ case PROP_PROGRESS_TYPE:
+ gsd_timeline_set_progress_type (timeline, g_value_get_enum (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+gsd_timeline_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ GsdTimeline *timeline;
+ GsdTimelinePriv *priv;
+
+ timeline = GSD_TIMELINE (object);
+ priv = GSD_TIMELINE_GET_PRIV (timeline);
+
+ switch (prop_id)
+ {
+ case PROP_FPS:
+ g_value_set_uint (value, priv->fps);
+ break;
+ case PROP_DURATION:
+ g_value_set_uint (value, priv->duration);
+ break;
+ case PROP_LOOP:
+ g_value_set_boolean (value, priv->loop);
+ break;
+ case PROP_DIRECTION:
+ g_value_set_enum (value, priv->direction);
+ break;
+ case PROP_SCREEN:
+ g_value_set_object (value, priv->screen);
+ break;
+ case PROP_PROGRESS_TYPE:
+ g_value_set_enum (value, priv->progress_type);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ }
+}
+
+static void
+gsd_timeline_finalize (GObject *object)
+{
+ GsdTimelinePriv *priv;
+
+ priv = GSD_TIMELINE_GET_PRIV (object);
+
+ if (priv->source_id)
+ {
+ g_source_remove (priv->source_id);
+ priv->source_id = 0;
+ }
+
+ if (priv->timer)
+ g_timer_destroy (priv->timer);
+
+ G_OBJECT_CLASS (gsd_timeline_parent_class)->finalize (object);
+}
+
+/* Sinusoidal progress */
+static gdouble
+sinusoidal_progress (gdouble progress)
+{
+ return (sinf ((progress * G_PI) / 2));
+}
+
+static gdouble
+exponential_progress (gdouble progress)
+{
+ return progress * progress;
+}
+
+static GsdTimelineProgressFunc
+progress_type_to_func (GsdTimelineProgressType type)
+{
+ if (type == GSD_TIMELINE_PROGRESS_SINUSOIDAL)
+ return sinusoidal_progress;
+ else if (type == GSD_TIMELINE_PROGRESS_EXPONENTIAL)
+ return exponential_progress;
+
+ return NULL;
+}
+
+static gboolean
+gsd_timeline_run_frame (GsdTimeline *timeline,
+ gboolean enable_animations)
+{
+ GsdTimelinePriv *priv;
+ gdouble linear_progress, progress;
+ guint elapsed_time;
+ GsdTimelineProgressFunc progress_func = NULL;
+
+ priv = GSD_TIMELINE_GET_PRIV (timeline);
+
+ if (enable_animations)
+ {
+ elapsed_time = (guint) (g_timer_elapsed (priv->timer, NULL) * 1000);
+
+ linear_progress = (gdouble) elapsed_time / priv->duration;
+
+ if (priv->direction == GSD_TIMELINE_DIRECTION_BACKWARD)
+ linear_progress = 1 - linear_progress;
+
+ linear_progress = CLAMP (linear_progress, 0., 1.);
+
+ if (priv->progress_func)
+ progress_func = priv->progress_func;
+ else if (priv->progress_type)
+ progress_func = progress_type_to_func (priv->progress_type);
+
+ if (progress_func)
+ progress = (progress_func) (linear_progress);
+ else
+ progress = linear_progress;
+ }
+ else
+ progress = (priv->direction == GSD_TIMELINE_DIRECTION_FORWARD) ? 1.0 : 0.0;
+
+ g_signal_emit (timeline, signals [FRAME], 0,
+ CLAMP (progress, 0.0, 1.0));
+
+ if ((priv->direction == GSD_TIMELINE_DIRECTION_FORWARD && progress >= 1.0) ||
+ (priv->direction == GSD_TIMELINE_DIRECTION_BACKWARD && progress <= 0.0))
+ {
+ if (!priv->loop)
+ {
+ if (priv->source_id)
+ {
+ g_source_remove (priv->source_id);
+ priv->source_id = 0;
+ }
+
+ g_signal_emit (timeline, signals [FINISHED], 0);
+ return FALSE;
+ }
+ else
+ gsd_timeline_rewind (timeline);
+ }
+
+ return TRUE;
+}
+
+static gboolean
+gsd_timeline_frame_idle_func (GsdTimeline *timeline)
+{
+ return gsd_timeline_run_frame (timeline, TRUE);
+}
+
+/**
+ * gsd_timeline_new:
+ * @duration: duration in milliseconds for the timeline
+ *
+ * Creates a new #GsdTimeline with the specified number of frames.
+ *
+ * Return Value: the newly created #GsdTimeline
+ **/
+GsdTimeline *
+gsd_timeline_new (guint duration)
+{
+ return g_object_new (GSD_TYPE_TIMELINE,
+ "duration", duration,
+ NULL);
+}
+
+GsdTimeline *
+gsd_timeline_new_for_screen (guint duration,
+ GdkScreen *screen)
+{
+ return g_object_new (GSD_TYPE_TIMELINE,
+ "duration", duration,
+ "screen", screen,
+ NULL);
+}
+
+/**
+ * gsd_timeline_start:
+ * @timeline: A #GsdTimeline
+ *
+ * Runs the timeline from the current frame.
+ **/
+void
+gsd_timeline_start (GsdTimeline *timeline)
+{
+ GsdTimelinePriv *priv;
+ GtkSettings *settings;
+ gboolean enable_animations = FALSE;
+
+ g_return_if_fail (GSD_IS_TIMELINE (timeline));
+
+ priv = GSD_TIMELINE_GET_PRIV (timeline);
+
+ if (priv->screen)
+ {
+ settings = gtk_settings_get_for_screen (priv->screen);
+ g_object_get (settings, "gtk-enable-animations", &enable_animations, NULL);
+ }
+
+ if (enable_animations)
+ {
+ if (!priv->source_id)
+ {
+ if (priv->timer)
+ g_timer_continue (priv->timer);
+ else
+ priv->timer = g_timer_new ();
+
+ /* sanity check */
+ g_assert (priv->fps > 0);
+
+ g_signal_emit (timeline, signals [STARTED], 0);
+
+ priv->source_id = gdk_threads_add_timeout (FRAME_INTERVAL (priv->fps),
+ (GSourceFunc) gsd_timeline_frame_idle_func,
+ timeline);
+ }
+ }
+ else
+ {
+ /* If animations are not enabled, only run the last frame,
+ * it take us instantaneously to the last state of the animation.
+ * The only potential flaw happens when people use the ::finished
+ * signal to trigger another animation, or even worse, finally
+ * loop into this animation again.
+ */
+ g_signal_emit (timeline, signals [STARTED], 0);
+ gsd_timeline_run_frame (timeline, FALSE);
+ }
+}
+
+/**
+ * gsd_timeline_pause:
+ * @timeline: A #GsdTimeline
+ *
+ * Pauses the timeline.
+ **/
+void
+gsd_timeline_pause (GsdTimeline *timeline)
+{
+ GsdTimelinePriv *priv;
+
+ g_return_if_fail (GSD_IS_TIMELINE (timeline));
+
+ priv = GSD_TIMELINE_GET_PRIV (timeline);
+
+ if (priv->source_id)
+ {
+ g_source_remove (priv->source_id);
+ priv->source_id = 0;
+ g_timer_stop (priv->timer);
+ g_signal_emit (timeline, signals [PAUSED], 0);
+ }
+}
+
+/**
+ * gsd_timeline_rewind:
+ * @timeline: A #GsdTimeline
+ *
+ * Rewinds the timeline.
+ **/
+void
+gsd_timeline_rewind (GsdTimeline *timeline)
+{
+ GsdTimelinePriv *priv;
+
+ g_return_if_fail (GSD_IS_TIMELINE (timeline));
+
+ priv = GSD_TIMELINE_GET_PRIV (timeline);
+
+ /* destroy and re-create timer if neccesary */
+ if (priv->timer)
+ {
+ g_timer_destroy (priv->timer);
+
+ if (gsd_timeline_is_running (timeline))
+ priv->timer = g_timer_new ();
+ else
+ priv->timer = NULL;
+ }
+}
+
+/**
+ * gsd_timeline_is_running:
+ * @timeline: A #GsdTimeline
+ *
+ * Returns whether the timeline is running or not.
+ *
+ * Return Value: %TRUE if the timeline is running
+ **/
+gboolean
+gsd_timeline_is_running (GsdTimeline *timeline)
+{
+ GsdTimelinePriv *priv;
+
+ g_return_val_if_fail (GSD_IS_TIMELINE (timeline), FALSE);
+
+ priv = GSD_TIMELINE_GET_PRIV (timeline);
+
+ return (priv->source_id != 0);
+}
+
+/**
+ * gsd_timeline_get_fps:
+ * @timeline: A #GsdTimeline
+ *
+ * Returns the number of frames per second.
+ *
+ * Return Value: frames per second
+ **/
+guint
+gsd_timeline_get_fps (GsdTimeline *timeline)
+{
+ GsdTimelinePriv *priv;
+
+ g_return_val_if_fail (GSD_IS_TIMELINE (timeline), 1);
+
+ priv = GSD_TIMELINE_GET_PRIV (timeline);
+ return priv->fps;
+}
+
+/**
+ * gsd_timeline_set_fps:
+ * @timeline: A #GsdTimeline
+ * @fps: frames per second
+ *
+ * Sets the number of frames per second that
+ * the timeline will play.
+ **/
+void
+gsd_timeline_set_fps (GsdTimeline *timeline,
+ guint fps)
+{
+ GsdTimelinePriv *priv;
+
+ g_return_if_fail (GSD_IS_TIMELINE (timeline));
+ g_return_if_fail (fps > 0);
+
+ priv = GSD_TIMELINE_GET_PRIV (timeline);
+
+ priv->fps = fps;
+
+ if (gsd_timeline_is_running (timeline))
+ {
+ g_source_remove (priv->source_id);
+ priv->source_id = gdk_threads_add_timeout (FRAME_INTERVAL (priv->fps),
+ (GSourceFunc) gsd_timeline_run_frame,
+ timeline);
+ }
+
+ g_object_notify (G_OBJECT (timeline), "fps");
+}
+
+/**
+ * gsd_timeline_get_loop:
+ * @timeline: A #GsdTimeline
+ *
+ * Returns whether the timeline loops to the
+ * beginning when it has reached the end.
+ *
+ * Return Value: %TRUE if the timeline loops
+ **/
+gboolean
+gsd_timeline_get_loop (GsdTimeline *timeline)
+{
+ GsdTimelinePriv *priv;
+
+ g_return_val_if_fail (GSD_IS_TIMELINE (timeline), FALSE);
+
+ priv = GSD_TIMELINE_GET_PRIV (timeline);
+ return priv->loop;
+}
+
+/**
+ * gsd_timeline_set_loop:
+ * @timeline: A #GsdTimeline
+ * @loop: %TRUE to make the timeline loop
+ *
+ * Sets whether the timeline loops to the beginning
+ * when it has reached the end.
+ **/
+void
+gsd_timeline_set_loop (GsdTimeline *timeline,
+ gboolean loop)
+{
+ GsdTimelinePriv *priv;
+
+ g_return_if_fail (GSD_IS_TIMELINE (timeline));
+
+ priv = GSD_TIMELINE_GET_PRIV (timeline);
+ priv->loop = loop;
+
+ g_object_notify (G_OBJECT (timeline), "loop");
+}
+
+void
+gsd_timeline_set_duration (GsdTimeline *timeline,
+ guint duration)
+{
+ GsdTimelinePriv *priv;
+
+ g_return_if_fail (GSD_IS_TIMELINE (timeline));
+
+ priv = GSD_TIMELINE_GET_PRIV (timeline);
+
+ priv->duration = duration;
+
+ g_object_notify (G_OBJECT (timeline), "duration");
+}
+
+guint
+gsd_timeline_get_duration (GsdTimeline *timeline)
+{
+ GsdTimelinePriv *priv;
+
+ g_return_val_if_fail (GSD_IS_TIMELINE (timeline), 0);
+
+ priv = GSD_TIMELINE_GET_PRIV (timeline);
+
+ return priv->duration;
+}
+
+/**
+ * gsd_timeline_get_direction:
+ * @timeline: A #GsdTimeline
+ *
+ * Returns the direction of the timeline.
+ *
+ * Return Value: direction
+ **/
+GsdTimelineDirection
+gsd_timeline_get_direction (GsdTimeline *timeline)
+{
+ GsdTimelinePriv *priv;
+
+ g_return_val_if_fail (GSD_IS_TIMELINE (timeline), GSD_TIMELINE_DIRECTION_FORWARD);
+
+ priv = GSD_TIMELINE_GET_PRIV (timeline);
+ return priv->direction;
+}
+
+/**
+ * gsd_timeline_set_direction:
+ * @timeline: A #GsdTimeline
+ * @direction: direction
+ *
+ * Sets the direction of the timeline.
+ **/
+void
+gsd_timeline_set_direction (GsdTimeline *timeline,
+ GsdTimelineDirection direction)
+{
+ GsdTimelinePriv *priv;
+
+ g_return_if_fail (GSD_IS_TIMELINE (timeline));
+
+ priv = GSD_TIMELINE_GET_PRIV (timeline);
+ priv->direction = direction;
+
+ g_object_notify (G_OBJECT (timeline), "direction");
+}
+
+GdkScreen *
+gsd_timeline_get_screen (GsdTimeline *timeline)
+{
+ GsdTimelinePriv *priv;
+
+ g_return_val_if_fail (GSD_IS_TIMELINE (timeline), NULL);
+
+ priv = GSD_TIMELINE_GET_PRIV (timeline);
+ return priv->screen;
+}
+
+void
+gsd_timeline_set_screen (GsdTimeline *timeline,
+ GdkScreen *screen)
+{
+ GsdTimelinePriv *priv;
+
+ g_return_if_fail (GSD_IS_TIMELINE (timeline));
+ g_return_if_fail (GDK_IS_SCREEN (screen));
+
+ priv = GSD_TIMELINE_GET_PRIV (timeline);
+
+ if (priv->screen)
+ g_object_unref (priv->screen);
+
+ priv->screen = g_object_ref (screen);
+
+ g_object_notify (G_OBJECT (timeline), "screen");
+}
+
+void
+gsd_timeline_set_progress_type (GsdTimeline *timeline,
+ GsdTimelineProgressType type)
+{
+ GsdTimelinePriv *priv;
+
+ g_return_if_fail (GSD_IS_TIMELINE (timeline));
+
+ priv = GSD_TIMELINE_GET_PRIV (timeline);
+
+ priv->progress_type = type;
+
+ g_object_notify (G_OBJECT (timeline), "progress-type");
+}
+
+GsdTimelineProgressType
+gsd_timeline_get_progress_type (GsdTimeline *timeline)
+{
+ GsdTimelinePriv *priv;
+
+ g_return_val_if_fail (GSD_IS_TIMELINE (timeline), GSD_TIMELINE_PROGRESS_LINEAR);
+
+ priv = GSD_TIMELINE_GET_PRIV (timeline);
+
+ if (priv->progress_func)
+ return GSD_TIMELINE_PROGRESS_LINEAR;
+
+ return priv->progress_type;
+}
+
+/**
+ * gsd_timeline_set_progress_func:
+ * @timeline: A #GsdTimeline
+ * @progress_func: progress function
+ *
+ * Sets the progress function. This function will be used to calculate
+ * a different progress to pass to the ::frame signal based on the
+ * linear progress through the timeline. Setting progress_func
+ * to %NULL will make the timeline use the default function,
+ * which is just a linear progress.
+ *
+ * All progresses are in the [0.0, 1.0] range.
+ **/
+void
+gsd_timeline_set_progress_func (GsdTimeline *timeline,
+ GsdTimelineProgressFunc progress_func)
+{
+ GsdTimelinePriv *priv;
+
+ g_return_if_fail (GSD_IS_TIMELINE (timeline));
+
+ priv = GSD_TIMELINE_GET_PRIV (timeline);
+ priv->progress_func = progress_func;
+}
+
+gdouble
+gsd_timeline_get_progress (GsdTimeline *timeline)
+{
+ GsdTimelinePriv *priv;
+ GsdTimelineProgressFunc progress_func = NULL;
+ gdouble linear_progress, progress;
+ guint elapsed_time;
+
+ g_return_val_if_fail (GSD_IS_TIMELINE (timeline), 0.0);
+
+ priv = GSD_TIMELINE_GET_PRIV (timeline);
+
+ if (!priv->timer)
+ return 0.;
+
+ elapsed_time = (guint) (g_timer_elapsed (priv->timer, NULL) * 1000);
+
+ linear_progress = (gdouble) elapsed_time / priv->duration;
+
+ if (priv->direction == GSD_TIMELINE_DIRECTION_BACKWARD)
+ linear_progress = 1 - linear_progress;
+
+ linear_progress = CLAMP (linear_progress, 0., 1.);
+
+ if (priv->progress_func)
+ progress_func = priv->progress_func;
+ else if (priv->progress_type)
+ progress_func = progress_type_to_func (priv->progress_type);
+
+ if (progress_func)
+ progress = (progress_func) (linear_progress);
+ else
+ progress = linear_progress;
+
+ return CLAMP (progress, 0., 1.);
+}
diff --git a/plugins/mouse/gsd-timeline.h b/plugins/mouse/gsd-timeline.h
new file mode 100644
index 0000000..d4ecbcc
--- /dev/null
+++ b/plugins/mouse/gsd-timeline.h
@@ -0,0 +1,127 @@
+/* gsdtimeline.c
+ *
+ * Copyright (C) 2008 Carlos Garnacho <[email protected]>
+ *
+ * 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.
+ */
+
+#ifndef __GSD_TIMELINE_H__
+#define __GSD_TIMELINE_H__
+
+#include <glib-object.h>
+#include <gdk/gdk.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define GSD_TYPE_TIMELINE_DIRECTION (gsd_timeline_direction_get_type ())
+#define GSD_TYPE_TIMELINE_PROGRESS_TYPE (gsd_timeline_progress_type_get_type ())
+#define GSD_TYPE_TIMELINE (gsd_timeline_get_type ())
+#define GSD_TIMELINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GSD_TYPE_TIMELINE, GsdTimeline))
+#define GSD_TIMELINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GSD_TYPE_TIMELINE, GsdTimelineClass))
+#define GSD_IS_TIMELINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GSD_TYPE_TIMELINE))
+#define GSD_IS_TIMELINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GSD_TYPE_TIMELINE))
+#define GSD_TIMELINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GSD_TYPE_TIMELINE, GsdTimelineClass))
+
+typedef enum {
+ GSD_TIMELINE_DIRECTION_FORWARD,
+ GSD_TIMELINE_DIRECTION_BACKWARD
+} GsdTimelineDirection;
+
+typedef enum {
+ GSD_TIMELINE_PROGRESS_LINEAR,
+ GSD_TIMELINE_PROGRESS_SINUSOIDAL,
+ GSD_TIMELINE_PROGRESS_EXPONENTIAL
+} GsdTimelineProgressType;
+
+typedef struct GsdTimeline GsdTimeline;
+typedef struct GsdTimelineClass GsdTimelineClass;
+
+struct GsdTimeline
+{
+ GObject parent_instance;
+};
+
+struct GsdTimelineClass
+{
+ GObjectClass parent_class;
+
+ void (* started) (GsdTimeline *timeline);
+ void (* finished) (GsdTimeline *timeline);
+ void (* paused) (GsdTimeline *timeline);
+
+ void (* frame) (GsdTimeline *timeline,
+ gdouble progress);
+
+ void (* __gsd_reserved1) (void);
+ void (* __gsd_reserved2) (void);
+ void (* __gsd_reserved3) (void);
+ void (* __gsd_reserved4) (void);
+};
+
+typedef gdouble (*GsdTimelineProgressFunc) (gdouble progress);
+
+
+GType gsd_timeline_get_type (void) G_GNUC_CONST;
+GType gsd_timeline_direction_get_type (void) G_GNUC_CONST;
+GType gsd_timeline_progress_type_get_type (void) G_GNUC_CONST;
+
+GsdTimeline *gsd_timeline_new (guint duration);
+GsdTimeline *gsd_timeline_new_for_screen (guint duration,
+ GdkScreen *screen);
+
+void gsd_timeline_start (GsdTimeline *timeline);
+void gsd_timeline_pause (GsdTimeline *timeline);
+void gsd_timeline_rewind (GsdTimeline *timeline);
+
+gboolean gsd_timeline_is_running (GsdTimeline *timeline);
+
+guint gsd_timeline_get_fps (GsdTimeline *timeline);
+void gsd_timeline_set_fps (GsdTimeline *timeline,
+ guint fps);
+
+gboolean gsd_timeline_get_loop (GsdTimeline *timeline);
+void gsd_timeline_set_loop (GsdTimeline *timeline,
+ gboolean loop);
+
+guint gsd_timeline_get_duration (GsdTimeline *timeline);
+void gsd_timeline_set_duration (GsdTimeline *timeline,
+ guint duration);
+
+GdkScreen *gsd_timeline_get_screen (GsdTimeline *timeline);
+void gsd_timeline_set_screen (GsdTimeline *timeline,
+ GdkScreen *screen);
+
+GsdTimelineDirection gsd_timeline_get_direction (GsdTimeline *timeline);
+void gsd_timeline_set_direction (GsdTimeline *timeline,
+ GsdTimelineDirection direction);
+
+GsdTimelineProgressType gsd_timeline_get_progress_type (GsdTimeline *timeline);
+void gsd_timeline_set_progress_type (GsdTimeline *timeline,
+ GsdTimelineProgressType type);
+void gsd_timeline_get_progress_func (GsdTimeline *timeline);
+
+void gsd_timeline_set_progress_func (GsdTimeline *timeline,
+ GsdTimelineProgressFunc progress_func);
+
+gdouble gsd_timeline_get_progress (GsdTimeline *timeline);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __GSD_TIMELINE_H__ */
diff --git a/plugins/mouse/mouse.mate-settings-plugin.in b/plugins/mouse/mouse.mate-settings-plugin.in
new file mode 100644
index 0000000..8cf5272
--- /dev/null
+++ b/plugins/mouse/mouse.mate-settings-plugin.in
@@ -0,0 +1,8 @@
+[MATE Settings Plugin]
+Module=mouse
+IAge=0
+_Name=Mouse
+_Description=Mouse plugin
+Authors=
+Copyright=Copyright © 2007
+Website=