diff options
Diffstat (limited to 'src/FbWinFrame.cc')
-rw-r--r-- | src/FbWinFrame.cc | 36 |
1 files changed, 25 insertions, 11 deletions
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(); |