Made session management multiscreen aware:

2003-11-13  Michael Natterer  <mitch@gimp.org>

	Made session management multiscreen aware:

	* app/widgets/gimpsessioninfo.[ch]: added "gint screen" member
	to struct GimpSessionInfo.

	(gimp_session_info_get_geometry): ask the window for its screen.
	(gimp_session_info_restore): place the window on the remembered
	screen if the screen exists.

	(gimp_session_info_save)
	(gimp_session_info_deserialize): extended "open-on-exit" property
	to include the screen number (e.g. "(open-on-exit 1)" for screen 1).

	This change breaks everybody's sessionrc again...
This commit is contained in:
Michael Natterer 2003-11-13 15:50:23 +00:00 committed by Michael Natterer
parent d13cf0d10b
commit 47f5d86688
3 changed files with 46 additions and 8 deletions

View File

@ -1,3 +1,20 @@
2003-11-13 Michael Natterer <mitch@gimp.org>
Made session management multiscreen aware:
* app/widgets/gimpsessioninfo.[ch]: added "gint screen" member
to struct GimpSessionInfo.
(gimp_session_info_get_geometry): ask the window for its screen.
(gimp_session_info_restore): place the window on the remembered
screen if the screen exists.
(gimp_session_info_save)
(gimp_session_info_deserialize): extended "open-on-exit" property
to include the screen number (e.g. "(open-on-exit 1)" for screen 1).
This change breaks everybody's sessionrc again...
2003-11-13 Sven Neumann <sven@gimp.org>
* app/gui/color-history.[ch]

View File

@ -201,6 +201,7 @@ gimp_session_info_save (GimpSessionInfo *info,
if (info->open)
{
gimp_config_writer_open (writer, "open-on-exit");
gimp_config_writer_printf (writer, "%d", info->screen);
gimp_config_writer_close (writer);
}
@ -457,6 +458,10 @@ gimp_session_info_deserialize (GScanner *scanner,
case SESSION_INFO_OPEN:
info->open = TRUE;
token = G_TOKEN_INT;
if (! gimp_scanner_parse_int (scanner, &info->screen))
goto error;
break;
case SESSION_INFO_AUX:
@ -530,18 +535,28 @@ void
gimp_session_info_restore (GimpSessionInfo *info,
GimpDialogFactory *factory)
{
GdkDisplay *display;
GdkScreen *screen;
g_return_if_fail (info != NULL);
g_return_if_fail (GIMP_IS_DIALOG_FACTORY (factory));
info->open = FALSE;
display = gdk_display_get_default ();
screen = gdk_display_get_screen (display, info->screen);
if (! screen)
screen = gdk_display_get_default_screen (display);
info->open = FALSE;
info->screen = 0;
if (info->toplevel_entry)
{
GtkWidget *dialog;
dialog =
gimp_dialog_factory_dialog_new (factory,
gdk_screen_get_default (),
gimp_dialog_factory_dialog_new (factory, screen,
info->toplevel_entry->identifier,
info->toplevel_entry->preview_size);
@ -553,8 +568,7 @@ gimp_session_info_restore (GimpSessionInfo *info,
GimpDock *dock;
GList *books;
dock = GIMP_DOCK (gimp_dialog_factory_dock_new (factory,
gdk_screen_get_default ()));
dock = GIMP_DOCK (gimp_dialog_factory_dock_new (factory, screen));
if (dock && info->aux_info)
session_info_set_aux_info (GTK_WIDGET (dock), info->aux_info);
@ -709,9 +723,15 @@ gimp_session_info_get_geometry (GimpSessionInfo *info)
}
if (! info->toplevel_entry || info->toplevel_entry->remember_if_open)
info->open = GTK_WIDGET_VISIBLE (info->widget);
{
info->open = GTK_WIDGET_VISIBLE (info->widget);
info->screen = gdk_screen_get_number (gtk_widget_get_screen (info->widget));
}
else
info->open = FALSE;
{
info->open = FALSE;
info->screen = 0;
}
}

View File

@ -29,7 +29,8 @@ struct _GimpSessionInfo
gint y;
gint width;
gint height;
gboolean open; /* only valid while restoring and saving the session */
gboolean open; /* only valid while restoring and saving the session */
gint screen; /* only valid while restoring and saving the session */
/* dialog specific list of GimpSessionInfoAux */
GList *aux_info;