[Xfce4-commits] <xfce4-settings:xrandr-display-settings> Store the preferred mode
Jérôme Guelfucci
noreply at xfce.org
Thu Jun 10 11:28:05 CEST 2010
Updating branch refs/heads/xrandr-display-settings
to ddea3c1d570df8cbb239ea5c6b13879646089160 (commit)
from d51f05a018746cf50950585ac5d03963ad02af9c (commit)
commit ddea3c1d570df8cbb239ea5c6b13879646089160
Author: Lionel Le Folgoc <mrpouit at gmail.com>
Date: Tue Jun 8 22:23:50 2010 +0200
Store the preferred mode
This can be useful when detecting new outputs (e.g. a dialog pops up,
preselecting the preferred modes for the user, something like xrandr --auto).
dialogs/display-settings/xfce-randr.c | 4 ++++
dialogs/display-settings/xfce-randr.h | 10 ++++++----
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/dialogs/display-settings/xfce-randr.c b/dialogs/display-settings/xfce-randr.c
index 43d102b..0de624a 100644
--- a/dialogs/display-settings/xfce-randr.c
+++ b/dialogs/display-settings/xfce-randr.c
@@ -88,6 +88,7 @@ xfce_randr_new (GdkDisplay *display,
/* 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);
@@ -118,6 +119,8 @@ xfce_randr_new (GdkDisplay *display,
}
/* load defaults */
+ randr->preferred_mode[n] = randr->output_info[n]->modes[randr->output_info[n]->npreferred];
+
if (randr->output_info[n]->crtc != None)
{
crtc_info = XRRGetCrtcInfo (xdisplay, randr->resources, randr->output_info[n]->crtc);
@@ -167,6 +170,7 @@ xfce_randr_free (XfceRandr *randr)
/* free the settings */
g_free (randr->mode);
+ g_free (randr->preferred_mode);
g_free (randr->rotation);
g_free (randr->rotations);
g_free (randr->status);
diff --git a/dialogs/display-settings/xfce-randr.h b/dialogs/display-settings/xfce-randr.h
index fd44b27..840e2b5 100644
--- a/dialogs/display-settings/xfce-randr.h
+++ b/dialogs/display-settings/xfce-randr.h
@@ -24,10 +24,11 @@
#ifndef __XFCE_RANDR_H__
#define __XFCE_RANDR_H__
-#define XFCE_RANDR_MODE(randr) (randr->mode[randr->active_output])
-#define XFCE_RANDR_ROTATION(randr) (randr->rotation[randr->active_output])
-#define XFCE_RANDR_ROTATIONS(randr) (randr->rotations[randr->active_output])
-#define XFCE_RANDR_OUTPUT_INFO(randr) (randr->output_info[randr->active_output])
+#define XFCE_RANDR_MODE(randr) (randr->mode[randr->active_output])
+#define XFCE_RANDR_PREFERRED_MODE(randr) (randr->preferred_mode[randr->active_output])
+#define XFCE_RANDR_ROTATION(randr) (randr->rotation[randr->active_output])
+#define XFCE_RANDR_ROTATIONS(randr) (randr->rotations[randr->active_output])
+#define XFCE_RANDR_OUTPUT_INFO(randr) (randr->output_info[randr->active_output])
/* check for randr 1.2 or better */
#if RANDR_MAJOR > 1 || (RANDR_MAJOR == 1 && RANDR_MINOR >= 2)
@@ -91,6 +92,7 @@ struct _XfceRandr
/* selected settings for all outputs */
RRMode *mode;
+ RRMode *preferred_mode;
Rotation *rotation;
Rotation *rotations;
XfceOutputPosition *position;
More information about the Xfce4-commits
mailing list