[gimp/gtk3-port: 104/230] app: port the device sort function to GdkDeviceManager
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gtk3-port: 104/230] app: port the device sort function to GdkDeviceManager
- Date: Mon, 9 Jun 2014 22:43:06 +0000 (UTC)
commit 7e6a4e229a5e8fc2d868dfa7449e2093f34c734f
Author: Michael Natterer <mitch gimp org>
Date: Thu Dec 9 22:34:27 2010 +0100
app: port the device sort function to GdkDeviceManager
Also make sure we don't pass around uninitialized keyvals and
modifiers of device keys.
app/widgets/gimpdeviceinfo.c | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/app/widgets/gimpdeviceinfo.c b/app/widgets/gimpdeviceinfo.c
index 90226c7..9557451 100644
--- a/app/widgets/gimpdeviceinfo.c
+++ b/app/widgets/gimpdeviceinfo.c
@@ -625,8 +625,8 @@ gimp_device_info_set_device (GimpDeviceInfo *info,
for (i = 0; i < MIN (info->n_keys, gdk_device_get_n_keys (device)); i++)
{
- guint keyval;
- GdkModifierType modifiers;
+ guint keyval = 0;
+ GdkModifierType modifiers = 0;
gdk_device_get_key (device, i, &keyval, &modifiers);
gimp_device_info_set_key (info, i, keyval, modifiers);
@@ -768,6 +768,9 @@ gimp_device_info_get_key (GimpDeviceInfo *info,
if (info->device)
{
+ *keyval = 0;
+ *modifiers = 0;
+
gdk_device_get_key (info->device, key,
keyval,
modifiers);
@@ -877,13 +880,17 @@ gint
gimp_device_info_compare (GimpDeviceInfo *a,
GimpDeviceInfo *b)
{
+ GdkDeviceManager *manager;
+
if (a->device && a->display &&
- a->device == gdk_display_get_core_pointer (a->display))
+ (manager = gdk_display_get_device_manager (a->display)) &&
+ a->device == gdk_device_manager_get_client_pointer (manager))
{
return -1;
}
else if (b->device && b->display &&
- b->device == gdk_display_get_core_pointer (b->display))
+ (manager = gdk_display_get_device_manager (b->display)) &&
+ b->device == gdk_device_manager_get_client_pointer (manager))
{
return 1;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]