macro_rules! default_environment { ($env_name:ident, desktop $(,fields = [$($fname:ident : $fty:ty),* $(,)?])? $(,singles = [$($sty:ty => $sname: ident),* $(,)?])? $(,multis = [$($mty:ty => $mname:ident),* $(,)?])? $(,)? ) => { ... }; ($env_name:ident $(,fields = [$($fname:ident : $fty:ty),* $(,)?])? $(,singles = [$($sty:ty => $sname:ident),* $(,)?])? $(,multis = [$($mty:ty => $mname:ident),* $(,)?])? $(,)? ) => { ... }; }
Expand description
Declare a batteries-included SCTK environment
Similar to the environment! macro, but creates the type for you and
includes all the handlers provided by SCTK, for use with the rest of the library. Its sister
macro new_default_environment! needs to be used to
initialize it.
This includes handlers for the following globals:
wl_compositoras aSimpleGlobalwl_data_device_manageras aDataDeviceHandlerwl_outputwith theOutputHandlerwl_seatwith theSeatHandlerwl_subcompositoras aSimpleGlobalwl_shmas aShmHandlerzwpandgtkprimary selection device manager as aPrimarySelectionHandler
If you don’t need to add anything more, using it is as simple as:
default_environment!(MyEnv);The macro also provides some presets including more globals depending on your use-case:
- the
desktoppreset, invoked asdefault_environment!(MyEnv, desktop);additionally includes:xdg_shellandwl_shellwith theShellHandlerxdg_decoration_manageras aSimpleGlobal
You can also add the fields argument to add additional fields to the generated struct, and
the singles and multis arguments to route additional globals like with the
environment! macro. These three fields are optional, but they must
appear in this order, and after the optional preset
default_environment!(MyEnv,
desktop, // the chosen preset, can be ommited
fields=[
somefield: u32,
otherfield: String,
],
singles=[
// Add some routing here
],
multis=[
// add some routing here
]
);