mirror of
https://github.com/genodelabs/genode.git
synced 2024-12-22 06:57:51 +00:00
gui_session: window-closed state as attribute
With the change of "gui_session: provide mode info as XML", the client-side window-close handling became dysfunct because the window-close state got wrongly interpreted as initial window state, to the effect that a client's initial-window size policy got applied instead of closing the window. This patch makes the inital state of running a windowed application (when no window size is defined yet) clearly distiguishable from the state after which the user closed the window. Prior this patch, both conditions were reflected by an empty <capture/> node in the panorama. Now, the latter condition is reported as <capture closed="yes"/>, which alleviates the need to track the life cycle of a window at the client size. Issue #5353
This commit is contained in:
parent
515bd3263f
commit
3ab9173b20
repos
@ -618,6 +618,7 @@ class Wm::Gui::Session_component : public Session_object<Gui::Session>,
|
||||
bool _resizeable = false;
|
||||
Area _requested_size { };
|
||||
bool _resize_requested = false;
|
||||
bool _close_requested = false;
|
||||
bool _has_alpha = false;
|
||||
Pointer::State _pointer_state;
|
||||
Point const _initial_pointer_pos { -1, -1 };
|
||||
@ -797,6 +798,11 @@ class Wm::Gui::Session_component : public Session_object<Gui::Session>,
|
||||
{
|
||||
_action.gen_screen_area_info(xml);
|
||||
|
||||
if (_close_requested) {
|
||||
xml.node("capture", [&] { xml.attribute("closed", "yes"); });
|
||||
return;
|
||||
}
|
||||
|
||||
auto virtual_capture_area = [&]
|
||||
{
|
||||
/*
|
||||
@ -1037,6 +1043,9 @@ class Wm::Gui::Session_component : public Session_object<Gui::Session>,
|
||||
_requested_size = size;
|
||||
_resize_requested = true;
|
||||
|
||||
if (_requested_size.count() == 0)
|
||||
_close_requested = true;
|
||||
|
||||
/* notify client */
|
||||
if (_info_rom.constructed())
|
||||
_info_rom->trigger_update();
|
||||
|
@ -275,20 +275,26 @@ class Gui::Connection : private Genode::Connection<Session>
|
||||
* to the window size as defined by the layouter.
|
||||
*
|
||||
* The returned rectangle may be undefined when a client of the window
|
||||
* manager has not defined a top-level view yet.
|
||||
* manager has not defined a top-level view yet. Once a window is got
|
||||
* closed, the returned rectangle is zero-sized.
|
||||
*/
|
||||
Window_result window()
|
||||
{
|
||||
Rect result { };
|
||||
bool closed = false;
|
||||
_with_info_xml([&] (Xml_node const &info) {
|
||||
Rect bb { }; /* bounding box of all captured rects */
|
||||
unsigned count = 0;
|
||||
info.for_each_sub_node("capture", [&] (Xml_node const &capture) {
|
||||
closed |= (capture.attribute_value("closed", false));
|
||||
bb = Rect::compound(bb, Rect::from_xml(capture));
|
||||
count++;
|
||||
});
|
||||
result = (count == 1) ? bb : Rect::from_xml(info);
|
||||
});
|
||||
if (closed)
|
||||
return Rect { };
|
||||
|
||||
return result.valid() ? Window_result { result }
|
||||
: Window_result { Undefined { } };
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user