aboutsummaryrefslogtreecommitdiff
path: root/src/Window.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/Window.cc
parentda365bb4c99edf1a18e1f8db285f8c2dcee2c5e3 (diff)
downloadfluxbox-fe4a7db228d69bc9a66ed948f218ef489b2cedaf.zip
fluxbox-fe4a7db228d69bc9a66ed948f218ef489b2cedaf.tar.bz2
external tabs features and bugfixes
Diffstat (limited to 'src/Window.cc')
-rw-r--r--src/Window.cc107
1 files changed, 77 insertions, 30 deletions
diff --git a/src/Window.cc b/src/Window.cc
index f28f6ab..e1cf224 100644
--- a/src/Window.cc
+++ b/src/Window.cc
@@ -394,10 +394,11 @@ void FluxboxWindow::init() {
394 394
395 frame().setUseShape(!m_shaped); 395 frame().setUseShape(!m_shaped);
396 396
397 if (screen().getDefaultExternalTabs()) { 397 frame().setTabPlacement(screen().getTabPlacement());
398 frame().setTabMode(FbWinFrame::EXTERNAL); 398 if (screen().getDefaultInternalTabs()) {
399 } else {
400 frame().setTabMode(FbWinFrame::INTERNAL); 399 frame().setTabMode(FbWinFrame::INTERNAL);
400 } else {
401 frame().setTabMode(FbWinFrame::EXTERNAL);
401 } 402 }
402 403
403 //!! TODO init of client should be better 404 //!! TODO init of client should be better
@@ -3049,20 +3050,28 @@ void FluxboxWindow::setDecoration(Decoration decoration, bool apply) {
3049 case DECOR_NORMAL: 3050 case DECOR_NORMAL:
3050 decorations.titlebar = decorations.border = decorations.handle = 3051 decorations.titlebar = decorations.border = decorations.handle =
3051 decorations.iconify = decorations.maximize = 3052 decorations.iconify = decorations.maximize =
3052 decorations.menu = true; 3053 decorations.menu = decorations.tab = true;
3054 functions.resize = functions.move = functions.iconify =
3055 functions.maximize = true;
3056 break;
3057
3058 case DECOR_TAB:
3059 decorations.border = decorations.iconify = decorations.maximize =
3060 decorations.menu = decorations.tab = true;
3061 decorations.titlebar = decorations.handle = false;
3053 functions.resize = functions.move = functions.iconify = 3062 functions.resize = functions.move = functions.iconify =
3054 functions.maximize = true; 3063 functions.maximize = true;
3055 break; 3064 break;
3056 3065
3057 case DECOR_TINY: 3066 case DECOR_TINY:
3058 decorations.titlebar = decorations.iconify = decorations.menu = 3067 decorations.titlebar = decorations.iconify = decorations.menu =
3059 functions.move = functions.iconify = true; 3068 functions.move = functions.iconify = decorations.tab = true;
3060 decorations.border = decorations.handle = decorations.maximize = 3069 decorations.border = decorations.handle = decorations.maximize =
3061 functions.resize = functions.maximize = false; 3070 functions.resize = functions.maximize = false;
3062 break; 3071 break;
3063 3072
3064 case DECOR_TOOL: 3073 case DECOR_TOOL:
3065 decorations.titlebar = decorations.menu = functions.move = true; 3074 decorations.titlebar = decorations.tab = decorations.menu = functions.move = true;
3066 decorations.iconify = decorations.border = decorations.handle = 3075 decorations.iconify = decorations.border = decorations.handle =
3067 decorations.maximize = functions.resize = functions.maximize = 3076 decorations.maximize = functions.resize = functions.maximize =
3068 functions.iconify = false; 3077 functions.iconify = false;
@@ -3110,7 +3119,7 @@ void FluxboxWindow::applyDecorations(bool initial) {
3110 if (decorations.titlebar) { 3119 if (decorations.titlebar) {
3111 bool change = frame().showTitlebar(); 3120 bool change = frame().showTitlebar();
3112 client_move |= change; 3121 client_move |= change;
3113 if (change && !screen().getDefaultExternalTabs()) { 3122 if (change && screen().getDefaultInternalTabs()) {
3114 client_move |= frame().setTabMode(FbWinFrame::INTERNAL); 3123 client_move |= frame().setTabMode(FbWinFrame::INTERNAL);
3115 } 3124 }
3116 } else { 3125 } else {
@@ -3357,42 +3366,56 @@ void FluxboxWindow::doSnapping(int &orig_left, int &orig_top) {
3357 int right = orig_left + width() + 2 * borderW; 3366 int right = orig_left + width() + 2 * borderW;
3358 int bottom = orig_top + height() + 2 * borderW; 3367 int bottom = orig_top + height() + 2 * borderW;
3359 3368
3369 // test against tabs too
3370 bool i_have_tabs = frame().externalTabMode();
3371 int xoff,yoff,woff,hoff;
3372 if (i_have_tabs) {
3373 xoff = xOffset();
3374 yoff = yOffset();
3375 woff = widthOffset();
3376 hoff = heightOffset();
3377 }
3378
3379
3360 ///////////////////////////////////// 3380 /////////////////////////////////////
3361 // begin by checking the screen (or Xinerama head) edges 3381 // begin by checking the screen (or Xinerama head) edges
3362 3382
3363 int h; 3383 int starth = 0;
3364 if (screen().numHeads() > 0) { 3384
3365 // head "0" == whole screen width + height, which we skip since the 3385 // head "0" == whole screen width + height, which we skip since the
3366 // sum of all the heads covers those edges 3386 // sum of all the heads covers those edges, if >1 head
3367 for (h = 1; h <= screen().numHeads(); h++) { 3387 if (screen().numHeads() > 0)
3368 snapToWindow(dx, dy, left, right, top, bottom, 3388 starth=1;
3389
3390 for (int h=starth; h <= screen().numHeads(); h++) {
3391 snapToWindow(dx, dy, left, right, top, bottom,
3392 screen().maxLeft(h),
3393 screen().maxRight(h),
3394 screen().maxTop(h),
3395 screen().maxBottom(h));
3396
3397 if (i_have_tabs)
3398 snapToWindow(dx, dy, left - xoff, right - xoff + woff, top - yoff, bottom - yoff + hoff,
3369 screen().maxLeft(h), 3399 screen().maxLeft(h),
3370 screen().maxRight(h), 3400 screen().maxRight(h),
3371 screen().maxTop(h), 3401 screen().maxTop(h),
3372 screen().maxBottom(h)); 3402 screen().maxBottom(h));
3373 } 3403 }
3374 for (h = 1; h <= screen().numHeads(); h++) { 3404 for (int h=starth; h <= screen().numHeads(); h++) {
3375 snapToWindow(dx, dy, left, right, top, bottom, 3405 snapToWindow(dx, dy, left, right, top, bottom,
3406 screen().getHeadX(h),
3407 screen().getHeadX(h) + screen().getHeadWidth(h),
3408 screen().getHeadY(h),
3409 screen().getHeadY(h) + screen().getHeadHeight(h));
3410
3411 if (i_have_tabs)
3412 snapToWindow(dx, dy, left - xoff, right - xoff + woff, top - yoff, bottom - yoff + hoff,
3376 screen().getHeadX(h), 3413 screen().getHeadX(h),
3377 screen().getHeadX(h) + screen().getHeadWidth(h), 3414 screen().getHeadX(h) + screen().getHeadWidth(h),
3378 screen().getHeadY(h), 3415 screen().getHeadY(h),
3379 screen().getHeadY(h) + screen().getHeadHeight(h)); 3416 screen().getHeadY(h) + screen().getHeadHeight(h));
3380 }
3381 } else {
3382 snapToWindow(dx, dy, left, right, top, bottom,
3383 screen().maxLeft(0),
3384 screen().maxRight(0),
3385 screen().maxTop(0),
3386 screen().maxBottom(0));
3387
3388 snapToWindow(dx, dy, left, right, top, bottom,
3389 screen().getHeadX(0),
3390 screen().getHeadX(0) + screen().getHeadWidth(0),
3391 screen().getHeadY(0),
3392 screen().getHeadY(0) + screen().getHeadHeight(0));
3393 } 3417 }
3394 3418
3395
3396 ///////////////////////////////////// 3419 /////////////////////////////////////
3397 // now check window edges 3420 // now check window edges
3398 3421
@@ -3415,6 +3438,30 @@ void FluxboxWindow::doSnapping(int &orig_left, int &orig_top) {
3415 (*it)->x() + (*it)->width() + 2 * bw, 3438 (*it)->x() + (*it)->width() + 2 * bw,
3416 (*it)->y(), 3439 (*it)->y(),
3417 (*it)->y() + (*it)->height() + 2 * bw); 3440 (*it)->y() + (*it)->height() + 2 * bw);
3441
3442 if (i_have_tabs)
3443 snapToWindow(dx, dy, left - xoff, right - xoff + woff, top - yoff, bottom - yoff + hoff,
3444 (*it)->x(),
3445 (*it)->x() + (*it)->width() + 2 * bw,
3446 (*it)->y(),
3447 (*it)->y() + (*it)->height() + 2 * bw);
3448
3449 // also snap to the box containing the tabs (don't bother with actual
3450 // tab edges, since they're dynamic
3451 if ((*it)->frame().externalTabMode())
3452 snapToWindow(dx, dy, left, right, top, bottom,
3453 (*it)->x() - (*it)->xOffset(),
3454 (*it)->x() - (*it)->xOffset() + (*it)->width() + 2 * bw + (*it)->widthOffset(),
3455 (*it)->y() - (*it)->yOffset(),
3456 (*it)->y() - (*it)->yOffset() + (*it)->height() + 2 * bw + (*it)->heightOffset());
3457
3458 if (i_have_tabs)
3459 snapToWindow(dx, dy, left - xoff, right - xoff + woff, top - yoff, bottom - yoff + hoff,
3460 (*it)->x() - (*it)->xOffset(),
3461 (*it)->x() - (*it)->xOffset() + (*it)->width() + 2 * bw + (*it)->widthOffset(),
3462 (*it)->y() - (*it)->yOffset(),
3463 (*it)->y() - (*it)->yOffset() + (*it)->height() + 2 * bw + (*it)->heightOffset());
3464
3418 } 3465 }
3419 3466
3420 // commit 3467 // commit