summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonsta <[email protected]>2015-09-02 17:42:04 +0300
committerMonsta <[email protected]>2015-09-02 17:42:04 +0300
commit1702c381f65cf90cd76ca80cf515754dd20c3add (patch)
treeb8d1594b83801b16177c9a64af21329af91c4a94
parentb0aeb32b14f8768e65de4da4db713fafcacba718 (diff)
downloadmate-desktop-1702c381f65cf90cd76ca80cf515754dd20c3add.tar.bz2
mate-desktop-1702c381f65cf90cd76ca80cf515754dd20c3add.tar.xz
mate-rr: unify laptop identification by output name
adapted from https://git.gnome.org/browse/gnome-desktop/commit?id=113c7c8252531665d9e9090c6f48cd3f6b16e120 and https://git.gnome.org/browse/gnome-desktop/commit?id=d9f5e5f58e86798c48995e1abc36e7c43174d132
-rw-r--r--libmate-desktop/mate-rr-config.c17
-rw-r--r--libmate-desktop/mate-rr-private.h2
-rw-r--r--libmate-desktop/mate-rr.c42
3 files changed, 24 insertions, 37 deletions
diff --git a/libmate-desktop/mate-rr-config.c b/libmate-desktop/mate-rr-config.c
index 5702b11..dfff1b6 100644
--- a/libmate-desktop/mate-rr-config.c
+++ b/libmate-desktop/mate-rr-config.c
@@ -1171,19 +1171,6 @@ mate_rr_config_sanitize (MateRRConfig *config)
}
}
-static gboolean
-output_info_is_laptop (MateRROutputInfo *info)
-{
- if (info->priv->name
- && (strstr (info->priv->name, "lvds") || /* Most drivers use an "LVDS" prefix... */
- strstr (info->priv->name, "LVDS") ||
- strstr (info->priv->name, "Lvds") ||
- strstr (info->priv->name, "LCD"))) /* ... but fglrx uses "LCD" in some versions. Shoot me now, kthxbye. */
- return TRUE;
-
- return FALSE;
-}
-
gboolean
mate_rr_config_ensure_primary (MateRRConfig *configuration)
{
@@ -1223,9 +1210,7 @@ mate_rr_config_ensure_primary (MateRRConfig *configuration)
top_left = info;
}
if (laptop == NULL
- && output_info_is_laptop (info)) {
- /* shame we can't find the connector type
- as with gnome_rr_output_is_laptop */
+ && _mate_rr_output_name_is_laptop (info->priv->name)) {
laptop = info;
}
}
diff --git a/libmate-desktop/mate-rr-private.h b/libmate-desktop/mate-rr-private.h
index b292a9d..d5410ca 100644
--- a/libmate-desktop/mate-rr-private.h
+++ b/libmate-desktop/mate-rr-private.h
@@ -79,4 +79,6 @@ struct MateRRConfigPrivate
MateRROutputInfo **outputs;
};
+gboolean _mate_rr_output_name_is_laptop (const char *name);
+
#endif
diff --git a/libmate-desktop/mate-rr.c b/libmate-desktop/mate-rr.c
index e26523d..0237787 100644
--- a/libmate-desktop/mate-rr.c
+++ b/libmate-desktop/mate-rr.c
@@ -1462,34 +1462,34 @@ mate_rr_output_get_connector_type (MateRROutput *output)
}
gboolean
-mate_rr_output_is_laptop (MateRROutput *output)
+_mate_rr_output_name_is_laptop (const char *name)
{
- const char *connector_type;
-
- g_return_val_if_fail (output != NULL, FALSE);
+ if (!name)
+ return FALSE;
- if (!output->connected)
- return FALSE;
+ if (strstr (name, "lvds") || /* Most drivers use an "LVDS" prefix... */
+ strstr (name, "LVDS") ||
+ strstr (name, "Lvds") ||
+ strstr (name, "LCD") || /* ... but fglrx uses "LCD" in some versions. Shoot me now, kthxbye. */
+ strstr (name, "eDP")) /* eDP is for internal laptop panel connections */
+ return TRUE;
- /* The ConnectorType property is present in RANDR 1.3 and greater */
+ return FALSE;
+}
- connector_type = mate_rr_output_get_connector_type (output);
- if (connector_type && strcmp (connector_type, MATE_RR_CONNECTOR_TYPE_PANEL) == 0)
- return TRUE;
+gboolean
+mate_rr_output_is_laptop (MateRROutput *output)
+{
+ g_return_val_if_fail (output != NULL, FALSE);
- /* Older versions of RANDR - this is a best guess, as @#$% RANDR doesn't have standard output names,
- * so drivers can use whatever they like.
- */
+ if (!output->connected)
+ return FALSE;
- if (output->name
- && (strstr (output->name, "lvds") || /* Most drivers use an "LVDS" prefix... */
- strstr (output->name, "LVDS") ||
- strstr (output->name, "Lvds") ||
- strstr (output->name, "LCD") || /* ... but fglrx uses "LCD" in some versions. Shoot me now, kthxbye. */
- strstr (output->name, "eDP"))) /* eDP is for internal laptop panel connections */
- return TRUE;
+ if (g_strcmp0 (output->connector_type, MATE_RR_CONNECTOR_TYPE_PANEL) == 0)
+ return TRUE;
- return FALSE;
+ /* Fallback (see https://bugs.freedesktop.org/show_bug.cgi?id=26736) */
+ return _mate_rr_output_name_is_laptop (output->name);
}
/**