don't call gtk_widget_grab_focus() here.

2008-05-08  Michael Natterer  <mitch@gimp.org>

	* app/display/gimpdisplayshell-callbacks.c
	(gimp_display_shell_events): don't call gtk_widget_grab_focus() here.

	(gimp_display_shell_canvas_tool_events): call it here instead and
	add comments about how BUTTON_PRESS and FOCUS_IN interact.

	Also return TRUE from BUTTON_PRESS, BUTTON_RELEASE and
	MOTION_NOTIFY.


svn path=/trunk/; revision=25590
This commit is contained in:
Michael Natterer 2008-05-08 15:26:21 +00:00 committed by Michael Natterer
parent c6bede23a0
commit 7cdecd20d0
2 changed files with 33 additions and 6 deletions

View File

@ -1,3 +1,14 @@
2008-05-08 Michael Natterer <mitch@gimp.org>
* app/display/gimpdisplayshell-callbacks.c
(gimp_display_shell_events): don't call gtk_widget_grab_focus() here.
(gimp_display_shell_canvas_tool_events): call it here instead and
add comments about how BUTTON_PRESS and FOCUS_IN interact.
Also return TRUE from BUTTON_PRESS, BUTTON_RELEASE and
MOTION_NOTIFY.
2008-05-08 Sven Neumann <sven@gimp.org>
* themes/Default/gtkrc

View File

@ -193,9 +193,6 @@ gimp_display_shell_events (GtkWidget *widget,
}
case GDK_BUTTON_PRESS:
gtk_widget_grab_focus (widget);
/* fall through */
case GDK_SCROLL:
set_display = TRUE;
break;
@ -685,13 +682,27 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
GdkEventButton *bevent = (GdkEventButton *) event;
GdkEventMask event_mask;
/* focus the widget if it isn't; if the toplevel window
* already has focus, this will generate a FOCUS_IN on the
* canvas immediately, therefore we do this before logging
* the BUTTON_PRESS.
*/
if (! GTK_WIDGET_HAS_FOCUS (canvas))
gtk_widget_grab_focus (canvas);
GIMP_LOG (TOOL_EVENTS, "event (display %p): BUTTON_PRESS (%d)",
display, bevent->button);
/* if the toplevel window didn't have focus, the above
* gtk_widget_grab_focus() didn't set the canvas' HAS_FOCUS
* flags, so check for it here again.
*
* this happens in "click to focus" mode.
*/
if (! GTK_WIDGET_HAS_FOCUS (canvas))
{
/* in "click to focus" mode, the BUTTON_PRESS arrives before
* FOCUS_IN, so we have to update the tool's modifier state here
/* do the things a FOCUS_IN event would do and set a flag
* preventing it from doing the same.
*/
gimp_display_shell_update_focus (shell, &image_coords, state);
@ -819,12 +830,13 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
"/dummy-menubar/image-popup",
GTK_WIDGET (shell),
NULL, NULL, NULL, NULL);
return_val = TRUE;
break;
default:
break;
}
return_val = TRUE;
}
break;
@ -890,6 +902,8 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
default:
break;
}
return_val = TRUE;
}
break;
@ -1196,6 +1210,8 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
shell->last_read_motion_time = time;
}
return_val = TRUE;
}
break;