[gnome-settings-daemon] power: return output id when changing screen brightness
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon] power: return output id when changing screen brightness
- Date: Thu, 13 Nov 2014 18:35:04 +0000 (UTC)
commit 5c17bd05f7d189ec97cd76b169f5888fc60374c8
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Thu Nov 13 10:23:24 2014 -0800
power: return output id when changing screen brightness
When StepUp() or StepDown() are called to change the screen brightness,
also return the output id where the brightness transition happened (if
any).
This is useful so that the shell can show the OSD only on the relevant
monitor, which will be done in the next commit.
https://bugzilla.gnome.org/show_bug.cgi?id=704086
plugins/media-keys/gsd-media-keys-manager.c | 25 ++++++++++++++++---------
plugins/power/gsd-power-manager.c | 7 +++++--
2 files changed, 21 insertions(+), 11 deletions(-)
---
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index dcd14f2..c649ec8 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -1831,22 +1831,21 @@ update_brightness_cb (GObject *source_object,
gpointer user_data)
{
GError *error = NULL;
- int percentage;
- GVariant *new_percentage;
+ int percentage, output_id;
+ GVariant *variant;
GsdMediaKeysManager *manager = GSD_MEDIA_KEYS_MANAGER (user_data);
const char *icon, *debug;
+ /* update the dialog with the new value */
if (G_DBUS_PROXY (source_object) == manager->priv->power_keyboard_proxy) {
- icon = "keyboard-brightness-symbolic";
debug = "keyboard";
} else {
- icon = "display-brightness-symbolic";
debug = "screen";
}
- new_percentage = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object),
- res, &error);
- if (new_percentage == NULL) {
+ variant = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object),
+ res, &error);
+ if (variant == NULL) {
g_warning ("Failed to set new %s percentage: %s",
debug, error->message);
g_error_free (error);
@@ -1854,9 +1853,17 @@ update_brightness_cb (GObject *source_object,
}
/* update the dialog with the new value */
- g_variant_get (new_percentage, "(i)", &percentage);
+ if (G_DBUS_PROXY (source_object) == manager->priv->power_keyboard_proxy) {
+ icon = "keyboard-brightness-symbolic";
+ output_id = -1;
+ g_variant_get (variant, "(i)", &percentage);
+ } else {
+ icon = "display-brightness-symbolic";
+ g_variant_get (variant, "(ii)", &percentage, &output_id);
+ }
+
show_osd (manager, icon, NULL, percentage);
- g_variant_unref (new_percentage);
+ g_variant_unref (variant);
}
static void
diff --git a/plugins/power/gsd-power-manager.c b/plugins/power/gsd-power-manager.c
index 0c2469d..13c34f3 100644
--- a/plugins/power/gsd-power-manager.c
+++ b/plugins/power/gsd-power-manager.c
@@ -83,9 +83,11 @@ static const gchar introspection_xml[] =
" <property name='Brightness' type='i' access='readwrite'/>"
" <method name='StepUp'>"
" <arg type='i' name='new_percentage' direction='out'/>"
+" <arg type='i' name='output_id' direction='out'/>"
" </method>"
" <method name='StepDown'>"
" <arg type='i' name='new_percentage' direction='out'/>"
+" <arg type='i' name='output_id' direction='out'/>"
" </method>"
" </interface>"
" <interface name='org.gnome.SettingsDaemon.Power.Keyboard'>"
@@ -2609,8 +2611,9 @@ out:
error);
} else {
g_dbus_method_invocation_return_value (invocation,
- g_variant_new ("(i)",
- value));
+ g_variant_new ("(ii)",
+ value,
+ backlight_get_output_id
(manager->priv->rr_screen)));
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]