diff options
author | JeyaSudha <jeyasudha.duraipandy@wipro.com> | 2002-09-04 02:44:52 +0000 |
---|---|---|
committer | Havoc Pennington <hp@src.gnome.org> | 2002-09-04 02:44:52 +0000 |
commit | a6a7407faa0fa30cb62cfc0494c2d905d975412b (patch) | |
tree | 3ea71e465831ffbeb56c1d4cb327f7fdf044501a | |
parent | a5c4eaa55cafea6abcf4423c2412e41e0ff38f89 (diff) | |
download | metacity-a6a7407faa0fa30cb62cfc0494c2d905d975412b.tar.gz metacity-a6a7407faa0fa30cb62cfc0494c2d905d975412b.tar.bz2 |
Session saves the unmaximized postion, size of a maximized window. #86059
2002-06-25 JeyaSudha <jeyasudha.duraipandy@wipro.com>
* src/session.c, src/window.c: Session saves the unmaximized
postion, size of a maximized window. #86059
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | src/session.c | 71 | ||||
-rw-r--r-- | src/session.h | 2 | ||||
-rw-r--r-- | src/window.c | 20 |
4 files changed, 96 insertions, 2 deletions
@@ -1,3 +1,8 @@ +2002-06-25 JeyaSudha <jeyasudha.duraipandy@wipro.com> + + * src/session.c, src/window.c: Session saves the unmaximized + postion, size of a maximized window. #86059 + 2002-09-03 Havoc Pennington <hp@pobox.com> * src/frames.c (meta_frames_update_prelit_control): don't filter diff --git a/src/session.c b/src/session.c index fd9191d..0637a9e 100644 --- a/src/session.c +++ b/src/session.c @@ -986,7 +986,14 @@ save_state (void) /* Maximized */ if (window->maximized) - fputs (" <maximized/>\n", outfile); + { + fprintf (outfile, + " <maximized saved_x=\"%d\" saved_y=\"%d\" saved_width=\"%d\" saved_height=\"%d\"/>\n", + window->saved_rect.x, + window->saved_rect.y, + window->saved_rect.width, + window->saved_rect.height); + } /* Workspaces we're on */ { @@ -1347,8 +1354,70 @@ start_element_handler (GMarkupParseContext *context, } else if (strcmp (element_name, "maximized") == 0) { + int i; + + i = 0; pd->info->maximized = TRUE; pd->info->maximized_set = TRUE; + while (attribute_names[i]) + { + const char *name; + const char *val; + + name = attribute_names[i]; + val = attribute_values[i]; + + if (strcmp (name, "saved_x") == 0) + { + if (*val) + { + pd->info->saved_rect.x = atoi (val); + pd->info->saved_rect_set = TRUE; + } + } + else if (strcmp (name, "saved_y") == 0) + { + if (*val) + { + pd->info->saved_rect.y = atoi (val); + pd->info->saved_rect_set = TRUE; + } + } + else if (strcmp (name, "saved_width") == 0) + { + if (*val) + { + pd->info->saved_rect.width = atoi (val); + pd->info->saved_rect_set = TRUE; + } + } + else if (strcmp (name, "saved_height") == 0) + { + if (*val) + { + pd->info->saved_rect.height = atoi (val); + pd->info->saved_rect_set = TRUE; + } + } + else + { + g_set_error (error, + G_MARKUP_ERROR, + G_MARKUP_ERROR_UNKNOWN_ATTRIBUTE, + _("Unknown attribute %s on <maximized> element"), + name); + return; + } + + ++i; + } + + if (pd->info->saved_rect_set) + meta_topic (META_DEBUG_SM, "Saved unmaximized size %d,%d %dx%d \n", + pd->info->saved_rect.x, + pd->info->saved_rect.y, + pd->info->saved_rect.width, + pd->info->saved_rect.height); } else if (strcmp (element_name, "geometry") == 0) { diff --git a/src/session.h b/src/session.h index 35f267f..1fa09c8 100644 --- a/src/session.h +++ b/src/session.h @@ -50,6 +50,7 @@ struct _MetaWindowSessionInfo */ int gravity; MetaRectangle rect; + MetaRectangle saved_rect; guint on_all_workspaces : 1; guint minimized : 1; guint maximized : 1; @@ -59,6 +60,7 @@ struct _MetaWindowSessionInfo guint on_all_workspaces_set : 1; guint minimized_set : 1; guint maximized_set : 1; + guint saved_rect_set : 1; }; /* If lookup_saved_state returns something, it should be used, diff --git a/src/window.c b/src/window.c index 7d4d444..5fb9d3a 100644 --- a/src/window.c +++ b/src/window.c @@ -696,7 +696,25 @@ meta_window_apply_session_info (MetaWindow *window, info->maximized, window->desc); if (window->has_maximize_func && info->maximized) - meta_window_maximize (window); + { + meta_window_maximize (window); + + if (info->saved_rect_set) + { + meta_topic (META_DEBUG_SM, + "Restoring saved rect %d,%d %dx%d for window %s\n", + info->saved_rect.x, + info->saved_rect.y, + info->saved_rect.width, + info->saved_rect.height, + window->desc); + + window->saved_rect.x = info->saved_rect.x; + window->saved_rect.y = info->saved_rect.y; + window->saved_rect.width = info->saved_rect.width; + window->saved_rect.height = info->saved_rect.height; + } + } } if (info->on_all_workspaces_set) |