jjk-jacky / statusnotifier

Library to use KDE's StatusNotifierItem via GObject
Other
25 stars 8 forks source link

Orientation when scrolling is always horizontal (patch) #13

Closed ugilio closed 7 years ago

ugilio commented 9 years ago

The smallest patch one could imagine ;-) Dbus sends "Vertical", not "vertical", so the code always sent STATUS_NOTIFIER_SCROLL_ORIENTATION_HORIZONTAL.

diff --git a/src/statusnotifier.c b/src/statusnotifier.c
index e258ed1..89b2f2c 100644
--- a/src/statusnotifier.c
+++ b/src/statusnotifier.c
@@ -1466,7 +1466,7 @@ method_call (GDBusConnection        *conn,
         gchar *s_orientation;

         g_variant_get (params, "(is)", &delta, &s_orientation);
-        if (!g_strcmp0 (s_orientation, "vertical"))
+        if (!g_strcmp0 (s_orientation, "Vertical"))
             orientation = STATUS_NOTIFIER_SCROLL_ORIENTATION_VERTICAL;
         else
             orientation = STATUS_NOTIFIER_SCROLL_ORIENTATION_HORIZONTAL;
jjk-jacky commented 9 years ago

On 08/12/15 07:42, Giulio Bernardi wrote:

The smallest patch one could imagine ;-) Dbus sends "Vertical", not "vertical", so the code always sent STATUS_NOTIFIER_SCROLL_ORIENTATION_HORIZONTAL.

Thanks. However, since the spec refer to "legal values" in their lowercase form only, I don't think this is a good idea, so I've committed a case-insensitive test instead.

diff --git a/src/statusnotifier.c b/src/statusnotifier.c
index e258ed1..89b2f2c 100644
--- a/src/statusnotifier.c
+++ b/src/statusnotifier.c
@@ -1466,7 +1466,7 @@ method_call (GDBusConnection        *conn,
         gchar *s_orientation;

         g_variant_get (params, "(is)", &delta, &s_orientation);
-        if (!g_strcmp0 (s_orientation, "vertical"))
+        if (!g_strcmp0 (s_orientation, "Vertical"))
             orientation = STATUS_NOTIFIER_SCROLL_ORIENTATION_VERTICAL;
         else
             orientation = STATUS_NOTIFIER_SCROLL_ORIENTATION_HORIZONTAL;

Reply to this email directly or view it on GitHub: https://github.com/jjk-jacky/statusnotifier/issues/13