[gimp/gimp-2-8] Bug 684003 - When using the main window in secondary monitor...
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-8] Bug 684003 - When using the main window in secondary monitor...
- Date: Sun, 11 Nov 2012 20:14:49 +0000 (UTC)
commit 908a71c4cf28d9d144f8853b32e0da17a6859b10
Author: Michael Natterer <mitch gimp org>
Date: Sun Nov 11 21:09:46 2012 +0100
Bug 684003 - When using the main window in secondary monitor...
If gimp_window_set_transient_for() fails (due to platform
restrictions), at least set GTK_WIN_POS_CENTER on the window, so it
gets centered on the monitor where the mouse is. This also removes the
need for OSX specific centering code in GimpDialog (bug 677776).
(cherry picked from commit 9e5ed1e70acfef7a488982ae42ea08c32e18a52d)
libgimp/gimpui.c | 39 +++++++++++++++++++++++++++------------
libgimpwidgets/gimpdialog.c | 4 ----
2 files changed, 27 insertions(+), 16 deletions(-)
---
diff --git a/libgimp/gimpui.c b/libgimp/gimpui.c
index a9b532a..beb6c1d 100644
--- a/libgimp/gimpui.c
+++ b/libgimp/gimpui.c
@@ -57,13 +57,13 @@
/* local function prototypes */
-static void gimp_ui_help_func (const gchar *help_id,
- gpointer help_data);
-static void gimp_ensure_modules (void);
-static void gimp_window_transient_realized (GtkWidget *window,
- GdkWindow *parent);
-static void gimp_window_set_transient_for (GtkWindow *window,
- GdkWindow *parent);
+static void gimp_ui_help_func (const gchar *help_id,
+ gpointer help_data);
+static void gimp_ensure_modules (void);
+static void gimp_window_transient_realized (GtkWidget *window,
+ GdkWindow *parent);
+static gboolean gimp_window_set_transient_for (GtkWindow *window,
+ GdkWindow *parent);
static gboolean gimp_ui_initialized = FALSE;
@@ -252,8 +252,15 @@ gimp_window_set_transient_for_display (GtkWindow *window,
g_return_if_fail (gimp_ui_initialized);
g_return_if_fail (GTK_IS_WINDOW (window));
- gimp_window_set_transient_for (window,
- gimp_ui_get_display_window (gdisp_ID));
+ if (! gimp_window_set_transient_for (window,
+ gimp_ui_get_display_window (gdisp_ID)))
+ {
+ /* if setting the window transient failed, at least set
+ * WIN_POS_CENTER, which will center the window on the screen
+ * where the mouse is (see bug #684003).
+ */
+ gtk_window_set_position (window, GTK_WIN_POS_CENTER);
+ }
}
/**
@@ -272,7 +279,11 @@ gimp_window_set_transient (GtkWindow *window)
g_return_if_fail (gimp_ui_initialized);
g_return_if_fail (GTK_IS_WINDOW (window));
- gimp_window_set_transient_for (window, gimp_ui_get_progress_window ());
+ if (! gimp_window_set_transient_for (window, gimp_ui_get_progress_window ()))
+ {
+ /* see above */
+ gtk_window_set_position (window, GTK_WIN_POS_CENTER);
+ }
}
@@ -313,7 +324,7 @@ gimp_window_transient_realized (GtkWidget *window,
gdk_window_set_transient_for (gtk_widget_get_window (window), parent);
}
-static void
+static gboolean
gimp_window_set_transient_for (GtkWindow *window,
GdkWindow *parent)
{
@@ -326,7 +337,7 @@ gimp_window_set_transient_for (GtkWindow *window,
NULL);
if (! parent)
- return;
+ return FALSE;
if (gtk_widget_get_realized (GTK_WIDGET (window)))
gdk_window_set_transient_for (gtk_widget_get_window (GTK_WIDGET (window)),
@@ -336,5 +347,9 @@ gimp_window_set_transient_for (GtkWindow *window,
G_CALLBACK (gimp_window_transient_realized),
parent, 0);
g_object_unref (parent);
+
+ return TRUE;
#endif
+
+ return FALSE;
}
diff --git a/libgimpwidgets/gimpdialog.c b/libgimpwidgets/gimpdialog.c
index 1a257d8..076a4a3 100644
--- a/libgimpwidgets/gimpdialog.c
+++ b/libgimpwidgets/gimpdialog.c
@@ -149,10 +149,6 @@ gimp_dialog_class_init (GimpDialogClass *klass)
static void
gimp_dialog_init (GimpDialog *dialog)
{
-#ifdef GDK_WINDOWING_QUARTZ
- gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
-#endif
-
g_signal_connect (dialog, "response",
G_CALLBACK (gimp_dialog_response),
NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]