emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/trunk r105400: Set _NET_WM_WINDOW_OPACITY o


From: Jan D.
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r105400: Set _NET_WM_WINDOW_OPACITY on outer window manager window also.
Date: Thu, 04 Aug 2011 13:06:22 +0200
User-agent: Bazaar (2.3.1)

------------------------------------------------------------
revno: 105400
fixes bug(s): http://debbugs.gnu.org/9181
committer: Jan D. <address@hidden>
branch nick: trunk
timestamp: Thu 2011-08-04 13:06:22 +0200
message:
  Set _NET_WM_WINDOW_OPACITY on outer window manager window also.
  
  * xterm.c (x_find_topmost_parent): New function.
  (x_set_frame_alpha): Find topmost parent window with
  x_find_topmost_parent and set the property there also.
  (handle_one_xevent): Call x_set_frame_alpha on ReparentNotify.
modified:
  src/ChangeLog
  src/xterm.c
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2011-08-04 03:08:01 +0000
+++ b/src/ChangeLog     2011-08-04 11:06:22 +0000
@@ -1,3 +1,10 @@
+2011-08-04  Jan Djärv  <address@hidden>
+
+       * xterm.c (x_find_topmost_parent): New function.
+       (x_set_frame_alpha): Find topmost parent window with
+       x_find_topmost_parent and set the property there also (bug#9181).
+       (handle_one_xevent): Call x_set_frame_alpha on ReparentNotify.
+
 2011-08-04  Paul Eggert  <address@hidden>
 
        * callproc.c (Fcall_process): Avoid vfork clobbering

=== modified file 'src/xterm.c'
--- a/src/xterm.c       2011-06-24 21:25:22 +0000
+++ b/src/xterm.c       2011-08-04 11:06:22 +0000
@@ -442,6 +442,27 @@
   return 0;
 }
 
+static Window
+x_find_topmost_parent (struct frame *f)
+{
+  struct x_output *x = f->output_data.x;
+  Window win = None, wi = x->parent_desc;
+  Display *dpy = FRAME_X_DISPLAY (f);
+
+  while (wi != FRAME_X_DISPLAY_INFO (f)->root_window)
+    {
+      Window root;
+      Window *children;
+      unsigned int nchildren;
+
+      win = wi;
+      XQueryTree (dpy, win, &root, &wi, &children, &nchildren);
+      XFree (children);
+    }
+
+  return win;
+}
+
 #define OPAQUE  0xffffffff
 
 void
@@ -453,6 +474,7 @@
   double alpha = 1.0;
   double alpha_min = 1.0;
   unsigned long opac;
+  Window parent;
 
   if (dpyinfo->x_highlight_frame == f)
     alpha = f->alpha[0];
@@ -473,6 +495,19 @@
 
   opac = alpha * OPAQUE;
 
+  x_catch_errors (dpy);
+
+  /* If there is a parent from the window manager, put the property there
+     also, to work around broken window managers that fail to do that.
+     Do this unconditionally as this function is called on reparent when
+     alpha has not changed on the frame.  */
+
+  parent = x_find_topmost_parent (f);
+  if (parent != None)
+    XChangeProperty (dpy, parent, dpyinfo->Xatom_net_wm_window_opacity,
+                     XA_CARDINAL, 32, PropModeReplace,
+                     (unsigned char *) &opac, 1L);
+
   /* return unless necessary */
   {
     unsigned char *data;
@@ -480,7 +515,6 @@
     int rc, format;
     unsigned long n, left;
 
-    x_catch_errors (dpy);
     rc = XGetWindowProperty (dpy, win, dpyinfo->Xatom_net_wm_window_opacity,
                             0L, 1L, False, XA_CARDINAL,
                             &actual, &format, &n, &left,
@@ -6088,6 +6122,8 @@
           /* Perhaps reparented due to a WM restart.  Reset this.  */
           FRAME_X_DISPLAY_INFO (f)->wm_type = X_WMTYPE_UNKNOWN;
           FRAME_X_DISPLAY_INFO (f)->net_supported_window = 0;
+
+          x_set_frame_alpha (f);
         }
       goto OTHER;
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]