Remove Gui::Session::session_control

This functionality has long been superseded by the window
manager/layouter.

Fixes 
This commit is contained in:
Norman Feske 2024-05-30 14:23:41 +02:00
parent a3a84b25e8
commit eca864175c
6 changed files with 8 additions and 153 deletions
repos
gems/src/server/wm
os
include/gui_session
src/server/nitpicker

@ -463,13 +463,6 @@ class Wm::Gui::Child_view : public View, private List<Child_view>::Element
};
struct Wm::Gui::Session_control_fn : Interface
{
virtual void session_control(char const *selector, Session::Session_control) = 0;
};
class Wm::Gui::Session_component : public Rpc_object<Gui::Session>,
private List<Session_component>::Element,
private Input_origin_changed_handler
@ -487,7 +480,6 @@ class Wm::Gui::Session_component : public Rpc_object<Gui::Session>,
Gui::Connection _session { _env, _session_label.string() };
Window_registry &_window_registry;
Session_control_fn &_session_control_fn;
Tslab<Top_level_view, 8000> _top_level_view_alloc;
Tslab<Child_view, 6000> _child_view_alloc;
List<Top_level_view> _top_level_views { };
@ -793,14 +785,12 @@ class Wm::Gui::Session_component : public Rpc_object<Gui::Session>,
Allocator &session_alloc,
Session_label const &session_label,
Pointer::Tracker &pointer_tracker,
Click_handler &click_handler,
Session_control_fn &session_control_fn)
Click_handler &click_handler)
:
_env(env),
_session_label(session_label),
_ram(ram),
_window_registry(window_registry),
_session_control_fn(session_control_fn),
_top_level_view_alloc(&session_alloc),
_child_view_alloc(&session_alloc),
_input_session_cap(env.ep().manage(_input_session)),
@ -1068,19 +1058,11 @@ class Wm::Gui::Session_component : public Rpc_object<Gui::Session>,
}
void focus(Genode::Capability<Gui::Session>) override { }
void session_control(Label suffix, Session_control operation) override
{
Session_label const selector(_session_label, suffix);
_session_control_fn.session_control(selector.string(), operation);
}
};
class Wm::Gui::Root : public Genode::Rpc_object<Genode::Typed_root<Session> >,
public Decorator_content_callback,
public Session_control_fn
public Decorator_content_callback
{
private:
@ -1232,7 +1214,7 @@ class Wm::Gui::Root : public Genode::Rpc_object<Genode::Typed_root<Session> >,
Session_component(_env, _ram, _window_registry,
_md_alloc, session_label,
_pointer_tracker,
_click_handler, *this);
_click_handler);
_sessions.insert(session);
return _env.ep().manage(*session);
}
@ -1354,49 +1336,6 @@ class Wm::Gui::Root : public Genode::Rpc_object<Genode::Typed_root<Session> >,
}
/**********************************
** Session_control_fn interface **
**********************************/
void session_control(char const *selector, Session::Session_control operation) override
{
for (Session_component *s = _sessions.first(); s; s = s->next()) {
if (!s->matches_session_label(selector))
continue;
switch (operation) {
case Session::SESSION_CONTROL_SHOW:
s->hidden(false);
break;
case Session::SESSION_CONTROL_HIDE:
s->hidden(true);
break;
case Session::SESSION_CONTROL_TO_FRONT:
/* post focus request to the layouter */
Genode::Reporter::Xml_generator
xml(_focus_request_reporter, [&] () {
xml.attribute("label", s->session_label().string());
xml.attribute("id", ++_focus_request_cnt);
});
break;
}
}
_window_registry.flush();
/*
* Forward the request to the GUI server's control session to apply
* the show/hide/to-front operations on "direct" GUI sessions.
*/
_focus_gui_session.session_control(selector, operation);
}
/******************************************
** Decorator_content_callback interface **
******************************************/

@ -86,9 +86,6 @@ class Gui::Session_client : public Genode::Rpc_client<Session>
void focus(Gui::Session_capability session) override {
call<Rpc_focus>(session); }
void session_control(Label selector, Session_control operation) override {
call<Rpc_session_control>(selector, operation); }
/**
* Enqueue command to command buffer
*

@ -301,21 +301,6 @@ struct Gui::Session : Genode::Session
typedef Genode::String<160> Label;
enum Session_control { SESSION_CONTROL_HIDE, SESSION_CONTROL_SHOW,
SESSION_CONTROL_TO_FRONT };
/**
* Perform control operation on one or multiple sessions
*
* The 'label' is used to select the sessions, on which the 'operation' is
* performed. The GUI server creates a selector string by concatenating the
* caller's session label with the supplied 'label' argument. A session is
* selected if its label starts with the selector string. Thereby, the
* operation is limited to the caller session or any child session of the
* caller.
*/
virtual void session_control(Label, Session_control) { }
/**
* Return number of bytes needed for virtual framebuffer of specified size
*/
@ -348,7 +333,6 @@ struct Gui::Session : Genode::Session
GENODE_RPC(Rpc_mode, Framebuffer::Mode, mode);
GENODE_RPC(Rpc_mode_sigh, void, mode_sigh, Genode::Signal_context_capability);
GENODE_RPC(Rpc_focus, void, focus, Genode::Capability<Session>);
GENODE_RPC(Rpc_session_control, void, session_control, Label, Session_control);
GENODE_RPC_THROW(Rpc_buffer, void, buffer, GENODE_TYPE_LIST(Out_of_ram, Out_of_caps),
Framebuffer::Mode, bool);
@ -356,7 +340,7 @@ struct Gui::Session : Genode::Session
Rpc_create_view, Rpc_destroy_view, Rpc_view_handle,
Rpc_view_capability, Rpc_release_view_handle,
Rpc_command_dataspace, Rpc_execute, Rpc_mode,
Rpc_mode_sigh, Rpc_buffer, Rpc_focus, Rpc_session_control);
Rpc_mode_sigh, Rpc_buffer, Rpc_focus);
};
#endif /* _INCLUDE__GUI_SESSION__GUI_SESSION_H_ */

