diff options
Diffstat (limited to 'src/Window.cc')
-rw-r--r-- | src/Window.cc | 59 |
1 files changed, 32 insertions, 27 deletions
diff --git a/src/Window.cc b/src/Window.cc index 608ceb1..abbe6d5 100644 --- a/src/Window.cc +++ b/src/Window.cc | |||
@@ -495,15 +495,18 @@ void FluxboxWindow::init() { | |||
495 | decorations.tab = false; //no tab for this window | 495 | decorations.tab = false; //no tab for this window |
496 | } | 496 | } |
497 | 497 | ||
498 | associateClientWindow(true, wattrib.x, wattrib.y, wattrib.width, wattrib.height); | ||
499 | 498 | ||
499 | if (m_client->normal_hint_flags & (PPosition|USPosition)) { | ||
500 | frame().gravityTranslate(wattrib.x, wattrib.y, m_client->gravity(), m_client->old_bw, false); | ||
501 | } | ||
502 | |||
503 | associateClientWindow(true, wattrib.x, wattrib.y, wattrib.width, wattrib.height, m_client->gravity(), m_client->old_bw); | ||
500 | 504 | ||
501 | Fluxbox::instance()->attachSignals(*this); | 505 | Fluxbox::instance()->attachSignals(*this); |
502 | 506 | ||
503 | // this window is managed, we are now allowed to modify actual state | 507 | // this window is managed, we are now allowed to modify actual state |
504 | m_initialized = true; | 508 | m_initialized = true; |
505 | 509 | ||
506 | |||
507 | applyDecorations(true); | 510 | applyDecorations(true); |
508 | 511 | ||
509 | grabButtons(); | 512 | grabButtons(); |
@@ -514,10 +517,9 @@ void FluxboxWindow::init() { | |||
514 | m_workspace_number = screen().currentWorkspaceID(); | 517 | m_workspace_number = screen().currentWorkspaceID(); |
515 | 518 | ||
516 | bool place_window = (m_old_pos_x == 0); | 519 | bool place_window = (m_old_pos_x == 0); |
517 | if (fluxbox.isStartup() || m_client->isTransient() || | ||
518 | m_client->normal_hint_flags & (PPosition|USPosition)) { | ||
519 | 520 | ||
520 | frame().gravityTranslate(wattrib.x, wattrib.y, m_client->gravity(), false); | 521 | if (fluxbox.isStartup() || m_client->isTransient() || |
522 | m_client->normal_hint_flags & (PPosition|USPosition)) { | ||
521 | 523 | ||
522 | if (! fluxbox.isStartup()) { | 524 | if (! fluxbox.isStartup()) { |
523 | 525 | ||
@@ -534,10 +536,12 @@ void FluxboxWindow::init() { | |||
534 | place_window = false; | 536 | place_window = false; |
535 | 537 | ||
536 | } | 538 | } |
539 | /* | ||
537 | if (wattrib.width <= 0) | 540 | if (wattrib.width <= 0) |
538 | wattrib.width = 1; | 541 | wattrib.width = 1; |
539 | if (wattrib.height <= 0) | 542 | if (wattrib.height <= 0) |
540 | wattrib.height = 1; | 543 | wattrib.height = 1; |
544 | */ | ||
541 | 545 | ||
542 | 546 | ||
543 | 547 | ||
@@ -1109,17 +1113,18 @@ bool FluxboxWindow::isGroupable() const { | |||
1109 | 1113 | ||
1110 | void FluxboxWindow::associateClientWindow(bool use_attrs, | 1114 | void FluxboxWindow::associateClientWindow(bool use_attrs, |
1111 | int x, int y, | 1115 | int x, int y, |
1112 | unsigned int width, unsigned int height) { | 1116 | unsigned int width, unsigned int height, |
1113 | m_client->setBorderWidth(0); | 1117 | int gravity, unsigned int client_bw) { |
1114 | updateTitleFromClient(*m_client); | 1118 | updateTitleFromClient(*m_client); |
1115 | updateIconNameFromClient(*m_client); | 1119 | updateIconNameFromClient(*m_client); |
1116 | 1120 | ||
1117 | if (use_attrs) | 1121 | if (use_attrs) |
1118 | frame().moveResizeForClient(x, y, | 1122 | frame().moveResizeForClient(x, y, |
1119 | width, height); | 1123 | width, height, gravity, client_bw); |
1120 | else | 1124 | else |
1121 | frame().resizeForClient(m_client->width(), m_client->height()); | 1125 | frame().resizeForClient(m_client->width(), m_client->height()); |
1122 | 1126 | ||
1127 | frame().setActiveGravity(m_client->gravity(), m_client->old_bw); | ||
1123 | frame().setClientWindow(*m_client); | 1128 | frame().setClientWindow(*m_client); |
1124 | } | 1129 | } |
1125 | 1130 | ||
@@ -1308,8 +1313,8 @@ void FluxboxWindow::updateBlackboxHintsFromClient(const WinClient &client) { | |||
1308 | } | 1313 | } |
1309 | } | 1314 | } |
1310 | 1315 | ||
1311 | void FluxboxWindow::move(int x, int y, int gravity) { | 1316 | void FluxboxWindow::move(int x, int y) { |
1312 | moveResize(x, y, frame().width(), frame().height(), gravity); | 1317 | moveResize(x, y, frame().width(), frame().height()); |
1313 | } | 1318 | } |
1314 | 1319 | ||
1315 | void FluxboxWindow::resize(unsigned int width, unsigned int height) { | 1320 | void FluxboxWindow::resize(unsigned int width, unsigned int height) { |
@@ -1325,16 +1330,12 @@ void FluxboxWindow::resize(unsigned int width, unsigned int height) { | |||
1325 | 1330 | ||
1326 | // send_event is just an override | 1331 | // send_event is just an override |
1327 | void FluxboxWindow::moveResize(int new_x, int new_y, | 1332 | void FluxboxWindow::moveResize(int new_x, int new_y, |
1328 | unsigned int new_width, unsigned int new_height, int gravity, bool send_event) { | 1333 | unsigned int new_width, unsigned int new_height, bool send_event) { |
1329 | 1334 | ||
1330 | // magic to detect if moved during initialisation | 1335 | // magic to detect if moved during initialisation |
1331 | if (!isInitialized()) | 1336 | if (!isInitialized()) |
1332 | m_old_pos_x = 1; | 1337 | m_old_pos_x = 1; |
1333 | 1338 | ||
1334 | if (gravity != ForgetGravity) { | ||
1335 | frame().gravityTranslate(new_x, new_y, gravity, false); | ||
1336 | } | ||
1337 | |||
1338 | send_event = send_event || (frame().x() != new_x || frame().y() != new_y); | 1339 | send_event = send_event || (frame().x() != new_x || frame().y() != new_y); |
1339 | 1340 | ||
1340 | if (new_width != frame().width() || new_height != frame().height()) { | 1341 | if (new_width != frame().width() || new_height != frame().height()) { |
@@ -1370,12 +1371,12 @@ void FluxboxWindow::moveResize(int new_x, int new_y, | |||
1370 | } | 1371 | } |
1371 | 1372 | ||
1372 | void FluxboxWindow::moveResizeForClient(int new_x, int new_y, | 1373 | void FluxboxWindow::moveResizeForClient(int new_x, int new_y, |
1373 | unsigned int new_width, unsigned int new_height, int gravity) { | 1374 | unsigned int new_width, unsigned int new_height, int gravity, unsigned int client_bw) { |
1374 | 1375 | ||
1375 | // magic to detect if moved during initialisation | 1376 | // magic to detect if moved during initialisation |
1376 | if (!isInitialized()) | 1377 | if (!isInitialized()) |
1377 | m_old_pos_x = 1; | 1378 | m_old_pos_x = 1; |
1378 | frame().moveResizeForClient(new_x, new_y, new_width, new_height, true, true, gravity); | 1379 | frame().moveResizeForClient(new_x, new_y, new_width, new_height, true, true, gravity, client_bw); |
1379 | setFocusFlag(focused); | 1380 | setFocusFlag(focused); |
1380 | shaded = false; | 1381 | shaded = false; |
1381 | sendConfigureNotify(); | 1382 | sendConfigureNotify(); |
@@ -2660,13 +2661,16 @@ void FluxboxWindow::configureRequestEvent(XConfigureRequestEvent &cr) { | |||
2660 | (cr.value_mask & CWY)) { | 2661 | (cr.value_mask & CWY)) { |
2661 | cx = cr.x; | 2662 | cx = cr.x; |
2662 | cy = cr.y; | 2663 | cy = cr.y; |
2663 | frame().gravityTranslate(cx, cy, client->gravity(), false); | 2664 | frame().gravityTranslate(cx, cy, client->gravity(), client->old_bw, false); |
2665 | frame().setActiveGravity(client->gravity(), client->old_bw); | ||
2664 | } else if (cr.value_mask & CWX) { | 2666 | } else if (cr.value_mask & CWX) { |
2665 | cx = cr.x; | 2667 | cx = cr.x; |
2666 | frame().gravityTranslate(cx, ignore, client->gravity(), false); | 2668 | frame().gravityTranslate(cx, ignore, client->gravity(), client->old_bw, false); |
2669 | frame().setActiveGravity(client->gravity(), client->old_bw); | ||
2667 | } else if (cr.value_mask & CWY) { | 2670 | } else if (cr.value_mask & CWY) { |
2668 | cy = cr.y; | 2671 | cy = cr.y; |
2669 | frame().gravityTranslate(ignore, cy, client->gravity(), false); | 2672 | frame().gravityTranslate(ignore, cy, client->gravity(), client->old_bw, false); |
2673 | frame().setActiveGravity(client->gravity(), client->old_bw); | ||
2670 | } | 2674 | } |
2671 | 2675 | ||
2672 | if (cr.value_mask & CWWidth) | 2676 | if (cr.value_mask & CWWidth) |
@@ -3160,21 +3164,22 @@ void FluxboxWindow::setDecoration(Decoration decoration, bool apply) { | |||
3160 | void FluxboxWindow::applyDecorations(bool initial) { | 3164 | void FluxboxWindow::applyDecorations(bool initial) { |
3161 | frame().clientArea().setBorderWidth(0); // client area bordered by other things | 3165 | frame().clientArea().setBorderWidth(0); // client area bordered by other things |
3162 | 3166 | ||
3163 | int grav_x=0, grav_y=0; | ||
3164 | // negate gravity | ||
3165 | frame().gravityTranslate(grav_x, grav_y, -m_client->gravity(), false); | ||
3166 | |||
3167 | unsigned int border_width = 0; | 3167 | unsigned int border_width = 0; |
3168 | if (decorations.border) | 3168 | if (decorations.border) |
3169 | border_width = frame().theme().border().width(); | 3169 | border_width = frame().theme().border().width(); |
3170 | 3170 | ||
3171 | bool client_move = false; | 3171 | bool client_move = false; |
3172 | 3172 | ||
3173 | // borderWidth setting handles its own gravity | ||
3173 | if (initial || frame().window().borderWidth() != border_width) { | 3174 | if (initial || frame().window().borderWidth() != border_width) { |
3174 | client_move = true; | 3175 | client_move = true; |
3175 | frame().setBorderWidth(border_width); | 3176 | frame().setBorderWidth(border_width); |
3176 | } | 3177 | } |
3177 | 3178 | ||
3179 | int grav_x=0, grav_y=0; | ||
3180 | // negate gravity | ||
3181 | frame().gravityTranslate(grav_x, grav_y, -m_client->gravity(), m_client->old_bw, false); | ||
3182 | |||
3178 | // tab deocration only affects if we're external | 3183 | // tab deocration only affects if we're external |
3179 | // must do before the setTabMode in case it goes | 3184 | // must do before the setTabMode in case it goes |
3180 | // to external and is meant to be hidden | 3185 | // to external and is meant to be hidden |
@@ -3202,7 +3207,7 @@ void FluxboxWindow::applyDecorations(bool initial) { | |||
3202 | client_move |= frame().hideHandle(); | 3207 | client_move |= frame().hideHandle(); |
3203 | 3208 | ||
3204 | // apply gravity once more | 3209 | // apply gravity once more |
3205 | frame().gravityTranslate(grav_x, grav_y, m_client->gravity(), false); | 3210 | frame().gravityTranslate(grav_x, grav_y, m_client->gravity(), m_client->old_bw, false); |
3206 | 3211 | ||
3207 | // if the location changes, shift it | 3212 | // if the location changes, shift it |
3208 | if (grav_x != 0 || grav_y != 0) { | 3213 | if (grav_x != 0 || grav_y != 0) { |
@@ -3337,7 +3342,7 @@ void FluxboxWindow::stopMoving(bool interrupted) { | |||
3337 | } | 3342 | } |
3338 | fluxbox->ungrab(); | 3343 | fluxbox->ungrab(); |
3339 | } else if (!interrupted) { | 3344 | } else if (!interrupted) { |
3340 | moveResize(frame().x(), frame().y(), frame().width(), frame().height(), ForgetGravity, true); | 3345 | moveResize(frame().x(), frame().y(), frame().width(), frame().height(), true); |
3341 | frame().notifyMoved(true); | 3346 | frame().notifyMoved(true); |
3342 | } | 3347 | } |
3343 | 3348 | ||
@@ -3680,7 +3685,7 @@ void FluxboxWindow::restore(WinClient *client, bool remap) { | |||
3680 | client->setEventMask(NoEventMask); | 3685 | client->setEventMask(NoEventMask); |
3681 | 3686 | ||
3682 | int wx = frame().x(), wy = frame().y(); // not actually used here | 3687 | int wx = frame().x(), wy = frame().y(); // not actually used here |
3683 | frame().gravityTranslate(wx, wy, -client->gravity(), true); // negative to invert | 3688 | frame().gravityTranslate(wx, wy, -client->gravity(), client->old_bw, true); // negative to invert |
3684 | 3689 | ||
3685 | // Why was this hide done? It broke vncviewer (and mplayer?), | 3690 | // Why was this hide done? It broke vncviewer (and mplayer?), |
3686 | // since it would reparent when going fullscreen. | 3691 | // since it would reparent when going fullscreen. |