aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Djärv2011-08-04 13:06:22 +0200
committerJan Djärv2011-08-04 13:06:22 +0200
commit99aaf75f7c50513f7a6ad6bac21bd8f68290633e (patch)
tree5291c6481fba535b17bfcf312686d4af13c4eb9b /src
parenteeec79cbfa7d7a45b1436942878ef5ad627a5a31 (diff)
downloademacs-99aaf75f7c50513f7a6ad6bac21bd8f68290633e.tar.gz
emacs-99aaf75f7c50513f7a6ad6bac21bd8f68290633e.zip
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. Fixes: debbugs:9181
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog7
-rw-r--r--src/xterm.c38
2 files changed, 44 insertions, 1 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 1ad53741533..f66d301e060 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,10 @@
12011-08-04 Jan Djärv <jan.h.d@swipnet.se>
2
3 * xterm.c (x_find_topmost_parent): New function.
4 (x_set_frame_alpha): Find topmost parent window with
5 x_find_topmost_parent and set the property there also (bug#9181).
6 (handle_one_xevent): Call x_set_frame_alpha on ReparentNotify.
7
12011-08-04 Paul Eggert <eggert@cs.ucla.edu> 82011-08-04 Paul Eggert <eggert@cs.ucla.edu>
2 9
3 * callproc.c (Fcall_process): Avoid vfork clobbering 10 * callproc.c (Fcall_process): Avoid vfork clobbering
diff --git a/src/xterm.c b/src/xterm.c
index 20516ee9d6f..74e905cd246 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -442,6 +442,27 @@ x_display_info_for_display (Display *dpy)
442 return 0; 442 return 0;
443} 443}
444 444
445static Window
446x_find_topmost_parent (struct frame *f)
447{
448 struct x_output *x = f->output_data.x;
449 Window win = None, wi = x->parent_desc;
450 Display *dpy = FRAME_X_DISPLAY (f);
451
452 while (wi != FRAME_X_DISPLAY_INFO (f)->root_window)
453 {
454 Window root;
455 Window *children;
456 unsigned int nchildren;
457
458 win = wi;
459 XQueryTree (dpy, win, &root, &wi, &children, &nchildren);
460 XFree (children);
461 }
462
463 return win;
464}
465
445#define OPAQUE 0xffffffff 466#define OPAQUE 0xffffffff
446 467
447void 468void
@@ -453,6 +474,7 @@ x_set_frame_alpha (struct frame *f)
453 double alpha = 1.0; 474 double alpha = 1.0;
454 double alpha_min = 1.0; 475 double alpha_min = 1.0;
455 unsigned long opac; 476 unsigned long opac;
477 Window parent;
456 478
457 if (dpyinfo->x_highlight_frame == f) 479 if (dpyinfo->x_highlight_frame == f)
458 alpha = f->alpha[0]; 480 alpha = f->alpha[0];
@@ -473,6 +495,19 @@ x_set_frame_alpha (struct frame *f)
473 495
474 opac = alpha * OPAQUE; 496 opac = alpha * OPAQUE;
475 497
498 x_catch_errors (dpy);
499
500 /* If there is a parent from the window manager, put the property there
501 also, to work around broken window managers that fail to do that.
502 Do this unconditionally as this function is called on reparent when
503 alpha has not changed on the frame. */
504
505 parent = x_find_topmost_parent (f);
506 if (parent != None)
507 XChangeProperty (dpy, parent, dpyinfo->Xatom_net_wm_window_opacity,
508 XA_CARDINAL, 32, PropModeReplace,
509 (unsigned char *) &opac, 1L);
510
476 /* return unless necessary */ 511 /* return unless necessary */
477 { 512 {
478 unsigned char *data; 513 unsigned char *data;
@@ -480,7 +515,6 @@ x_set_frame_alpha (struct frame *f)
480 int rc, format; 515 int rc, format;
481 unsigned long n, left; 516 unsigned long n, left;
482 517
483 x_catch_errors (dpy);
484 rc = XGetWindowProperty (dpy, win, dpyinfo->Xatom_net_wm_window_opacity, 518 rc = XGetWindowProperty (dpy, win, dpyinfo->Xatom_net_wm_window_opacity,
485 0L, 1L, False, XA_CARDINAL, 519 0L, 1L, False, XA_CARDINAL,
486 &actual, &format, &n, &left, 520 &actual, &format, &n, &left,
@@ -6088,6 +6122,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6088 /* Perhaps reparented due to a WM restart. Reset this. */ 6122 /* Perhaps reparented due to a WM restart. Reset this. */
6089 FRAME_X_DISPLAY_INFO (f)->wm_type = X_WMTYPE_UNKNOWN; 6123 FRAME_X_DISPLAY_INFO (f)->wm_type = X_WMTYPE_UNKNOWN;
6090 FRAME_X_DISPLAY_INFO (f)->net_supported_window = 0; 6124 FRAME_X_DISPLAY_INFO (f)->net_supported_window = 0;
6125
6126 x_set_frame_alpha (f);
6091 } 6127 }
6092 goto OTHER; 6128 goto OTHER;
6093 6129