Skip to content

Commit

Permalink
Change focus-stealing-prevention to be a switch
Browse files Browse the repository at this point in the history
  • Loading branch information
tarek-y-ismail committed Dec 18, 2024
1 parent 2e0efa0 commit 40c93fe
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions examples/miral-shell/shell_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,7 @@ int main(int argc, char const* argv[])

SpinnerSplash spinner;
InternalClientLauncher launcher;
auto constexpr default_focus_stealing_prevention = false;
auto const to_focus_stealing = [](bool focus_stealing_prevention)
{
if (focus_stealing_prevention)
return FocusStealing::prevent;
else
return FocusStealing::allow;
};
auto focus_stealing_prevention = to_focus_stealing(default_focus_stealing_prevention);
auto focus_stealing_prevention = FocusStealing::allow;
WindowManagerOptions window_managers
{
add_window_manager_policy<FloatingWindowManagerPolicy>("floating", spinner, launcher, shutdown_hook, focus_stealing_prevention),
Expand Down Expand Up @@ -142,17 +134,23 @@ int main(int argc, char const* argv[])
}
};

auto const to_focus_stealing = [](bool focus_stealing_prevention)
{
if (focus_stealing_prevention)
return FocusStealing::prevent;
else
return FocusStealing::allow;
};

return runner.run_with(
{
CursorTheme{"default:DMZ-White"},
WaylandExtensions{},
X11Support{},
ConfigureDecorations{},
pre_init(ConfigurationOption{[&](bool option)
{ focus_stealing_prevention = to_focus_stealing(option); },
"focus-stealing-prevention", "allow or prevent focus stealing",
default_focus_stealing_prevention}),
pre_init(ConfigurationOption{[&](bool is_set)
{ focus_stealing_prevention = to_focus_stealing(is_set); },
"focus-stealing-prevention", "allow or prevent focus stealing"}),
window_managers,
display_configuration_options,
external_client_launcher,
Expand Down

0 comments on commit 40c93fe

Please sign in to comment.