[gimp] app: make sure the GUI appears on the same monitor as the splash
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: make sure the GUI appears on the same monitor as the splash
- Date: Fri, 2 May 2014 19:20:31 +0000 (UTC)
commit 62257edb3e4e14a9f6f28e31f0c19e066623211a
Author: Michael Natterer <mitch gimp org>
Date: Fri May 2 21:15:01 2014 +0200
app: make sure the GUI appears on the same monitor as the splash
Manually figure the monitor where the pointer is and pass it to the
splash, the empty image window and to session_restore() explicly.
app/gui/gui.c | 21 +++++++++++++--------
app/gui/session.c | 10 ++++------
app/gui/session.h | 16 +++++++++-------
app/gui/splash.c | 9 +++++----
app/gui/splash.h | 4 +++-
5 files changed, 34 insertions(+), 26 deletions(-)
---
diff --git a/app/gui/gui.c b/app/gui/gui.c
index 576209e..a1d4a15 100644
--- a/app/gui/gui.c
+++ b/app/gui/gui.c
@@ -140,6 +140,8 @@ static void gui_display_changed (GimpContext *context,
static Gimp *the_gui_gimp = NULL;
static GimpUIManager *image_ui_manager = NULL;
static GimpUIConfigurer *ui_configurer = NULL;
+static GdkScreen *initial_screen = NULL;
+static gint initial_monitor = 0;
/* public functions */
@@ -188,7 +190,6 @@ gui_init (Gimp *gimp,
gboolean no_splash)
{
GimpInitStatusFunc status_callback = NULL;
- GdkScreen *screen;
gchar *abort_message;
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
@@ -233,12 +234,12 @@ gui_init (Gimp *gimp,
themes_init (gimp);
- screen = gdk_screen_get_default ();
- gtk_widget_set_default_colormap (gdk_screen_get_rgb_colormap (screen));
+ initial_monitor = gimp_get_monitor_at_pointer (&initial_screen);
+ gtk_widget_set_default_colormap (gdk_screen_get_rgb_colormap (initial_screen));
if (! no_splash)
{
- splash_create (gimp->be_verbose);
+ splash_create (gimp->be_verbose, initial_screen, initial_monitor);
status_callback = splash_update;
}
@@ -570,20 +571,24 @@ gui_restore_after_callback (Gimp *gimp,
if (gimp_get_show_gui (gimp))
{
GimpDisplayShell *shell;
+ GtkWidget *toplevel;
/* create the empty display */
display = GIMP_DISPLAY (gimp_create_display (gimp, NULL,
GIMP_UNIT_PIXEL, 1.0,
- NULL, /* FIXME monitor */
- 0 /* FIXME monitor */));
+ G_OBJECT (initial_screen),
+ initial_monitor));
shell = gimp_display_get_shell (display);
if (gui_config->restore_session)
- session_restore (gimp);
+ session_restore (gimp,
+ initial_screen,
+ initial_monitor);
/* move keyboard focus to the display */
- gtk_window_present (GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (shell))));
+ toplevel = gtk_widget_get_toplevel (GTK_WIDGET (shell));
+ gtk_window_present (GTK_WINDOW (toplevel));
}
/* indicate that the application has finished loading */
diff --git a/app/gui/session.c b/app/gui/session.c
index 9aa1037..1674edb 100644
--- a/app/gui/session.c
+++ b/app/gui/session.c
@@ -316,14 +316,12 @@ session_exit (Gimp *gimp)
}
void
-session_restore (Gimp *gimp)
+session_restore (Gimp *gimp,
+ GdkScreen *screen,
+ gint monitor)
{
- GdkScreen *screen;
- gint monitor;
-
g_return_if_fail (GIMP_IS_GIMP (gimp));
-
- monitor = gimp_get_monitor_at_pointer (&screen);
+ g_return_if_fail (GDK_IS_SCREEN (screen));
gimp_dialog_factory_restore (gimp_dialog_factory_get_singleton (),
screen, monitor);
diff --git a/app/gui/session.h b/app/gui/session.h
index ad82baa..65af7ca 100644
--- a/app/gui/session.h
+++ b/app/gui/session.h
@@ -19,15 +19,17 @@
#define __SESSION_H__
-void session_init (Gimp *gimp);
-void session_exit (Gimp *gimp);
+void session_init (Gimp *gimp);
+void session_exit (Gimp *gimp);
-void session_restore (Gimp *gimp);
-void session_save (Gimp *gimp,
- gboolean always_save);
+void session_restore (Gimp *gimp,
+ GdkScreen *screen,
+ gint monitor);
+void session_save (Gimp *gimp,
+ gboolean always_save);
-gboolean session_clear (Gimp *gimp,
- GError **error);
+gboolean session_clear (Gimp *gimp,
+ GError **error);
#endif /* __SESSION_H__ */
diff --git a/app/gui/splash.c b/app/gui/splash.c
index 5481947..74443fc 100644
--- a/app/gui/splash.c
+++ b/app/gui/splash.c
@@ -93,14 +93,16 @@ static void splash_timer_elapsed (const gchar *text1,
/* public functions */
void
-splash_create (gboolean be_verbose)
+splash_create (gboolean be_verbose,
+ GdkScreen *screen,
+ gint monitor)
{
GtkWidget *frame;
GtkWidget *vbox;
GdkPixbufAnimation *pixbuf;
- GdkScreen *screen;
g_return_if_fail (splash == NULL);
+ g_return_if_fail (GDK_IS_SCREEN (screen));
pixbuf = splash_image_load (be_verbose);
@@ -115,6 +117,7 @@ splash_create (gboolean be_verbose)
"type-hint", GDK_WINDOW_TYPE_HINT_SPLASHSCREEN,
"title", _("GIMP Startup"),
"role", "gimp-startup",
+ "screen", screen,
"window-position", GTK_WIN_POS_CENTER,
"resizable", FALSE,
NULL);
@@ -123,8 +126,6 @@ splash_create (gboolean be_verbose)
G_CALLBACK (exit),
GINT_TO_POINTER (0));
- screen = gtk_widget_get_screen (splash->window);
-
splash->width = MIN (gdk_pixbuf_animation_get_width (pixbuf),
gdk_screen_get_width (screen));
splash->height = MIN (gdk_pixbuf_animation_get_height (pixbuf),
diff --git a/app/gui/splash.h b/app/gui/splash.h
index db50d8e..54a9ecb 100644
--- a/app/gui/splash.h
+++ b/app/gui/splash.h
@@ -19,7 +19,9 @@
#define __SPLASH_H__
-void splash_create (gboolean be_verbose);
+void splash_create (gboolean be_verbose,
+ GdkScreen *screen,
+ gint monitor);
void splash_destroy (void);
void splash_update (const gchar *label1,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]