Skip to content

Commit

Permalink
Add screen config MaxDisable{Move,Resize}
Browse files Browse the repository at this point in the history
Pretty much design copy from fluxbox. Since fullscreen is also
maximized, you can't move or resize it either
  • Loading branch information
pclouds committed Nov 14, 2023
1 parent f557e62 commit 7a9a92f
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 2 deletions.
23 changes: 23 additions & 0 deletions src/Client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
4 changes: 2 additions & 2 deletions src/Client.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
4 changes: 4 additions & 0 deletions src/Config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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();
Expand Down
5 changes: 5 additions & 0 deletions src/Config.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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); }
Expand Down Expand Up @@ -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. */
Expand Down

0 comments on commit 7a9a92f

Please sign in to comment.