aboutsummaryrefslogtreecommitdiff
path: root/src/WinButton.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/WinButton.cc')
-rw-r--r--src/WinButton.cc48
1 files changed, 7 insertions, 41 deletions
diff --git a/src/WinButton.cc b/src/WinButton.cc
index 496e63d..f8421b5 100644
--- a/src/WinButton.cc
+++ b/src/WinButton.cc
@@ -310,12 +310,13 @@ void WinButton::drawType() {
310 310
311void WinButton::clear() { 311void WinButton::clear() {
312 FbTk::Button::clear(); 312 FbTk::Button::clear();
313 313 drawType();
314 // ensure the m_listen_to has actually a client 314}
315 if (m_type == MENUICON && !m_listen_to.empty() && ( 315
316 !m_icon_pixmap.drawable() || 316void WinButton::update(FbTk::Subject *subj) {
317 (m_icon_pixmap.width() != width() - 4 || 317
318 m_icon_pixmap.height() != height() - 4))) { 318 // update the menu icon
319 if (m_type == MENUICON && !m_listen_to.empty()) {
319 320
320 Display* display = m_listen_to.fbWindow().display(); 321 Display* display = m_listen_to.fbWindow().display();
321 int screen = m_listen_to.screen().screenNumber(); 322 int screen = m_listen_to.screen().screenNumber();
@@ -334,41 +335,6 @@ void WinButton::clear() {
334 335
335 } 336 }
336 337
337 drawType();
338}
339
340void WinButton::update(FbTk::Subject *subj) {
341
342 // just checking, if we the app provides a pixmap.
343 if (m_type == MENUICON && !m_listen_to.empty()) {
344 XWMHints* hints = XGetWMHints(m_listen_to.fbWindow().display(),
345 m_listen_to.winClient().window());
346 if (hints == 0) {
347 m_icon_pixmap.release();
348 m_icon_mask.release();
349 } else {
350
351 // no pixmap
352 if (!((hints->flags & IconPixmapHint) && hints->icon_pixmap != 0))
353 m_icon_pixmap.release();
354
355 // pixmap has changed
356 if (hints->flags & IconPixmapHint && hints->icon_pixmap != 0 &&
357 hints->icon_pixmap != m_icon_pixmap.drawable())
358 m_icon_pixmap.release();
359
360 // no pixmap-mask
361 if (!(hints->flags & IconMaskHint))
362 m_icon_mask.release();
363
364 // pixmap-mask has changed
365 if (hints->flags & IconMaskHint && hints->icon_mask != m_icon_mask.drawable())
366 m_icon_mask.release();
367 }
368
369 XFree(hints);
370 }
371
372 // pressed_pixmap isn't stateful in any current buttons, so no need 338 // pressed_pixmap isn't stateful in any current buttons, so no need
373 // to potentially override that. Just make sure background pm is ok 339 // to potentially override that. Just make sure background pm is ok
374 Pixmap my_pm = getBackgroundPixmap(); 340 Pixmap my_pm = getBackgroundPixmap();