@ -434,26 +434,6 @@ void Gui_session::focus(Capability<Gui::Session> session_cap)
}
void Gui_session::session_control(Label suffix, Session_control control)
{
switch (control) {
case SESSION_CONTROL_HIDE:
_visibility_controller.hide_matching_sessions(label(), suffix);
break;
case SESSION_CONTROL_SHOW:
_visibility_controller.show_matching_sessions(label(), suffix);
break;
case SESSION_CONTROL_TO_FRONT:
_view_stack.to_front(Label(label(), suffix).string());
break;
}
_hover_updater.update_hover();
}
Dataspace_capability Gui_session::realloc_buffer(Framebuffer::Mode mode, bool use_alpha)
{
Ram_quota const next_buffer_size { Chunky_texture<Pixel>::calc_num_bytes(mode.area, use_alpha) };

@ -34,7 +34,6 @@
namespace Nitpicker {
class Visibility_controller;
class Gui_session;
class View;
@ -42,16 +41,6 @@ namespace Nitpicker {
}
struct Nitpicker::Visibility_controller : Interface
{
using Suffix = Gui::Session::Label;
virtual void hide_matching_sessions(Session_label const &, Suffix const &) = 0;
virtual void show_matching_sessions(Session_label const &, Suffix const &) = 0;
};
class Nitpicker::Gui_session : public Session_object<Gui::Session>,
public View_owner,
public Buffer_provider,
@ -139,8 +128,6 @@ class Nitpicker::Gui_session : public Session_object<Gui::Session>,
Reporter &_focus_reporter;
Visibility_controller &_visibility_controller;
Gui_session *_forwarded_focus = nullptr;
/**
@ -179,8 +166,7 @@ class Nitpicker::Gui_session : public Session_object<Gui::Session>,
View &pointer_origin,
View &builtin_background,
bool provides_default_bg,
Reporter &focus_reporter,
Visibility_controller &visibility_controller)
Reporter &focus_reporter)
:
Session_object(env.ep(), resources, label, diag),
_env(env),
@ -195,8 +181,7 @@ class Nitpicker::Gui_session : public Session_object<Gui::Session>,
_input_session_cap(_env.ep().manage(_input_session_component)),
_provides_default_bg(provides_default_bg),
_view_handle_registry(_session_alloc),
_focus_reporter(focus_reporter),
_visibility_controller(visibility_controller)
_focus_reporter(focus_reporter)
{ }
~Gui_session()
@ -383,8 +368,6 @@ class Nitpicker::Gui_session : public Session_object<Gui::Session>,
void focus(Capability<Gui::Session> session_cap) override;
void session_control(Label suffix, Session_control control) override;
/*******************************
** Buffer_provider interface **

@ -66,8 +66,7 @@ void Framebuffer::Session_component::refresh(int x, int y, int w, int h)
** Implementation of the GUI service **
***************************************/
class Nitpicker::Gui_root : public Root_component<Gui_session>,
public Visibility_controller
class Nitpicker::Gui_root : public Root_component<Gui_session>
{
private:
@ -98,7 +97,7 @@ class Nitpicker::Gui_root : public Root_component<Gui_session>,
session_diag_from_args(args), _view_stack,
_focus_updater, _hover_updater, _pointer_origin,
_builtin_background, provides_default_bg,
_focus_reporter, *this);
_focus_reporter);
session->apply_session_policy(_config.xml(), _domain_registry);
_session_list.insert(session);
@ -167,33 +166,6 @@ class Nitpicker::Gui_root : public Root_component<Gui_session>,
_focus_reporter(focus_reporter), _focus_updater(focus_updater),
_hover_updater(hover_updater)
{ }
/*************************************
** Visibility_controller interface **
*************************************/
void _session_visibility(Session_label const &label, Suffix const &suffix,
bool visible)
{
Gui::Session::Label const selector(label, suffix);
for (Gui_session *s = _session_list.first(); s; s = s->next())
if (s->matches_session_label(selector))
s->visible(visible);
_view_stack.update_all_views();
}
void hide_matching_sessions(Session_label const &label, Suffix const &suffix) override
{
_session_visibility(label, suffix, false);
}
void show_matching_sessions(Session_label const &label, Suffix const &suffix) override
{
_session_visibility(label, suffix, true);
}
};