[mutter/wayland] window-props: _NET_WM_WINDOW_OPACITY range is 0xffffffff to 0



commit ab0bd59f5e1d7462a6efacf1a8ca71425a9d1715
Author: Nirbheek Chauhan <nirbheek chauhan gmail com>
Date:   Wed Apr 9 11:27:52 2014 +0530

    window-props: _NET_WM_WINDOW_OPACITY range is 0xffffffff to 0
    
    After reading the atom, scale the value from 0xffffffff to 0xff. Not doing so
    causes Clutter to truncate the opacity value, and only read the last two digits.
    Hence, 0x7fffffff (50%) becomes 0xff (100%).
    
    https://bugzilla.gnome.org/show_bug.cgi?id=727874

 src/x11/window-props.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/src/x11/window-props.c b/src/x11/window-props.c
index 128dfde..404e61b 100644
--- a/src/x11/window-props.c
+++ b/src/x11/window-props.c
@@ -1594,12 +1594,12 @@ reload_window_opacity (MetaWindow    *window,
                        gboolean       initial)
 
 {
-  int requested_value = 0xFF;
+  guint8 opacity = 0xFF;
 
   if (value->type != META_PROP_VALUE_INVALID)
-    requested_value = (int) value->v.cardinal;
+    opacity = (guint8)((gfloat)value->v.cardinal * 255.0 / ((gfloat)0xffffffff));
 
-  meta_window_set_opacity (window, requested_value);
+  meta_window_set_opacity (window, opacity);
 }
 
 #define RELOAD_STRING(var_name, propname) \


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]