diff --git a/plugins/decor/deco-button.hpp b/plugins/decor/deco-button.hpp index de4717bad..ebff2d823 100644 --- a/plugins/decor/deco-button.hpp +++ b/plugins/decor/deco-button.hpp @@ -19,9 +19,9 @@ class decoration_theme_t; enum button_type_t { - BUTTON_CLOSE, - BUTTON_TOGGLE_MAXIMIZE, - BUTTON_MINIMIZE, + BUTTON_CLOSE = 1 << 0, + BUTTON_TOGGLE_MAXIMIZE = 1 << 1, + BUTTON_MINIMIZE = 1 << 2, }; class button_t diff --git a/plugins/decor/deco-layout.cpp b/plugins/decor/deco-layout.cpp index 8786a4f33..588c514b8 100644 --- a/plugins/decor/deco-layout.cpp +++ b/plugins/decor/deco-layout.cpp @@ -77,17 +77,17 @@ wf::geometry_t decoration_layout_t::create_buttons(int width, int) std::string button_name; while (stream >> button_name) { - if (button_name == "minimize") + if ((button_name == "minimize") && (theme.button_flags & BUTTON_MINIMIZE)) { buttons.push_back(BUTTON_MINIMIZE); } - if (button_name == "maximize") + if ((button_name == "maximize") && (theme.button_flags & BUTTON_TOGGLE_MAXIMIZE)) { buttons.push_back(BUTTON_TOGGLE_MAXIMIZE); } - if (button_name == "close") + if ((button_name == "close") && (theme.button_flags & BUTTON_CLOSE)) { buttons.push_back(BUTTON_CLOSE); } diff --git a/plugins/decor/deco-subsurface.cpp b/plugins/decor/deco-subsurface.cpp index eb494a876..499af226a 100644 --- a/plugins/decor/deco-subsurface.cpp +++ b/plugins/decor/deco-subsurface.cpp @@ -80,6 +80,15 @@ class simple_decoration_node_t : public wf::scene::node_t, public wf::pointer_in { this->_view = view->weak_from_this(); view->connect(&title_set); + if (view->parent) + { + theme.set_buttons(wf::decor::button_type_t(wf::decor::BUTTON_TOGGLE_MAXIMIZE | + wf::decor::BUTTON_CLOSE)); + } else + { + theme.set_buttons(wf::decor::button_type_t(wf::decor::BUTTON_MINIMIZE | + wf::decor::BUTTON_TOGGLE_MAXIMIZE | wf::decor::BUTTON_CLOSE)); + } // make sure to hide frame if the view is fullscreen update_decoration_size(); diff --git a/plugins/decor/deco-theme.cpp b/plugins/decor/deco-theme.cpp index fe9dbfb5f..555649c26 100644 --- a/plugins/decor/deco-theme.cpp +++ b/plugins/decor/deco-theme.cpp @@ -24,6 +24,12 @@ int decoration_theme_t::get_border_size() const return border_size; } +/** @return The available border for resizing */ +void decoration_theme_t::set_buttons(button_type_t flags) +{ + button_flags = flags; +} + /** * Fill the given rectangle with the background color(s). * diff --git a/plugins/decor/deco-theme.hpp b/plugins/decor/deco-theme.hpp index 366167d4b..288a7f1a3 100644 --- a/plugins/decor/deco-theme.hpp +++ b/plugins/decor/deco-theme.hpp @@ -20,6 +20,9 @@ class decoration_theme_t int get_title_height() const; /** @return The available border for resizing */ int get_border_size() const; + /** Set the flags for buttons */ + void set_buttons(button_type_t flags); + button_type_t button_flags; /** * Fill the given rectangle with the background color(s). diff --git a/src/view/toplevel-view.cpp b/src/view/toplevel-view.cpp index a68d21938..bfc3824cd 100644 --- a/src/view/toplevel-view.cpp +++ b/src/view/toplevel-view.cpp @@ -206,6 +206,12 @@ void wf::toplevel_view_interface_t::set_minimized(bool minim) return; } + if (this->parent && minim) + { + LOGE("Ignoring a request to minimize a view with a parent, minimize the parent instead!"); + return; + } + this->minimized = minim; wf::scene::set_node_enabled(get_root_node(), !minimized);