aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathias Gumz <akira at fluxbox dot org>2010-05-06 18:09:59 (GMT)
committerMathias Gumz <akira at fluxbox dot org>2010-05-06 18:09:59 (GMT)
commita443d461173e0ccf31b012117b13c65ea615648b (patch)
tree8feaa811ad559c4e7ec451d2f358a998ea9468c6
parenta2f809f8f254e96739de6015e7475a3ae4cc2a62 (diff)
downloadfluxbox-a443d461173e0ccf31b012117b13c65ea615648b.zip
fluxbox-a443d461173e0ccf31b012117b13c65ea615648b.tar.bz2
bugfix: resizing/moving a maximized window via keys do not end maximization state (#2980313)
-rw-r--r--src/CurrentWindowCmd.cc52
1 files changed, 49 insertions, 3 deletions
diff --git a/src/CurrentWindowCmd.cc b/src/CurrentWindowCmd.cc
index f896009..713c32a 100644
--- a/src/CurrentWindowCmd.cc
+++ b/src/CurrentWindowCmd.cc
@@ -51,6 +51,17 @@ using FbTk::Command;
51 51
52namespace { 52namespace {
53 53
54void disableMaximizationIfNeeded(FluxboxWindow& win) {
55
56 if (win.isMaximized() ||
57 win.isMaximizedVert() ||
58 win.isMaximizedHorz() ||
59 win.isFullscreen()) {
60
61 win.disableMaximization();
62 }
63}
64
54FbTk::Command<void> *createCurrentWindowCmd(const std::string &command, 65FbTk::Command<void> *createCurrentWindowCmd(const std::string &command,
55 const std::string &args, bool trusted) { 66 const std::string &args, bool trusted) {
56 if (command == "minimizewindow" || command == "minimize" || command == "iconify") 67 if (command == "minimizewindow" || command == "minimize" || command == "iconify")
@@ -384,9 +395,15 @@ MoveCmd::MoveCmd(const int step_size_x, const int step_size_y) :
384 m_step_size_x(step_size_x), m_step_size_y(step_size_y) { } 395 m_step_size_x(step_size_x), m_step_size_y(step_size_y) { }
385 396
386void MoveCmd::real_execute() { 397void MoveCmd::real_execute() {
387 fbwindow().move( 398 if (fbwindow().isMaximized() || fbwindow().isFullscreen()) {
388 fbwindow().x() + m_step_size_x, 399 if (fbwindow().screen().getMaxDisableMove()) {
389 fbwindow().y() + m_step_size_y); 400 return;
401 }
402
403 fbwindow().setMaximizedState(WindowState::MAX_NONE);
404 }
405
406 fbwindow().move(fbwindow().x() + m_step_size_x, fbwindow().y() + m_step_size_y);
390} 407}
391 408
392FbTk::Command<void> *ResizeCmd::parse(const string &command, const string &args, 409FbTk::Command<void> *ResizeCmd::parse(const string &command, const string &args,
@@ -416,12 +433,21 @@ ResizeCmd::ResizeCmd(const int step_size_x, const int step_size_y) :
416 433
417void ResizeCmd::real_execute() { 434void ResizeCmd::real_execute() {
418 435
436 if (fbwindow().isMaximized() || fbwindow().isFullscreen()) {
437 if (fbwindow().screen().getMaxDisableResize()) {
438 return;
439 }
440 }
441
442 disableMaximizationIfNeeded(fbwindow());
443
419 int w = std::max<int>(static_cast<int>(fbwindow().width() + 444 int w = std::max<int>(static_cast<int>(fbwindow().width() +
420 m_step_size_x * fbwindow().winClient().widthInc()), 445 m_step_size_x * fbwindow().winClient().widthInc()),
421 fbwindow().frame().titlebarHeight() * 2 + 10); 446 fbwindow().frame().titlebarHeight() * 2 + 10);
422 int h = std::max<int>(static_cast<int>(fbwindow().height() + 447 int h = std::max<int>(static_cast<int>(fbwindow().height() +
423 m_step_size_y * fbwindow().winClient().heightInc()), 448 m_step_size_y * fbwindow().winClient().heightInc()),
424 fbwindow().frame().titlebarHeight() + 10); 449 fbwindow().frame().titlebarHeight() + 10);
450
425 fbwindow().resize(w, h); 451 fbwindow().resize(w, h);
426} 452}
427 453
@@ -460,6 +486,16 @@ FbTk::Command<void> *MoveToCmd::parse(const string &cmd, const string &args,
460REGISTER_COMMAND_PARSER(moveto, MoveToCmd::parse, void); 486REGISTER_COMMAND_PARSER(moveto, MoveToCmd::parse, void);
461 487
462void MoveToCmd::real_execute() { 488void MoveToCmd::real_execute() {
489
490 if (fbwindow().isMaximized() || fbwindow().isFullscreen()) {
491 if (fbwindow().screen().getMaxDisableMove()) {
492 return;
493 }
494 }
495
496 disableMaximizationIfNeeded(fbwindow());
497
498
463 int x = m_pos_x, y = m_pos_y; 499 int x = m_pos_x, y = m_pos_y;
464 500
465 fbwindow().translateCoords(x, y, m_corner); 501 fbwindow().translateCoords(x, y, m_corner);
@@ -476,6 +512,16 @@ ResizeToCmd::ResizeToCmd(const int step_size_x, const int step_size_y) :
476 m_step_size_x(step_size_x), m_step_size_y(step_size_y) { } 512 m_step_size_x(step_size_x), m_step_size_y(step_size_y) { }
477 513
478void ResizeToCmd::real_execute() { 514void ResizeToCmd::real_execute() {
515
516 if (fbwindow().isMaximized() || fbwindow().isFullscreen()) {
517 if (fbwindow().screen().getMaxDisableResize()) {
518 return;
519 }
520 }
521
522 disableMaximizationIfNeeded(fbwindow());
523
524
479 if (m_step_size_x > 0 && m_step_size_y > 0) 525 if (m_step_size_x > 0 && m_step_size_y > 0)
480 fbwindow().resize(m_step_size_x, m_step_size_y); 526 fbwindow().resize(m_step_size_x, m_step_size_y);
481} 527}