app: fix "grabbing" of extended devices

If grabbing fails with GDK_GRAB_ALREADY_GRABBED (which it always
does), simply silently ignore that and assume the grab succeesed
anyway (puke).
This commit is contained in:
Michael Natterer 2011-03-03 22:38:50 +01:00
parent e3c0a4e549
commit 7a47e36c63
1 changed files with 24 additions and 0 deletions

View File

@ -23,6 +23,11 @@
#include "display-types.h"
#include "widgets/gimpdeviceinfo.h"
#include "widgets/gimpdevices.h"
#include "widgets/gimpdevicemanager.h"
#include "gimpdisplay.h"
#include "gimpdisplayshell.h"
#include "gimpdisplayshell-grab.h"
@ -48,6 +53,25 @@ gimp_display_shell_pointer_grab (GimpDisplayShell *shell,
return TRUE;
}
else if (status == GDK_GRAB_ALREADY_GRABBED)
{
GimpDeviceManager *manager;
GdkDisplay *gdk_display;
manager = gimp_devices_get_manager (shell->display->gimp);
gdk_display = gtk_widget_get_display (GTK_WIDGET (shell));
/* EEK: trying to grab an extended device always returns
* ALREADY_GRABBED, so simply assume the grab succeeded anyway
*/
if (gimp_device_manager_get_current_device (manager)->device !=
gdk_display_get_core_pointer (gdk_display))
{
shell->pointer_grabbed = TRUE;
return TRUE;
}
}
g_printerr ("%s: gdk_pointer_grab failed with status %d\n",
G_STRFUNC, status);