aboutsummaryrefslogtreecommitdiff
path: root/src/Window.cc
diff options
context:
space:
mode:
authorsimonb <simonb>2006-03-20 11:31:24 (GMT)
committersimonb <simonb>2006-03-20 11:31:24 (GMT)
commitf2d3fff4d4db7677814379139dcec3e31fc68047 (patch)
tree95bd9dc99986104613acc37945895b0812e63801 /src/Window.cc
parenteba0040373179cc6d34f8ee132209f2fa01c2889 (diff)
downloadfluxbox-f2d3fff4d4db7677814379139dcec3e31fc68047.zip
fluxbox-f2d3fff4d4db7677814379139dcec3e31fc68047.tar.bz2
external tabs
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc61
1 files changed, 49 insertions, 12 deletions
diff --git a/src/Window.cc b/src/Window.cc
index b03ee6f..f28f6ab 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -311,8 +311,7 @@ FluxboxWindow::FluxboxWindow(WinClient &client, FbWinFrameTheme &tm,
311 m_old_pos_x(0), m_old_pos_y(0), 311 m_old_pos_x(0), m_old_pos_y(0),
312 m_old_width(1), m_old_height(1), 312 m_old_width(1), m_old_height(1),
313 m_last_button_x(0), m_last_button_y(0), 313 m_last_button_x(0), m_last_button_y(0),
314 m_frame(tm, client.screen().imageControl(), 0, 0, 100, 100), 314 m_frame(client.screen(), tm, client.screen().imageControl(), layer, 0, 0, 100, 100),
315 m_layeritem(m_frame.window(), layer),
316 m_layernum(layer.getLayerNum()), 315 m_layernum(layer.getLayerNum()),
317 m_old_layernum(0), 316 m_old_layernum(0),
318 m_parent(client.screen().rootWindow()), 317 m_parent(client.screen().rootWindow()),
@@ -344,6 +343,7 @@ FluxboxWindow::~FluxboxWindow() {
344 343
345 // no longer a valid window to do stuff with 344 // no longer a valid window to do stuff with
346 Fluxbox::instance()->removeWindowSearchGroup(frame().window().window()); 345 Fluxbox::instance()->removeWindowSearchGroup(frame().window().window());
346 Fluxbox::instance()->removeWindowSearchGroup(frame().tabcontainer().window());
347 347
348 Client2ButtonMap::iterator it = m_labelbuttons.begin(); 348 Client2ButtonMap::iterator it = m_labelbuttons.begin();
349 Client2ButtonMap::iterator it_end = m_labelbuttons.end(); 349 Client2ButtonMap::iterator it_end = m_labelbuttons.end();
@@ -394,6 +394,12 @@ void FluxboxWindow::init() {
394 394
395 frame().setUseShape(!m_shaped); 395 frame().setUseShape(!m_shaped);
396 396
397 if (screen().getDefaultExternalTabs()) {
398 frame().setTabMode(FbWinFrame::EXTERNAL);
399 } else {
400 frame().setTabMode(FbWinFrame::INTERNAL);
401 }
402
397 //!! TODO init of client should be better 403 //!! TODO init of client should be better
398 // we don't want to duplicate code here and in attachClient 404 // we don't want to duplicate code here and in attachClient
399 m_clientlist.push_back(m_client); 405 m_clientlist.push_back(m_client);
@@ -467,6 +473,7 @@ void FluxboxWindow::init() {
467 m_timer.fireOnce(true); 473 m_timer.fireOnce(true);
468 474
469 Fluxbox::instance()->saveWindowSearchGroup(frame().window().window(), this); 475 Fluxbox::instance()->saveWindowSearchGroup(frame().window().window(), this);
476 Fluxbox::instance()->saveWindowSearchGroup(frame().tabcontainer().window(), this);
470 477
471 /**************************************************/ 478 /**************************************************/
472 /* Read state above here, apply state below here. */ 479 /* Read state above here, apply state below here. */
@@ -1146,8 +1153,11 @@ void FluxboxWindow::updateTitleFromClient(WinClient &client) {
1146 client.updateTitle(); 1153 client.updateTitle();
1147 // compare old title with new and see if we need to update 1154 // compare old title with new and see if we need to update
1148 // graphics 1155 // graphics
1149 if (m_labelbuttons[&client]->text() != client.title()) 1156 if (m_labelbuttons[&client]->text() != client.title()) {
1150 m_labelbuttons[&client]->setText(client.title()); 1157 m_labelbuttons[&client]->setText(client.title());
1158 if (&client == m_client)
1159 frame().setFocusTitle(client.title());
1160 }
1151} 1161}
1152 1162
1153/// update icon title from client 1163/// update icon title from client
@@ -2648,7 +2658,7 @@ void FluxboxWindow::buttonPressEvent(XButtonEvent &be) {
2648 setInputFocus(); 2658 setInputFocus();
2649 } 2659 }
2650 2660
2651 if (frame().window().window() == be.window) { 2661 if (frame().window().window() == be.window || frame().tabcontainer().window() == be.window) {
2652 if (screen().clickRaises()) 2662 if (screen().clickRaises())
2653 raise(); 2663 raise();
2654#ifdef DEBUG 2664#ifdef DEBUG
@@ -2694,17 +2704,28 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2694 if (isMoving() && me.window == parent()) { 2704 if (isMoving() && me.window == parent()) {
2695 me.window = frame().window().window(); 2705 me.window = frame().window().window();
2696 } 2706 }
2697 bool inside_titlebar = (frame().titlebar() == me.window || frame().label() == me.window || 2707
2698 frame().handle() == me.window || frame().window() == me.window); 2708 bool inside_titlebar = (frame().titlebar() == me.window
2709 || frame().label() == me.window
2710 || frame().tabcontainer() == me.window
2711 || frame().handle() == me.window
2712 || frame().window() == me.window);
2699 2713
2700 if (Fluxbox::instance()->getIgnoreBorder() 2714 if (Fluxbox::instance()->getIgnoreBorder()
2701 && !(me.state & Mod1Mask) // really should check for exact matches 2715 && !(me.state & Mod1Mask) // really should check for exact matches
2702 && !(isMoving() || isResizing() || m_attaching_tab != 0)) { 2716 && !(isMoving() || isResizing() || m_attaching_tab != 0)) {
2703 int borderw = frame().window().borderWidth(); 2717 int borderw = frame().window().borderWidth();
2704 if (me.x_root < (frame().x() + borderw) || 2718 //!! TODO(tabs): the below test ought to be in FbWinFrame
2719 if ((me.x_root < (frame().x() + borderw) ||
2705 me.y_root < (frame().y() + borderw) || 2720 me.y_root < (frame().y() + borderw) ||
2706 me.x_root > (frame().x() + (int)frame().width() + borderw) || 2721 me.x_root > (frame().x() + (int)frame().width() + borderw) ||
2707 me.y_root > (frame().y() + (int)frame().height() + borderw)) 2722 me.y_root > (frame().y() + (int)frame().height() + borderw)) &&
2723 ( !frame().externalTabMode() ||
2724 (me.x_root < (frame().tabcontainer().x() + borderw) ||
2725 me.y_root < (frame().tabcontainer().y() + borderw) ||
2726 me.x_root > (frame().tabcontainer().x() + (int)frame().tabcontainer().width() + borderw) ||
2727 me.y_root > (frame().tabcontainer().y() + (int)frame().tabcontainer().height() + borderw)
2728 )))
2708 return; 2729 return;
2709 } 2730 }
2710 2731
@@ -2794,7 +2815,7 @@ void FluxboxWindow::motionNotifyEvent(XMotionEvent &me) {
2794 } else { 2815 } else {
2795 //moveResize(dx, dy, frame().width(), frame().height()); 2816 //moveResize(dx, dy, frame().width(), frame().height());
2796 // need to move the base window without interfering with transparency 2817 // need to move the base window without interfering with transparency
2797 frame().window().moveResize(dx, dy, frame().width(), frame().height()); 2818 frame().quietMoveResize(dx, dy, frame().width(), frame().height());
2798 } 2819 }
2799 2820
2800 screen().showPosition(dx, dy); 2821 screen().showPosition(dx, dy);
@@ -3077,11 +3098,26 @@ void FluxboxWindow::applyDecorations(bool initial) {
3077 frame().setBorderWidth(border_width); 3098 frame().setBorderWidth(border_width);
3078 } 3099 }
3079 3100
3080 // we rely on frame not doing anything if it is already shown/hidden 3101 // tab deocration only affects if we're external
3081 if (decorations.titlebar) 3102 // must do before the setTabMode in case it goes
3082 client_move |= frame().showTitlebar(); 3103 // to external and is meant to be hidden
3104 if (decorations.tab)
3105 client_move |= frame().showTabs();
3083 else 3106 else
3107 client_move |= frame().hideTabs();
3108
3109 // we rely on frame not doing anything if it is already shown/hidden
3110 if (decorations.titlebar) {
3111 bool change = frame().showTitlebar();
3112 client_move |= change;
3113 if (change && !screen().getDefaultExternalTabs()) {
3114 client_move |= frame().setTabMode(FbWinFrame::INTERNAL);
3115 }
3116 } else {
3084 client_move |= frame().hideTitlebar(); 3117 client_move |= frame().hideTitlebar();
3118 if (decorations.tab)
3119 client_move |= frame().setTabMode(FbWinFrame::EXTERNAL);
3120 }
3085 3121
3086 if (decorations.handle) { 3122 if (decorations.handle) {
3087 client_move |= frame().showHandle(); 3123 client_move |= frame().showHandle();
@@ -4048,6 +4084,7 @@ void FluxboxWindow::associateClient(WinClient &client) {
4048 Fluxbox::instance()->getTabsPadding()); 4084 Fluxbox::instance()->getTabsPadding());
4049 4085
4050 m_labelbuttons[&client] = btn; 4086 m_labelbuttons[&client] = btn;
4087
4051 4088
4052 4089
4053 FbTk::EventManager &evm = *FbTk::EventManager::instance(); 4090 FbTk::EventManager &evm = *FbTk::EventManager::instance();