Merge lp:~bratsche/xsplash/monitors into lp:xsplash

Proposed by Cody Russell
Status: Merged
Merged at revision: not available
Proposed branch: lp:~bratsche/xsplash/monitors
Merge into: lp:xsplash
Diff against target: 136 lines
1 file modified
src/xsplash.c (+44/-19)
To merge this branch: bzr merge lp:~bratsche/xsplash/monitors
Reviewer Review Type Date Requested Status
Ted Gould (community) Approve
Review via email: mp+12613@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Ted Gould (ted) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/xsplash.c'
2--- src/xsplash.c 2009-09-28 21:24:52 +0000
3+++ src/xsplash.c 2009-09-29 20:25:19 +0000
4@@ -313,6 +313,36 @@
5 return gdk_pixbuf_scale_simple (src, new_width, new_height, GDK_INTERP_BILINEAR);
6 }
7
8+static gint
9+get_monitor_width ()
10+{
11+ GdkScreen *screen;
12+ GdkRectangle rect;
13+
14+ screen = gdk_screen_get_default ();
15+
16+ gdk_screen_get_monitor_geometry (screen,
17+ 0,
18+ &rect);
19+
20+ return rect.width;
21+}
22+
23+static gint
24+get_monitor_height ()
25+{
26+ GdkScreen *screen;
27+ GdkRectangle rect;
28+
29+ screen = gdk_screen_get_default ();
30+
31+ gdk_screen_get_monitor_geometry (screen,
32+ 0,
33+ &rect);
34+
35+ return rect.height;
36+}
37+
38 static gchar *
39 get_background_filename (void)
40 {
41@@ -322,11 +352,9 @@
42 gint i;
43 gint last_good = 0;
44 gchar *ret;
45- GdkScreen *screen;
46
47- screen = gdk_screen_get_default ();
48- width = gdk_screen_get_width (screen);
49- height = gdk_screen_get_height (screen);
50+ width = get_monitor_width ();
51+ height = get_monitor_height ();
52
53 g_message ("get_background_filename(): looking for appropriate resolution...");
54 for (i = 0; i < (sizeof (widths) / sizeof (gint)); i++)
55@@ -369,11 +397,9 @@
56 get_throbber_filename (void)
57 {
58 gchar *ret;
59- GdkScreen *screen;
60 gint width;
61
62- screen = gdk_screen_get_default ();
63- width = gdk_screen_get_width (screen);
64+ width = get_monitor_width ();
65
66 if (throbber_image != NULL)
67 {
68@@ -397,11 +423,9 @@
69 get_logo_filename ()
70 {
71 gchar *ret;
72- GdkScreen *screen;
73 gint width;
74
75- screen = gdk_screen_get_default ();
76- width = gdk_screen_get_width (screen);
77+ width = get_monitor_width ();
78
79 if (logo_image != NULL)
80 {
81@@ -435,6 +459,7 @@
82
83 w = gdk_pixbuf_get_width (scaled);
84 h = gdk_pixbuf_get_height (scaled);
85+
86 x = (width - w) / 2;
87 y = (height - h) / 2;
88
89@@ -444,8 +469,8 @@
90 return gdk_pixbuf_new_subpixbuf (scaled,
91 x,
92 y,
93- w - x,
94- h - y);
95+ w - (2 * x),
96+ h - (2 * y));
97 }
98
99 static gboolean
100@@ -544,11 +569,11 @@
101 G_CALLBACK (focus_out_event),
102 server);
103
104- logo_filename = get_logo_filename (gdk_screen_get_width (priv->screen));
105+ logo_filename = get_logo_filename (get_monitor_width ());
106 throbber_filename = get_throbber_filename ();
107
108- pixbuf = get_pixbuf (gdk_screen_get_width (priv->screen),
109- gdk_screen_get_height (priv->screen));
110+ pixbuf = get_pixbuf (get_monitor_width (),
111+ get_monitor_height ());
112
113 logo = gdk_pixbuf_new_from_file (logo_filename, NULL);
114
115@@ -559,8 +584,8 @@
116
117 image = gtk_image_new_from_pixbuf (logo);
118 gtk_fixed_put (GTK_FIXED (fixed), image,
119- gdk_screen_get_width (priv->screen) / 2 - gdk_pixbuf_get_width (logo) / 2,
120- gdk_screen_get_height (priv->screen) / 3 - gdk_pixbuf_get_height (logo) / 2);
121+ get_monitor_width () / 2 - gdk_pixbuf_get_width (logo) / 2,
122+ get_monitor_height () / 3 - gdk_pixbuf_get_height (logo) / 2);
123
124 if (throbber_filename && throbber_frames)
125 {
126@@ -572,8 +597,8 @@
127 gtk_widget_show (priv->throbber);
128
129 gtk_fixed_put (GTK_FIXED (fixed), priv->throbber,
130- gdk_screen_get_width (priv->screen) / 2 - gdk_pixbuf_get_width (priv->throbber_pixbuf) / 2,
131- gdk_screen_get_height (priv->screen) / 3 + gdk_pixbuf_get_height (logo) / 2 + gdk_pixbuf_get_height (priv->throbber_pixbuf) / ((throbber_frames - 1) * 2));
132+ get_monitor_width () / 2 - gdk_pixbuf_get_width (priv->throbber_pixbuf) / 2,
133+ get_monitor_height () / 3 + gdk_pixbuf_get_height (logo) / 2 + gdk_pixbuf_get_height (priv->throbber_pixbuf) / ((throbber_frames - 1) * 2));
134 start_throbber (server);
135 }
136 else

Subscribers

People subscribed via source and target branches