[gimp] Move GtkWidget::configure_event() impl from the shell to the window
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp] Move GtkWidget::configure_event() impl from the shell to the window
- Date: Tue, 29 Sep 2009 18:39:16 +0000 (UTC)
commit d015a704b328d8e1a0084ec7efd14724d313eea5
Author: Michael Natterer <mitch gimp org>
Date: Fri Sep 25 13:41:23 2009 +0200
Move GtkWidget::configure_event() impl from the shell to the window
Still has a FIXME for later, but is in the right place now.
app/display/gimpdisplayshell.c | 34 +--------------
app/display/gimpimagewindow.c | 93 ++++++++++++++++++++++++++++------------
2 files changed, 67 insertions(+), 60 deletions(-)
---
diff --git a/app/display/gimpdisplayshell.c b/app/display/gimpdisplayshell.c
index f17e8fe..824930c 100644
--- a/app/display/gimpdisplayshell.c
+++ b/app/display/gimpdisplayshell.c
@@ -121,8 +121,6 @@ static void gimp_display_shell_destroy (GtkObject *object);
static void gimp_display_shell_unrealize (GtkWidget *widget);
static void gimp_display_shell_screen_changed (GtkWidget *widget,
GdkScreen *previous);
-static gboolean gimp_display_shell_configure_event(GtkWidget *widget,
- GdkEventConfigure*cevent);
static gboolean
gimp_display_shell_window_state_event (GtkWidget *widget,
GdkEventWindowState *event);
@@ -204,7 +202,6 @@ gimp_display_shell_class_init (GimpDisplayShellClass *klass)
widget_class->unrealize = gimp_display_shell_unrealize;
widget_class->screen_changed = gimp_display_shell_screen_changed;
- 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;
@@ -660,36 +657,6 @@ gimp_display_shell_screen_changed (GtkWidget *widget,
}
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);
-
- /* If the window size has changed, make sure additoinal logic is run
- * on size-allocate
- */
- if (shell->display &&
- shell->display->image &&
- (cevent->width != current_width ||
- cevent->height != current_height))
- {
- shell->size_allocate_from_configure_event = TRUE;
- }
-
- return TRUE;
-}
-
-static gboolean
gimp_display_shell_window_state_event (GtkWidget *widget,
GdkEventWindowState *event)
{
@@ -1355,6 +1322,7 @@ gimp_display_shell_fill_idle (GimpDisplayShell *shell)
gimp_display_shell_scale_shrink_wrap (shell, TRUE);
+ /* FIXME image window */
gtk_window_present (GTK_WINDOW (shell));
return FALSE;
diff --git a/app/display/gimpimagewindow.c b/app/display/gimpimagewindow.c
index 5dd93a7..108d057 100644
--- a/app/display/gimpimagewindow.c
+++ b/app/display/gimpimagewindow.c
@@ -52,33 +52,35 @@ enum
/* local function prototypes */
-static GObject * gimp_image_window_constructor (GType type,
- guint n_params,
- GObjectConstructParam *params);
-static void gimp_image_window_finalize (GObject *object);
-static void gimp_image_window_set_property (GObject *object,
- guint property_id,
- const GValue *value,
- GParamSpec *pspec);
-static void gimp_image_window_get_property (GObject *object,
- guint property_id,
- GValue *value,
- GParamSpec *pspec);
-
-static void gimp_image_window_destroy (GtkObject *object);
-
-static gboolean gimp_image_window_delete_event (GtkWidget *widget,
- GdkEventAny *event);
-static gboolean gimp_image_window_window_state (GtkWidget *widget,
- GdkEventWindowState *event);
-static void gimp_image_window_style_set (GtkWidget *widget,
- GtkStyle *prev_style);
-
-static void gimp_image_window_show_tooltip (GimpUIManager *manager,
- const gchar *tooltip,
- GimpImageWindow *window);
-static void gimp_image_window_hide_tooltip (GimpUIManager *manager,
- GimpImageWindow *window);
+static GObject * gimp_image_window_constructor (GType type,
+ guint n_params,
+ GObjectConstructParam *params);
+static void gimp_image_window_finalize (GObject *object);
+static void gimp_image_window_set_property (GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec);
+static void gimp_image_window_get_property (GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec);
+
+static void gimp_image_window_destroy (GtkObject *object);
+
+static gboolean gimp_image_window_delete_event (GtkWidget *widget,
+ GdkEventAny *event);
+static gboolean gimp_image_window_configure_event (GtkWidget *widget,
+ GdkEventConfigure *event);
+static gboolean gimp_image_window_window_state (GtkWidget *widget,
+ GdkEventWindowState *event);
+static void gimp_image_window_style_set (GtkWidget *widget,
+ GtkStyle *prev_style);
+
+static void gimp_image_window_show_tooltip (GimpUIManager *manager,
+ const gchar *tooltip,
+ GimpImageWindow *window);
+static void gimp_image_window_hide_tooltip (GimpUIManager *manager,
+ GimpImageWindow *window);
static void gimp_image_window_image_notify (GimpDisplay *display,
const GParamSpec *pspec,
@@ -124,6 +126,7 @@ gimp_image_window_class_init (GimpImageWindowClass *klass)
gtk_object_class->destroy = gimp_image_window_destroy;
widget_class->delete_event = gimp_image_window_delete_event;
+ widget_class->configure_event = gimp_image_window_configure_event;
widget_class->window_state_event = gimp_image_window_window_state;
widget_class->style_set = gimp_image_window_style_set;
@@ -300,6 +303,42 @@ gimp_image_window_delete_event (GtkWidget *widget,
}
static gboolean
+gimp_image_window_configure_event (GtkWidget *widget,
+ GdkEventConfigure *event)
+{
+ GimpImageWindow *window = GIMP_IMAGE_WINDOW (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, event);
+
+ /* If the window size has changed, make sure additoinal logic is run
+ * in the display shell's size-allocate
+ */
+ if (event->width != current_width ||
+ event->height != current_height)
+ {
+ /* FIXME multiple shells */
+ GimpDisplay *display = gimp_image_window_get_active_display (window);
+
+ if (display->image)
+ {
+ GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (display->shell);
+
+ shell->size_allocate_from_configure_event = TRUE;
+ }
+ }
+
+ return TRUE;
+}
+
+static gboolean
gimp_image_window_window_state (GtkWidget *widget,
GdkEventWindowState *event)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]