Skip to content

Commit

Permalink
panel: move wm_menu field to new config
Browse files Browse the repository at this point in the history
Related issues:
  - #27
  • Loading branch information
jmc-88 committed Oct 1, 2017
1 parent fdf54a6 commit f9d138f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,7 @@ bool Reader::AddEntry_Panel(std::string const& key, std::string const& value) {
return true;
}
if (key == "wm_menu") {
ParseBoolean(value, &wm_menu);
ParseBoolean(value, &new_panel_config.wm_menu);
return true;
}
if (key == "panel_dock") {
Expand Down
2 changes: 1 addition & 1 deletion src/config_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ TEST_CASE("ConfigParserBooleanValues") {
REQUIRE(panel_config.g_task.text);
REQUIRE(panel_config.g_task.icon);

REQUIRE_FALSE(wm_menu);
REQUIRE_FALSE(new_panel_config.wm_menu);
REQUIRE_FALSE(panel_dock);

REQUIRE(taskbar_enabled);
Expand Down
6 changes: 4 additions & 2 deletions src/panel.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ MouseAction mouse_scroll_down;
MouseAction mouse_tilt_left;
MouseAction mouse_tilt_right;

bool wm_menu;
bool panel_dock;
PanelHorizontalPosition panel_horizontal_position;
PanelVerticalPosition panel_vertical_position;
Expand Down Expand Up @@ -111,6 +110,8 @@ PanelConfig PanelConfig::Default() {
cfg.height = 40;
cfg.percent_y = false;

cfg.wm_menu = false;

return cfg;
}

Expand All @@ -128,7 +129,6 @@ void DefaultPanel() {
panel_autohide_height = 5; // for vertical panels this is of course the width
panel_strut_policy = PanelStrutPolicy::kFollowSize;
panel_dock = 0; // default not in the dock
wm_menu = false;
max_tick_urgent = 14;

// append full transparency background
Expand Down Expand Up @@ -832,6 +832,8 @@ Monitor const& Panel::monitor() const {
return server.monitor[config_.monitor];
}

bool Panel::window_manager_menu() const { return config_.wm_menu; }

bool Panel::hidden() const { return hidden_; }

#ifdef _TINT3_DEBUG
Expand Down
4 changes: 3 additions & 1 deletion src/panel.hh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ extern MouseAction mouse_scroll_down;
extern MouseAction mouse_tilt_left;
extern MouseAction mouse_tilt_right;

extern bool wm_menu;
extern bool panel_dock;

// panel layer
Expand Down Expand Up @@ -107,6 +106,8 @@ class PanelConfig {
unsigned int height;
bool percent_y;

bool wm_menu;

static PanelConfig Default();
};

Expand Down Expand Up @@ -172,6 +173,7 @@ class Panel : public Area {
PanelLayer layer() const;
TaskbarMode taskbar_mode() const;
Monitor const& monitor() const;
bool window_manager_menu() const;
void UseConfig(PanelConfig const& cfg, unsigned int num_desktop);

#ifdef _TINT3_DEBUG
Expand Down
4 changes: 2 additions & 2 deletions src/tint.cc
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ void EventButtonPress(XEvent* e) {
}

if (!panel->HandlesClick(e)) {
if (wm_menu) {
if (panel->window_manager_menu()) {
ForwardClick(e);
}
return;
Expand Down Expand Up @@ -460,7 +460,7 @@ void EventButtonRelease(XEvent* e) {
});

if (!panel->HandlesClick(e)) {
if (wm_menu) {
if (panel->window_manager_menu()) {
ForwardClick(e);
}
return;
Expand Down

0 comments on commit f9d138f

Please sign in to comment.