[gnome-desktop] primary monitory support
- From: Matthias Clasen <matthiasc src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-desktop] primary monitory support
- Date: Thu, 30 Jul 2009 18:25:39 +0000 (UTC)
commit ac466a59aa7b68d1502431a634fce788c176007f
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Jul 8 00:57:51 2009 -0400
primary monitory support
Add support for marking an output as 'primary', when using Xrandr 1.3.
See bug 588040.
libgnome-desktop/gnome-rr-config.c | 11 ++++-------
libgnome-desktop/gnome-rr.c | 16 +++++++++++-----
libgnome-desktop/libgnomeui/gnome-rr.h | 6 ++++--
3 files changed, 19 insertions(+), 14 deletions(-)
---
diff --git a/libgnome-desktop/gnome-rr-config.c b/libgnome-desktop/gnome-rr-config.c
index 01d2c1d..8d3a9a0 100644
--- a/libgnome-desktop/gnome-rr-config.c
+++ b/libgnome-desktop/gnome-rr-config.c
@@ -564,7 +564,7 @@ gnome_rr_config_new_current (GnomeRRScreen *screen)
}
}
- output->primary = gnome_rr_output_get_primary (rr_output);
+ output->primary = gnome_rr_output_get_is_primary (rr_output);
g_ptr_array_add (a, output);
}
@@ -1727,7 +1727,7 @@ crtc_assignment_apply (CrtcAssignment *assign, guint32 timestamp, GError **error
*/
gdk_x11_display_grab (gdk_screen_get_display (assign->screen->gdk_screen));
-
+
/* Turn off all crtcs that are currently displaying outside the new screen,
* or are not used in the new setup
*/
@@ -1744,7 +1744,7 @@ crtc_assignment_apply (CrtcAssignment *assign, guint32 timestamp, GError **error
w = gnome_rr_mode_get_width (mode);
h = gnome_rr_mode_get_height (mode);
-
+
if (crtc_is_rotated (crtc))
{
int tmp = h;
@@ -1788,10 +1788,7 @@ crtc_assignment_apply (CrtcAssignment *assign, guint32 timestamp, GError **error
success = !state.has_error;
}
- if (assign->primary)
- {
- gnome_rr_output_set_primary (assign->primary);
- }
+ gnome_rr_screen_set_primary_output (assign->screen, assign->primary);
gdk_x11_display_ungrab (gdk_screen_get_display (assign->screen->gdk_screen));
diff --git a/libgnome-desktop/gnome-rr.c b/libgnome-desktop/gnome-rr.c
index 39d6e37..4f558a7 100644
--- a/libgnome-desktop/gnome-rr.c
+++ b/libgnome-desktop/gnome-rr.c
@@ -1141,20 +1141,26 @@ gnome_rr_output_can_clone (GnomeRROutput *output,
}
gboolean
-gnome_rr_output_get_primary (GnomeRROutput *output)
+gnome_rr_output_get_is_primary (GnomeRROutput *output)
{
return output->info->primary == output->id;
}
void
-gnome_rr_output_set_primary (GnomeRROutput *output)
+gnome_rr_screen_set_primary_output (GnomeRRScreen *screen,
+ GnomeRROutput *output)
{
- GnomeRRScreen *screen = output->info->screen;
-
#if (RANDR_MAJOR > 1 || (RANDR_MAJOR == 1 && RANDR_MINOR >= 3))
+ RROutput id;
+
+ if (output)
+ id = output->id;
+ else
+ id = None;
+
/* Runtime check for RandR 1.3 or higher */
if (screen->rr_major_version == 1 && screen->rr_minor_version >= 3)
- XRRSetOutputPrimary (screen->xdisplay, screen->xroot, output->id);
+ XRRSetOutputPrimary (screen->xdisplay, screen->xroot, id);
#endif
}
diff --git a/libgnome-desktop/libgnomeui/gnome-rr.h b/libgnome-desktop/libgnomeui/gnome-rr.h
index 80147f6..6eae3d0 100644
--- a/libgnome-desktop/libgnomeui/gnome-rr.h
+++ b/libgnome-desktop/libgnomeui/gnome-rr.h
@@ -95,6 +95,9 @@ void gnome_rr_screen_get_timestamps (GnomeRRScreen *scree
guint32 *change_timestamp_ret,
guint32 *config_timestamp_ret);
+void gnome_rr_screen_set_primary_output (GnomeRRScreen *screen,
+ GnomeRROutput *output);
+
/* GnomeRROutput */
guint32 gnome_rr_output_get_id (GnomeRROutput *output);
const char * gnome_rr_output_get_name (GnomeRROutput *output);
@@ -115,8 +118,7 @@ GnomeRRMode ** gnome_rr_output_list_modes (GnomeRROutput *outpu
GnomeRRMode * gnome_rr_output_get_preferred_mode (GnomeRROutput *output);
gboolean gnome_rr_output_supports_mode (GnomeRROutput *output,
GnomeRRMode *mode);
-gboolean gnome_rr_output_get_primary (GnomeRROutput *output);
-void gnome_rr_output_set_primary (GnomeRROutput *output);
+gboolean gnome_rr_output_get_is_primary (GnomeRROutput *output);
/* GnomeRRMode */
guint32 gnome_rr_mode_get_id (GnomeRRMode *mode);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]