diff options
Diffstat (limited to 'src/IconButton.cc')
-rw-r--r-- | src/IconButton.cc | 12 |
1 files changed, 8 insertions, 4 deletions
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, |