Skip to content

Commit

Permalink
xwayland: add lazy start config option (WayfireWM#2330)
Browse files Browse the repository at this point in the history
* xwayland: add lazy start config option

---------

Co-authored-by: Bruce Mills <[email protected]>
  • Loading branch information
dep4 and Bruce Mills authored Apr 13, 2024
1 parent d675db6 commit e0554e0
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 deletions.
14 changes: 13 additions & 1 deletion metadata/core.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,22 @@
<_name>Server</_name>
</desc>
</option>
<option name="xwayland" type="bool">
<option name="xwayland" type="string">
<_short>XWayland</_short>
<_long>Enables or disables XWayland support, which allows X11 applications to be used.</_long>
<default>true</default>
<desc>
<value>true</value>
<_name>Enable</_name>
</desc>
<desc>
<value>false</value>
<_name>Disable</_name>
</desc>
<desc>
<value>lazy</value>
<_name>Start when client connects</_name>
</desc>
</option>
<option name="max_render_time" type="int">
<_short>Maximum render time</_short>
Expand Down
6 changes: 3 additions & 3 deletions src/view/view-impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,10 @@ void wf::init_desktop_apis()
init_xdg_shell();
init_layer_shell();

wf::option_wrapper_t<bool> xwayland_enabled("core/xwayland");
if (xwayland_enabled == 1)
wf::option_wrapper_t<std::string> xwayland_enabled("core/xwayland");
if ((xwayland_enabled.value() == "true") || (xwayland_enabled.value() == "lazy"))
{
init_xwayland();
init_xwayland(xwayland_enabled.value() == "lazy");
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/view/view-impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ void adjust_geometry_for_gravity(wf::toplevel_state_t& desired_state, wf::dimens

/** Emit the map signal for the given view */
void init_xdg_shell();
void init_xwayland();
void init_xwayland(bool lazy);
void init_layer_shell();

std::string xwayland_get_display();
Expand Down
4 changes: 2 additions & 2 deletions src/view/xwayland.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ class xwayland_view_controller_t
static wlr_xwayland *xwayland_handle = nullptr;
#endif

void wf::init_xwayland()
void wf::init_xwayland(bool lazy)
{
#if WF_HAS_XWAYLAND
static wf::wl_listener_wrapper on_created;
Expand Down Expand Up @@ -252,7 +252,7 @@ void wf::init_xwayland()
});

xwayland_handle = wlr_xwayland_create(wf::get_core().display,
wf::get_core_impl().compositor, false);
wf::get_core_impl().compositor, lazy);

if (xwayland_handle)
{
Expand Down

0 comments on commit e0554e0

Please sign in to comment.