From f911d0e0c2f217f81af4b9e5331ed3110f703c3c Mon Sep 17 00:00:00 2001 From: Andrew Shadura Date: Fri, 15 Jul 2016 18:26:00 +0200 Subject: Apply patches. --- configure.ac | 9 +- .../gsd-pointing-device-plugin.c | 56 ++++-- .../gsd-touchpad-manager.c | 6 +- po/Makefile.in.in | 217 +++++++++++++++++++++ po/POTFILES.skip | 1 + src/gpds-xinput-pointer-info.c | 3 +- src/gpds-xinput-utils.c | 7 +- src/gpds-xinput.c | 27 +-- test/test-xinput-utils.c | 2 +- 9 files changed, 288 insertions(+), 40 deletions(-) create mode 100644 po/Makefile.in.in diff --git a/configure.ac b/configure.ac index 0dcbf3f..fc28546 100644 --- a/configure.ac +++ b/configure.ac @@ -3,10 +3,9 @@ AC_PREREQ(2.57) AC_INIT(gpointing-device-settings, 1.5.1, [http://bugzilla.gnome.org/enter_bug.cgi?product=GPointingDeviceSettings]) -AM_INIT_AUTOMAKE([1.9 tar-ustar]) -AM_INIT_AUTOMAKE([foreign]) +AM_INIT_AUTOMAKE([1.9 tar-ustar foreign]) m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) -AM_CONFIG_HEADER(config.h) +AC_CONFIG_HEADERS(config.h) AC_CONFIG_MACRO_DIR([m4]) AM_PROG_LIBTOOL @@ -146,9 +145,6 @@ GENHTML_OPTIONS="--title 'GPointingDeviceSettings Code Coverage'" GPDS_CFLAGS="$XINPUT_CFLAGS $GTK_CFLAGS" GPDS_CFLAGS="$GPDS_CFLAGS $GCONF2_CFLAGS" -GPDS_CFLAGS="$GPDS_CFLAGS -DGTK_DISABLE_DEPRECATED" -GPDS_CFLAGS="$GPDS_CFLAGS -DGDK_DISABLE_DEPRECATED" -GPDS_CFLAGS="$GPDS_CFLAGS -DG_DISABLE_DEPRECATED" GPDS_CFLAGS="$GPDS_CFLAGS -DGPDS_MODULEDIR=\\\"\"\$(gpds_moduledir)\"\\\"" GPDS_CFLAGS="$GPDS_CFLAGS -DGPDS_DATADIR=\\\"\"\$(gpds_datadir)\"\\\"" GPDS_CFLAGS="$GPDS_CFLAGS -DGPDS_UIDIR=\\\"\"\$(gpds_uidir)\"\\\"" @@ -174,4 +170,5 @@ po/Makefile.in libgpointing-device-settings.pc ]) + AC_OUTPUT diff --git a/modules/gnome-settings-daemon-plugins/gsd-pointing-device-plugin.c b/modules/gnome-settings-daemon-plugins/gsd-pointing-device-plugin.c index 8a2d98f..c7f4fee 100644 --- a/modules/gnome-settings-daemon-plugins/gsd-pointing-device-plugin.c +++ b/modules/gnome-settings-daemon-plugins/gsd-pointing-device-plugin.c @@ -56,6 +56,25 @@ struct _GsdPointingDevicePluginClass GType gsd_pointing_device_plugin_get_type (void) G_GNUC_CONST; G_MODULE_EXPORT GType register_gnome_settings_plugin (GTypeModule *module); +#undef GNOME_SETTINGS_PLUGIN_REGISTER +/* + * Utility macro used to register plugins + * + * use: GNOME_SETTINGS_PLUGIN_REGISTER (PluginName, plugin_name) + */ +#define GNOME_SETTINGS_PLUGIN_REGISTER(PluginName, plugin_name) \ + G_DEFINE_DYNAMIC_TYPE (PluginName, \ + plugin_name, \ + GNOME_TYPE_SETTINGS_PLUGIN) \ + \ +G_MODULE_EXPORT GType \ +register_gnome_settings_plugin (GTypeModule *type_module) \ +{ \ + plugin_name##_register_type (type_module); \ + \ + return plugin_name##_get_type(); \ +} \ + GNOME_SETTINGS_PLUGIN_REGISTER(GsdPointingDevicePlugin, gsd_pointing_device_plugin) static void @@ -96,19 +115,21 @@ device_presence_filter (GdkXEvent *xevent, XDevicePresenceNotifyEvent *notify_event = (XDevicePresenceNotifyEvent *)xev; device_info = gpds_xinput_utils_get_device_info_from_id(notify_event->deviceid, NULL); - if (notify_event->devchange == DeviceEnabled) { - GsdPointingDeviceManager *manager; - - if (has_manager(plugin, device_info->name)) - return GDK_FILTER_CONTINUE; - - manager = gsd_pointing_device_manager_new(gdk_x11_get_xatom_name(device_info->type), - device_info->name); - if (manager) { - gsd_pointing_device_manager_start(manager, NULL); - plugin->managers = g_list_prepend(plugin->managers, manager); + if (device_info) { + if (notify_event->devchange == DeviceEnabled) { + GsdPointingDeviceManager *manager; + + if (has_manager(plugin, device_info->name)) + return GDK_FILTER_CONTINUE; + + manager = gsd_pointing_device_manager_new(gdk_x11_get_xatom_name(device_info->type), + device_info->name); + if (manager) { + gsd_pointing_device_manager_start(manager, NULL); + plugin->managers = g_list_prepend(plugin->managers, manager); + } + } else if (notify_event->devchange == DeviceRemoved) { } - } else if (notify_event->devchange == DeviceRemoved) { } } @@ -124,7 +145,9 @@ add_device_presence_filter (GsdPointingDevicePlugin *plugin) gint op_code, event, error; - if (!XQueryExtension(GDK_DISPLAY(), + display = gdk_x11_get_default_xdisplay(); + + if (!XQueryExtension(display, "XInputExtension", &op_code, &event, @@ -132,8 +155,6 @@ add_device_presence_filter (GsdPointingDevicePlugin *plugin) return; } - display = gdk_x11_get_default_xdisplay(); - gdk_error_trap_push(); DevicePresence(display, xi_presence, class_presence); XSelectExtensionEvent(display, @@ -212,6 +233,11 @@ gsd_pointing_device_plugin_class_init (GsdPointingDevicePluginClass *klass) plugin_class->activate = activate; plugin_class->deactivate = deactivate; } + +static void +gsd_pointing_device_plugin_class_finalize (GsdPointingDevicePluginClass *klass) +{ +} /* vi:ts=4:nowrap:ai:expandtab:sw=4 */ diff --git a/modules/gnome-settings-daemon-plugins/gsd-touchpad-manager.c b/modules/gnome-settings-daemon-plugins/gsd-touchpad-manager.c index 2038d53..f47e0a4 100644 --- a/modules/gnome-settings-daemon-plugins/gsd-touchpad-manager.c +++ b/modules/gnome-settings-daemon-plugins/gsd-touchpad-manager.c @@ -348,7 +348,9 @@ add_device_presence_filter (GsdPointingDeviceManager *manager) gint op_code, event, error; - if (!XQueryExtension(GDK_DISPLAY(), + display = gdk_x11_get_default_xdisplay(); + + if (!XQueryExtension(display, "XInputExtension", &op_code, &event, @@ -356,8 +358,6 @@ add_device_presence_filter (GsdPointingDeviceManager *manager) return; } - display = gdk_x11_get_default_xdisplay(); - gdk_error_trap_push(); DevicePresence(display, xi_presence, class_presence); XSelectExtensionEvent(display, diff --git a/po/Makefile.in.in b/po/Makefile.in.in new file mode 100644 index 0000000..cc8a222 --- /dev/null +++ b/po/Makefile.in.in @@ -0,0 +1,217 @@ +# Makefile for program source directory in GNU NLS utilities package. +# Copyright (C) 1995, 1996, 1997 by Ulrich Drepper +# Copyright (C) 2004-2008 Rodney Dawes +# +# This file may be copied and used freely without restrictions. It may +# be used in projects which are not available under a GNU Public License, +# but which still want to provide support for the GNU gettext functionality. +# +# - Modified by Owen Taylor to use GETTEXT_PACKAGE +# instead of PACKAGE and to look for po2tbl in ./ not in intl/ +# +# - Modified by jacob berkman to install +# Makefile.in.in and po2tbl.sed.in for use with glib-gettextize +# +# - Modified by Rodney Dawes for use with intltool +# +# We have the following line for use by intltoolize: +# INTLTOOL_MAKEFILE + +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +PACKAGE = @PACKAGE@ +VERSION = @VERSION@ + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +top_builddir = @top_builddir@ +VPATH = @srcdir@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ +datadir = @datadir@ +datarootdir = @datarootdir@ +libdir = @libdir@ +DATADIRNAME = @DATADIRNAME@ +itlocaledir = $(prefix)/$(DATADIRNAME)/locale +subdir = po +install_sh = @install_sh@ +# Automake >= 1.8 provides @mkdir_p@. +# Until it can be supposed, use the safe fallback: +mkdir_p = $(install_sh) -d + +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ + +GMSGFMT = @GMSGFMT@ +MSGFMT = @MSGFMT@ +XGETTEXT = @XGETTEXT@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +MSGMERGE = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist +GENPOT = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot + +ALL_LINGUAS = @ALL_LINGUAS@ + +PO_LINGUAS=$(shell if test -r $(srcdir)/LINGUAS; then grep -v "^\#" $(srcdir)/LINGUAS; else echo "$(ALL_LINGUAS)"; fi) + +USER_LINGUAS=$(shell if test -n "$(LINGUAS)"; then LLINGUAS="$(LINGUAS)"; ALINGUAS="$(ALL_LINGUAS)"; for lang in $$LLINGUAS; do if test -n "`grep \^$$lang$$ $(srcdir)/LINGUAS 2>/dev/null`" -o -n "`echo $$ALINGUAS|tr ' ' '\n'|grep \^$$lang$$`"; then printf "$$lang "; fi; done; fi) + +USE_LINGUAS=$(shell if test -n "$(USER_LINGUAS)" -o -n "$(LINGUAS)"; then LLINGUAS="$(USER_LINGUAS)"; else if test -n "$(PO_LINGUAS)"; then LLINGUAS="$(PO_LINGUAS)"; else LLINGUAS="$(ALL_LINGUAS)"; fi; fi; for lang in $$LLINGUAS; do printf "$$lang "; done) + +POFILES=$(shell LINGUAS="$(PO_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.po "; done) + +DISTFILES = Makefile.in.in POTFILES.in $(POFILES) +EXTRA_DISTFILES = ChangeLog POTFILES.skip Makevars LINGUAS + +POTFILES = \ +# This comment gets stripped out + +CATALOGS=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.gmo "; done) + +.SUFFIXES: +.SUFFIXES: .po .pox .gmo .mo .msg .cat + +.po.pox: + $(MAKE) $(GETTEXT_PACKAGE).pot + $(MSGMERGE) $< $(GETTEXT_PACKAGE).pot -o $*.pox + +.po.mo: + $(MSGFMT) -o $@ $< + +.po.gmo: + file=`echo $* | sed 's,.*/,,'`.gmo \ + && rm -f $$file && $(GMSGFMT) -o $$file $< + +.po.cat: + sed -f ../intl/po2msg.sed < $< > $*.msg \ + && rm -f $@ && gencat $@ $*.msg + + +all: all-@USE_NLS@ + +all-yes: $(CATALOGS) +all-no: + +$(GETTEXT_PACKAGE).pot: $(POTFILES) + $(GENPOT) + +install: install-data +install-data: install-data-@USE_NLS@ +install-data-no: all +install-data-yes: all + linguas="$(USE_LINGUAS)"; \ + for lang in $$linguas; do \ + dir=$(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES; \ + $(mkdir_p) $$dir; \ + if test -r $$lang.gmo; then \ + $(INSTALL_DATA) $$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \ + echo "installing $$lang.gmo as $$dir/$(GETTEXT_PACKAGE).mo"; \ + else \ + $(INSTALL_DATA) $(srcdir)/$$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \ + echo "installing $(srcdir)/$$lang.gmo as" \ + "$$dir/$(GETTEXT_PACKAGE).mo"; \ + fi; \ + if test -r $$lang.gmo.m; then \ + $(INSTALL_DATA) $$lang.gmo.m $$dir/$(GETTEXT_PACKAGE).mo.m; \ + echo "installing $$lang.gmo.m as $$dir/$(GETTEXT_PACKAGE).mo.m"; \ + else \ + if test -r $(srcdir)/$$lang.gmo.m ; then \ + $(INSTALL_DATA) $(srcdir)/$$lang.gmo.m \ + $$dir/$(GETTEXT_PACKAGE).mo.m; \ + echo "installing $(srcdir)/$$lang.gmo.m as" \ + "$$dir/$(GETTEXT_PACKAGE).mo.m"; \ + else \ + true; \ + fi; \ + fi; \ + done + +# Empty stubs to satisfy archaic automake needs +dvi info ctags tags CTAGS TAGS ID: + +# Define this as empty until I found a useful application. +install-exec installcheck: + +uninstall: + linguas="$(USE_LINGUAS)"; \ + for lang in $$linguas; do \ + rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \ + rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo.m; \ + done + +check: all $(GETTEXT_PACKAGE).pot + rm -f missing notexist + srcdir=$(srcdir) $(INTLTOOL_UPDATE) -m + if [ -r missing -o -r notexist ]; then \ + exit 1; \ + fi + +mostlyclean: + rm -f *.pox $(GETTEXT_PACKAGE).pot *.old.po cat-id-tbl.tmp + rm -f .intltool-merge-cache + +clean: mostlyclean + +distclean: clean + rm -f Makefile Makefile.in POTFILES stamp-it + rm -f *.mo *.msg *.cat *.cat.m *.gmo + +maintainer-clean: distclean + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + rm -f Makefile.in.in + +distdir = ../$(PACKAGE)-$(VERSION)/$(subdir) +dist distdir: $(DISTFILES) + dists="$(DISTFILES)"; \ + extra_dists="$(EXTRA_DISTFILES)"; \ + for file in $$extra_dists; do \ + test -f $(srcdir)/$$file && dists="$$dists $(srcdir)/$$file"; \ + done; \ + for file in $$dists; do \ + test -f $$file || file="$(srcdir)/$$file"; \ + ln $$file $(distdir) 2> /dev/null \ + || cp -p $$file $(distdir); \ + done + +update-po: Makefile + $(MAKE) $(GETTEXT_PACKAGE).pot + tmpdir=`pwd`; \ + linguas="$(USE_LINGUAS)"; \ + for lang in $$linguas; do \ + echo "$$lang:"; \ + result="`$(MSGMERGE) -o $$tmpdir/$$lang.new.po $$lang`"; \ + if $$result; then \ + if cmp $(srcdir)/$$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \ + rm -f $$tmpdir/$$lang.new.po; \ + else \ + if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \ + :; \ + else \ + echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \ + rm -f $$tmpdir/$$lang.new.po; \ + exit 1; \ + fi; \ + fi; \ + else \ + echo "msgmerge for $$lang.gmo failed!"; \ + rm -f $$tmpdir/$$lang.new.po; \ + fi; \ + done + +Makefile POTFILES: stamp-it + @if test ! -f $@; then \ + rm -f stamp-it; \ + $(MAKE) stamp-it; \ + fi + +stamp-it: Makefile.in.in $(top_builddir)/config.status POTFILES.in + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/Makefile.in CONFIG_HEADERS= CONFIG_LINKS= \ + $(SHELL) ./config.status + +# Tell versions [3.59,3.63) of GNU make not to export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/po/POTFILES.skip b/po/POTFILES.skip index 9019a8c..28d5568 100644 --- a/po/POTFILES.skip +++ b/po/POTFILES.skip @@ -1 +1,2 @@ data/gpointing-device-settings.desktop.in +.pc/fix-crash.patch/modules/gpds-touchpad-ui.c diff --git a/src/gpds-xinput-pointer-info.c b/src/gpds-xinput-pointer-info.c index d38afad..ce9a952 100644 --- a/src/gpds-xinput-pointer-info.c +++ b/src/gpds-xinput-pointer-info.c @@ -55,7 +55,8 @@ gpds_xinput_utils_collect_pointer_infos (void) XDeviceInfo *device_infos; gint i, n_device_infos; - device_infos = XListInputDevices(GDK_DISPLAY(), &n_device_infos); + device_infos = XListInputDevices(gdk_x11_get_default_xdisplay(), + &n_device_infos); for (i = 0; i < n_device_infos; i++) { GpdsXInputPointerInfo *info; diff --git a/src/gpds-xinput-utils.c b/src/gpds-xinput-utils.c index 0f7ceea..5a3e3a2 100644 --- a/src/gpds-xinput-utils.c +++ b/src/gpds-xinput-utils.c @@ -41,7 +41,8 @@ gpds_xinput_utils_get_device_info (const gchar *device_name, GError **error) XDeviceInfo *device_infos; gint i, n_device_infos; - device_infos = XListInputDevices(GDK_DISPLAY(), &n_device_infos); + device_infos = XListInputDevices(gdk_x11_get_default_xdisplay(), + &n_device_infos); for (i = 0; i < n_device_infos; i++) { if (device_infos[i].use != IsXExtensionPointer) @@ -68,7 +69,7 @@ gpds_xinput_utils_get_device_info_from_id (XID id, GError **error) XDeviceInfo *device_infos; gint i, n_device_infos; - device_infos = XListInputDevices(GDK_DISPLAY(), &n_device_infos); + device_infos = XListInputDevices(gdk_x11_get_default_xdisplay(), &n_device_infos); for (i = 0; i < n_device_infos; i++) { if (device_infos[i].use != IsXExtensionPointer) @@ -125,7 +126,7 @@ gpds_xinput_utils_open_device (const gchar *device_name, GError **error) return NULL; gdk_error_trap_push(); - device = XOpenDevice(GDK_DISPLAY(), device_info->id); + device = XOpenDevice(gdk_x11_get_default_xdisplay(), device_info->id); gdk_error_trap_pop(); if (!device) { g_set_error(error, diff --git a/src/gpds-xinput.c b/src/gpds-xinput.c index d8bd1a2..66634b3 100644 --- a/src/gpds-xinput.c +++ b/src/gpds-xinput.c @@ -100,7 +100,7 @@ dispose (GObject *object) g_free(priv->device_name); if (priv->device) { - XCloseDevice(GDK_DISPLAY(), priv->device); + XCloseDevice(gdk_x11_get_default_xdisplay(), priv->device); priv->device = NULL; } @@ -199,7 +199,8 @@ get_x_error_text (int x_error_code) { gchar buf[64]; - XGetErrorText(GDK_DISPLAY(), x_error_code, buf, sizeof(buf) - 1); + XGetErrorText(gdk_x11_get_default_xdisplay(), x_error_code, + buf, sizeof(buf) - 1); return g_strdup(buf); } @@ -273,7 +274,7 @@ gpds_xinput_set_int_properties_by_name_with_format_type } gdk_error_trap_push(); - XChangeDeviceProperty(GDK_DISPLAY(), + XChangeDeviceProperty(gdk_x11_get_default_xdisplay(), device, property_atom, XA_INTEGER, format_type, PropModeReplace, (unsigned char*)property_data, n_properties); @@ -383,7 +384,8 @@ get_atom (GpdsXInput *xinput, const gchar *property_name, GError **error) if (!device) return -1; - properties = XListDeviceProperties(GDK_DISPLAY(), device, &n_properties); + properties = XListDeviceProperties(gdk_x11_get_default_xdisplay(), + device, &n_properties); for (i = 0; i < n_properties; i++) { const gchar *name; @@ -427,9 +429,9 @@ gpds_xinput_get_int_properties_by_name (GpdsXInput *xinput, return FALSE; gdk_error_trap_push(); - status = XGetDeviceProperty(GDK_DISPLAY(), device, atom, 0, 1000, False, - XA_INTEGER, &actual_type, &actual_format, - n_values, &bytes_after, &data); + status = XGetDeviceProperty(gdk_x11_get_default_xdisplay(), device, atom, + 0, 1000, False, XA_INTEGER, &actual_type, + &actual_format, n_values, &bytes_after, &data); gdk_flush(); x_error_code = gdk_error_trap_pop(); if (status != Success || x_error_code != 0) { @@ -523,7 +525,7 @@ gpds_xinput_set_float_properties_by_name (GpdsXInput *xinput, *(property_data + i) = (gfloat)properties[i]; gdk_error_trap_push(); - XChangeDeviceProperty(GDK_DISPLAY(), + XChangeDeviceProperty(gdk_x11_get_default_xdisplay(), device, property_atom, float_atom, 32, PropModeReplace, (unsigned char*)property_data, n_properties); @@ -594,7 +596,8 @@ gpds_xinput_get_float_properties_by_name (GpdsXInput *xinput, return FALSE; gdk_error_trap_push(); - status = XGetDeviceProperty(GDK_DISPLAY(), device, property_atom, 0, 1000, False, + status = XGetDeviceProperty(gdk_x11_get_default_xdisplay(), device, + property_atom, 0, 1000, False, float_atom, &actual_type, &actual_format, n_properties, &bytes_after, &data); gdk_flush(); @@ -676,7 +679,8 @@ gpds_xinput_get_button_map (GpdsXInput *xinput, *map = g_new0(guchar, *n_buttons); gdk_error_trap_push(); - status = XGetDeviceButtonMapping(GDK_DISPLAY(), device, *map, *n_buttons); + status = XGetDeviceButtonMapping(gdk_x11_get_default_xdisplay(), + device, *map, *n_buttons); gdk_flush(); x_error_code = gdk_error_trap_pop(); @@ -705,7 +709,8 @@ gpds_xinput_set_button_map (GpdsXInput *xinput, return FALSE; gdk_error_trap_push(); - status = XSetDeviceButtonMapping(GDK_DISPLAY(), device, map, n_buttons); + status = XSetDeviceButtonMapping(gdk_x11_get_default_xdisplay(), + device, map, n_buttons); gdk_flush(); x_error_code = gdk_error_trap_pop(); diff --git a/test/test-xinput-utils.c b/test/test-xinput-utils.c index a06dcbc..f97f9d4 100644 --- a/test/test-xinput-utils.c +++ b/test/test-xinput-utils.c @@ -29,7 +29,7 @@ void teardown (void) { if (device) - XCloseDevice(GDK_DISPLAY(), device); + XCloseDevice(gdk_x11_get_default_xdisplay(), device); g_clear_error(&error); g_clear_error(&expected_error); } -- cgit v1.2.3