Skip to content

Commit

Permalink
Demonstrate using the window decoration strategy (#3459)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlanGriffiths authored Jul 8, 2024
2 parents c751ed7 + 965736d commit 96738e0
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
26 changes: 26 additions & 0 deletions examples/miral-shell/shell_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,38 @@
#include <miral/internal_client.h>
#include <miral/command_line_option.h>
#include <miral/cursor_theme.h>
#include <miral/decorations.h>
#include <miral/keymap.h>
#include <miral/toolkit_event.h>
#include <miral/x11_support.h>
#include <miral/wayland_extensions.h>

#include <xkbcommon/xkbcommon-keysyms.h>

#include <cstring>

namespace
{
struct ConfigureDecorations
{
miral::Decorations const decorations{[]
{
if (auto const strategy = getenv("MIRAL_SHELL_DECORATIONS"))
{
if (strcmp(strategy, "always-ssd") == 0) return miral::Decorations::always_ssd();
if (strcmp(strategy, "prefer-ssd") == 0) return miral::Decorations::prefer_ssd();
if (strcmp(strategy, "always-csd") == 0) return miral::Decorations::always_csd();
}
return miral::Decorations::prefer_csd();
}()};

void operator()(mir::Server& s) const
{
decorations(s);
}
};
}

int main(int argc, char const* argv[])
{
using namespace miral;
Expand Down Expand Up @@ -113,6 +138,7 @@ int main(int argc, char const* argv[])
CursorTheme{"default:DMZ-White"},
WaylandExtensions{},
X11Support{},
ConfigureDecorations{},
window_managers,
display_configuration_options,
external_client_launcher,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,8 @@ auto mf::get_standard_extensions() -> std::vector<std::string>
mw::TextInputManagerV1::interface_name,
mw::TextInputManagerV2::interface_name,
mw::TextInputManagerV3::interface_name,
mw::MirShellV1::interface_name};
mw::MirShellV1::interface_name,
mw::XdgDecorationManagerV1::interface_name};
}

auto mf::get_supported_extensions() -> std::vector<std::string>
Expand Down

0 comments on commit 96738e0

Please sign in to comment.