add rough support for non-default depth pixmaps. Saves us having ghost holes in windows
simonb simonb
5 files changed,
36 insertions(+),
14 deletions(-)
M
ChangeLog
→
ChangeLog
@@ -1,6 +1,10 @@
(Format: Year/Month/Day) Changes for 0.9.13 *05/04/27: + * Add some extremely basic handling for icon pixmaps that aren't + the same depth as the screen (treat all as 1-bit, easy to handle) + (Simon) + FbTk/FbPixmap.hh/cc FbTk/ImageImlib2.cc IconButton.cc * Fix a bunch more issues with recent patches (Simon) - Clock text colour on start - Resizing not updating in some cases
M
src/FbTk/FbPixmap.cc
→
src/FbTk/FbPixmap.cc
@@ -139,7 +139,8 @@ }
} } -void FbPixmap::copy(Pixmap pm) { +// screen doesn't count if depth is "zero"... +void FbPixmap::copy(Pixmap pm, int depth, int screen_num) { free(); if (pm == 0) return;@@ -157,15 +158,28 @@ &x, &y,
&new_width, &new_height, &border_width, &bpp); + + if (depth == 0) + depth = bpp; + // create new pixmap and copy area - create(root, new_width, new_height, bpp); + create(root, new_width, new_height, depth); GC gc = XCreateGC(display(), drawable(), 0, 0); - XCopyArea(display(), pm, drawable(), gc, - 0, 0, - width(), height(), - 0, 0); + if (depth == bpp) { + XCopyArea(display(), pm, drawable(), gc, + 0, 0, + width(), height(), + 0, 0); + } else { + XSetForeground(display(), gc, Color("black", screen_num).pixel()); + XSetBackground(display(), gc, Color("white", screen_num).pixel()); + XCopyPlane(display(), pm, drawable(), gc, + 0, 0, + width(), height(), + 0, 0, 1); + } XFreeGC(display(), gc); }@@ -254,7 +268,7 @@ return;
FbPixmap new_pm(drawable(), width(), height(), depth()); - new_pm.copy(m_pm); + new_pm.copy(m_pm, 0, 0); resize(dest_width, dest_height);
M
src/FbTk/FbPixmap.hh
→
src/FbTk/FbPixmap.hh
@@ -48,7 +48,7 @@
virtual ~FbPixmap(); void copy(const FbPixmap &the_copy); - void copy(Pixmap pixmap); + void copy(Pixmap pixmap, int depth_convert, int screen_num); /// rotates the pixmap 90 deg, not implemented! void rotate(); /// scales the pixmap to specified size
M
src/FbTk/ImageImlib2.cc
→
src/FbTk/ImageImlib2.cc
@@ -147,8 +147,8 @@
// pm and mask belong to imlib2, // so we have to copy them PixmapWithMask* result = new PixmapWithMask(); - result->pixmap().copy(pm); - result->mask().copy(mask); + result->pixmap().copy(pm, 0, 0); + result->mask().copy(mask, 0, 0); // mark pm and mask as freeable in imlib imlib_free_image_and_decache();
M
src/IconButton.cc
→
src/IconButton.cc
@@ -226,9 +226,13 @@ // we need to check our client first
if (m_win.clientList().empty()) return; - XWMHints *hints = XGetWMHints(FbTk::App::instance()->display(), m_win.winClient().window()); + Display *display = FbTk::App::instance()->display(); + + XWMHints *hints = XGetWMHints(display, m_win.winClient().window()); if (hints == 0) return; + + int screen = m_win.screen().screenNumber(); if (m_use_pixmap && (hints->flags & IconPixmapHint) && hints->icon_pixmap != 0) { // setup icon window@@ -237,7 +241,7 @@ int new_height = height() - 2*m_icon_window.y(); // equally padded
int new_width = new_height; m_icon_window.resize((new_width>0) ? new_width : 1, (new_height>0) ? new_height : 1); - m_icon_pixmap.copy(hints->icon_pixmap); + m_icon_pixmap.copy(hints->icon_pixmap, DefaultDepth(display, screen), screen); m_icon_pixmap.scale(m_icon_window.width(), m_icon_window.height()); m_icon_window.setBackgroundPixmap(m_icon_pixmap.drawable());@@ -249,7 +253,7 @@ m_icon_pixmap = 0;
} if(m_use_pixmap && (hints->flags & IconMaskHint)) { - m_icon_mask.copy(hints->icon_mask); + m_icon_mask.copy(hints->icon_mask, 0, 0); m_icon_mask.scale(m_icon_pixmap.width(), m_icon_pixmap.height()); } else m_icon_mask = 0;@@ -260,7 +264,7 @@
#ifdef SHAPE if (m_icon_mask.drawable() != 0) { - XShapeCombineMask(FbTk::App::instance()->display(), + XShapeCombineMask(display, m_icon_window.drawable(), ShapeBounding, 0, 0,