Add GtkWidget::window_state_event() implementation to GimpImageWindow

Keep an own window_state member around and update it accordingly.
Chain up in GimpDisplayShell's window_state_event() impl.
This commit is contained in:
Michael Natterer
2009-09-23 13:40:52 +02:00
parent 7c66b4c43d
commit fb046b097d
3 changed files with 39 additions and 17 deletions

View File

@ -643,6 +643,8 @@ gimp_display_shell_window_state_event (GtkWidget *widget,
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (widget); GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (widget);
Gimp *gimp = shell->display->gimp; Gimp *gimp = shell->display->gimp;
GTK_WIDGET_CLASS (parent_class)->window_state_event (widget, event);
shell->window_state = event->new_window_state; shell->window_state = event->new_window_state;
if (event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN) if (event->changed_mask & GDK_WINDOW_STATE_FULLSCREEN)

View File

@ -30,6 +30,7 @@
#include "gimpdisplayshell.h" #include "gimpdisplayshell.h"
#include "gimpimagewindow.h" #include "gimpimagewindow.h"
#include "gimp-log.h"
#include "gimp-intl.h" #include "gimp-intl.h"
@ -42,20 +43,23 @@ enum
/* local function prototypes */ /* local function prototypes */
static GObject * gimp_image_window_constructor (GType type, static GObject * gimp_image_window_constructor (GType type,
guint n_params, guint n_params,
GObjectConstructParam *params); GObjectConstructParam *params);
static void gimp_image_window_finalize (GObject *object); static void gimp_image_window_finalize (GObject *object);
static void gimp_image_window_set_property (GObject *object, static void gimp_image_window_set_property (GObject *object,
guint property_id, guint property_id,
const GValue *value, const GValue *value,
GParamSpec *pspec); GParamSpec *pspec);
static void gimp_image_window_get_property (GObject *object, static void gimp_image_window_get_property (GObject *object,
guint property_id, guint property_id,
GValue *value, GValue *value,
GParamSpec *pspec); GParamSpec *pspec);
static void gimp_image_window_destroy (GtkObject *object); static void gimp_image_window_destroy (GtkObject *object);
static gboolean gimp_image_window_window_state (GtkWidget *widget,
GdkEventWindowState *event);
G_DEFINE_TYPE (GimpImageWindow, gimp_image_window, GIMP_TYPE_WINDOW) G_DEFINE_TYPE (GimpImageWindow, gimp_image_window, GIMP_TYPE_WINDOW)
@ -68,13 +72,16 @@ gimp_image_window_class_init (GimpImageWindowClass *klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass); GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
object_class->constructor = gimp_image_window_constructor; object_class->constructor = gimp_image_window_constructor;
object_class->finalize = gimp_image_window_finalize; object_class->finalize = gimp_image_window_finalize;
object_class->set_property = gimp_image_window_set_property; object_class->set_property = gimp_image_window_set_property;
object_class->get_property = gimp_image_window_get_property; object_class->get_property = gimp_image_window_get_property;
gtk_object_class->destroy = gimp_image_window_destroy; gtk_object_class->destroy = gimp_image_window_destroy;
widget_class->window_state_event = gimp_image_window_window_state;
g_object_class_install_property (object_class, PROP_MENU_FACTORY, g_object_class_install_property (object_class, PROP_MENU_FACTORY,
g_param_spec_object ("menu-factory", g_param_spec_object ("menu-factory",
@ -171,6 +178,17 @@ gimp_image_window_destroy (GtkObject *object)
GTK_OBJECT_CLASS (parent_class)->destroy (object); GTK_OBJECT_CLASS (parent_class)->destroy (object);
} }
static gboolean
gimp_image_window_window_state (GtkWidget *widget,
GdkEventWindowState *event)
{
GimpImageWindow *window = GIMP_IMAGE_WINDOW (widget);
window->window_state = event->new_window_state;
return FALSE;
}
/* public functions */ /* public functions */

View File

@ -37,6 +37,8 @@ struct _GimpImageWindow
GimpWindow parent_instance; GimpWindow parent_instance;
GimpUIManager *menubar_manager; GimpUIManager *menubar_manager;
GdkWindowState window_state;
}; };
struct _GimpImageWindowClass struct _GimpImageWindowClass