aboutsummaryrefslogtreecommitdiff
path: root/src/FbWinFrame.cc
diff options
context:
space:
mode:
authorsimonb <simonb>2006-03-22 12:23:17 (GMT)
committersimonb <simonb>2006-03-22 12:23:17 (GMT)
commitfe4a7db228d69bc9a66ed948f218ef489b2cedaf (patch)
tree5ee59c4862b04871dbd6f5112278682e4b005e47 /src/FbWinFrame.cc
parentda365bb4c99edf1a18e1f8db285f8c2dcee2c5e3 (diff)
downloadfluxbox-fe4a7db228d69bc9a66ed948f218ef489b2cedaf.zip
fluxbox-fe4a7db228d69bc9a66ed948f218ef489b2cedaf.tar.bz2
external tabs features and bugfixes
Diffstat (limited to 'src/FbWinFrame.cc')
-rw-r--r--src/FbWinFrame.cc90
1 files changed, 75 insertions, 15 deletions
diff --git a/src/FbWinFrame.cc b/src/FbWinFrame.cc
index ec74f4b..5ccfe12 100644
--- a/src/FbWinFrame.cc
+++ b/src/FbWinFrame.cc
@@ -80,6 +80,7 @@ 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),
83 m_use_tabs(true), 84 m_use_tabs(true),
84 m_use_handle(true), 85 m_use_handle(true),
85 m_focused(false), 86 m_focused(false),
@@ -126,9 +127,11 @@ bool FbWinFrame::setTabMode(TabMode tabmode) {
126 if (tabmode == NOTSET) 127 if (tabmode == NOTSET)
127 tabmode = m_tabmode; 128 tabmode = m_tabmode;
128 129
130 m_tabmode = tabmode;
131
129 // reparent tab container 132 // reparent tab container
130 if (tabmode == EXTERNAL) { 133 if (tabmode == EXTERNAL) {
131 134 m_label.show();
132 m_tab_container.setBorderWidth(m_window.borderWidth()); 135 m_tab_container.setBorderWidth(m_window.borderWidth());
133 m_tab_container.setBorderColor(theme().border().color()); 136 m_tab_container.setBorderColor(theme().border().color());
134 m_tab_container.setEventMask( 137 m_tab_container.setEventMask(
@@ -141,15 +144,35 @@ bool FbWinFrame::setTabMode(TabMode tabmode) {
141 GrabModeSync, GrabModeSync, None, None); 144 GrabModeSync, GrabModeSync, None, None);
142 XUngrabButton(m_tab_container.display(), Button1, Mod1Mask|Mod2Mask|Mod3Mask, m_tab_container.window()); 145 XUngrabButton(m_tab_container.display(), Button1, Mod1Mask|Mod2Mask|Mod3Mask, m_tab_container.window());
143 146
147 int tabx, taby;
148 switch (m_tabplacement) {
149 case TOPLEFT:
150 m_tab_container.setAlignment(Container::LEFT);
151 tabx = x();
152 taby = y() - yOffset();
153 break;
154 case TOPRIGHT:
155 m_tab_container.setAlignment(Container::RIGHT);
156 tabx = x() + width() - m_tab_container.width();
157 taby = y() - yOffset();
158 break;
159 case BOTTOMLEFT:
160 m_tab_container.setAlignment(Container::LEFT);
161 tabx = x();
162 taby = y() + height() + m_window.borderWidth();
163 break;
164 case BOTTOMRIGHT:
165 m_tab_container.setAlignment(Container::RIGHT);
166 tabx = x() + width() - m_tab_container.width();
167 taby = y() + height() + m_window.borderWidth();
168 break;
169 }
170
144 if (m_tab_container.parent()->window() != m_screen.rootWindow().window()) { 171 if (m_tab_container.parent()->window() != m_screen.rootWindow().window()) {
145 int tabx = x();
146 // one borderwidth only, so the adjacent borders overlab
147 int taby = y() - m_tab_container.height() - m_tab_container.borderWidth();
148 m_tab_container.reparent(m_screen.rootWindow(), tabx, taby); 172 m_tab_container.reparent(m_screen.rootWindow(), tabx, taby);
149 m_layeritem.addWindow(m_tab_container); 173 m_layeritem.addWindow(m_tab_container);
150 } 174 }
151 175
152 m_tab_container.setAlignment(Container::LEFT);
153 m_tab_container.setMaxSizePerClient(64); //!!TODO make this a setting 176 m_tab_container.setMaxSizePerClient(64); //!!TODO make this a setting
154 m_tab_container.setMaxTotalSize(window().width()); 177 m_tab_container.setMaxTotalSize(window().width());
155 178
@@ -162,23 +185,24 @@ bool FbWinFrame::setTabMode(TabMode tabmode) {
162 } 185 }
163 186
164 } else { 187 } else {
188 m_tab_container.setAlignment(Container::RELATIVE);
165 if (m_tab_container.parent()->window() == m_screen.rootWindow().window()) { 189 if (m_tab_container.parent()->window() == m_screen.rootWindow().window()) {
166 m_layeritem.removeWindow(m_tab_container); 190 m_layeritem.removeWindow(m_tab_container);
167 m_tab_container.reparent(m_titlebar, m_label.x(), m_label.y()); 191 m_tab_container.reparent(m_titlebar, m_label.x(), m_label.y());
192 m_tab_container.resize(m_label.width(), m_label.height());
168 m_tab_container.raise(); 193 m_tab_container.raise();
169 } 194 }
170 m_tab_container.setBorderWidth(0); 195 m_tab_container.setBorderWidth(0);
171 m_tab_container.setMaxTotalSize(0); 196 m_tab_container.setMaxTotalSize(0);
172 m_tab_container.setMaxSizePerClient(0); 197 m_tab_container.setMaxSizePerClient(0);
173 m_tab_container.setAlignment(Container::RELATIVE);
174 if (!m_use_tabs) 198 if (!m_use_tabs)
175 m_tab_container.show(); 199 m_tab_container.show();
176 else 200 else
177 ret = false; 201 ret = false;
202 m_label.hide();
178// reconfigure(); 203// reconfigure();
179 } 204 }
180 205
181 m_tabmode = tabmode;
182 return true; 206 return true;
183} 207}
184 208
@@ -286,7 +310,7 @@ void FbWinFrame::moveResize(int x, int y, unsigned int width, unsigned int heigh
286 m_window.resize(width, height); 310 m_window.resize(width, height);
287 } 311 }
288 312
289 if (move) 313 if (move || resize && m_tabplacement != TOPLEFT)
290 alignTabs(); 314 alignTabs();
291 315
292 if (resize) { 316 if (resize) {
@@ -306,8 +330,30 @@ void FbWinFrame::quietMoveResize(int x, int y,
306} 330}
307 331
308void FbWinFrame::alignTabs() { 332void FbWinFrame::alignTabs() {
309 if (m_tabmode == EXTERNAL) 333 if (m_tabmode != EXTERNAL)
310 m_tab_container.move(m_window.x(), m_window.y() - m_tab_container.height() - m_tab_container.borderWidth()); 334 return;
335
336 int tabx = 0, taby = 0;
337 switch (m_tabplacement) {
338 case TOPLEFT:
339 tabx = x();
340 taby = y() - yOffset();
341 break;
342 case TOPRIGHT:
343 tabx = x() + width() - m_tab_container.width();
344 taby = y() - yOffset();
345 break;
346 case BOTTOMLEFT:
347 tabx = x();
348 taby = y() + height() + m_window.borderWidth();
349 break;
350 case BOTTOMRIGHT:
351 tabx = x() + width() - m_tab_container.width();
352 taby = y() + height() + m_window.borderWidth();
353 break;
354 }
355
356 m_tab_container.move(tabx, taby);
311} 357}
312 358
313void FbWinFrame::notifyMoved(bool clear) { 359void FbWinFrame::notifyMoved(bool clear) {
@@ -1077,6 +1123,9 @@ void FbWinFrame::applyTitlebar() {
1077 m_titlebar.setAlpha(alpha); 1123 m_titlebar.setAlpha(alpha);
1078 m_label.setAlpha(alpha); 1124 m_label.setAlpha(alpha);
1079 1125
1126 if (externalTabMode())
1127 m_label.setGC(m_focused?theme().labelTextFocusGC():theme().labelTextUnfocusGC());
1128
1080 if (label_pm != 0) 1129 if (label_pm != 0)
1081 m_label.setBackgroundPixmap(label_pm); 1130 m_label.setBackgroundPixmap(label_pm);
1082 else 1131 else
@@ -1398,6 +1447,7 @@ void FbWinFrame::applyFocusLabel(FbTk::TextButton &button) {
1398} 1447}
1399 1448
1400void FbWinFrame::applyActiveLabel(FbTk::TextButton &button) { 1449void FbWinFrame::applyActiveLabel(FbTk::TextButton &button) {
1450
1401 button.setBorderWidth(1); 1451 button.setBorderWidth(1);
1402 button.setGC(theme().labelTextActiveGC()); 1452 button.setGC(theme().labelTextActiveGC());
1403 button.setJustify(theme().justify()); 1453 button.setJustify(theme().justify());
@@ -1544,16 +1594,26 @@ void FbWinFrame::gravityTranslate(int &x, int &y, unsigned int width, unsigned i
1544} 1594}
1545 1595
1546int FbWinFrame::heightOffset() const { 1596int FbWinFrame::heightOffset() const {
1547 if (m_tabmode == EXTERNAL && m_use_tabs) 1597 if (m_tabmode != EXTERNAL || !m_use_tabs)
1548 return m_tab_container.height() + m_window.borderWidth();
1549 else
1550 return 0; 1598 return 0;
1599
1600 // same height offset for top and bottom tabs
1601 return m_tab_container.height() + m_window.borderWidth();
1551} 1602}
1552 1603
1553int FbWinFrame::yOffset() const { 1604int FbWinFrame::yOffset() const {
1554 if (m_tabmode == EXTERNAL && m_use_tabs) 1605 if (m_tabmode != EXTERNAL || !m_use_tabs)
1606 return 0;
1607
1608 switch (m_tabplacement) {
1609 case TOPLEFT:
1610 case TOPRIGHT:
1555 return m_tab_container.height() + m_window.borderWidth(); 1611 return m_tab_container.height() + m_window.borderWidth();
1556 else 1612 break;
1613 case BOTTOMLEFT:
1614 case BOTTOMRIGHT:
1557 return 0; 1615 return 0;
1616 break;
1617 }
1558} 1618}
1559 1619