diff --git a/ChangeLog b/ChangeLog index 8f6cb12ad..2c2155770 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2002-06-25 JeyaSudha + + * src/session.c, src/window.c: Session saves the unmaximized + postion, size of a maximized window. #86059 + 2002-09-03 Havoc Pennington * src/frames.c (meta_frames_update_prelit_control): don't filter diff --git a/src/session.c b/src/session.c index fd9191d03..0637a9e4c 100644 --- a/src/session.c +++ b/src/session.c @@ -986,7 +986,14 @@ save_state (void) /* Maximized */ if (window->maximized) - fputs (" \n", outfile); + { + fprintf (outfile, + " \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 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 35f267f7b..1fa09c8f3 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 7d4d44478..5fb9d3acf 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)