diff options
author | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-01-10 23:03:44 +0800 |
---|---|---|
committer | Emilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk> | 2011-01-11 19:37:18 +0800 |
commit | 05047bfdd596bf6010d09f9409ff13a74190ed4c (patch) | |
tree | ea92784853959acb736eb718d6e54298238dc43b | |
parent | 0ffc53acc1c6993100c08e85180a10daf817556b (diff) | |
download | gsoc2013-empathy-05047bfdd596bf6010d09f9409ff13a74190ed4c.tar gsoc2013-empathy-05047bfdd596bf6010d09f9409ff13a74190ed4c.tar.gz gsoc2013-empathy-05047bfdd596bf6010d09f9409ff13a74190ed4c.tar.bz2 gsoc2013-empathy-05047bfdd596bf6010d09f9409ff13a74190ed4c.tar.lz gsoc2013-empathy-05047bfdd596bf6010d09f9409ff13a74190ed4c.tar.xz gsoc2013-empathy-05047bfdd596bf6010d09f9409ff13a74190ed4c.tar.zst gsoc2013-empathy-05047bfdd596bf6010d09f9409ff13a74190ed4c.zip |
Don't use deprecated gdk_keyboard_grab/ungrab
-rw-r--r-- | libempathy-gtk/empathy-password-dialog.c | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/libempathy-gtk/empathy-password-dialog.c b/libempathy-gtk/empathy-password-dialog.c index 2b1048c1c..2491872c2 100644 --- a/libempathy-gtk/empathy-password-dialog.c +++ b/libempathy-gtk/empathy-password-dialog.c @@ -157,13 +157,25 @@ password_dialog_grab_keyboard (GtkWidget *widget, if (!priv->grabbing) { - GdkGrabStatus status = gdk_keyboard_grab (gtk_widget_get_window (widget), - FALSE, gdk_event_get_time (event)); - - if (status != GDK_GRAB_SUCCESS) - DEBUG ("Could not grab keyboard; grab status was %u", status); + GdkDevice *device = gdk_event_get_device (event); + + if (device != NULL) + { + GdkGrabStatus status = gdk_device_grab (device, + gtk_widget_get_window (widget), + GDK_OWNERSHIP_WINDOW, + FALSE, + GDK_ALL_EVENTS_MASK, + NULL, + gdk_event_get_time (event)); + + if (status != GDK_GRAB_SUCCESS) + DEBUG ("Could not grab keyboard; grab status was %u", status); + else + priv->grabbing = TRUE; + } else - priv->grabbing = TRUE; + DEBUG ("Could not get the event device!"); } return FALSE; @@ -178,8 +190,15 @@ password_dialog_ungrab_keyboard (GtkWidget *widget, if (priv->grabbing) { - gdk_keyboard_ungrab (gdk_event_get_time (event)); - priv->grabbing = FALSE; + GdkDevice *device = gdk_event_get_device (event); + + if (device != NULL) + { + gdk_device_ungrab (device, gdk_event_get_time (event)); + priv->grabbing = FALSE; + } + else + DEBUG ("Could not get the event device!"); } return FALSE; |