summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/FbTk/FbWindow.cc27
-rw-r--r--src/FbTk/FbWindow.hh2
2 files changed, 28 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,
diff --git a/src/FbTk/FbWindow.hh b/src/FbTk/FbWindow.hh
index b9f5e18..e5298b0 100644
--- a/src/FbTk/FbWindow.hh
+++ b/src/FbTk/FbWindow.hh
@@ -204,6 +204,8 @@ public:
204 /// updates x,y, width, height and screen num from X window 204 /// updates x,y, width, height and screen num from X window
205 bool updateGeometry(); 205 bool updateGeometry();
206 206
207 Visual *visual();
208
207protected: 209protected:
208 /// creates a window with x window client (m_window = client) 210 /// creates a window with x window client (m_window = client)
209 explicit FbWindow(Window client); 211 explicit FbWindow(Window client);