diff options
author | simonb <simonb> | 2006-03-26 12:32:15 (GMT) |
---|---|---|
committer | simonb <simonb> | 2006-03-26 12:32:15 (GMT) |
commit | a8c95d4e4f0bf9d8f84004188289a55402c2e837 (patch) | |
tree | 69acad5643ffcb661193aae74630d74c0dc8fb33 /src | |
parent | ce9a0962e6515c91d2da2486dda214279b698456 (diff) | |
download | fluxbox_paul-a8c95d4e4f0bf9d8f84004188289a55402c2e837.zip fluxbox_paul-a8c95d4e4f0bf9d8f84004188289a55402c2e837.tar.bz2 |
some mroe external tabs tweaking
Diffstat (limited to 'src')
-rw-r--r-- | src/Container.cc | 14 | ||||
-rw-r--r-- | src/FbWinFrame.cc | 139 |
2 files changed, 59 insertions, 94 deletions
diff --git a/src/Container.cc b/src/Container.cc index 0bec346..1a7ea34 100644 --- a/src/Container.cc +++ b/src/Container.cc | |||
@@ -409,10 +409,13 @@ void Container::repositionItems() { | |||
409 | // calling Container::resize here risks infinite loops | 409 | // calling Container::resize here risks infinite loops |
410 | unsigned int neww = total_width, newh = height; | 410 | unsigned int neww = total_width, newh = height; |
411 | translateSize(m_orientation, neww, newh); | 411 | translateSize(m_orientation, neww, newh); |
412 | if (align == RIGHT || m_orientation == FbTk::ROT270) { | 412 | if (align == RIGHT && m_orientation != FbTk::ROT270 || align == LEFT && m_orientation == FbTk::ROT270) { |
413 | int deltax = - (total_width - cur_width); | 413 | int deltax = 0; |
414 | int deltay = 0; | 414 | int deltay = 0; |
415 | FbTk::translateCoords(m_orientation, deltax, deltay, total_width, height); | 415 | if (m_orientation == FbTk::ROT0 || m_orientation == FbTk::ROT180) |
416 | deltax = - (total_width - cur_width); | ||
417 | else | ||
418 | deltay = - (total_width - cur_width); | ||
416 | 419 | ||
417 | FbTk::FbWindow::moveResize(x() + deltax, y() + deltay, neww, newh); | 420 | FbTk::FbWindow::moveResize(x() + deltax, y() + deltay, neww, newh); |
418 | } else { | 421 | } else { |
@@ -435,6 +438,11 @@ void Container::repositionItems() { | |||
435 | next_x = total_width - max_width_per_client - borderW; | 438 | next_x = total_width - max_width_per_client - borderW; |
436 | } | 439 | } |
437 | 440 | ||
441 | // when rot270, our borderwidth adjustment actually needs to be at the | ||
442 | // other end (i.e. top), so this puts it there | ||
443 | if (m_orientation == FbTk::ROT270) | ||
444 | next_x += 2*borderW; | ||
445 | |||
438 | int tmpx, tmpy; | 446 | int tmpx, tmpy; |
439 | unsigned int tmpw, tmph; | 447 | unsigned int tmpw, tmph; |
440 | for (; it != it_end; ++it, next_x += direction*(max_width_per_client + borderW + extra)) { | 448 | for (; it != it_end; ++it, next_x += direction*(max_width_per_client + borderW + extra)) { |
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc index f93e9f4..10068f6 100644 --- a/src/FbWinFrame.cc +++ b/src/FbWinFrame.cc | |||
@@ -42,8 +42,6 @@ | |||
42 | 42 | ||
43 | #include <algorithm> | 43 | #include <algorithm> |
44 | #include <X11/X.h> | 44 | #include <X11/X.h> |
45 | #include <iostream> | ||
46 | using namespace std; | ||
47 | 45 | ||
48 | FbWinFrame::FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageControl &imgctrl, | 46 | FbWinFrame::FbWinFrame(BScreen &screen, FbWinFrameTheme &theme, FbTk::ImageControl &imgctrl, |
49 | FbTk::XLayer &layer, | 47 | FbTk::XLayer &layer, |
@@ -127,8 +125,6 @@ bool FbWinFrame::setTabMode(TabMode tabmode) { | |||
127 | 125 | ||
128 | m_tabmode = tabmode; | 126 | m_tabmode = tabmode; |
129 | 127 | ||
130 | m_tab_container.setUpdateLock(true); | ||
131 | |||
132 | // reparent tab container | 128 | // reparent tab container |
133 | if (tabmode == EXTERNAL) { | 129 | if (tabmode == EXTERNAL) { |
134 | m_label.show(); | 130 | m_label.show(); |
@@ -144,79 +140,7 @@ bool FbWinFrame::setTabMode(TabMode tabmode) { | |||
144 | GrabModeSync, GrabModeSync, None, None); | 140 | GrabModeSync, GrabModeSync, None, None); |
145 | XUngrabButton(m_tab_container.display(), Button1, Mod1Mask|Mod2Mask|Mod3Mask, m_tab_container.window()); | 141 | XUngrabButton(m_tab_container.display(), Button1, Mod1Mask|Mod2Mask|Mod3Mask, m_tab_container.window()); |
146 | 142 | ||
147 | int tabx, taby; | 143 | alignTabs(); |
148 | unsigned int maxtotal; | ||
149 | switch (m_screen.getTabPlacement()) { | ||
150 | case TOPLEFT: | ||
151 | m_tab_container.setAlignment(Container::LEFT); | ||
152 | m_tab_container.setOrientation(FbTk::ROT0); | ||
153 | tabx = x(); | ||
154 | taby = y() - yOffset(); | ||
155 | maxtotal = m_window.width(); | ||
156 | break; | ||
157 | case TOPRIGHT: | ||
158 | m_tab_container.setAlignment(Container::RIGHT); | ||
159 | m_tab_container.setOrientation(FbTk::ROT0); | ||
160 | tabx = x() + width() - m_tab_container.width(); | ||
161 | taby = y() - yOffset(); | ||
162 | maxtotal = m_window.width(); | ||
163 | break; | ||
164 | case LEFTTOP: | ||
165 | m_tab_container.setAlignment(Container::RIGHT); | ||
166 | m_tab_container.setOrientation(FbTk::ROT270); | ||
167 | tabx = x() - xOffset(); | ||
168 | taby = y(); | ||
169 | maxtotal = m_window.height(); | ||
170 | break; | ||
171 | case LEFTBOTTOM: | ||
172 | m_tab_container.setAlignment(Container::LEFT); | ||
173 | m_tab_container.setOrientation(FbTk::ROT270); | ||
174 | tabx = x() - xOffset(); | ||
175 | taby = y() + height() - m_tab_container.height(); | ||
176 | maxtotal = m_window.height(); | ||
177 | break; | ||
178 | case RIGHTTOP: | ||
179 | m_tab_container.setAlignment(Container::LEFT); | ||
180 | m_tab_container.setOrientation(FbTk::ROT90); | ||
181 | tabx = x() + width(); | ||
182 | taby = y(); | ||
183 | maxtotal = m_window.height(); | ||
184 | break; | ||
185 | case RIGHTBOTTOM: | ||
186 | m_tab_container.setAlignment(Container::RIGHT); | ||
187 | m_tab_container.setOrientation(FbTk::ROT90); | ||
188 | tabx = x() + width(); | ||
189 | taby = y() + height() - m_tab_container.height(); | ||
190 | maxtotal = m_window.height(); | ||
191 | break; | ||
192 | case BOTTOMLEFT: | ||
193 | m_tab_container.setAlignment(Container::LEFT); | ||
194 | m_tab_container.setOrientation(FbTk::ROT0); | ||
195 | tabx = x(); | ||
196 | taby = y() + height() + m_window.borderWidth(); | ||
197 | maxtotal = m_window.width(); | ||
198 | break; | ||
199 | case BOTTOMRIGHT: | ||
200 | m_tab_container.setAlignment(Container::RIGHT); | ||
201 | m_tab_container.setOrientation(FbTk::ROT0); | ||
202 | tabx = x() + width() - m_tab_container.width(); | ||
203 | taby = y() + height() + m_window.borderWidth(); | ||
204 | maxtotal = m_window.width(); | ||
205 | break; | ||
206 | } | ||
207 | |||
208 | if (m_tab_container.parent()->window() != m_screen.rootWindow().window()) { | ||
209 | m_tab_container.reparent(m_screen.rootWindow(), tabx, taby); | ||
210 | m_layeritem.addWindow(m_tab_container); | ||
211 | } | ||
212 | |||
213 | m_tab_container.setMaxSizePerClient(m_screen.getTabWidth()); | ||
214 | m_tab_container.setUpdateLock(false); | ||
215 | m_tab_container.setMaxTotalSize(maxtotal); | ||
216 | |||
217 | renderTabContainer(); | ||
218 | applyTabContainer(); | ||
219 | m_tab_container.clear(); | ||
220 | 144 | ||
221 | // TODO: tab position | 145 | // TODO: tab position |
222 | if (m_use_tabs && m_visible) | 146 | if (m_use_tabs && m_visible) |
@@ -227,6 +151,8 @@ bool FbWinFrame::setTabMode(TabMode tabmode) { | |||
227 | } | 151 | } |
228 | 152 | ||
229 | } else { | 153 | } else { |
154 | m_tab_container.setUpdateLock(true); | ||
155 | |||
230 | m_tab_container.setAlignment(Container::RELATIVE); | 156 | m_tab_container.setAlignment(Container::RELATIVE); |
231 | m_tab_container.setOrientation(FbTk::ROT0); | 157 | m_tab_container.setOrientation(FbTk::ROT0); |
232 | if (m_tab_container.parent()->window() == m_screen.rootWindow().window()) { | 158 | if (m_tab_container.parent()->window() == m_screen.rootWindow().window()) { |
@@ -407,64 +333,93 @@ void FbWinFrame::alignTabs() { | |||
407 | if (m_tabmode != EXTERNAL) | 333 | if (m_tabmode != EXTERNAL) |
408 | return; | 334 | return; |
409 | 335 | ||
410 | if (m_tab_container.maxWidthPerClient() != m_screen.getTabWidth()) { | 336 | FbTk::Orientation orig_orient = m_tab_container.orientation(); |
337 | unsigned int orig_tabwidth = m_tab_container.maxWidthPerClient(); | ||
338 | |||
339 | if (orig_tabwidth != m_screen.getTabWidth()) | ||
411 | m_tab_container.setMaxSizePerClient(m_screen.getTabWidth()); | 340 | m_tab_container.setMaxSizePerClient(m_screen.getTabWidth()); |
412 | renderTabContainer(); | ||
413 | applyTabContainer(); | ||
414 | } | ||
415 | 341 | ||
416 | FbTk::Orientation orig_orient = m_tab_container.orientation(); | ||
417 | int tabx = 0, taby = 0; | 342 | int tabx = 0, taby = 0; |
418 | switch (m_screen.getTabPlacement()) { | 343 | switch (m_screen.getTabPlacement()) { |
419 | case TOPLEFT: | 344 | case TOPLEFT: |
345 | if (orig_orient != FbTk::ROT0) m_tab_container.hide(); | ||
420 | m_tab_container.setOrientation(FbTk::ROT0); | 346 | m_tab_container.setOrientation(FbTk::ROT0); |
347 | m_tab_container.setAlignment(Container::LEFT); | ||
421 | tabx = x(); | 348 | tabx = x(); |
422 | taby = y() - yOffset(); | 349 | taby = y() - yOffset(); |
423 | break; | 350 | break; |
424 | case TOPRIGHT: | 351 | case TOPRIGHT: |
352 | if (orig_orient != FbTk::ROT0) m_tab_container.hide(); | ||
425 | m_tab_container.setOrientation(FbTk::ROT0); | 353 | m_tab_container.setOrientation(FbTk::ROT0); |
354 | m_tab_container.setAlignment(Container::RIGHT); | ||
426 | tabx = x() + width() - m_tab_container.width(); | 355 | tabx = x() + width() - m_tab_container.width(); |
427 | taby = y() - yOffset(); | 356 | taby = y() - yOffset(); |
428 | break; | 357 | break; |
429 | case LEFTTOP: | 358 | case LEFTTOP: |
359 | if (orig_orient != FbTk::ROT270) m_tab_container.hide(); | ||
430 | m_tab_container.setOrientation(FbTk::ROT270); | 360 | m_tab_container.setOrientation(FbTk::ROT270); |
361 | m_tab_container.setAlignment(Container::RIGHT); | ||
431 | tabx = x() - xOffset(); | 362 | tabx = x() - xOffset(); |
432 | taby = y(); | 363 | taby = y(); |
433 | break; | 364 | break; |
434 | case LEFTBOTTOM: | 365 | case LEFTBOTTOM: |
366 | if (orig_orient != FbTk::ROT270) m_tab_container.hide(); | ||
435 | m_tab_container.setOrientation(FbTk::ROT270); | 367 | m_tab_container.setOrientation(FbTk::ROT270); |
368 | m_tab_container.setAlignment(Container::LEFT); | ||
436 | tabx = x() - xOffset(); | 369 | tabx = x() - xOffset(); |
437 | taby = y() + height() - m_tab_container.height(); | 370 | taby = y() + height() - m_tab_container.height(); |
438 | break; | 371 | break; |
439 | case RIGHTTOP: | 372 | case RIGHTTOP: |
373 | if (orig_orient != FbTk::ROT90) m_tab_container.hide(); | ||
440 | m_tab_container.setOrientation(FbTk::ROT90); | 374 | m_tab_container.setOrientation(FbTk::ROT90); |
375 | m_tab_container.setAlignment(Container::LEFT); | ||
441 | tabx = x() + width(); | 376 | tabx = x() + width(); |
442 | taby = y(); | 377 | taby = y(); |
443 | break; | 378 | break; |
444 | case RIGHTBOTTOM: | 379 | case RIGHTBOTTOM: |
380 | if (orig_orient != FbTk::ROT90) m_tab_container.hide(); | ||
445 | m_tab_container.setOrientation(FbTk::ROT90); | 381 | m_tab_container.setOrientation(FbTk::ROT90); |
382 | m_tab_container.setAlignment(Container::RIGHT); | ||
446 | tabx = x() + width(); | 383 | tabx = x() + width(); |
447 | taby = y() + height() - m_tab_container.height(); | 384 | taby = y() + height() - m_tab_container.height(); |
448 | break; | 385 | break; |
449 | case BOTTOMLEFT: | 386 | case BOTTOMLEFT: |
387 | if (orig_orient != FbTk::ROT0) m_tab_container.hide(); | ||
450 | m_tab_container.setOrientation(FbTk::ROT0); | 388 | m_tab_container.setOrientation(FbTk::ROT0); |
389 | m_tab_container.setAlignment(Container::LEFT); | ||
451 | tabx = x(); | 390 | tabx = x(); |
452 | taby = y() + height() + m_window.borderWidth(); | 391 | taby = y() + height() + m_window.borderWidth(); |
453 | break; | 392 | break; |
454 | case BOTTOMRIGHT: | 393 | case BOTTOMRIGHT: |
394 | if (orig_orient != FbTk::ROT0) m_tab_container.hide(); | ||
455 | m_tab_container.setOrientation(FbTk::ROT0); | 395 | m_tab_container.setOrientation(FbTk::ROT0); |
396 | m_tab_container.setAlignment(Container::RIGHT); | ||
456 | tabx = x() + width() - m_tab_container.width(); | 397 | tabx = x() + width() - m_tab_container.width(); |
457 | taby = y() + height() + m_window.borderWidth(); | 398 | taby = y() + height() + m_window.borderWidth(); |
458 | break; | 399 | break; |
459 | } | 400 | } |
460 | 401 | ||
461 | if (m_tab_container.orientation() != orig_orient) { | 402 | unsigned int w = m_window.width(), h = m_window.height(); |
403 | translateSize(m_tab_container.orientation(), w, h); | ||
404 | m_tab_container.setMaxTotalSize(w); | ||
405 | |||
406 | if (m_tab_container.orientation() != orig_orient || | ||
407 | m_tab_container.maxWidthPerClient() != orig_tabwidth) { | ||
462 | renderTabContainer(); | 408 | renderTabContainer(); |
463 | applyTabContainer(); | 409 | if (m_visible && m_use_tabs) { |
464 | m_tab_container.clear(); | 410 | applyTabContainer(); |
411 | m_tab_container.clear(); | ||
412 | } | ||
413 | if (m_use_tabs) | ||
414 | m_tab_container.show(); | ||
465 | } | 415 | } |
466 | 416 | ||
467 | m_tab_container.move(tabx, taby); | 417 | if (m_tab_container.parent()->window() != m_screen.rootWindow().window()) { |
418 | m_tab_container.reparent(m_screen.rootWindow(), tabx, taby); | ||
419 | m_layeritem.addWindow(m_tab_container); | ||
420 | } else { | ||
421 | m_tab_container.move(tabx, taby); | ||
422 | } | ||
468 | } | 423 | } |
469 | 424 | ||
470 | void FbWinFrame::notifyMoved(bool clear) { | 425 | void FbWinFrame::notifyMoved(bool clear) { |
@@ -1250,13 +1205,15 @@ void FbWinFrame::applyTitlebar() { | |||
1250 | m_titlebar.setAlpha(alpha); | 1205 | m_titlebar.setAlpha(alpha); |
1251 | m_label.setAlpha(alpha); | 1206 | m_label.setAlpha(alpha); |
1252 | 1207 | ||
1253 | if (externalTabMode()) | 1208 | if (externalTabMode()) { |
1254 | m_label.setGC(m_focused?theme().labelTextFocusGC():theme().labelTextUnfocusGC()); | 1209 | m_label.setGC(m_focused?theme().labelTextFocusGC():theme().labelTextUnfocusGC()); |
1210 | m_label.setJustify(theme().justify()); | ||
1255 | 1211 | ||
1256 | if (label_pm != 0) | 1212 | if (label_pm != 0) |
1257 | m_label.setBackgroundPixmap(label_pm); | 1213 | m_label.setBackgroundPixmap(label_pm); |
1258 | else | 1214 | else |
1259 | m_label.setBackgroundColor(label_color); | 1215 | m_label.setBackgroundColor(label_color); |
1216 | } | ||
1260 | 1217 | ||
1261 | if (title_pm != 0) | 1218 | if (title_pm != 0) |
1262 | m_titlebar.setBackgroundPixmap(title_pm); | 1219 | m_titlebar.setBackgroundPixmap(title_pm); |