[Xfce4-commits] <xfce4-settings:xrandr-display-settings> Factorize more common code
Jérôme Guelfucci
noreply at xfce.org
Sun Jun 13 18:46:01 CEST 2010
Updating branch refs/heads/xrandr-display-settings
to b2bf3990196963945b51e5005c3feef738283b9b (commit)
from 7f9176c124ad8172d3f6ca40df3f4312c24d00dd (commit)
commit b2bf3990196963945b51e5005c3feef738283b9b
Author: Lionel Le Folgoc <mrpouit at gmail.com>
Date: Sun Jun 13 12:52:05 2010 +0200
Factorize more common code
dialogs/display-settings/xfce-randr.c | 37 +++++++++++---------------------
1 files changed, 13 insertions(+), 24 deletions(-)
diff --git a/dialogs/display-settings/xfce-randr.c b/dialogs/display-settings/xfce-randr.c
index 5bb428d..e567fba 100644
--- a/dialogs/display-settings/xfce-randr.c
+++ b/dialogs/display-settings/xfce-randr.c
@@ -46,8 +46,21 @@ xfce_randr_populate (XfceRandr *randr,
XRRCrtcInfo *crtc_info;
gint n;
+ g_return_val_if_fail (randr != NULL, FALSE);
g_return_val_if_fail (randr->resources != NULL, FALSE);
+ /* set some layout */
+ randr->layout = XFCE_DISPLAY_LAYOUT_SINGLE;
+
+ /* allocate space for the settings */
+ randr->mode = g_new0 (RRMode, randr->resources->noutput);
+ randr->preferred_mode = g_new0 (RRMode, randr->resources->noutput);
+ randr->rotation = g_new0 (Rotation, randr->resources->noutput);
+ randr->rotations = g_new0 (Rotation, randr->resources->noutput);
+ randr->position = g_new0 (XfceOutputPosition, randr->resources->noutput);
+ randr->status = g_new0 (XfceOutputStatus, randr->resources->noutput);
+ randr->output_info = g_new0 (XRROutputInfo *, randr->resources->noutput);
+
/* walk the outputs */
for (n = 0; n < randr->resources->noutput; n++)
{
@@ -163,18 +176,6 @@ xfce_randr_new (GdkDisplay *display,
/* get the screen resource */
randr->resources = XRRGetScreenResources (xdisplay, GDK_WINDOW_XID (root_window));
- /* set some layout */
- randr->layout = XFCE_DISPLAY_LAYOUT_SINGLE;
-
- /* allocate space for the settings */
- randr->mode = g_new0 (RRMode, randr->resources->noutput);
- randr->preferred_mode = g_new0 (RRMode, randr->resources->noutput);
- randr->rotation = g_new0 (Rotation, randr->resources->noutput);
- randr->rotations = g_new0 (Rotation, randr->resources->noutput);
- randr->position = g_new0 (XfceOutputPosition, randr->resources->noutput);
- randr->status = g_new0 (XfceOutputStatus, randr->resources->noutput);
- randr->output_info = g_new0 (XRROutputInfo *, randr->resources->noutput);
-
if (!xfce_randr_populate (randr, xdisplay, root_window))
{
/* cleanup */
@@ -258,18 +259,6 @@ xfce_randr_reload (XfceRandr *randr)
#endif
randr->resources = XRRGetScreenResources (xdisplay, GDK_WINDOW_XID (root_window));
- /* set some layout */
- randr->layout = XFCE_DISPLAY_LAYOUT_SINGLE;
-
- /* allocate space for the settings */
- randr->mode = g_new0 (RRMode, randr->resources->noutput);
- randr->preferred_mode = g_new0 (RRMode, randr->resources->noutput);
- randr->rotation = g_new0 (Rotation, randr->resources->noutput);
- randr->rotations = g_new0 (Rotation, randr->resources->noutput);
- randr->position = g_new0 (XfceOutputPosition, randr->resources->noutput);
- randr->status = g_new0 (XfceOutputStatus, randr->resources->noutput);
- randr->output_info = g_new0 (XRROutputInfo *, randr->resources->noutput);
-
/* repopulate */
xfce_randr_populate (randr, xdisplay, root_window);
}
More information about the Xfce4-commits
mailing list