diff options
author | simonb <simonb> | 2005-04-27 17:45:56 (GMT) |
---|---|---|
committer | simonb <simonb> | 2005-04-27 17:45:56 (GMT) |
commit | 690030444b984e6b348284ae3c88671ee65a530b (patch) | |
tree | a0e36a3de8afa6a867f395a37757343e9577a24d | |
parent | 9970dd11c7f9c0d9d91601c9e9785a857ca2c6d8 (diff) | |
download | fluxbox_paul-690030444b984e6b348284ae3c88671ee65a530b.zip fluxbox_paul-690030444b984e6b348284ae3c88671ee65a530b.tar.bz2 |
add rough support for non-default depth pixmaps. Saves us having ghost
holes in windows
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | src/FbTk/FbPixmap.cc | 28 | ||||
-rw-r--r-- | src/FbTk/FbPixmap.hh | 2 | ||||
-rw-r--r-- | src/FbTk/ImageImlib2.cc | 4 | ||||
-rw-r--r-- | src/IconButton.cc | 12 |
5 files changed, 36 insertions, 14 deletions
@@ -1,6 +1,10 @@ | |||
1 | (Format: Year/Month/Day) | 1 | (Format: Year/Month/Day) |
2 | Changes for 0.9.13 | 2 | Changes for 0.9.13 |
3 | *05/04/27: | 3 | *05/04/27: |
4 | * Add some extremely basic handling for icon pixmaps that aren't | ||
5 | the same depth as the screen (treat all as 1-bit, easy to handle) | ||
6 | (Simon) | ||
7 | FbTk/FbPixmap.hh/cc FbTk/ImageImlib2.cc IconButton.cc | ||
4 | * Fix a bunch more issues with recent patches (Simon) | 8 | * Fix a bunch more issues with recent patches (Simon) |
5 | - Clock text colour on start | 9 | - Clock text colour on start |
6 | - Resizing not updating in some cases | 10 | - Resizing not updating in some cases |
diff --git a/src/FbTk/FbPixmap.cc b/src/FbTk/FbPixmap.cc index e573945..b2937c3 100644 --- a/src/FbTk/FbPixmap.cc +++ b/src/FbTk/FbPixmap.cc | |||
@@ -139,7 +139,8 @@ void FbPixmap::copy(const FbPixmap &the_copy) { | |||
139 | } | 139 | } |
140 | } | 140 | } |
141 | 141 | ||
142 | void FbPixmap::copy(Pixmap pm) { | 142 | // screen doesn't count if depth is "zero"... |
143 | void FbPixmap::copy(Pixmap pm, int depth, int screen_num) { | ||
143 | free(); | 144 | free(); |
144 | if (pm == 0) | 145 | if (pm == 0) |
145 | return; | 146 | return; |
@@ -157,15 +158,28 @@ void FbPixmap::copy(Pixmap pm) { | |||
157 | &new_width, &new_height, | 158 | &new_width, &new_height, |
158 | &border_width, | 159 | &border_width, |
159 | &bpp); | 160 | &bpp); |
161 | |||
162 | if (depth == 0) | ||
163 | depth = bpp; | ||
164 | |||
160 | // create new pixmap and copy area | 165 | // create new pixmap and copy area |
161 | create(root, new_width, new_height, bpp); | 166 | create(root, new_width, new_height, depth); |
162 | 167 | ||
163 | GC gc = XCreateGC(display(), drawable(), 0, 0); | 168 | GC gc = XCreateGC(display(), drawable(), 0, 0); |
164 | 169 | ||
165 | XCopyArea(display(), pm, drawable(), gc, | 170 | if (depth == bpp) { |
166 | 0, 0, | 171 | XCopyArea(display(), pm, drawable(), gc, |
167 | width(), height(), | 172 | 0, 0, |
168 | 0, 0); | 173 | width(), height(), |
174 | 0, 0); | ||
175 | } else { | ||
176 | XSetForeground(display(), gc, Color("black", screen_num).pixel()); | ||
177 | XSetBackground(display(), gc, Color("white", screen_num).pixel()); | ||
178 | XCopyPlane(display(), pm, drawable(), gc, | ||
179 | 0, 0, | ||
180 | width(), height(), | ||
181 | 0, 0, 1); | ||
182 | } | ||
169 | 183 | ||
170 | XFreeGC(display(), gc); | 184 | XFreeGC(display(), gc); |
171 | } | 185 | } |
@@ -254,7 +268,7 @@ void FbPixmap::tile(unsigned int dest_width, unsigned int dest_height) { | |||
254 | 268 | ||
255 | FbPixmap new_pm(drawable(), width(), height(), depth()); | 269 | FbPixmap new_pm(drawable(), width(), height(), depth()); |
256 | 270 | ||
257 | new_pm.copy(m_pm); | 271 | new_pm.copy(m_pm, 0, 0); |
258 | 272 | ||
259 | resize(dest_width, dest_height); | 273 | resize(dest_width, dest_height); |
260 | 274 | ||
diff --git a/src/FbTk/FbPixmap.hh b/src/FbTk/FbPixmap.hh index a1c17a5..c8640a2 100644 --- a/src/FbTk/FbPixmap.hh +++ b/src/FbTk/FbPixmap.hh | |||
@@ -48,7 +48,7 @@ public: | |||
48 | virtual ~FbPixmap(); | 48 | virtual ~FbPixmap(); |
49 | 49 | ||
50 | void copy(const FbPixmap &the_copy); | 50 | void copy(const FbPixmap &the_copy); |
51 | void copy(Pixmap pixmap); | 51 | void copy(Pixmap pixmap, int depth_convert, int screen_num); |
52 | /// rotates the pixmap 90 deg, not implemented! | 52 | /// rotates the pixmap 90 deg, not implemented! |
53 | void rotate(); | 53 | void rotate(); |
54 | /// scales the pixmap to specified size | 54 | /// scales the pixmap to specified size |
diff --git a/src/FbTk/ImageImlib2.cc b/src/FbTk/ImageImlib2.cc index ca47209..62ed182 100644 --- a/src/FbTk/ImageImlib2.cc +++ b/src/FbTk/ImageImlib2.cc | |||
@@ -147,8 +147,8 @@ PixmapWithMask *ImageImlib2::load(const std::string &filename, int screen_num) c | |||
147 | // pm and mask belong to imlib2, | 147 | // pm and mask belong to imlib2, |
148 | // so we have to copy them | 148 | // so we have to copy them |
149 | PixmapWithMask* result = new PixmapWithMask(); | 149 | PixmapWithMask* result = new PixmapWithMask(); |
150 | result->pixmap().copy(pm); | 150 | result->pixmap().copy(pm, 0, 0); |
151 | result->mask().copy(mask); | 151 | result->mask().copy(mask, 0, 0); |
152 | 152 | ||
153 | // mark pm and mask as freeable in imlib | 153 | // mark pm and mask as freeable in imlib |
154 | imlib_free_image_and_decache(); | 154 | imlib_free_image_and_decache(); |
diff --git a/src/IconButton.cc b/src/IconButton.cc index 4258f13..7918be9 100644 --- a/src/IconButton.cc +++ b/src/IconButton.cc | |||
@@ -226,10 +226,14 @@ void IconButton::update(FbTk::Subject *subj) { | |||
226 | if (m_win.clientList().empty()) | 226 | if (m_win.clientList().empty()) |
227 | return; | 227 | return; |
228 | 228 | ||
229 | XWMHints *hints = XGetWMHints(FbTk::App::instance()->display(), m_win.winClient().window()); | 229 | Display *display = FbTk::App::instance()->display(); |
230 | |||
231 | XWMHints *hints = XGetWMHints(display, m_win.winClient().window()); | ||
230 | if (hints == 0) | 232 | if (hints == 0) |
231 | return; | 233 | return; |
232 | 234 | ||
235 | int screen = m_win.screen().screenNumber(); | ||
236 | |||
233 | if (m_use_pixmap && (hints->flags & IconPixmapHint) && hints->icon_pixmap != 0) { | 237 | if (m_use_pixmap && (hints->flags & IconPixmapHint) && hints->icon_pixmap != 0) { |
234 | // setup icon window | 238 | // setup icon window |
235 | m_icon_window.show(); | 239 | m_icon_window.show(); |
@@ -237,7 +241,7 @@ void IconButton::update(FbTk::Subject *subj) { | |||
237 | int new_width = new_height; | 241 | int new_width = new_height; |
238 | m_icon_window.resize((new_width>0) ? new_width : 1, (new_height>0) ? new_height : 1); | 242 | m_icon_window.resize((new_width>0) ? new_width : 1, (new_height>0) ? new_height : 1); |
239 | 243 | ||
240 | m_icon_pixmap.copy(hints->icon_pixmap); | 244 | m_icon_pixmap.copy(hints->icon_pixmap, DefaultDepth(display, screen), screen); |
241 | m_icon_pixmap.scale(m_icon_window.width(), m_icon_window.height()); | 245 | m_icon_pixmap.scale(m_icon_window.width(), m_icon_window.height()); |
242 | 246 | ||
243 | m_icon_window.setBackgroundPixmap(m_icon_pixmap.drawable()); | 247 | m_icon_window.setBackgroundPixmap(m_icon_pixmap.drawable()); |
@@ -249,7 +253,7 @@ void IconButton::update(FbTk::Subject *subj) { | |||
249 | } | 253 | } |
250 | 254 | ||
251 | if(m_use_pixmap && (hints->flags & IconMaskHint)) { | 255 | if(m_use_pixmap && (hints->flags & IconMaskHint)) { |
252 | m_icon_mask.copy(hints->icon_mask); | 256 | m_icon_mask.copy(hints->icon_mask, 0, 0); |
253 | m_icon_mask.scale(m_icon_pixmap.width(), m_icon_pixmap.height()); | 257 | m_icon_mask.scale(m_icon_pixmap.width(), m_icon_pixmap.height()); |
254 | } else | 258 | } else |
255 | m_icon_mask = 0; | 259 | m_icon_mask = 0; |
@@ -260,7 +264,7 @@ void IconButton::update(FbTk::Subject *subj) { | |||
260 | #ifdef SHAPE | 264 | #ifdef SHAPE |
261 | 265 | ||
262 | if (m_icon_mask.drawable() != 0) { | 266 | if (m_icon_mask.drawable() != 0) { |
263 | XShapeCombineMask(FbTk::App::instance()->display(), | 267 | XShapeCombineMask(display, |
264 | m_icon_window.drawable(), | 268 | m_icon_window.drawable(), |
265 | ShapeBounding, | 269 | ShapeBounding, |
266 | 0, 0, | 270 | 0, 0, |