From 7a9a92fd22e97d014fc4adbe57677341d993a03c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nguy=E1=BB=85n=20Th=C3=A1i=20Ng=E1=BB=8Dc=20Duy?= Date: Tue, 13 Apr 2021 19:31:51 +0700 Subject: [PATCH] Add screen config MaxDisable{Move,Resize} Pretty much design copy from fluxbox. Since fullscreen is also maximized, you can't move or resize it either --- src/Client.cc | 23 +++++++++++++++++++++++ src/Client.hh | 4 ++-- src/Config.cc | 4 ++++ src/Config.hh | 5 +++++ 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/src/Client.cc b/src/Client.cc index 42fd22c2..ba4e5439 100644 --- a/src/Client.cc +++ b/src/Client.cc @@ -1910,3 +1910,26 @@ Client::setClientEnvironment(Client *client) Util::setEnv("CLIENT_WINDOW", ""); } } + +bool Client::allowMove(void) const +{ + if (!_actions.move) { + return false; + } + if (pekwm::config()->isMaxDisableMove() && + isMaximizedVert() && isMaximizedHorz()) { + return false; + } + return true; +} +bool Client::allowResize(void) const +{ + if (!_actions.resize) { + return false; + } + if (pekwm::config()->isMaxDisableResize() && + isMaximizedVert() && isMaximizedHorz()) { + return false; + } + return true; +} diff --git a/src/Client.hh b/src/Client.hh index 8b0c97c2..0621da9b 100644 --- a/src/Client.hh +++ b/src/Client.hh @@ -185,8 +185,8 @@ public: // Public Member Functions uint getDecorState(void) const { return _state.decor; } bool isCfgDeny(uint deny) const { return (_state.cfg_deny&deny); } - bool allowMove(void) const { return _actions.move; } - bool allowResize(void) const { return _actions.resize; } + bool allowMove(void) const; + bool allowResize(void) const; bool allowIconify(void) const { return _actions.iconify; } bool allowShade(void) const { return _actions.shade; } bool allowStick(void) const { return _actions.stick; } diff --git a/src/Config.cc b/src/Config.cc index bc9807c2..20b1edc7 100644 --- a/src/Config.cc +++ b/src/Config.cc @@ -182,6 +182,8 @@ Config::Config(void) : _screen_client_unique_name_pre(" #"), _screen_client_unique_name_post(""), _screen_report_all_clients(false), + _screen_max_disable_move(false), + _screen_max_disable_resize(false), _menu_select_mask(0), _menu_enter_mask(0), _menu_exec_mask(0), _menu_display_icons(true), _menu_focus_opacity(EWMH_OPAQUE_WINDOW), @@ -435,6 +437,8 @@ Config::loadScreen(CfgParser::Entry *section) keys.add_bool("FONTDEFAULTX11", _screen_default_font_x11, false); keys.add_string("FONTCHARSETOVERRIDE", _screen_font_charset_override); keys.add_bool("REPORTALLCLIENTS", _screen_report_all_clients, false); + keys.add_bool("MAXDISABLEMOVE", _screen_max_disable_move, false); + keys.add_bool("MAXDISABLERESIZE", _screen_max_disable_resize, false); section->parseKeyValues(keys.begin(), keys.end()); keys.clear(); diff --git a/src/Config.hh b/src/Config.hh index 08513594..bdcb6d2f 100644 --- a/src/Config.hh +++ b/src/Config.hh @@ -216,6 +216,9 @@ public: return _screen_report_all_clients; } + bool isMaxDisableMove(void) const { return _screen_max_disable_move; } + bool isMaxDisableResize(void) const { return _screen_max_disable_resize; } + bool isMenuSelectOn(uint val) const { return (_menu_select_mask&val); } bool isMenuEnterOn(uint val) const { return (_menu_enter_mask&val); } bool isMenuExecOn(uint val) const { return (_menu_exec_mask&val); } @@ -373,6 +376,8 @@ private: std::string _screen_client_unique_name_pre; std::string _screen_client_unique_name_post; bool _screen_report_all_clients; + bool _screen_max_disable_move; + bool _screen_max_disable_resize; uint _menu_select_mask, _menu_enter_mask, _menu_exec_mask; /** Boolean flag, when true display icons in menus. */