[Xfce4-commits] [xfce/xfwm4] 02/05: Use 32 unsigned integer for opacity

noreply at xfce.org noreply at xfce.org
Tue Jan 6 22:08:34 CET 2015


This is an automated email from the git hooks/post-receive script.

olivier pushed a commit to branch master
in repository xfce/xfwm4.

commit b3b014a3ae58efe9b4eecdc9bd75316eb552e7c1
Author: Olivier Fourdan <fourdan at xfce.org>
Date:   Tue Jan 6 20:48:18 2015 +0100

    Use 32 unsigned integer for opacity
    
    Signed-off-by: Olivier Fourdan <fourdan at xfce.org>
---
 src/client.c     |    6 +++---
 src/client.h     |    9 +++++----
 src/compositor.c |    8 ++++----
 src/compositor.h |    2 +-
 src/hints.c      |    8 ++++----
 src/hints.h      |    4 ++--
 6 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/src/client.c b/src/client.c
index 37ecae8..05b28fa 100644
--- a/src/client.c
+++ b/src/client.c
@@ -3471,11 +3471,11 @@ clientUpdateAllOpacity (ScreenInfo *screen_info)
 }
 
 void
-clientSetOpacity (Client *c, guint opacity, guint clear, guint xor)
+clientSetOpacity (Client *c, guint32 opacity, guint32 clear, guint32 xor)
 {
     ScreenInfo *screen_info;
     DisplayInfo *display_info;
-    guint applied;
+    guint32 applied;
 
     screen_info = c->screen_info;
     display_info = screen_info->display_info;
@@ -3513,7 +3513,7 @@ clientSetOpacity (Client *c, guint opacity, guint clear, guint xor)
             divisor *= 100;
         }
 
-        applied = (guint) ((long long) applied * multiplier / divisor);
+        applied = (guint32) (((long long) applied * multiplier / divisor) & G_MAXUINT32);
     }
 
     if (applied != c->opacity_applied)
diff --git a/src/client.h b/src/client.h
index 0b57c8f..ab09a4b 100644
--- a/src/client.h
+++ b/src/client.h
@@ -327,8 +327,8 @@ struct _Client
     /* Timout for asynchronous icon update */
     guint ping_timeout_id;
     /* Opacity for the compositor */
-    guint opacity;
-    guint opacity_applied;
+    guint32 opacity;
+    guint32 opacity_applied;
     guint opacity_flags;
 
 #ifdef HAVE_LIBSTARTUP_NOTIFICATION
@@ -451,8 +451,9 @@ gboolean                 clientTile                             (Client *,
 void                     clientUpdateOpacity                    (Client *);
 void                     clientUpdateAllOpacity                 (ScreenInfo *);
 void                     clientSetOpacity                       (Client *,
-                                                                 guint,
-                                                                 guint, guint);
+                                                                 guint32,
+                                                                 guint32,
+                                                                 guint32);
 void                     clientIncOpacity                       (Client *);
 void                     clientDecOpacity                       (Client *);
 void                     clientUpdateCursor                     (Client *);
diff --git a/src/compositor.c b/src/compositor.c
index a566dc8..e013187 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -141,7 +141,7 @@ struct _CWindow
     gint shadow_width;
     gint shadow_height;
 
-    guint opacity;
+    guint32 opacity;
 };
 
 static CWindow*
@@ -1926,7 +1926,7 @@ expose_area (ScreenInfo *screen_info, XRectangle *rects, gint nrects)
 }
 
 static void
-set_win_opacity (CWindow *cw, guint opacity)
+set_win_opacity (CWindow *cw, guint32 opacity)
 {
     DisplayInfo *display_info;
     ScreenInfo *screen_info;
@@ -2060,7 +2060,7 @@ init_opacity (CWindow *cw)
     DisplayInfo *display_info;
     Client *c;
 
-    TRACE ("set_opacity");
+    TRACE ("init_opacity");
     g_return_if_fail (cw != NULL);
 
     screen_info = cw->screen_info;
@@ -3541,7 +3541,7 @@ compositorUpdateScreenSize (ScreenInfo *screen_info)
 }
 
 void
-compositorWindowSetOpacity (DisplayInfo *display_info, Window id, guint opacity)
+compositorWindowSetOpacity (DisplayInfo *display_info, Window id, guint32 opacity)
 {
 #ifdef HAVE_COMPOSITOR
     CWindow *cw;
diff --git a/src/compositor.h b/src/compositor.h
index fbb0fee..d889449 100644
--- a/src/compositor.h
+++ b/src/compositor.h
@@ -70,7 +70,7 @@ void                     compositorUpdateScreenSize             (ScreenInfo *);
 
 void                     compositorWindowSetOpacity             (DisplayInfo *,
                                                                  Window,
-                                                                 guint);
+                                                                 guint32);
 void                     compositorRebuildScreen                (ScreenInfo *);
 gboolean                 compositorTestServer                   (DisplayInfo *);
 
diff --git a/src/hints.c b/src/hints.c
index 9cedf06..cb9d34a 100644
--- a/src/hints.c
+++ b/src/hints.c
@@ -242,7 +242,7 @@ getHint (DisplayInfo *display_info, Window w, int atom_id, long *value)
                              FALSE, XA_CARDINAL, &real_type, &real_format, &items_read, &items_left,
                              (unsigned char **) &data) == Success) && (items_read))
     {
-        *value = *((long *) data) & 0xffffffff;
+        *value = *((long *) data) & ((1L << real_format) - 1);
         if (data)
         {
             XFree (data);
@@ -507,7 +507,7 @@ getCardinalList (DisplayInfo *display_info, Window w, int atom_id, unsigned long
     *n_cardinals_p = n_cardinals;
     for (i = 0; i < n_cardinals; i++)
     {
-        (*cardinals_p)[i] = (*cardinals_p)[i] & 0xffffffff;
+        (*cardinals_p)[i] = (*cardinals_p)[i] & ((1L << format) - 1);
     }
 
     return TRUE;
@@ -1118,7 +1118,7 @@ getRGBIconData (DisplayInfo *display_info, Window window, unsigned long **data,
 }
 
 gboolean
-getOpacity (DisplayInfo *display_info, Window window, guint *opacity)
+getOpacity (DisplayInfo *display_info, Window window, guint32 *opacity)
 {
     long val;
 
@@ -1129,7 +1129,7 @@ getOpacity (DisplayInfo *display_info, Window window, guint *opacity)
     val = 0;
     if (getHint (display_info, window, NET_WM_WINDOW_OPACITY, &val))
     {
-        *opacity = (guint) val;
+        *opacity = (guint32) val;
         return TRUE;
     }
 
diff --git a/src/hints.h b/src/hints.h
index c106247..29c9b5b 100644
--- a/src/hints.h
+++ b/src/hints.h
@@ -105,7 +105,7 @@
 #define NET_WM_BOTTOMRIGHT                      2
 #define NET_WM_BOTTOMLEFT                       3
 
-#define NET_WM_OPAQUE                           0xffffffff
+#define NET_WM_OPAQUE                           G_MAXUINT32
 
 #define STRUTS_LEFT                             0
 #define STRUTS_RIGHT                            1
@@ -260,7 +260,7 @@ gboolean                 getRGBIconData                         (DisplayInfo *,
                                                                  unsigned long *);
 gboolean                 getOpacity                             (DisplayInfo *,
                                                                  Window,
-                                                                 guint *);
+                                                                 guint32 *);
 gboolean                 getOpacityLock                         (DisplayInfo *,
                                                                  Window);
 gboolean                 setXAtomManagerOwner                   (DisplayInfo *,

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list