summaryrefslogtreecommitdiff
path: root/src/FbTk/FbWindow.cc
diff options
context:
space:
mode:
authorJim Ramsay <i.am@jimramsay.com>2009-05-06 12:18:56 (GMT)
committerJim Ramsay <i.am@jimramsay.com>2009-05-06 12:48:11 (GMT)
commit4d3aa646c1d1d1de4fdb31f938f6ea62fd5dd21e (patch)
tree9b1c85dc423696b4e104647c9948d493a7e05428 /src/FbTk/FbWindow.cc
parentb82f21acc9abc50c87caf5b0cd3bb0f6d8f7249f (diff)
downloadfluxbox_lack-4d3aa646c1d1d1de4fdb31f938f6ea62fd5dd21e.zip
fluxbox_lack-4d3aa646c1d1d1de4fdb31f938f6ea62fd5dd21e.tar.bz2
Force window borders to be opaque color
This is needed until we support full ARGB colors everywhere. Until then, since the outer-most "frame" window in FbWinFrame is the only 32-bit window we create, and the only part seen is the border, we only need to worry about forcing this one color to be opaque.
Diffstat (limited to 'src/FbTk/FbWindow.cc')
-rw-r--r--src/FbTk/FbWindow.cc27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/FbTk/FbWindow.cc b/src/FbTk/FbWindow.cc
index 9179cb3..18cec3f 100644
--- a/src/FbTk/FbWindow.cc
+++ b/src/FbTk/FbWindow.cc
@@ -41,6 +41,10 @@
41 #include <assert.h> 41 #include <assert.h>
42#endif 42#endif
43 43
44#if HAVE_XRENDER
45#include <X11/extensions/Xrender.h>
46#endif
47
44namespace FbTk { 48namespace FbTk {
45 49
46FbWindow::FbWindow(): 50FbWindow::FbWindow():
@@ -251,7 +255,20 @@ void FbWindow::updateBackground(bool only_if_alpha) {
251} 255}
252 256
253void FbWindow::setBorderColor(const FbTk::Color &border_color) { 257void FbWindow::setBorderColor(const FbTk::Color &border_color) {
254 XSetWindowBorder(display(), m_window, border_color.pixel()); 258 unsigned long pixel = border_color.pixel();
259#if HAVE_XRENDER
260 XRenderPictFormat *format = XRenderFindVisualFormat(display(), visual());
261 if (depth() == 32 && format) {
262 /* TODO: Temporarily, until we have full ARGB color support, hack in the
263 * alpha channel of this pixel to be opaque
264 */
265 pixel |= ((0xffff * (format->direct.alphaMask + 1) >> 16)
266 << format->direct.alpha);
267 }
268#endif
269 XSetWindowBorder(display(), m_window, pixel);
270
271 /* Important: Use the original color here, it is matched in FbWinFrame.cc */
255 m_border_color = border_color.pixel(); 272 m_border_color = border_color.pixel();
256} 273}
257 274
@@ -613,6 +630,14 @@ bool FbWindow::updateGeometry() {
613 old_height != m_height); 630 old_height != m_height);
614} 631}
615 632
633Visual *FbWindow::visual() {
634 XWindowAttributes attr;
635 if (XGetWindowAttributes(display(), m_window, &attr)) {
636 return attr.visual;
637 }
638 return 0;
639}
640
616void FbWindow::create(Window parent, int x, int y, 641void FbWindow::create(Window parent, int x, int y,
617 unsigned int width, unsigned int height, 642 unsigned int width, unsigned int height,
618 long eventmask, bool override_redirect, 643 long eventmask, bool override_redirect,