aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsimonb <simonb>2006-03-22 13:06:00 (GMT)
committersimonb <simonb>2006-03-22 13:06:00 (GMT)
commit5e22dcd9ff8cb8a173992bf57b592a7f8cfd66f5 (patch)
treeb57412ffe8799f4a59db1f43e58fcfbc6ab5b841 /src
parentfe4a7db228d69bc9a66ed948f218ef489b2cedaf (diff)
downloadfluxbox-5e22dcd9ff8cb8a173992bf57b592a7f8cfd66f5.zip
fluxbox-5e22dcd9ff8cb8a173992bf57b592a7f8cfd66f5.tar.bz2
more external tab work, tidying and tab width config option
Diffstat (limited to 'src')
-rw-r--r--src/Container.cc5
-rw-r--r--src/FbWinFrame.cc36
-rw-r--r--src/FbWinFrame.hh3
-rw-r--r--src/Screen.cc17
-rw-r--r--src/Screen.hh4
-rw-r--r--src/Window.cc7
6 files changed, 47 insertions, 25 deletions
diff --git a/src/Container.cc b/src/Container.cc
index 76d8d52..be3a57b 100644
--- a/src/Container.cc
+++ b/src/Container.cc
@@ -260,7 +260,10 @@ void Container::setSelected(int pos) {
260} 260}
261 261
262void Container::setMaxSizePerClient(unsigned int size) { 262void Container::setMaxSizePerClient(unsigned int size) {
263 m_max_size_per_client = size; 263 if (size != m_max_size_per_client) {
264 m_max_size_per_client = size;
265 repositionItems();
266 }
264} 267}
265 268
266void Container::setMaxTotalSize(unsigned int size) { 269void Container::setMaxTotalSize(unsigned int size) {
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index 5ccfe12..1d9c862 100644
--- a/src/FbWinFrame.cc
+++ b/src/FbWinFrame.cc
@@ -80,13 +80,12 @@ FbWinFrame::FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageContr
80 EnterWindowMask | LeaveWindowMask), 80 EnterWindowMask | LeaveWindowMask),
81 m_bevel(1), 81 m_bevel(1),
82 m_use_titlebar(true), 82 m_use_titlebar(true),
83 m_tabplacement(BOTTOMRIGHT),
84 m_use_tabs(true), 83 m_use_tabs(true),
85 m_use_handle(true), 84 m_use_handle(true),
86 m_focused(false), 85 m_focused(false),
87 m_visible(false), 86 m_visible(false),
88 m_button_pm(0), 87 m_button_pm(0),
89 m_tabmode(NOTSET), 88 m_tabmode(screen.getDefaultInternalTabs()?INTERNAL:EXTERNAL),
90 m_need_render(true), 89 m_need_render(true),
91 m_themelistener(*this), 90 m_themelistener(*this),
92 m_shape(new Shape(m_window, theme.shapePlace())) { 91 m_shape(new Shape(m_window, theme.shapePlace())) {
@@ -129,6 +128,8 @@ bool FbWinFrame::setTabMode(TabMode tabmode) {
129 128
130 m_tabmode = tabmode; 129 m_tabmode = tabmode;
131 130
131 m_tab_container.setUpdateLock(true);
132
132 // reparent tab container 133 // reparent tab container
133 if (tabmode == EXTERNAL) { 134 if (tabmode == EXTERNAL) {
134 m_label.show(); 135 m_label.show();
@@ -145,7 +146,7 @@ bool FbWinFrame::setTabMode(TabMode tabmode) {
145 XUngrabButton(m_tab_container.display(), Button1, Mod1Mask|Mod2Mask|Mod3Mask, m_tab_container.window()); 146 XUngrabButton(m_tab_container.display(), Button1, Mod1Mask|Mod2Mask|Mod3Mask, m_tab_container.window());
146 147
147 int tabx, taby; 148 int tabx, taby;
148 switch (m_tabplacement) { 149 switch (m_screen.getTabPlacement()) {
149 case TOPLEFT: 150 case TOPLEFT:
150 m_tab_container.setAlignment(Container::LEFT); 151 m_tab_container.setAlignment(Container::LEFT);
151 tabx = x(); 152 tabx = x();
@@ -173,9 +174,14 @@ bool FbWinFrame::setTabMode(TabMode tabmode) {
173 m_layeritem.addWindow(m_tab_container); 174 m_layeritem.addWindow(m_tab_container);
174 } 175 }
175 176
176 m_tab_container.setMaxSizePerClient(64); //!!TODO make this a setting 177 m_tab_container.setMaxSizePerClient(m_screen.getTabWidth());
178 m_tab_container.setUpdateLock(false);
177 m_tab_container.setMaxTotalSize(window().width()); 179 m_tab_container.setMaxTotalSize(window().width());
178 180
181 renderTabContainer();
182 applyTabContainer();
183 m_tab_container.clear();
184
179 // TODO: tab position 185 // TODO: tab position
180 if (m_use_tabs && m_visible) 186 if (m_use_tabs && m_visible)
181 m_tab_container.show(); 187 m_tab_container.show();
@@ -194,7 +200,13 @@ bool FbWinFrame::setTabMode(TabMode tabmode) {
194 } 200 }
195 m_tab_container.setBorderWidth(0); 201 m_tab_container.setBorderWidth(0);
196 m_tab_container.setMaxTotalSize(0); 202 m_tab_container.setMaxTotalSize(0);
203 m_tab_container.setUpdateLock(false);
197 m_tab_container.setMaxSizePerClient(0); 204 m_tab_container.setMaxSizePerClient(0);
205
206 renderTabContainer();
207 applyTabContainer();
208 m_tab_container.clear();
209
198 if (!m_use_tabs) 210 if (!m_use_tabs)
199 m_tab_container.show(); 211 m_tab_container.show();
200 else 212 else
@@ -310,7 +322,7 @@ void FbWinFrame::moveResize(int x, int y, unsigned int width, unsigned int heigh
310 m_window.resize(width, height); 322 m_window.resize(width, height);
311 } 323 }
312 324
313 if (move || resize && m_tabplacement != TOPLEFT) 325 if (move || resize && m_screen.getTabPlacement() != TOPLEFT)
314 alignTabs(); 326 alignTabs();
315 327
316 if (resize) { 328 if (resize) {
@@ -333,8 +345,10 @@ void FbWinFrame::alignTabs() {
333 if (m_tabmode != EXTERNAL) 345 if (m_tabmode != EXTERNAL)
334 return; 346 return;
335 347
348 m_tab_container.setMaxSizePerClient(m_screen.getTabWidth());
349
336 int tabx = 0, taby = 0; 350 int tabx = 0, taby = 0;
337 switch (m_tabplacement) { 351 switch (m_screen.getTabPlacement()) {
338 case TOPLEFT: 352 case TOPLEFT:
339 tabx = x(); 353 tabx = x();
340 taby = y() - yOffset(); 354 taby = y() - yOffset();
@@ -877,8 +891,10 @@ void FbWinFrame::reconfigure() {
877 } else 891 } else
878 m_titlebar.lower(); 892 m_titlebar.lower();
879 893
880 if (m_tabmode == EXTERNAL) 894 if (m_tabmode == EXTERNAL) {
881 m_tab_container.resize(m_tab_container.width(), buttonHeight()); 895 m_tab_container.resize(m_tab_container.width(), buttonHeight());
896 alignTabs();
897 }
882 898
883 // leave client+grips alone if we're shaded (it'll get fixed when we unshade) 899 // leave client+grips alone if we're shaded (it'll get fixed when we unshade)
884 if (!m_shaded) { 900 if (!m_shaded) {
@@ -1271,9 +1287,7 @@ void FbWinFrame::init() {
1271 m_label.setBorderWidth(0); 1287 m_label.setBorderWidth(0);
1272 m_shaded = false; 1288 m_shaded = false;
1273 1289
1274 // TODO: configurable default (on compile, for backwards compat) 1290 setTabMode(NOTSET);
1275// setTabMode(EXTERNAL);
1276 setTabMode(INTERNAL);
1277 1291
1278 m_label.setEventMask(ExposureMask | ButtonPressMask | 1292 m_label.setEventMask(ExposureMask | ButtonPressMask |
1279 ButtonReleaseMask | ButtonMotionMask | 1293 ButtonReleaseMask | ButtonMotionMask |
@@ -1605,7 +1619,7 @@ int FbWinFrame::yOffset() const {
1605 if (m_tabmode != EXTERNAL || !m_use_tabs) 1619 if (m_tabmode != EXTERNAL || !m_use_tabs)
1606 return 0; 1620 return 0;
1607 1621
1608 switch (m_tabplacement) { 1622 switch (m_screen.getTabPlacement()) {
1609 case TOPLEFT: 1623 case TOPLEFT:
1610 case TOPRIGHT: 1624 case TOPRIGHT:
1611 return m_tab_container.height() + m_window.borderWidth(); 1625 return m_tab_container.height() + m_window.borderWidth();
diff --git a/src/FbWinFrame.hh b/src/FbWinFrame.hh
index 10cd98f..900af07 100644
--- a/src/FbWinFrame.hh
+++ b/src/FbWinFrame.hh
@@ -125,7 +125,7 @@ public:
125 inline void setFocusTitle(const std::string &str) { m_label.setText(str); } 125 inline void setFocusTitle(const std::string &str) { m_label.setText(str); }
126 void setDoubleClickTime(unsigned int time); 126 void setDoubleClickTime(unsigned int time);
127 bool setTabMode(TabMode tabmode); 127 bool setTabMode(TabMode tabmode);
128 inline void setTabPlacement(TabPlacement tabplacement) { m_tabplacement = tabplacement; alignTabs(); } 128 inline void updateTabProperties() { alignTabs(); }
129 129
130 /// add a button to the left of the label 130 /// add a button to the left of the label
131 void addLeftButton(FbTk::Button *btn); 131 void addLeftButton(FbTk::Button *btn);
@@ -367,7 +367,6 @@ private:
367 //@} 367 //@}
368 368
369 TabMode m_tabmode; 369 TabMode m_tabmode;
370 TabPlacement m_tabplacement;
371 370
372 bool m_need_render; 371 bool m_need_render;
373 int m_button_size; ///< size for all titlebar buttons 372 int m_button_size; ///< size for all titlebar buttons
diff --git a/src/Screen.cc b/src/Screen.cc
index 851e407..a69e7fe 100644
--- a/src/Screen.cc
+++ b/src/Screen.cc
@@ -270,6 +270,7 @@ BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager &rm,
270 menu_alpha(rm, 255, scrname+".menu.alpha", altscrname+".Menu.Alpha"), 270 menu_alpha(rm, 255, scrname+".menu.alpha", altscrname+".Menu.Alpha"),
271 menu_delay(rm, 0, scrname + ".menuDelay", altscrname+".MenuDelay"), 271 menu_delay(rm, 0, scrname + ".menuDelay", altscrname+".MenuDelay"),
272 menu_delay_close(rm, 0, scrname + ".menuDelayClose", altscrname+".MenuDelayClose"), 272 menu_delay_close(rm, 0, scrname + ".menuDelayClose", altscrname+".MenuDelayClose"),
273 tab_width(rm, 64, scrname + ".tab.width", altscrname+".Tab.Width"),
273 menu_mode(rm, FbTk::MenuTheme::DELAY_OPEN, scrname+".menuMode", altscrname+".MenuMode"), 274 menu_mode(rm, FbTk::MenuTheme::DELAY_OPEN, scrname+".menuMode", altscrname+".MenuMode"),
274 275
275 gc_line_width(rm, 1, scrname+".overlay.lineWidth", altscrname+".Overlay.LineWidth"), 276 gc_line_width(rm, 1, scrname+".overlay.lineWidth", altscrname+".Overlay.LineWidth"),
@@ -287,7 +288,7 @@ BScreen::ScreenResource::ScreenResource(FbTk::ResourceManager &rm,
287 altscrname+".overlay.CapStyle"), 288 altscrname+".overlay.CapStyle"),
288 scroll_action(rm, "", scrname+".windowScrollAction", altscrname+".WindowScrollAction"), 289 scroll_action(rm, "", scrname+".windowScrollAction", altscrname+".WindowScrollAction"),
289 scroll_reverse(rm, false, scrname+".windowScrollReverse", altscrname+".WindowScrollReverse"), 290 scroll_reverse(rm, false, scrname+".windowScrollReverse", altscrname+".WindowScrollReverse"),
290 default_internal_tabs(rm, false /* TODO: autoconf option? */ , scrname+".tabs.intitlebar", altscrname+".Tabs.InTitlebar") { 291 default_internal_tabs(rm, true /* TODO: autoconf option? */ , scrname+".tabs.intitlebar", altscrname+".Tabs.InTitlebar") {
291 292
292 293
293} 294}
@@ -900,7 +901,7 @@ void BScreen::reconfigureTabs() {
900 Workspace::Windows::iterator win_it = (*w_it)->windowList().begin(); 901 Workspace::Windows::iterator win_it = (*w_it)->windowList().begin();
901 const Workspace::Windows::iterator win_it_end = (*w_it)->windowList().end(); 902 const Workspace::Windows::iterator win_it_end = (*w_it)->windowList().end();
902 for (; win_it != win_it_end; ++win_it) { 903 for (; win_it != win_it_end; ++win_it) {
903 (*win_it)->frame().setTabPlacement(*resource.tab_placement); 904 (*win_it)->frame().updateTabProperties();
904 if (*resource.default_internal_tabs) 905 if (*resource.default_internal_tabs)
905 (*win_it)->frame().setTabMode(FbWinFrame::INTERNAL); 906 (*win_it)->frame().setTabMode(FbWinFrame::INTERNAL);
906 else 907 else
@@ -1642,11 +1643,21 @@ void BScreen::setupConfigmenu(FbTk::Menu &menu) {
1642 "Tabs in Titlebar", "Tabs in Titlebar", 1643 "Tabs in Titlebar", "Tabs in Titlebar",
1643 *resource.default_internal_tabs, save_and_reconftabs); 1644 *resource.default_internal_tabs, save_and_reconftabs);
1644 1645
1646 FbTk::MenuItem *tab_width_item =
1647 new IntResMenuItem(_FBTEXT(Configmenu, ExternalTabWidth,
1648 "External Tab Width",
1649 "Width of external-style tabs"),
1650 resource.tab_width, 10, 3000, /* silly number */
1651 *tab_menu);
1652 tab_width_item->setCommand(save_and_reconftabs);
1653 tab_menu->insert(tab_width_item);
1654
1655
1645 typedef pair<const char*, FbWinFrame::TabPlacement> PlacementP; 1656 typedef pair<const char*, FbWinFrame::TabPlacement> PlacementP;
1646 typedef list<PlacementP> Placements; 1657 typedef list<PlacementP> Placements;
1647 Placements place_menu; 1658 Placements place_menu;
1648 1659
1649 // menu is 3 wide, 5 down 1660 // menu is 2 wide, 2 down
1650 place_menu.push_back(PlacementP(_FBTEXT(Align, TopLeft, "Top Left", "Top Left"), FbWinFrame::TOPLEFT)); 1661 place_menu.push_back(PlacementP(_FBTEXT(Align, TopLeft, "Top Left", "Top Left"), FbWinFrame::TOPLEFT));
1651 place_menu.push_back(PlacementP(_FBTEXT(Align, BottomLeft, "Bottom Left", "Bottom Left"), FbWinFrame::BOTTOMLEFT)); 1662 place_menu.push_back(PlacementP(_FBTEXT(Align, BottomLeft, "Bottom Left", "Bottom Left"), FbWinFrame::BOTTOMLEFT));
1652 place_menu.push_back(PlacementP(_FBTEXT(Align, TopRight, "Top Right", "Top Right"), FbWinFrame::TOPRIGHT)); 1663 place_menu.push_back(PlacementP(_FBTEXT(Align, TopRight, "Top Right", "Top Right"), FbWinFrame::TOPRIGHT));
diff --git a/src/Screen.hh b/src/Screen.hh
index 738fe1a..2d20efd 100644
--- a/src/Screen.hh
+++ b/src/Screen.hh
@@ -142,6 +142,8 @@ public:
142 inline const bool getScrollReverse() const { return *resource.scroll_reverse; } 142 inline const bool getScrollReverse() const { return *resource.scroll_reverse; }
143 inline const bool getDefaultInternalTabs() const { return *resource.default_internal_tabs; } 143 inline const bool getDefaultInternalTabs() const { return *resource.default_internal_tabs; }
144 144
145 inline unsigned int getTabWidth() const { return *resource.tab_width; }
146
145 inline Slit *slit() { return m_slit.get(); } 147 inline Slit *slit() { return m_slit.get(); }
146 inline const Slit *slit() const { return m_slit.get(); } 148 inline const Slit *slit() const { return m_slit.get(); }
147 149
@@ -445,7 +447,7 @@ private:
445 FbTk::Resource<FollowModel> follow_model; 447 FbTk::Resource<FollowModel> follow_model;
446 bool ordered_dither; 448 bool ordered_dither;
447 FbTk::Resource<int> workspaces, edge_snap_threshold, focused_alpha, 449 FbTk::Resource<int> workspaces, edge_snap_threshold, focused_alpha,
448 unfocused_alpha, menu_alpha, menu_delay, menu_delay_close; 450 unfocused_alpha, menu_alpha, menu_delay, menu_delay_close, tab_width;
449 FbTk::Resource<FbTk::MenuTheme::MenuMode> menu_mode; 451 FbTk::Resource<FbTk::MenuTheme::MenuMode> menu_mode;
450 452
451 FbTk::Resource<int> gc_line_width; 453 FbTk::Resource<int> gc_line_width;
diff --git a/src/Window.cc b/src/Window.cc
index e1cf224..a275e43 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -394,13 +394,6 @@ void FluxboxWindow::init() {
394 394
395 frame().setUseShape(!m_shaped); 395 frame().setUseShape(!m_shaped);
396 396
397 frame().setTabPlacement(screen().getTabPlacement());
398 if (screen().getDefaultInternalTabs()) {
399 frame().setTabMode(FbWinFrame::INTERNAL);
400 } else {
401 frame().setTabMode(FbWinFrame::EXTERNAL);
402 }
403
404 //!! TODO init of client should be better 397 //!! TODO init of client should be better
405 // we don't want to duplicate code here and in attachClient 398 // we don't want to duplicate code here and in attachClient
406 m_clientlist.push_back(m_client); 399 m_clientlist.push_back(m_client);