[Xfce4-commits] <xfce4-session:jeromeg/libxfce4ui> First try for centering dialogs.
Jérôme Guelfucci
noreply at xfce.org
Fri Jan 22 23:58:05 CET 2010
Updating branch refs/heads/jeromeg/libxfce4ui
to a06da59b94520a5f364e8735b385aac7dc4c3eb8 (commit)
from 883d72e1b34c91f32f887ab017b29bf6147dac20 (commit)
commit a06da59b94520a5f364e8735b385aac7dc4c3eb8
Author: Jérôme Guelfucci <jeromeg at xfce.org>
Date: Fri Jan 22 23:57:59 2010 +0100
First try for centering dialogs.
xfce4-session/shutdown.c | 12 +++++++-----
xfce4-session/xfsm-dns.c | 5 ++++-
xfce4-session/xfsm-splash-screen.c | 8 ++++----
3 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/xfce4-session/shutdown.c b/xfce4-session/shutdown.c
index cd6cc6b..3a3aae7 100644
--- a/xfce4-session/shutdown.c
+++ b/xfce4-session/shutdown.c
@@ -601,9 +601,10 @@ shutdownDialog(const gchar *sessionName, XfsmShutdownType *shutdownType, gboolea
/* create small border */
if (!accessibility)
xfsm_window_add_border (GTK_WINDOW (dialog));
-
+
/* center dialog on target monitor */
- gtk_window_center_on_monitor (GTK_WINDOW (dialog), screen, monitor);
+ gtk_window_set_screen (GTK_WINDOW (dialog), screen);
+ gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
/* save portion of the root window covered by the dialog */
if (!accessibility && shutdown_helper != NULL)
@@ -656,7 +657,8 @@ shutdownDialog(const gchar *sessionName, XfsmShutdownType *shutdownType, gboolea
gtk_widget_show (entry);
/* center dialog on target monitor */
- xfce_gtk_window_center_on_monitor (GTK_WINDOW (dialog), screen, monitor);
+ gtk_window_set_screen (GTK_WINDOW (dialog), screen);
+ gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
gtk_widget_show_now (dialog);
gtk_widget_grab_focus (entry);
@@ -697,8 +699,8 @@ shutdownDialog(const gchar *sessionName, XfsmShutdownType *shutdownType, gboolea
gtk_widget_show (label);
/* center dialog on target monitor */
- xfce_gtk_window_center_on_monitor (GTK_WINDOW (dialog),
- screen, monitor);
+ gtk_window_set_screen (GTK_WINDOW (dialog), screen);
+ gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
gtk_widget_show_now (dialog);
diff --git a/xfce4-session/xfsm-dns.c b/xfce4-session/xfsm-dns.c
index 2237c68..aab3bcb 100644
--- a/xfce4-session/xfsm-dns.c
+++ b/xfce4-session/xfsm-dns.c
@@ -137,6 +137,8 @@ xfsm_dns_check (void)
{
if (msgbox == NULL)
{
+ GdkScreen *screen = xfce_gdk_screen_get_active (NULL);
+
queryhostname (hostname, 256, TRUE);
msgbox = gtk_message_dialog_new (NULL, 0,
@@ -153,8 +155,9 @@ xfsm_dns_check (void)
_("Try again"), RESPONSE_TRY_AGAIN,
NULL);
+ gtk_window_set_screen (GTK_WINDOW (msgbox), screen);
xfsm_window_add_border (GTK_WINDOW (msgbox));
- xfce_gtk_window_center_on_monitor_with_pointer (GTK_WINDOW (msgbox));
+ gtk_window_set_position (GTK_WINDOW (msgbox), GTK_WIN_POS_CENTER);
}
gtk_dialog_set_default_response (GTK_DIALOG (msgbox), RESPONSE_TRY_AGAIN);
diff --git a/xfce4-session/xfsm-splash-screen.c b/xfce4-session/xfsm-splash-screen.c
index feb71cc..f22ac57 100644
--- a/xfce4-session/xfsm-splash-screen.c
+++ b/xfce4-session/xfsm-splash-screen.c
@@ -66,7 +66,8 @@ xfsm_splash_screen_new (GdkDisplay *display,
XfconfChannel *channel;
/* locate monitor with pointer */
- screen = xfce_gdk_display_locate_monitor_with_pointer (display, &monitor);
+ screen = xfce_gdk_screen_get_active (&monitor);
+
if (G_UNLIKELY (screen == NULL))
{
screen = gdk_display_get_screen (display, 0);
@@ -139,9 +140,8 @@ xfsm_splash_screen_run (XfsmSplashScreen *splash,
}
else
{
- xfce_gtk_window_center_on_monitor (GTK_WINDOW (dialog),
- splash->engine.primary_screen,
- splash->engine.primary_monitor);
+ gtk_window_set_screen (GTK_WINDOW (dialog), splash->engine.primary_screen);
+ gtk_window_set_position (GTK_WINDOW (dialog), GTK_WIN_POS_CENTER);
result = gtk_dialog_run (GTK_DIALOG (dialog));
}
More information about the Xfce4-commits
mailing list