diff options
-rw-r--r-- | src/CurrentWindowCmd.cc | 52 |
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 | ||
52 | namespace { | 52 | namespace { |
53 | 53 | ||
54 | void disableMaximizationIfNeeded(FluxboxWindow& win) { | ||
55 | |||
56 | if (win.isMaximized() || | ||
57 | win.isMaximizedVert() || | ||
58 | win.isMaximizedHorz() || | ||
59 | win.isFullscreen()) { | ||
60 | |||
61 | win.disableMaximization(); | ||
62 | } | ||
63 | } | ||
64 | |||
54 | FbTk::Command<void> *createCurrentWindowCmd(const std::string &command, | 65 | FbTk::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 | ||
386 | void MoveCmd::real_execute() { | 397 | void 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 | ||
392 | FbTk::Command<void> *ResizeCmd::parse(const string &command, const string &args, | 409 | FbTk::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 | ||
417 | void ResizeCmd::real_execute() { | 434 | void 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, | |||
460 | REGISTER_COMMAND_PARSER(moveto, MoveToCmd::parse, void); | 486 | REGISTER_COMMAND_PARSER(moveto, MoveToCmd::parse, void); |
461 | 487 | ||
462 | void MoveToCmd::real_execute() { | 488 | void 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 | ||
478 | void ResizeToCmd::real_execute() { | 514 | void 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 | } |