mirror of
https://github.com/genodelabs/genode.git
synced 2025-03-10 22:44:30 +00:00
window_layouter: propagate pressed window controls
This patch supplements the dragging state of window controls to the window layout so that decorators become able to visually reflect this state, i.e., pressing the title bar while moving a window. Issue #3097
This commit is contained in:
parent
2d95c4dc1c
commit
9efb957059
@ -195,19 +195,22 @@ struct Window_layouter::Main : Operations,
|
||||
{
|
||||
to_front(id);
|
||||
|
||||
bool window_geometry_changed = false;
|
||||
bool window_layout_changed = false;
|
||||
|
||||
_window_list.with_window(id, [&] (Window &window) {
|
||||
|
||||
bool const orig_dragged = window.dragged();
|
||||
Rect const orig_geometry = window.effective_inner_geometry();
|
||||
window.drag(element, clicked, curr);
|
||||
bool const next_dragged = window.dragged();
|
||||
Rect const next_geometry = window.effective_inner_geometry();
|
||||
|
||||
window_geometry_changed = orig_geometry.p1() != next_geometry.p1()
|
||||
|| orig_geometry.p2() != next_geometry.p2();
|
||||
window_layout_changed = orig_geometry.p1() != next_geometry.p1()
|
||||
|| orig_geometry.p2() != next_geometry.p2()
|
||||
|| orig_dragged != next_dragged;
|
||||
});
|
||||
|
||||
if (window_geometry_changed)
|
||||
if (window_layout_changed)
|
||||
_gen_window_layout();
|
||||
|
||||
_gen_resize_request();
|
||||
|
@ -120,6 +120,8 @@ class Window_layouter::Window : public List_model<Window>::Element
|
||||
|
||||
bool _dragged = false;
|
||||
|
||||
Element _dragged_element { Element::UNDEFINED };
|
||||
|
||||
bool _focused = false;
|
||||
|
||||
Element _hovered { Element::UNDEFINED };
|
||||
@ -149,6 +151,8 @@ class Window_layouter::Window : public List_model<Window>::Element
|
||||
*/
|
||||
void _initiate_drag_operation(Window::Element element)
|
||||
{
|
||||
_dragged_element = element;
|
||||
|
||||
_drag_left_border = (element.type == Window::Element::LEFT)
|
||||
|| (element.type == Window::Element::TOP_LEFT)
|
||||
|| (element.type == Window::Element::BOTTOM_LEFT);
|
||||
@ -231,6 +235,8 @@ class Window_layouter::Window : public List_model<Window>::Element
|
||||
|
||||
Label label() const { return _label; }
|
||||
|
||||
bool dragged() const { return _dragged; }
|
||||
|
||||
Rect effective_inner_geometry() const
|
||||
{
|
||||
if (!_dragged)
|
||||
@ -372,10 +378,17 @@ class Window_layouter::Window : public List_model<Window>::Element
|
||||
if (_focused)
|
||||
xml.attribute("focused", "yes");
|
||||
|
||||
if (_hovered.type != Element::UNDEFINED) {
|
||||
if (_dragged) {
|
||||
|
||||
xml.node("highlight", [&] () {
|
||||
xml.node(_hovered.name());
|
||||
});
|
||||
xml.node(_dragged_element.name(), [&] () {
|
||||
xml.attribute("pressed", "yes"); }); });
|
||||
|
||||
} else {
|
||||
|
||||
if (_hovered.type != Element::UNDEFINED)
|
||||
xml.node("highlight", [&] () {
|
||||
xml.node(_hovered.name()); });
|
||||
}
|
||||
|
||||
if (_has_alpha)
|
||||
|
Loading…
x
Reference in New Issue
Block a user