[gnome-settings-daemon] RANDR - Use gnome_rr_output_is_laptop() instead of our own function
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] RANDR - Use gnome_rr_output_is_laptop() instead of our own function
- Date: Tue, 23 Feb 2010 00:20:13 +0000 (UTC)
commit a1fc969510ae6f91884976e2b899210977e38b14
Author: Federico Mena Quintero <federico novell com>
Date: Mon Feb 22 18:12:53 2010 -0600
RANDR - Use gnome_rr_output_is_laptop() instead of our own function
The one in GnomeRR (from the gnome-desktop library) is smarter than our old is_laptop(),
as it knows how to use the ConnectorType output property in RANDR 1.3.
This also raises the requirement for gnome-desktop-2.29.92, which is where that
API was introduced.
Signed-off-by: Federico Mena Quintero <federico novell com>
configure.ac | 2 +-
plugins/xrandr/gsd-xrandr-manager.c | 30 +++++++++++-------------------
2 files changed, 12 insertions(+), 20 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 8eb4809..163fc6d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -49,7 +49,7 @@ GLIB_REQUIRED_VERSION=2.17.3
GTK_REQUIRED_VERSION=2.16.0
GCONF_REQUIRED_VERSION=2.6.1
GIO_REQUIRED_VERSION=2.17.3
-GNOME_DESKTOP_REQUIRED_VERSION=2.26.3
+GNOME_DESKTOP_REQUIRED_VERSION=2.29.92
LIBNOTIFY_REQUIRED_VERSION=0.4.3
EXTRA_COMPILE_WARNINGS(yes)
diff --git a/plugins/xrandr/gsd-xrandr-manager.c b/plugins/xrandr/gsd-xrandr-manager.c
index 577be09..303c905 100644
--- a/plugins/xrandr/gsd-xrandr-manager.c
+++ b/plugins/xrandr/gsd-xrandr-manager.c
@@ -485,20 +485,12 @@ gsd_xrandr_manager_2_apply_configuration (GsdXrandrManager *manager,
#include "gsd-xrandr-manager-glue.h"
static gboolean
-is_laptop (GnomeOutputInfo *output)
+is_laptop (GnomeRRScreen *screen, GnomeOutputInfo *output)
{
- const char *output_name = output->name;
+ GnomeRROutput *rr_output;
- if (output->connected && output_name &&
- (strstr (output_name, "lvds") ||
- strstr (output_name, "LVDS") ||
- strstr (output_name, "Lvds") ||
- strstr (output_name, "LCD")))
- {
- return TRUE;
- }
-
- return FALSE;
+ rr_output = gnome_rr_screen_get_output_by_name (screen, output->name);
+ return gnome_rr_output_is_laptop (rr_output);
}
static gboolean
@@ -697,7 +689,7 @@ make_laptop_setup (GnomeRRScreen *screen)
for (i = 0; result->outputs[i] != NULL; ++i) {
GnomeOutputInfo *info = result->outputs[i];
- if (is_laptop (info)) {
+ if (is_laptop (screen, info)) {
if (!turn_on (screen, info, 0, 0)) {
gnome_rr_config_free (result);
result = NULL;
@@ -741,14 +733,14 @@ make_xinerama_setup (GnomeRRScreen *screen)
for (i = 0; result->outputs[i] != NULL; ++i) {
GnomeOutputInfo *info = result->outputs[i];
- if (is_laptop (info))
+ if (is_laptop (screen, info))
x = turn_on_and_get_rightmost_offset (screen, info, x);
}
for (i = 0; result->outputs[i] != NULL; ++i) {
GnomeOutputInfo *info = result->outputs[i];
- if (info->connected && !is_laptop (info))
+ if (info->connected && !is_laptop (screen, info))
x = turn_on_and_get_rightmost_offset (screen, info, x);
}
@@ -770,7 +762,7 @@ make_other_setup (GnomeRRScreen *screen)
for (i = 0; result->outputs[i] != NULL; ++i) {
GnomeOutputInfo *info = result->outputs[i];
- if (is_laptop (info)) {
+ if (is_laptop (screen, info)) {
info->on = FALSE;
}
else {
@@ -1020,7 +1012,7 @@ handle_fn_f7 (GsdXrandrManager *mgr, guint32 timestamp)
}
static GnomeOutputInfo *
-get_laptop_output_info (GnomeRRConfig *config)
+get_laptop_output_info (GnomeRRScreen *screen, GnomeRRConfig *config)
{
int i;
@@ -1028,7 +1020,7 @@ get_laptop_output_info (GnomeRRConfig *config)
GnomeOutputInfo *info;
info = config->outputs[i];
- if (is_laptop (info))
+ if (is_laptop (screen, info))
return info;
}
@@ -1100,7 +1092,7 @@ handle_rotate_windows (GsdXrandrManager *mgr, guint32 timestamp)
current = gnome_rr_config_new_current (screen);
- rotatable_output_info = get_laptop_output_info (current);
+ rotatable_output_info = get_laptop_output_info (screen, current);
if (rotatable_output_info == NULL) {
g_debug ("No laptop outputs found to rotate; XF86RotateWindows key will do nothing");
goto out;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]