ayatana-commits team mailing list archive
-
ayatana-commits team
-
Mailing list archive
-
Message #00402
[Branch ~xsplash-team/xsplash/trunk] Rev 77: merge lp:~bratsche/xsplash/monitors, fixes #420225
Merge authors:
Cody Russell (bratsche)
Related merge proposals:
https://code.launchpad.net/~bratsche/xsplash/monitors/+merge/12613
proposed by: Cody Russell (bratsche)
review: Approve - Ted Gould (ted)
------------------------------------------------------------
revno: 77 [merge]
committer: Cody Russell <crussell@xxxxxxxxxxxxx>
branch nick: xsplash
timestamp: Tue 2009-09-29 16:29:11 -0500
message:
merge lp:~bratsche/xsplash/monitors, fixes #420225
modified:
src/xsplash.c
--
lp:xsplash
https://code.launchpad.net/~xsplash-team/xsplash/trunk
Your team ayatana-commits is subscribed to branch lp:xsplash.
To unsubscribe from this branch go to https://code.launchpad.net/~xsplash-team/xsplash/trunk/+edit-subscription.
=== modified file 'src/xsplash.c'
--- src/xsplash.c 2009-09-28 21:24:52 +0000
+++ src/xsplash.c 2009-09-29 20:15:46 +0000
@@ -313,6 +313,36 @@
return gdk_pixbuf_scale_simple (src, new_width, new_height, GDK_INTERP_BILINEAR);
}
+static gint
+get_monitor_width ()
+{
+ GdkScreen *screen;
+ GdkRectangle rect;
+
+ screen = gdk_screen_get_default ();
+
+ gdk_screen_get_monitor_geometry (screen,
+ 0,
+ &rect);
+
+ return rect.width;
+}
+
+static gint
+get_monitor_height ()
+{
+ GdkScreen *screen;
+ GdkRectangle rect;
+
+ screen = gdk_screen_get_default ();
+
+ gdk_screen_get_monitor_geometry (screen,
+ 0,
+ &rect);
+
+ return rect.height;
+}
+
static gchar *
get_background_filename (void)
{
@@ -322,11 +352,9 @@
gint i;
gint last_good = 0;
gchar *ret;
- GdkScreen *screen;
- screen = gdk_screen_get_default ();
- width = gdk_screen_get_width (screen);
- height = gdk_screen_get_height (screen);
+ width = get_monitor_width ();
+ height = get_monitor_height ();
g_message ("get_background_filename(): looking for appropriate resolution...");
for (i = 0; i < (sizeof (widths) / sizeof (gint)); i++)
@@ -369,11 +397,9 @@
get_throbber_filename (void)
{
gchar *ret;
- GdkScreen *screen;
gint width;
- screen = gdk_screen_get_default ();
- width = gdk_screen_get_width (screen);
+ width = get_monitor_width ();
if (throbber_image != NULL)
{
@@ -397,11 +423,9 @@
get_logo_filename ()
{
gchar *ret;
- GdkScreen *screen;
gint width;
- screen = gdk_screen_get_default ();
- width = gdk_screen_get_width (screen);
+ width = get_monitor_width ();
if (logo_image != NULL)
{
@@ -435,6 +459,7 @@
w = gdk_pixbuf_get_width (scaled);
h = gdk_pixbuf_get_height (scaled);
+
x = (width - w) / 2;
y = (height - h) / 2;
@@ -444,8 +469,8 @@
return gdk_pixbuf_new_subpixbuf (scaled,
x,
y,
- w - x,
- h - y);
+ w - (2 * x),
+ h - (2 * y));
}
static gboolean
@@ -544,11 +569,11 @@
G_CALLBACK (focus_out_event),
server);
- logo_filename = get_logo_filename (gdk_screen_get_width (priv->screen));
+ logo_filename = get_logo_filename (get_monitor_width ());
throbber_filename = get_throbber_filename ();
- pixbuf = get_pixbuf (gdk_screen_get_width (priv->screen),
- gdk_screen_get_height (priv->screen));
+ pixbuf = get_pixbuf (get_monitor_width (),
+ get_monitor_height ());
logo = gdk_pixbuf_new_from_file (logo_filename, NULL);
@@ -559,8 +584,8 @@
image = gtk_image_new_from_pixbuf (logo);
gtk_fixed_put (GTK_FIXED (fixed), image,
- gdk_screen_get_width (priv->screen) / 2 - gdk_pixbuf_get_width (logo) / 2,
- gdk_screen_get_height (priv->screen) / 3 - gdk_pixbuf_get_height (logo) / 2);
+ get_monitor_width () / 2 - gdk_pixbuf_get_width (logo) / 2,
+ get_monitor_height () / 3 - gdk_pixbuf_get_height (logo) / 2);
if (throbber_filename && throbber_frames)
{
@@ -572,8 +597,8 @@
gtk_widget_show (priv->throbber);
gtk_fixed_put (GTK_FIXED (fixed), priv->throbber,
- gdk_screen_get_width (priv->screen) / 2 - gdk_pixbuf_get_width (priv->throbber_pixbuf) / 2,
- gdk_screen_get_height (priv->screen) / 3 + gdk_pixbuf_get_height (logo) / 2 + gdk_pixbuf_get_height (priv->throbber_pixbuf) / ((throbber_frames - 1) * 2));
+ get_monitor_width () / 2 - gdk_pixbuf_get_width (priv->throbber_pixbuf) / 2,
+ get_monitor_height () / 3 + gdk_pixbuf_get_height (logo) / 2 + gdk_pixbuf_get_height (priv->throbber_pixbuf) / ((throbber_frames - 1) * 2));
start_throbber (server);
}
else