[gimp] app: Give configure event info to gimp_session_info_read_geometry()
- From: Martin Nordholts <martinn src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: Give configure event info to gimp_session_info_read_geometry()
- Date: Fri, 27 May 2011 20:36:57 +0000 (UTC)
commit 93fd257c522bc54dae42398ddc351a8b0285c8de
Author: Martin Nordholts <martinn src gnome org>
Date: Thu May 26 08:06:20 2011 +0200
app: Give configure event info to gimp_session_info_read_geometry()
When we get to gimp_dialog_factory_dialog_configure() and do
gimp_session_info_read_geometry(), the window geometry has not yet
been updated, i.e. gimp_session_info_read_geometry() gives the session
info the size of the *previous* configure event.
Solve this by giving gimp_session_info_read_geometry() the configure
event so it can use that size when availble.
If we don't do this change, then we get bogus values of the size of
image window when repeatedly switching between single- and
multi-window mode.
app/widgets/gimpdialogfactory.c | 2 +-
app/widgets/gimpsessioninfo.c | 31 ++++++++++++++++++++++++-------
app/widgets/gimpsessioninfo.h | 3 ++-
3 files changed, 27 insertions(+), 9 deletions(-)
---
diff --git a/app/widgets/gimpdialogfactory.c b/app/widgets/gimpdialogfactory.c
index 1f0ff41..932e773 100644
--- a/app/widgets/gimpdialogfactory.c
+++ b/app/widgets/gimpdialogfactory.c
@@ -1324,7 +1324,7 @@ gimp_dialog_factory_dialog_configure (GtkWidget *dialog,
if (gimp_session_info_get_widget (session_info) == dialog)
{
- gimp_session_info_read_geometry (session_info);
+ gimp_session_info_read_geometry (session_info, cevent);
GIMP_LOG (DIALOG_FACTORY,
"updated session info for \"%s\" from window geometry "
diff --git a/app/widgets/gimpsessioninfo.c b/app/widgets/gimpsessioninfo.c
index 7851df6..9eff944 100644
--- a/app/widgets/gimpsessioninfo.c
+++ b/app/widgets/gimpsessioninfo.c
@@ -633,12 +633,15 @@ gimp_session_info_apply_geometry (GimpSessionInfo *info)
/**
* gimp_session_info_read_geometry:
- * @info:
+ * @info: A #GimpSessionInfo
+ * @cevent A #GdkEventConfigure. If set, use the size from here
+ * instead of from the window allocation.
*
* Read geometry related information from the associated widget.
**/
void
-gimp_session_info_read_geometry (GimpSessionInfo *info)
+gimp_session_info_read_geometry (GimpSessionInfo *info,
+ GdkEventConfigure *cevent)
{
GdkWindow *window;
@@ -662,12 +665,26 @@ gimp_session_info_read_geometry (GimpSessionInfo *info)
if (gimp_session_info_get_remember_size (info))
{
- GtkAllocation allocation;
+ int width;
+ int height;
- gtk_widget_get_allocation (info->p->widget, &allocation);
+ if (cevent)
+ {
+ width = cevent->width;
+ height = cevent->height;
+ }
+ else
+ {
+ GtkAllocation allocation;
+
+ gtk_widget_get_allocation (info->p->widget, &allocation);
+
+ width = allocation.width;
+ height = allocation.height;
+ }
- info->p->width = allocation.width;
- info->p->height = allocation.height;
+ info->p->width = width;
+ info->p->height = height;
}
else
{
@@ -725,7 +742,7 @@ gimp_session_info_get_info (GimpSessionInfo *info)
g_return_if_fail (GIMP_IS_SESSION_INFO (info));
g_return_if_fail (GTK_IS_WIDGET (info->p->widget));
- gimp_session_info_read_geometry (info);
+ gimp_session_info_read_geometry (info, NULL /*cevent*/);
info->p->aux_info = gimp_session_info_aux_get_list (info->p->widget);
diff --git a/app/widgets/gimpsessioninfo.h b/app/widgets/gimpsessioninfo.h
index eb29e5a..7a6fb63 100644
--- a/app/widgets/gimpsessioninfo.h
+++ b/app/widgets/gimpsessioninfo.h
@@ -62,7 +62,8 @@ GimpSessionInfo * gimp_session_info_new (void);
void gimp_session_info_restore (GimpSessionInfo *info,
GimpDialogFactory *factory);
void gimp_session_info_apply_geometry (GimpSessionInfo *info);
-void gimp_session_info_read_geometry (GimpSessionInfo *info);
+void gimp_session_info_read_geometry (GimpSessionInfo *info,
+ GdkEventConfigure *cevent);
void gimp_session_info_get_info (GimpSessionInfo *info);
void gimp_session_info_get_info_with_widget (GimpSessionInfo *info,
GtkWidget *widget);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]