diff options
Diffstat (limited to 'src/IconbarTool.cc')
-rw-r--r-- | src/IconbarTool.cc | 93 |
1 files changed, 33 insertions, 60 deletions
diff --git a/src/IconbarTool.cc b/src/IconbarTool.cc index 413aebf..d7d45cd 100644 --- a/src/IconbarTool.cc +++ b/src/IconbarTool.cc | |||
@@ -333,11 +333,11 @@ IconbarTool::IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme, BScr | |||
333 | m_screen(screen), | 333 | m_screen(screen), |
334 | m_icon_container(parent), | 334 | m_icon_container(parent), |
335 | m_theme(theme), | 335 | m_theme(theme), |
336 | m_focused_pm(0), | 336 | m_focused_pm( screen.imageControl() ), |
337 | m_unfocused_pm(0), | 337 | m_unfocused_pm( screen.imageControl() ), |
338 | m_focused_err_pm(0), | 338 | m_focused_err_pm( screen.imageControl() ), |
339 | m_unfocused_err_pm(0), | 339 | m_unfocused_err_pm( screen.imageControl() ), |
340 | m_empty_pm(0), | 340 | m_empty_pm( screen.imageControl() ), |
341 | m_rc_mode(screen.resourceManager(), WORKSPACE, | 341 | m_rc_mode(screen.resourceManager(), WORKSPACE, |
342 | screen.name() + ".iconbar.mode", screen.altName() + ".Iconbar.Mode"), | 342 | screen.name() + ".iconbar.mode", screen.altName() + ".Iconbar.Mode"), |
343 | m_wheel_mode(screen.resourceManager(), OFF, | 343 | m_wheel_mode(screen.resourceManager(), OFF, |
@@ -393,19 +393,6 @@ IconbarTool::IconbarTool(const FbTk::FbWindow &parent, IconbarTheme &theme, BScr | |||
393 | 393 | ||
394 | IconbarTool::~IconbarTool() { | 394 | IconbarTool::~IconbarTool() { |
395 | deleteIcons(); | 395 | deleteIcons(); |
396 | |||
397 | // remove cached images | ||
398 | if (m_focused_pm) | ||
399 | m_screen.imageControl().removeImage(m_focused_pm); | ||
400 | if (m_unfocused_pm) | ||
401 | m_screen.imageControl().removeImage(m_unfocused_pm); | ||
402 | if (m_focused_err_pm) | ||
403 | m_screen.imageControl().removeImage(m_focused_err_pm); | ||
404 | if (m_unfocused_err_pm) | ||
405 | m_screen.imageControl().removeImage(m_unfocused_err_pm); | ||
406 | if (m_empty_pm) | ||
407 | m_screen.imageControl().removeImage(m_empty_pm); | ||
408 | |||
409 | } | 396 | } |
410 | 397 | ||
411 | void IconbarTool::move(int x, int y) { | 398 | void IconbarTool::move(int x, int y) { |
@@ -547,13 +534,14 @@ void IconbarTool::update(FbTk::Subject *subj) { | |||
547 | 534 | ||
548 | bool remove_all = false; // if we should readd all windows | 535 | bool remove_all = false; // if we should readd all windows |
549 | 536 | ||
550 | if (subj != 0 && typeid(*subj) == typeid(BScreen::ScreenSubject) && mode() != ALLWINDOWS) { | 537 | if (subj != 0 && typeid(*subj) == typeid(BScreen::ScreenSubject) && |
538 | mode() != ALLWINDOWS && mode() != ICONS ) { | ||
551 | BScreen::ScreenSubject *screen_subj = static_cast<BScreen::ScreenSubject *>(subj); | 539 | BScreen::ScreenSubject *screen_subj = static_cast<BScreen::ScreenSubject *>(subj); |
552 | // current workspace sig | 540 | // current workspace sig |
553 | if (&m_screen.currentWorkspaceSig() == screen_subj && | 541 | if (&m_screen.currentWorkspaceSig() == screen_subj ) { |
554 | mode() != ALLWINDOWS && mode() != ICONS) { | ||
555 | remove_all = true; // remove and readd all windows | 542 | remove_all = true; // remove and readd all windows |
556 | } | 543 | } |
544 | |||
557 | } | 545 | } |
558 | 546 | ||
559 | // lock graphic update | 547 | // lock graphic update |
@@ -621,9 +609,7 @@ void IconbarTool::renderTheme() { | |||
621 | // update button sizes before we get max width per client! | 609 | // update button sizes before we get max width per client! |
622 | updateSizing(); | 610 | updateSizing(); |
623 | 611 | ||
624 | Pixmap tmp = m_focused_pm; | 612 | unsigned int icon_width = 0, icon_height = 0; |
625 | Pixmap err_tmp = m_focused_err_pm; | ||
626 | unsigned int icon_width, icon_height; | ||
627 | unsigned int icon_width_off=0, icon_height_off=0; | 613 | unsigned int icon_width_off=0, icon_height_off=0; |
628 | 614 | ||
629 | if (orientation() == FbTk::ROT0 || orientation() == FbTk::ROT180) { | 615 | if (orientation() == FbTk::ROT0 || orientation() == FbTk::ROT180) { |
@@ -637,56 +623,42 @@ void IconbarTool::renderTheme() { | |||
637 | } | 623 | } |
638 | 624 | ||
639 | if (!m_theme.focusedTexture().usePixmap()) { | 625 | if (!m_theme.focusedTexture().usePixmap()) { |
640 | m_focused_pm = 0; | 626 | m_focused_pm.reset( 0 ); |
641 | m_focused_err_pm = 0; | 627 | m_focused_err_pm.reset( 0 ); |
642 | } else { | 628 | } else { |
643 | m_focused_pm = m_screen.imageControl().renderImage(icon_width, | 629 | m_focused_pm.reset( m_screen.imageControl(). |
644 | icon_height, | 630 | renderImage(icon_width, icon_height, |
645 | m_theme.focusedTexture(), orientation()); | 631 | m_theme.focusedTexture(), orientation()) ); |
646 | m_focused_err_pm = m_screen.imageControl().renderImage(icon_width+icon_width_off, | 632 | m_focused_err_pm.reset( m_screen.imageControl(). |
647 | icon_height+icon_height_off, | 633 | renderImage(icon_width + icon_width_off, |
648 | m_theme.focusedTexture(), orientation()); | 634 | icon_height + icon_height_off, |
635 | m_theme.focusedTexture(), orientation()) ); | ||
649 | } | 636 | } |
650 | 637 | ||
651 | if (tmp) | ||
652 | m_screen.imageControl().removeImage(tmp); | ||
653 | if (err_tmp) | ||
654 | m_screen.imageControl().removeImage(err_tmp); | ||
655 | |||
656 | tmp = m_unfocused_pm; | ||
657 | err_tmp = m_unfocused_err_pm; | ||
658 | |||
659 | if (!m_theme.unfocusedTexture().usePixmap()) { | 638 | if (!m_theme.unfocusedTexture().usePixmap()) { |
660 | m_unfocused_pm = 0; | 639 | m_unfocused_pm.reset( 0 ); |
661 | m_unfocused_err_pm = 0; | 640 | m_unfocused_err_pm.reset( 0 ); |
662 | } else { | 641 | } else { |
663 | m_unfocused_pm = m_screen.imageControl().renderImage(icon_width, | 642 | m_unfocused_pm.reset( m_screen.imageControl(). |
664 | icon_height, | 643 | renderImage(icon_width, icon_height, |
665 | m_theme.unfocusedTexture(), orientation()); | 644 | m_theme.unfocusedTexture(), orientation()) ); |
666 | m_unfocused_err_pm = m_screen.imageControl().renderImage(icon_width+icon_width_off, | 645 | m_unfocused_err_pm.reset( m_screen.imageControl(). |
667 | icon_height+icon_height_off, | 646 | renderImage(icon_width+icon_width_off, |
668 | m_theme.unfocusedTexture(), orientation()); | 647 | icon_height+icon_height_off, |
648 | m_theme.unfocusedTexture(), orientation()) ); | ||
669 | } | 649 | } |
670 | if (tmp) | ||
671 | m_screen.imageControl().removeImage(tmp); | ||
672 | if (err_tmp) | ||
673 | m_screen.imageControl().removeImage(err_tmp); | ||
674 | 650 | ||
675 | // if we dont have any icons then we should render empty texture | 651 | // if we dont have any icons then we should render empty texture |
676 | tmp = m_empty_pm; | ||
677 | if (!m_theme.emptyTexture().usePixmap()) { | 652 | if (!m_theme.emptyTexture().usePixmap()) { |
678 | m_empty_pm = 0; | 653 | m_empty_pm.reset( 0 ); |
679 | m_icon_container.setBackgroundColor(m_theme.emptyTexture().color()); | 654 | m_icon_container.setBackgroundColor(m_theme.emptyTexture().color()); |
680 | } else { | 655 | } else { |
681 | m_empty_pm = m_screen.imageControl().renderImage(m_icon_container.width(), | 656 | m_empty_pm.reset( m_screen.imageControl(). |
682 | m_icon_container.height(), | 657 | renderImage(m_icon_container.width(), m_icon_container.height(), |
683 | m_theme.emptyTexture(), orientation()); | 658 | m_theme.emptyTexture(), orientation()) ); |
684 | m_icon_container.setBackgroundPixmap(m_empty_pm); | 659 | m_icon_container.setBackgroundPixmap(m_empty_pm); |
685 | } | 660 | } |
686 | 661 | ||
687 | if (tmp) | ||
688 | m_screen.imageControl().removeImage(tmp); | ||
689 | |||
690 | // set to zero so its consistent and not ugly | 662 | // set to zero so its consistent and not ugly |
691 | m_icon_container.setBorderWidth(m_theme.border().width()); | 663 | m_icon_container.setBorderWidth(m_theme.border().width()); |
692 | m_icon_container.setBorderColor(m_theme.border().color()); | 664 | m_icon_container.setBorderColor(m_theme.border().color()); |
@@ -839,6 +811,7 @@ void IconbarTool::updateList() { | |||
839 | !checkDuplicate(*(*it)->fbwindow())) | 811 | !checkDuplicate(*(*it)->fbwindow())) |
840 | addWindow(*(*it)->fbwindow()); | 812 | addWindow(*(*it)->fbwindow()); |
841 | } | 813 | } |
814 | |||
842 | renderTheme(); | 815 | renderTheme(); |
843 | } | 816 | } |
844 | 817 | ||