gimp r26599 - in trunk: . app/display
- From: martinn svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp r26599 - in trunk: . app/display
- Date: Sat, 16 Aug 2008 16:52:05 +0000 (UTC)
Author: martinn
Date: Sat Aug 16 16:52:05 2008
New Revision: 26599
URL: http://svn.gnome.org/viewvc/gimp?rev=26599&view=rev
Log:
2008-08-16 Martin Nordholts <martinn svn gnome org>
* app/display/gimpdisplayshell-callbacks.c
(gimp_display_shell_canvas_size_allocate): Remove the centering
logic because we do not always want to run it when the canvas size
changes. For example, the canvas size changes if rulers are
toggled on/off.
* app/display/gimpdisplayshell.c
(gimp_display_shell_configure_event): Implement
GtkWidget::configure_event() for the display shell and put the
image centering logic here instead, since this class function is
run when the top level window size changes. Run it only if the
size (not position) of the window changes.
Modified:
trunk/ChangeLog
trunk/app/display/gimpdisplayshell-callbacks.c
trunk/app/display/gimpdisplayshell.c
Modified: trunk/app/display/gimpdisplayshell-callbacks.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-callbacks.c (original)
+++ trunk/app/display/gimpdisplayshell-callbacks.c Sat Aug 16 16:52:05 2008
@@ -302,26 +302,6 @@
shell->disp_width = allocation->width;
shell->disp_height = allocation->height;
- if (shell->display && shell->display->image)
- {
- gint sw;
- gint sh;
- gboolean center_horizontally;
- gboolean center_vertically;
-
- gimp_display_shell_draw_get_scaled_image_size (shell, &sw, &sh);
-
- center_horizontally = sw < shell->disp_width;
- center_vertically = sh < shell->disp_height;
-
- /* If the image fits within the display shell canvas on a
- * given axis, center the image on that axis.
- */
- gimp_display_shell_scroll_center_image (shell,
- center_horizontally,
- center_vertically);
- }
-
gimp_display_shell_scroll_clamp_and_update (shell);
gimp_display_shell_scaled (shell);
Modified: trunk/app/display/gimpdisplayshell.c
==============================================================================
--- trunk/app/display/gimpdisplayshell.c (original)
+++ trunk/app/display/gimpdisplayshell.c Sat Aug 16 16:52:05 2008
@@ -117,6 +117,8 @@
GdkScreen *previous);
static gboolean gimp_display_shell_delete_event (GtkWidget *widget,
GdkEventAny *aevent);
+static gboolean gimp_display_shell_configure_event(GtkWidget *widget,
+ GdkEventConfigure*cevent);
static gboolean
gimp_display_shell_window_state_event (GtkWidget *widget,
GdkEventWindowState *event);
@@ -211,6 +213,7 @@
widget_class->unrealize = gimp_display_shell_unrealize;
widget_class->screen_changed = gimp_display_shell_screen_changed;
widget_class->delete_event = gimp_display_shell_delete_event;
+ widget_class->configure_event = gimp_display_shell_configure_event;
widget_class->window_state_event = gimp_display_shell_window_state_event;
widget_class->popup_menu = gimp_display_shell_popup_menu;
widget_class->style_set = gimp_display_shell_style_set;
@@ -576,6 +579,47 @@
}
static gboolean
+gimp_display_shell_configure_event (GtkWidget *widget,
+ GdkEventConfigure *cevent)
+{
+ GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (widget);
+ gint current_width;
+ gint current_height;
+
+ /* Grab the size before we run the parent implementation */
+ current_width = widget->allocation.width;
+ current_height = widget->allocation.height;
+
+ /* Run the parent implementation */
+ if (GTK_WIDGET_CLASS (parent_class)->configure_event)
+ GTK_WIDGET_CLASS (parent_class)->configure_event (widget, cevent);
+
+ /* Only run this stuff if the size changed */
+ if (shell->display &&
+ shell->display->image &&
+ (cevent->width != current_width ||
+ cevent->height != current_height))
+ {
+ gint sw;
+ gint sh;
+ gboolean center_horizontally;
+ gboolean center_vertically;
+
+ gimp_display_shell_draw_get_scaled_image_size (shell, &sw, &sh);
+
+ center_horizontally = sw < shell->disp_width;
+ center_vertically = sh < shell->disp_height;
+
+ /* If the image fits within the display shell canvas on a
+ * given axis, center the image on that axis.
+ */
+ gimp_display_shell_scroll_center_image_on_next_size_allocate (shell);
+ }
+
+ return TRUE;
+}
+
+static gboolean
gimp_display_shell_window_state_event (GtkWidget *widget,
GdkEventWindowState *event)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]