mirror of https://github.com/GNOME/gimp.git
app: g_printerr() a warning if grabbing fails
This should not happen, but happens anyway on GTK+ 3.x, so better warn about it to make debugging easier.
This commit is contained in:
parent
0ba0b637f2
commit
748fac5c00
|
@ -1845,6 +1845,8 @@ gimp_display_shell_ruler_button_press (GtkWidget *widget,
|
||||||
|
|
||||||
if (active_tool)
|
if (active_tool)
|
||||||
{
|
{
|
||||||
|
GdkGrabStatus status;
|
||||||
|
|
||||||
if (! gtk_widget_has_focus (shell->canvas))
|
if (! gtk_widget_has_focus (shell->canvas))
|
||||||
{
|
{
|
||||||
gimp_display_shell_update_focus (shell, NULL, event->state);
|
gimp_display_shell_update_focus (shell, NULL, event->state);
|
||||||
|
@ -1858,21 +1860,42 @@ gimp_display_shell_ruler_button_press (GtkWidget *widget,
|
||||||
gdk_event_get_time ((GdkEvent *) event));
|
gdk_event_get_time ((GdkEvent *) event));
|
||||||
}
|
}
|
||||||
|
|
||||||
gdk_pointer_grab (gtk_widget_get_window (shell->canvas), FALSE,
|
status = gdk_pointer_grab (gtk_widget_get_window (shell->canvas), FALSE,
|
||||||
GDK_POINTER_MOTION_HINT_MASK |
|
GDK_POINTER_MOTION_HINT_MASK |
|
||||||
GDK_BUTTON1_MOTION_MASK |
|
GDK_BUTTON1_MOTION_MASK |
|
||||||
GDK_BUTTON_RELEASE_MASK,
|
GDK_BUTTON_RELEASE_MASK,
|
||||||
NULL, NULL, event->time);
|
NULL, NULL, event->time);
|
||||||
|
|
||||||
gdk_keyboard_grab (gtk_widget_get_window (shell->canvas),
|
if (status == GDK_GRAB_SUCCESS)
|
||||||
FALSE, event->time);
|
{
|
||||||
|
status = gdk_keyboard_grab (gtk_widget_get_window (shell->canvas),
|
||||||
|
FALSE, event->time);
|
||||||
|
|
||||||
if (sample_point)
|
if (status == GDK_GRAB_SUCCESS)
|
||||||
gimp_color_tool_start_sample_point (active_tool, display);
|
{
|
||||||
else if (horizontal)
|
if (sample_point)
|
||||||
gimp_move_tool_start_hguide (active_tool, display);
|
gimp_color_tool_start_sample_point (active_tool, display);
|
||||||
|
else if (horizontal)
|
||||||
|
gimp_move_tool_start_hguide (active_tool, display);
|
||||||
|
else
|
||||||
|
gimp_move_tool_start_vguide (active_tool, display);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
g_printerr ("%s: gdk_keyboard_grab failed with status %d\n",
|
||||||
|
G_STRFUNC, status);
|
||||||
|
|
||||||
|
gdk_display_pointer_ungrab (gtk_widget_get_display (shell->canvas),
|
||||||
|
event->time);
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
gimp_move_tool_start_vguide (active_tool, display);
|
{
|
||||||
|
g_printerr ("%s: gdk_pointer_grab failed with status %d\n",
|
||||||
|
G_STRFUNC, status);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue