aboutsummaryrefslogtreecommitdiffstats
path: root/community/gnome-settings-daemon/dont-use-logind-for-brightness-changing.patch
blob: a05266763cda61c0cc3f60c1c573dfad9c87a80b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
Upstream introduced brightness level changing with
https://gitlab.gnome.org/GNOME/gnome-settings-daemon/-/commit/cd051e6c7ccfb7e7b0ec440409c559b2e51284e8
but apparently this doesn't work with elogind (see https://github.com/elogind/elogind/issues/158),
so let's revert this for now and keep using the old mechanism.
diff --git a/plugins/power/gsd-backlight.c b/plugins/power/gsd-backlight.c
index 9f406c9..9c872f8 100644
--- a/plugins/power/gsd-backlight.c
+++ b/plugins/power/gsd-backlight.c
@@ -40,8 +40,6 @@ struct _GsdBacklight
         gint brightness_step;
 
 #ifdef __linux__
-        GDBusProxy *logind_proxy;
-
         GUdevClient *udev;
         GUdevDevice *udev_device;
 
@@ -61,10 +59,6 @@ enum {
         PROP_LAST,
 };
 
-#define SYSTEMD_DBUS_NAME                       "org.freedesktop.login1"
-#define SYSTEMD_DBUS_PATH                       "/org/freedesktop/login1/session/auto"
-#define SYSTEMD_DBUS_INTERFACE                  "org.freedesktop.login1.Session"
-
 static GParamSpec *props[PROP_LAST];
 
 static void     gsd_backlight_initable_iface_init (GInitableIface  *iface);
@@ -481,31 +475,13 @@ gsd_backlight_set_brightness_val_async (GsdBacklight *backlight,
 #ifdef __linux__
         if (backlight->udev_device != NULL) {
                 BacklightHelperData *task_data;
+                  task_data = g_new0 (BacklightHelperData, 1);
+                  task_data->value = backlight->brightness_target;
+                  g_task_set_task_data (task, task_data, backlight_task_data_destroy);
 
-                if (backlight->logind_proxy) {
-                        g_dbus_proxy_call (backlight->logind_proxy,
-                                           "SetBrightness",
-                                           g_variant_new ("(ssu)",
-                                                          "backlight",
-                                                          g_udev_device_get_name (backlight->udev_device),
-                                                          backlight->brightness_target),
-                                           G_DBUS_CALL_FLAGS_NONE,
-                                           -1, NULL,
-                                           NULL, NULL);
-
-                        percent = ABS_TO_PERCENTAGE (backlight->brightness_min,
-                                                     backlight->brightness_max,
-                                                     backlight->brightness_target);
-                        g_task_return_int (task, percent);
-                } else {
-                        task_data = g_new0 (BacklightHelperData, 1);
-                        task_data->value = backlight->brightness_target;
-                        g_task_set_task_data (task, task_data, backlight_task_data_destroy);
-
-                        /* Task is set up now. Queue it and ensure we are working something. */
-                        g_queue_push_tail (&backlight->tasks, task);
-                        gsd_backlight_process_taskqueue (backlight);
-                }
+                  /* Task is set up now. Queue it and ensure we are working something. */
+                  g_queue_push_tail (&backlight->tasks, task);
+                  gsd_backlight_process_taskqueue (backlight);
 
                 return;
         }
@@ -823,7 +799,6 @@ gsd_backlight_initable_init (GInitable       *initable,
 {
         GsdBacklight *backlight = GSD_BACKLIGHT (initable);
         GnomeRROutput* output = NULL;
-        GError *logind_error = NULL;
 
         if (cancellable != NULL) {
                 g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
@@ -832,38 +807,6 @@ gsd_backlight_initable_init (GInitable       *initable,
         }
 
 #ifdef __linux__
-        backlight->logind_proxy =
-                g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM,
-                                               0,
-                                               NULL,
-                                               SYSTEMD_DBUS_NAME,
-                                               SYSTEMD_DBUS_PATH,
-                                               SYSTEMD_DBUS_INTERFACE,
-                                               NULL, &logind_error);
-        if (backlight->logind_proxy) {
-                /* Check that the SetBrightness method does exist */
-                g_dbus_proxy_call_sync (backlight->logind_proxy,
-                                        "SetBrightness", NULL,
-                                        G_DBUS_CALL_FLAGS_NONE, -1,
-                                        NULL, &logind_error);
-
-                if (g_error_matches (logind_error, G_DBUS_ERROR,
-                                     G_DBUS_ERROR_INVALID_ARGS)) {
-                        /* We are calling the method with no arguments, so
-                         * this is expected.
-                         */
-                        g_clear_error (&logind_error);
-                } else {
-                        /* Fail on anything else */
-                        g_clear_object (&backlight->logind_proxy);
-                }
-        }
-
-        if (logind_error) {
-                g_warning ("No logind found: %s", logind_error->message);
-                g_error_free (logind_error);
-        }
-
         /* Try finding a udev device. */
         if (gsd_backlight_udev_init (backlight))
                 goto found;
@@ -905,7 +848,6 @@ gsd_backlight_finalize (GObject *object)
 #ifdef __linux__
         g_assert (backlight->active_task == NULL);
         g_assert (g_queue_is_empty (&backlight->tasks));
-        g_clear_object (&backlight->logind_proxy);
         g_clear_object (&backlight->udev);
         g_clear_object (&backlight->udev_device);
         if (backlight->idle_update) {