aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfluxgen <fluxgen>2006-09-20 20:55:18 (GMT)
committerfluxgen <fluxgen>2006-09-20 20:55:18 (GMT)
commitfa675bb367621d6e27c0660141330bffd4235447 (patch)
tree9594015f07ca9237ee9a7fa7f3d254b533bec798
parent750caf08b865df30021e9ec1f1d89f3824028216 (diff)
downloadfluxbox_paul-fa675bb367621d6e27c0660141330bffd4235447.zip
fluxbox_paul-fa675bb367621d6e27c0660141330bffd4235447.tar.bz2
fixed bug #1561482, crashed with toolbarmenu
-rw-r--r--ChangeLog4
-rw-r--r--src/Toolbar.cc110
-rw-r--r--src/Toolbar.hh2
3 files changed, 65 insertions, 51 deletions
diff --git a/ChangeLog b/ChangeLog
index 18a4325..b8d0dbf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,10 @@
1 (Format: Year/Month/Day) 1 (Format: Year/Month/Day)
2Changes for 1.0rc3: 2Changes for 1.0rc3:
3*06/09/20: 3*06/09/20:
4 * Fixed bug #1561482, (Henrik)
5 Crash when cicking on the workspacename to get the tbarmenu.
6 Fixed so it recreated toolbar menu if needed in Toolbar::reconfigure.
7 src/Toolbar.cc/hh
4 * fixed little issue in fbsetbg (Mathias) 8 * fixed little issue in fbsetbg (Mathias)
5 if someone has no wpsetters installed at all but only wants to use 9 if someone has no wpsetters installed at all but only wants to use
6 fbsetroot thru fbsetbg then the warning would pop up, telling her 10 fbsetroot thru fbsetbg then the warning would pop up, telling her
diff --git a/src/Toolbar.cc b/src/Toolbar.cc
index 54fa0e1..f93465c 100644
--- a/src/Toolbar.cc
+++ b/src/Toolbar.cc
@@ -401,6 +401,9 @@ void Toolbar::reconfigure() {
401 401
402 // destroy tools and rebuild them 402 // destroy tools and rebuild them
403 deleteItems(); 403 deleteItems();
404 // they will be readded later
405 menu().removeAll();
406 setupMenus(true); // rebuild menu but skip rebuild of placement menu
404 407
405 m_tools = tools; // copy values 408 m_tools = tools; // copy values
406 409
@@ -424,6 +427,9 @@ void Toolbar::reconfigure() {
424 // show all items 427 // show all items
425 frame.window.showSubwindows(); 428 frame.window.showSubwindows();
426 } 429 }
430
431 } else { // just update the menu
432 menu().reconfigure();
427 } 433 }
428 434
429 if (doAutoHide()) 435 if (doAutoHide())
@@ -488,7 +494,7 @@ void Toolbar::reconfigure() {
488 (*item_it)->renderTheme(alpha()); 494 (*item_it)->renderTheme(alpha());
489 } 495 }
490 496
491 menu().reconfigure(); 497
492 // we're done with all resizing and stuff now we can request a new 498 // we're done with all resizing and stuff now we can request a new
493 // area to be reserved on screen 499 // area to be reserved on screen
494 updateStrut(); 500 updateStrut();
@@ -799,7 +805,7 @@ void Toolbar::moveToLayer(int layernum) {
799 *m_rc_layernum = layernum; 805 *m_rc_layernum = layernum;
800} 806}
801 807
802void Toolbar::setupMenus() { 808void Toolbar::setupMenus(bool skip_new_placement) {
803 _FB_USES_NLS; 809 _FB_USES_NLS;
804 using namespace FbTk; 810 using namespace FbTk;
805 811
@@ -807,7 +813,7 @@ void Toolbar::setupMenus() {
807 typedef SimpleCommand<Toolbar> ToolbarCommand; 813 typedef SimpleCommand<Toolbar> ToolbarCommand;
808 814
809 menu().setLabel(_FB_XTEXT(Toolbar, Toolbar, 815 menu().setLabel(_FB_XTEXT(Toolbar, Toolbar,
810 "Toolbar", "Title of Toolbar menu")); 816 "Toolbar", "Title of Toolbar menu"));
811 817
812 RefCommand reconfig_toolbar(new ToolbarCommand(*this, &Toolbar::reconfigure)); 818 RefCommand reconfig_toolbar(new ToolbarCommand(*this, &Toolbar::reconfigure));
813 RefCommand save_resources(CommandParser::instance().parseLine("saverc")); 819 RefCommand save_resources(CommandParser::instance().parseLine("saverc"));
@@ -823,18 +829,18 @@ void Toolbar::setupMenus() {
823 visible_macro->add(save_resources); 829 visible_macro->add(save_resources);
824 RefCommand toggle_visible_cmd(visible_macro); 830 RefCommand toggle_visible_cmd(visible_macro);
825 menu().insert(new BoolMenuItem(_FB_XTEXT(Common, Visible, 831 menu().insert(new BoolMenuItem(_FB_XTEXT(Common, Visible,
826 "Visible", "Whether this item is visible"), 832 "Visible", "Whether this item is visible"),
827 *m_rc_visible, toggle_visible_cmd)); 833 *m_rc_visible, toggle_visible_cmd));
828 834
829 menu().insert(new BoolMenuItem(_FB_XTEXT(Common, AutoHide, 835 menu().insert(new BoolMenuItem(_FB_XTEXT(Common, AutoHide,
830 "Auto hide", "Toggle auto hide of toolbar"), 836 "Auto hide", "Toggle auto hide of toolbar"),
831 *m_rc_auto_hide, 837 *m_rc_auto_hide,
832 reconfig_toolbar_and_save_resource)); 838 reconfig_toolbar_and_save_resource));
833 839
834 MenuItem *toolbar_menuitem = 840 MenuItem *toolbar_menuitem =
835 new IntResMenuItem(_FB_XTEXT(Toolbar, WidthPercent, 841 new IntResMenuItem(_FB_XTEXT(Toolbar, WidthPercent,
836 "Toolbar width percent", 842 "Toolbar width percent",
837 "Percentage of screen width taken by toolbar"), 843 "Percentage of screen width taken by toolbar"),
838 m_rc_width_percent, 844 m_rc_width_percent,
839 0, 100, menu()); // min/max value 845 0, 100, menu()); // min/max value
840 846
@@ -843,65 +849,69 @@ void Toolbar::setupMenus() {
843 menu().insert(toolbar_menuitem); 849 menu().insert(toolbar_menuitem);
844 850
845 menu().insert(new BoolMenuItem(_FB_XTEXT(Common, MaximizeOver, 851 menu().insert(new BoolMenuItem(_FB_XTEXT(Common, MaximizeOver,
846 "Maximize Over", 852 "Maximize Over",
847 "Maximize over this thing when maximizing"), 853 "Maximize over this thing when maximizing"),
848 *m_rc_maximize_over, 854 *m_rc_maximize_over,
849 reconfig_toolbar_and_save_resource)); 855 reconfig_toolbar_and_save_resource));
850 menu().insert(_FB_XTEXT(Menu, Layer, "Layer...", "Title of Layer menu"), &layerMenu()); 856 menu().insert(_FB_XTEXT(Menu, Layer, "Layer...", "Title of Layer menu"), &layerMenu());
851#ifdef XINERAMA 857#ifdef XINERAMA
852 if (screen().hasXinerama()) { 858 if (screen().hasXinerama()) {
853 menu().insert(_FB_XTEXT(Menu, OnHead, "On Head...", "Title of On Head menu"), 859 menu().insert(_FB_XTEXT(Menu, OnHead, "On Head...", "Title of On Head menu"),
854 new XineramaHeadMenu<Toolbar>(screen().menuTheme(), 860 new XineramaHeadMenu<Toolbar>(screen().menuTheme(),
855 screen(), 861 screen(),
856 screen().imageControl(), 862 screen().imageControl(),
857 *screen().layerManager().getLayer(::Layer::MENU), 863 *screen().layerManager().getLayer(::Layer::MENU),
858 *this, 864 *this,
859 _FB_XTEXT(Toolbar, OnHead, "Toolbar on Head", 865 _FB_XTEXT(Toolbar, OnHead, "Toolbar on Head",
860 "Title of toolbar on head menu"))); 866 "Title of toolbar on head menu")));
861 } 867 }
862#endif // XINERAMA 868#endif // XINERAMA
863 869
864 typedef pair<FbTk::FbString, Toolbar::Placement> PlacementP;
865 typedef list<PlacementP> Placements;
866 Placements place_menu;
867 870
868 // menu is 3 wide, 5 down 871 // menu is 3 wide, 5 down
869 place_menu.push_back(PlacementP(_FB_XTEXT(Align, TopLeft, "Top Left", "Top Left"), Toolbar::TOPLEFT)); 872 if (!skip_new_placement) {
870 place_menu.push_back(PlacementP(_FB_XTEXT(Align, LeftTop, "Left Top", "Left Top"), Toolbar::LEFTTOP)); 873 typedef pair<FbTk::FbString, Toolbar::Placement> PlacementP;
871 place_menu.push_back(PlacementP(_FB_XTEXT(Align, LeftCenter, "Left Center", "Left Center"), Toolbar::LEFTCENTER)); 874 typedef list<PlacementP> Placements;
872 place_menu.push_back(PlacementP(_FB_XTEXT(Align, LeftBottom, "Left Bottom", "Left Bottom"), Toolbar::LEFTBOTTOM)); 875 Placements place_menu;
873 place_menu.push_back(PlacementP(_FB_XTEXT(Align, BottomLeft, "Bottom Left", "Bottom Left"), Toolbar::BOTTOMLEFT)); 876
874 place_menu.push_back(PlacementP(_FB_XTEXT(Align, TopCenter, "Top Center", "Top Center"), Toolbar::TOPCENTER)); 877 place_menu.push_back(PlacementP(_FB_XTEXT(Align, TopLeft, "Top Left", "Top Left"), Toolbar::TOPLEFT));
875 place_menu.push_back(PlacementP("", Toolbar::TOPLEFT)); 878 place_menu.push_back(PlacementP(_FB_XTEXT(Align, LeftTop, "Left Top", "Left Top"), Toolbar::LEFTTOP));
876 place_menu.push_back(PlacementP("", Toolbar::TOPLEFT)); 879 place_menu.push_back(PlacementP(_FB_XTEXT(Align, LeftCenter, "Left Center", "Left Center"), Toolbar::LEFTCENTER));
877 place_menu.push_back(PlacementP("", Toolbar::TOPLEFT)); 880 place_menu.push_back(PlacementP(_FB_XTEXT(Align, LeftBottom, "Left Bottom", "Left Bottom"), Toolbar::LEFTBOTTOM));
878 place_menu.push_back(PlacementP(_FB_XTEXT(Align, BottomCenter, "Bottom Center", "Bottom Center"), Toolbar::BOTTOMCENTER)); 881 place_menu.push_back(PlacementP(_FB_XTEXT(Align, BottomLeft, "Bottom Left", "Bottom Left"), Toolbar::BOTTOMLEFT));
879 place_menu.push_back(PlacementP(_FB_XTEXT(Align, TopRight, "Top Right", "Top Right"), Toolbar::TOPRIGHT)); 882 place_menu.push_back(PlacementP(_FB_XTEXT(Align, TopCenter, "Top Center", "Top Center"), Toolbar::TOPCENTER));
880 place_menu.push_back(PlacementP(_FB_XTEXT(Align, RightTop, "Right Top", "Right Top"), Toolbar::RIGHTTOP)); 883 place_menu.push_back(PlacementP("", Toolbar::TOPLEFT));
881 place_menu.push_back(PlacementP(_FB_XTEXT(Align, RightCenter, "Right Center", "Right Center"), Toolbar::RIGHTCENTER)); 884 place_menu.push_back(PlacementP("", Toolbar::TOPLEFT));
882 place_menu.push_back(PlacementP(_FB_XTEXT(Align, RightBottom, "Right Bottom", "Right Bottom"), Toolbar::RIGHTBOTTOM)); 885 place_menu.push_back(PlacementP("", Toolbar::TOPLEFT));
883 place_menu.push_back(PlacementP(_FB_XTEXT(Align, BottomRight, "Bottom Right", "Bottom Right"), Toolbar::BOTTOMRIGHT)); 886 place_menu.push_back(PlacementP(_FB_XTEXT(Align, BottomCenter, "Bottom Center", "Bottom Center"), Toolbar::BOTTOMCENTER));
884 887 place_menu.push_back(PlacementP(_FB_XTEXT(Align, TopRight, "Top Right", "Top Right"), Toolbar::TOPRIGHT));
885 888 place_menu.push_back(PlacementP(_FB_XTEXT(Align, RightTop, "Right Top", "Right Top"), Toolbar::RIGHTTOP));
886 placementMenu().setMinimumSublevels(3); 889 place_menu.push_back(PlacementP(_FB_XTEXT(Align, RightCenter, "Right Center", "Right Center"), Toolbar::RIGHTCENTER));
887 // create items in sub menu 890 place_menu.push_back(PlacementP(_FB_XTEXT(Align, RightBottom, "Right Bottom", "Right Bottom"), Toolbar::RIGHTBOTTOM));
888 for (size_t i=0; i<15; ++i) { 891 place_menu.push_back(PlacementP(_FB_XTEXT(Align, BottomRight, "Bottom Right", "Bottom Right"), Toolbar::BOTTOMRIGHT));
889 FbTk::FbString &str = place_menu.front().first; 892
890 Toolbar::Placement placement = place_menu.front().second; 893
891 894 placementMenu().setMinimumSublevels(3);
892 if (str == "") { 895 // create items in sub menu
893 placementMenu().insert(""); 896 for (size_t i=0; i<15; ++i) {
894 placementMenu().setItemEnabled(i, false); 897 FbTk::FbString &str = place_menu.front().first;
895 } else { 898 Toolbar::Placement placement = place_menu.front().second;
896 RefCommand setplace(new SetToolbarPlacementCmd(*this, placement)); 899
897 placementMenu().insert(str, setplace); 900 if (str == "") {
901 placementMenu().insert("");
902 placementMenu().setItemEnabled(i, false);
903 } else {
904 RefCommand setplace(new SetToolbarPlacementCmd(*this, placement));
905 placementMenu().insert(str, setplace);
898 906
907 }
908 place_menu.pop_front();
899 } 909 }
900 place_menu.pop_front();
901 } 910 }
911
902 menu().insert(_FB_XTEXT(Menu, Placement, "Placement", "Title of Placement menu"), &placementMenu()); 912 menu().insert(_FB_XTEXT(Menu, Placement, "Placement", "Title of Placement menu"), &placementMenu());
903 placementMenu().updateMenu(); 913 placementMenu().updateMenu();
904 914
905 915
906 // this saves resources and clears the slit window to update alpha value 916 // this saves resources and clears the slit window to update alpha value
907 FbTk::MenuItem *alpha_menuitem = 917 FbTk::MenuItem *alpha_menuitem =
diff --git a/src/Toolbar.hh b/src/Toolbar.hh
index 04b06e6..5ac2114 100644
--- a/src/Toolbar.hh
+++ b/src/Toolbar.hh
@@ -135,7 +135,7 @@ private:
135 void rearrangeItems(); 135 void rearrangeItems();
136 void deleteItems(); 136 void deleteItems();
137 137
138 void setupMenus(); 138 void setupMenus(bool skip_new_placement=false);
139 void clearStrut(); 139 void clearStrut();
140 void updateStrut(); 140 void updateStrut();
141 void updateAlpha(); 141 void updateAlpha();