summaryrefslogtreecommitdiff
path: root/src/Toolbar.cc
diff options
context:
space:
mode:
authorJim Ramsay <i.am@jimramsay.com>2009-10-14 01:05:49 (GMT)
committerJim Ramsay <i.am@jimramsay.com>2009-10-14 01:05:49 (GMT)
commit839ea523164caecd8c779e60539b78c2a748a81f (patch)
tree0019d04f27a1a258bc7a900e3cf77b916dca6493 /src/Toolbar.cc
parent4d3aa646c1d1d1de4fdb31f938f6ea62fd5dd21e (diff)
parent8def80cec337a986b762cdbb5e2555c6da809353 (diff)
downloadfluxbox_lack-argb.zip
fluxbox_lack-argb.tar.bz2
Merge branch 'master' into argbtesting/argbargb
Conflicts: src/FbTk/FbWindow.cc
Diffstat (limited to 'src/Toolbar.cc')
-rw-r--r--src/Toolbar.cc39
1 files changed, 18 insertions, 21 deletions
diff --git a/src/Toolbar.cc b/src/Toolbar.cc
index 96d2701..e64d74e 100644
--- a/src/Toolbar.cc
+++ b/src/Toolbar.cc
@@ -177,7 +177,7 @@ private:
177 Toolbar::Placement m_place; 177 Toolbar::Placement m_place;
178}; 178};
179 179
180}; // end anonymous 180} // end anonymous
181 181
182// toolbar frame 182// toolbar frame
183Toolbar::Frame::Frame(FbTk::EventHandler &evh, int screen_num): 183Toolbar::Frame::Frame(FbTk::EventHandler &evh, int screen_num):
@@ -238,12 +238,12 @@ Toolbar::Toolbar(BScreen &scrn, FbTk::XLayer &layer, size_t width):
238 scrn.name() + ".toolbar.alpha", scrn.altName() + ".Toolbar.Alpha"), 238 scrn.name() + ".toolbar.alpha", scrn.altName() + ".Toolbar.Alpha"),
239 m_rc_layernum(scrn.resourceManager(), Layer(Layer::DOCK), 239 m_rc_layernum(scrn.resourceManager(), Layer(Layer::DOCK),
240 scrn.name() + ".toolbar.layer", scrn.altName() + ".Toolbar.Layer"), 240 scrn.name() + ".toolbar.layer", scrn.altName() + ".Toolbar.Layer"),
241 m_rc_on_head(scrn.resourceManager(), 0, 241 m_rc_on_head(scrn.resourceManager(), 1,
242 scrn.name() + ".toolbar.onhead", scrn.altName() + ".Toolbar.onHead"), 242 scrn.name() + ".toolbar.onhead", scrn.altName() + ".Toolbar.onHead"),
243 m_rc_placement(scrn.resourceManager(), Toolbar::BOTTOMCENTER, 243 m_rc_placement(scrn.resourceManager(), Toolbar::BOTTOMCENTER,
244 scrn.name() + ".toolbar.placement", scrn.altName() + ".Toolbar.Placement"), 244 scrn.name() + ".toolbar.placement", scrn.altName() + ".Toolbar.Placement"),
245 m_rc_height(scrn.resourceManager(), 0, scrn.name() + ".toolbar.height", scrn.altName() + ".Toolbar.Height"), 245 m_rc_height(scrn.resourceManager(), 0, scrn.name() + ".toolbar.height", scrn.altName() + ".Toolbar.Height"),
246 m_rc_tools(scrn.resourceManager(), "workspacename, prevworkspace, nextworkspace, iconbar, systemtray, prevwindow, nextwindow, clock", 246 m_rc_tools(scrn.resourceManager(), "prevworkspace, workspacename, nextworkspace, iconbar, systemtray, clock",
247 scrn.name() + ".toolbar.tools", scrn.altName() + ".Toolbar.Tools"), 247 scrn.name() + ".toolbar.tools", scrn.altName() + ".Toolbar.Tools"),
248 m_shape(new FbTk::Shape(frame.window, 0)), 248 m_shape(new FbTk::Shape(frame.window, 0)),
249 m_resize_lock(false) { 249 m_resize_lock(false) {
@@ -391,6 +391,8 @@ void Toolbar::reconfigure() {
391 391
392 updateVisibleState(); 392 updateVisibleState();
393 393
394 if (doAutoHide() && !isHidden() && !m_hide_timer.isTiming())
395 m_hide_timer.start();
394 if (!doAutoHide() && isHidden()) 396 if (!doAutoHide() && isHidden())
395 toggleHidden(); 397 toggleHidden();
396 398
@@ -457,9 +459,6 @@ void Toolbar::reconfigure() {
457 menu().reconfigure(); 459 menu().reconfigure();
458 } 460 }
459 461
460 if (doAutoHide())
461 m_hide_timer.start();
462
463 frame.bevel_w = theme()->bevelWidth(); 462 frame.bevel_w = theme()->bevelWidth();
464 // destroy shape if the theme wasn't specified with one, 463 // destroy shape if the theme wasn't specified with one,
465 // or create one 464 // or create one
@@ -655,7 +654,6 @@ void Toolbar::setPlacement(Toolbar::Placement where) {
655 head_h = screen().getHeadHeight(head); 654 head_h = screen().getHeadHeight(head);
656 } 655 }
657 656
658 int bevel_width = theme()->bevelWidth();
659 int border_width = theme()->border().width(); 657 int border_width = theme()->border().width();
660 658
661 frame.width = (head_w - 2*border_width) * (*m_rc_width_percent) / 100; 659 frame.width = (head_w - 2*border_width) * (*m_rc_width_percent) / 100;
@@ -682,8 +680,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) {
682 680
683 681
684 // So we get at least one pixel visible in hidden mode 682 // So we get at least one pixel visible in hidden mode
685 if (bevel_width <= border_width) 683 int pixel = (border_width == 0 ? 1 : 0);
686 bevel_width = border_width + 1;
687 684
688 FbTk::Orientation orient = FbTk::ROT0; 685 FbTk::Orientation orient = FbTk::ROT0;
689 686
@@ -692,7 +689,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) {
692 frame.x = head_x; 689 frame.x = head_x;
693 frame.y = head_y; 690 frame.y = head_y;
694 frame.x_hidden = head_x; 691 frame.x_hidden = head_x;
695 frame.y_hidden = head_y + bevel_width - border_width - frame.height; 692 frame.y_hidden = head_y - border_width - frame.height + pixel;
696 if (m_shape.get()) 693 if (m_shape.get())
697 m_shape->setPlaces(FbTk::Shape::BOTTOMRIGHT | FbTk::Shape::BOTTOMLEFT); 694 m_shape->setPlaces(FbTk::Shape::BOTTOMRIGHT | FbTk::Shape::BOTTOMLEFT);
698 break; 695 break;
@@ -701,7 +698,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) {
701 frame.x = head_x; 698 frame.x = head_x;
702 frame.y = head_y + head_h - frame.height - border_width*2; 699 frame.y = head_y + head_h - frame.height - border_width*2;
703 frame.x_hidden = head_x; 700 frame.x_hidden = head_x;
704 frame.y_hidden = head_y + head_h - bevel_width - border_width; 701 frame.y_hidden = head_y + head_h - border_width - pixel;
705 if (m_shape.get()) 702 if (m_shape.get())
706 m_shape->setPlaces(FbTk::Shape::TOPRIGHT | FbTk::Shape::TOPLEFT); 703 m_shape->setPlaces(FbTk::Shape::TOPRIGHT | FbTk::Shape::TOPLEFT);
707 break; 704 break;
@@ -710,7 +707,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) {
710 frame.x = head_x + (head_w - frame.width) / 2 - border_width; 707 frame.x = head_x + (head_w - frame.width) / 2 - border_width;
711 frame.y = head_y; 708 frame.y = head_y;
712 frame.x_hidden = frame.x; 709 frame.x_hidden = frame.x;
713 frame.y_hidden = head_y + bevel_width - border_width - frame.height; 710 frame.y_hidden = head_y - border_width - frame.height + pixel;
714 if (m_shape.get()) 711 if (m_shape.get())
715 m_shape->setPlaces(FbTk::Shape::BOTTOMRIGHT | FbTk::Shape::BOTTOMLEFT); 712 m_shape->setPlaces(FbTk::Shape::BOTTOMRIGHT | FbTk::Shape::BOTTOMLEFT);
716 break; 713 break;
@@ -718,7 +715,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) {
718 frame.x = head_x + head_w - frame.width - border_width*2; 715 frame.x = head_x + head_w - frame.width - border_width*2;
719 frame.y = head_y; 716 frame.y = head_y;
720 frame.x_hidden = frame.x; 717 frame.x_hidden = frame.x;
721 frame.y_hidden = head_y + bevel_width - border_width - frame.height; 718 frame.y_hidden = head_y - border_width - frame.height + pixel;
722 if (m_shape.get()) 719 if (m_shape.get())
723 m_shape->setPlaces(FbTk::Shape::BOTTOMRIGHT | FbTk::Shape::BOTTOMLEFT); 720 m_shape->setPlaces(FbTk::Shape::BOTTOMRIGHT | FbTk::Shape::BOTTOMLEFT);
724 break; 721 break;
@@ -727,7 +724,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) {
727 frame.x = head_x + head_w - frame.width - border_width*2; 724 frame.x = head_x + head_w - frame.width - border_width*2;
728 frame.y = head_y + head_h - frame.height - border_width*2; 725 frame.y = head_y + head_h - frame.height - border_width*2;
729 frame.x_hidden = frame.x; 726 frame.x_hidden = frame.x;
730 frame.y_hidden = head_y + head_h - bevel_width - border_width; 727 frame.y_hidden = head_y + head_h - border_width - pixel;
731 if (m_shape.get()) 728 if (m_shape.get())
732 m_shape->setPlaces(FbTk::Shape::TOPRIGHT | FbTk::Shape::TOPLEFT); 729 m_shape->setPlaces(FbTk::Shape::TOPRIGHT | FbTk::Shape::TOPLEFT);
733 break; 730 break;
@@ -736,7 +733,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) {
736 frame.x = head_x + (head_w - frame.width) / 2 - border_width; 733 frame.x = head_x + (head_w - frame.width) / 2 - border_width;
737 frame.y = head_y + head_h - frame.height - border_width*2; 734 frame.y = head_y + head_h - frame.height - border_width*2;
738 frame.x_hidden = frame.x; 735 frame.x_hidden = frame.x;
739 frame.y_hidden = head_y + head_h - bevel_width - border_width; 736 frame.y_hidden = head_y + head_h - border_width - pixel;
740 if (m_shape.get()) 737 if (m_shape.get())
741 m_shape->setPlaces(FbTk::Shape::TOPRIGHT | FbTk::Shape::TOPLEFT); 738 m_shape->setPlaces(FbTk::Shape::TOPRIGHT | FbTk::Shape::TOPLEFT);
742 break; 739 break;
@@ -744,7 +741,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) {
744 orient = FbTk::ROT270; 741 orient = FbTk::ROT270;
745 frame.x = head_x; 742 frame.x = head_x;
746 frame.y = head_y + (head_h - frame.height)/2 - border_width; 743 frame.y = head_y + (head_h - frame.height)/2 - border_width;
747 frame.x_hidden = frame.x - frame.width + bevel_width + border_width; 744 frame.x_hidden = frame.x - frame.width - border_width + pixel;
748 frame.y_hidden = frame.y; 745 frame.y_hidden = frame.y;
749 if (m_shape.get()) 746 if (m_shape.get())
750 m_shape->setPlaces(FbTk::Shape::TOPRIGHT | FbTk::Shape::BOTTOMRIGHT); 747 m_shape->setPlaces(FbTk::Shape::TOPRIGHT | FbTk::Shape::BOTTOMRIGHT);
@@ -753,7 +750,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) {
753 orient = FbTk::ROT270; 750 orient = FbTk::ROT270;
754 frame.x = head_x; 751 frame.x = head_x;
755 frame.y = head_y; 752 frame.y = head_y;
756 frame.x_hidden = frame.x - frame.width + bevel_width + border_width; 753 frame.x_hidden = frame.x - frame.width - border_width + pixel;
757 frame.y_hidden = frame.y; 754 frame.y_hidden = frame.y;
758 if (m_shape.get()) 755 if (m_shape.get())
759 m_shape->setPlaces(FbTk::Shape::TOPRIGHT | FbTk::Shape::BOTTOMRIGHT); 756 m_shape->setPlaces(FbTk::Shape::TOPRIGHT | FbTk::Shape::BOTTOMRIGHT);
@@ -762,7 +759,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) {
762 orient = FbTk::ROT270; 759 orient = FbTk::ROT270;
763 frame.x = head_x; 760 frame.x = head_x;
764 frame.y = head_y + head_h - frame.height - border_width*2; 761 frame.y = head_y + head_h - frame.height - border_width*2;
765 frame.x_hidden = frame.x - frame.width + bevel_width + border_width; 762 frame.x_hidden = frame.x - frame.width - border_width + pixel;
766 frame.y_hidden = frame.y; 763 frame.y_hidden = frame.y;
767 if (m_shape.get()) 764 if (m_shape.get())
768 m_shape->setPlaces(FbTk::Shape::TOPRIGHT | FbTk::Shape::BOTTOMRIGHT); 765 m_shape->setPlaces(FbTk::Shape::TOPRIGHT | FbTk::Shape::BOTTOMRIGHT);
@@ -771,7 +768,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) {
771 orient = FbTk::ROT90; 768 orient = FbTk::ROT90;
772 frame.x = head_x + head_w - frame.width - border_width*2; 769 frame.x = head_x + head_w - frame.width - border_width*2;
773 frame.y = head_y + (head_h - frame.height)/2 - border_width; 770 frame.y = head_y + (head_h - frame.height)/2 - border_width;
774 frame.x_hidden = frame.x + frame.width - bevel_width - border_width; 771 frame.x_hidden = frame.x + frame.width + border_width - pixel;
775 frame.y_hidden = frame.y; 772 frame.y_hidden = frame.y;
776 if (m_shape.get()) 773 if (m_shape.get())
777 m_shape->setPlaces(FbTk::Shape::TOPLEFT | FbTk::Shape::BOTTOMLEFT); 774 m_shape->setPlaces(FbTk::Shape::TOPLEFT | FbTk::Shape::BOTTOMLEFT);
@@ -780,7 +777,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) {
780 orient = FbTk::ROT90; 777 orient = FbTk::ROT90;
781 frame.x = head_x + head_w - frame.width - border_width*2; 778 frame.x = head_x + head_w - frame.width - border_width*2;
782 frame.y = head_y; 779 frame.y = head_y;
783 frame.x_hidden = frame.x + frame.width - bevel_width - border_width; 780 frame.x_hidden = frame.x + frame.width + border_width - pixel;
784 frame.y_hidden = frame.y; 781 frame.y_hidden = frame.y;
785 if (m_shape.get()) 782 if (m_shape.get())
786 m_shape->setPlaces(FbTk::Shape::TOPLEFT | FbTk::Shape::BOTTOMLEFT); 783 m_shape->setPlaces(FbTk::Shape::TOPLEFT | FbTk::Shape::BOTTOMLEFT);
@@ -789,7 +786,7 @@ void Toolbar::setPlacement(Toolbar::Placement where) {
789 orient = FbTk::ROT90; 786 orient = FbTk::ROT90;
790 frame.x = head_x + head_w - frame.width - border_width*2; 787 frame.x = head_x + head_w - frame.width - border_width*2;
791 frame.y = head_y + head_h - frame.height - border_width*2; 788 frame.y = head_y + head_h - frame.height - border_width*2;
792 frame.x_hidden = frame.x + frame.width - bevel_width - border_width; 789 frame.x_hidden = frame.x + frame.width + border_width - pixel;
793 frame.y_hidden = frame.y; 790 frame.y_hidden = frame.y;
794 if (m_shape.get()) 791 if (m_shape.get())
795 m_shape->setPlaces(FbTk::Shape::TOPLEFT | FbTk::Shape::BOTTOMLEFT); 792 m_shape->setPlaces(FbTk::Shape::TOPLEFT | FbTk::Shape::BOTTOMLEFT);