[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/src/xterm.c,v
From: |
Glenn Morris |
Subject: |
[Emacs-diffs] Changes to emacs/src/xterm.c,v |
Date: |
Wed, 21 May 2008 03:59:45 +0000 |
CVSROOT: /sources/emacs
Module name: emacs
Changes by: Glenn Morris <gm> 08/05/21 03:59:45
Index: xterm.c
===================================================================
RCS file: /sources/emacs/emacs/src/xterm.c,v
retrieving revision 1.988
retrieving revision 1.989
diff -u -b -r1.988 -r1.989
--- xterm.c 14 May 2008 07:50:26 -0000 1.988
+++ xterm.c 21 May 2008 03:59:44 -0000 1.989
@@ -457,6 +457,67 @@
return 0;
}
+#define OPAQUE 0xffffffff
+#define OPACITY "_NET_WM_WINDOW_OPACITY"
+
+void
+x_set_frame_alpha (f)
+ struct frame *f;
+{
+ struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+ Display *dpy = FRAME_X_DISPLAY (f);
+ Window win = FRAME_OUTER_WINDOW (f);
+ if (FRAME_X_DISPLAY_INFO (f)->root_window != FRAME_X_OUTPUT (f)->parent_desc)
+ /* Since the WM decoration lies under the FRAME_OUTER_WINDOW,
+ we must treat the former instead of the latter. */
+ win = FRAME_X_OUTPUT(f)->parent_desc;
+
+ double alpha = 1.0, alpha_min = 1.0;
+
+ if (dpyinfo->x_highlight_frame == f)
+ alpha = f->alpha[0];
+ else
+ alpha = f->alpha[1];
+
+ if (FLOATP (Vframe_alpha_lower_limit))
+ alpha_min = XFLOAT_DATA (Vframe_alpha_lower_limit);
+ else if (INTEGERP (Vframe_alpha_lower_limit))
+ alpha_min = (XINT (Vframe_alpha_lower_limit)) / 100.0;
+
+ if (alpha < 0.0 || 1.0 < alpha)
+ alpha = 1.0;
+ else if (0.0 <= alpha && alpha < alpha_min && alpha_min <= 1.0)
+ alpha = alpha_min;
+
+ unsigned int opac = (unsigned int)(alpha * OPAQUE);
+
+ /* return unless necessary */
+ {
+ unsigned char *data;
+ Atom actual;
+ int format;
+ unsigned long n, left;
+
+ XGetWindowProperty(dpy, win, XInternAtom(dpy, OPACITY, False),
+ 0L, 1L, False, XA_CARDINAL, &actual, &format, &n, &left,
+ (unsigned char **) &data);
+ if (data != None)
+ if (*(unsigned int *)data == opac)
+ {
+ XFree ((void *) data);
+ return;
+ }
+ else
+ {
+ XFree ((void *) data);
+ }
+ }
+
+ XChangeProperty (dpy, win, XInternAtom (dpy, OPACITY, False),
+ XA_CARDINAL, 32, PropModeReplace,
+ (unsigned char *) &opac, 1L);
+ XSync (dpy, False);
+}
/***********************************************************************
@@ -3171,6 +3232,7 @@
f->output_data.x->border_pixel);
UNBLOCK_INPUT;
x_update_cursor (f, 1);
+ x_set_frame_alpha (f);
}
static void
@@ -3186,6 +3248,7 @@
f->output_data.x->border_tile);
UNBLOCK_INPUT;
x_update_cursor (f, 1);
+ x_set_frame_alpha (f);
}
/* The focus has changed. Update the frames as necessary to reflect
- [Emacs-diffs] Changes to emacs/src/xterm.c,v, Jan Djärv, 2008/05/13
- [Emacs-diffs] Changes to emacs/src/xterm.c,v, Kenichi Handa, 2008/05/13
- [Emacs-diffs] Changes to emacs/src/xterm.c,v, Glenn Morris, 2008/05/14
- [Emacs-diffs] Changes to emacs/src/xterm.c,v,
Glenn Morris <=
- [Emacs-diffs] Changes to emacs/src/xterm.c,v, Dan Nicolaescu, 2008/05/21
- [Emacs-diffs] Changes to emacs/src/xterm.c,v, Kenichi Handa, 2008/05/23
- [Emacs-diffs] Changes to emacs/src/xterm.c,v, Kenichi Handa, 2008/05/23
- [Emacs-diffs] Changes to emacs/src/xterm.c,v, Kenichi Handa, 2008/05/25
- [Emacs-diffs] Changes to emacs/src/xterm.c,v, Andreas Schwab, 2008/05/26
- [Emacs-diffs] Changes to emacs/src/xterm.c,v, Chong Yidong, 2008/05/27