also zoom on mouse position if the event originates from the canvas (see

2005-05-11  Sven Neumann  <sven@gimp.org>

	* app/display/gimpdisplayshell-scale.c (gimp_display_shell_scale):
	also zoom on mouse position if the event originates from the canvas
	(see bug #79384).

	* app/display/gimpdisplayshell-callbacks.c
	(gimp_display_shell_canvas_tool_events): replaced a g_warning()
	with g_return_if_fail().
This commit is contained in:
Sven Neumann 2005-05-11 15:00:49 +00:00 committed by Sven Neumann
parent 9ddc6cafcc
commit 5c4278d003
3 changed files with 27 additions and 7 deletions

View file

@ -1,3 +1,13 @@
2005-05-11 Sven Neumann <sven@gimp.org>
* app/display/gimpdisplayshell-scale.c (gimp_display_shell_scale):
also zoom on mouse position if the event originates from the canvas
(see bug #79384).
* app/display/gimpdisplayshell-callbacks.c
(gimp_display_shell_canvas_tool_events): replaced a g_warning()
with g_return_if_fail().
2005-05-11 Simon Budig <simon@gimp.org>
* app/tools/gimpvectortool.c: reset the vector tool to Design

View file

@ -458,11 +458,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
static GimpToolInfo *space_shaded_tool = NULL;
if (! canvas->window)
{
g_warning ("%s: called unrealized", G_STRFUNC);
return FALSE;
}
g_return_val_if_fail (GTK_WIDGET_REALIZED (canvas), FALSE);
/* are we in destruction? */
if (! shell->gdisp || ! shell->gdisp->shell)

View file

@ -361,7 +361,7 @@ gimp_display_shell_scale_set_dot_for_dot (GimpDisplayShell *shell,
*
* This function calls gimp_display_shell_scale_to(). It tries to be
* smart whether to use the position of the mouse pointer or the
* center of the display as coordinates.+
* center of the display as coordinates.
**/
void
gimp_display_shell_scale (GimpDisplayShell *shell,
@ -377,9 +377,23 @@ gimp_display_shell_scale (GimpDisplayShell *shell,
x = shell->disp_width / 2;
y = shell->disp_height / 2;
/* Center on the mouse position instead of the display center,
* if one of the following conditions is fulfilled:
*
* (1) there's no current event (the action was triggered by an
* input controller)
* (2) the event originates from the canvas (a scroll event)
* (3) the event originates from the shell (a key press event)
*
* Basically the only situation where we don't want to center on
* mouse position is if the action is being called from a menu.
*/
event = gtk_get_current_event ();
if (! event || gtk_get_event_widget (event) == GTK_WIDGET (shell))
if (! event ||
gtk_get_event_widget (event) == shell->canvas ||
gtk_get_event_widget (event) == GTK_WIDGET (shell))
{
gtk_widget_get_pointer (shell->canvas, &x, &y);
}