The main() program
The main() program from miral-shell looks like this:
#include <linux/input.h>
#include <unistd.h>
#include <boost/filesystem.hpp>
int main(
int argc,
char const* argv[])
{
std::function<void()> shutdown_hook{[]{}};
{
add_window_manager_policy<FloatingWindowManagerPolicy>("floating", spinner, launcher, shutdown_hook),
add_window_manager_policy<TilingWindowManagerPolicy>("tiling", spinner, launcher),
};
std::string terminal_cmd{"weston-terminal"};
auto const quit_on_ctrl_alt_bksp = [&](
MirEvent const* event)
{
return false;
return false;
return false;
return false;
{
case KEY_BACKSPACE:
runner.stop();
return true;
case KEY_T:
external_client_launcher.
launch({terminal_cmd});
return false;
case KEY_X:
return false;
default:
return false;
};
};
return runner.run_with(
{
window_managers,
external_client_launcher,
launcher,
config_keymap,
debug_extensions,
"shell-terminal-emulator", "terminal emulator to use", terminal_cmd}
});
}
This shell is providing FloatingWindowManagerPolicy, TilingWindowManagerPolicy and SpinnerSplash. The rest is from MirAL.
If you look for the corresponding code in lp:qtmir and lp:mir you’ll find it less clear, more verbose and scattered over multiple files.
A shell has to provide a window management policy (miral-shell provides two: FloatingWindowManagerPolicy and TilingWindowManagerPolicy). A window management policy needs to implement the miral::WindowManagementPolicy interface for handling a set of window management events.
The way these events are handled determines the behaviour of the shell.
The miral::WindowManagerTools interface provides the principle methods for a window management policy to control Mir.
auto pre_init(CommandLineOption const &clo) -> CommandLineOption
Update the option to be called back before Mir initialization starts.
Definition: external_client.h:32
Mir Abstraction Layer.
Definition: floating_window_manager.h:29
void display_configuration_options(mir::Server &server)
Load a keymap.
Definition: keymap.h:30
Definition: window_management_options.h:53
Wrapper for running an internal Mir client at startup.
Definition: internal_client.h:41
void add_stop_callback(std::function< void()> const &stop_callback)
Add a callback to be invoked when the server is about to stop, If multiple callbacks are added they w...
void font_file(std::string const &font_file)
Definition: wallpaper_config.cpp:49
Allow debug extension APIs to be enabled and disabled.
Definition: debug_extension.h:29
int main(int argc, char const *argv[])
Definition: kiosk_main.cpp:83
Definition: internal_client.h:70
void launch(std::vector< std::string > const &command_line) const
Add a user configuration option for X11 support.
Definition: x11_support.h:30
Load an X-cursor theme, either the supplied default, or through the –cursor-theme config option.
Definition: cursor_theme.h:29
Add a user configuration option to Mir's option handling. By default the callback will be invoked fol...
Definition: command_line_option.h:40
Definition: append_event_filter.h:31
Enable configuration of the Wayland extensions enabled at runtime.
Definition: wayland_extensions.h:48
Runner for applying initialization options to Mir.
Definition: runner.h:39
void launch_using_x11(std::vector< std::string > const &command_line) const
Launch using only X11 support (if enabled). For the occasions it is desired to coerce applications in...
Copyright © 2012-2024
Canonical Ltd.
Generated on Tue May 7 06:11:54 UTC 2024
This documentation is licensed under the GPL version 2 or 3.