You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently in the FDO Wayland platform plug-in we have code that checks which shell protocol is being used, every time that is needed. Like this:
if (wl_data.xdg_shell) {
// do something when we use the xdg_wm_base protocol
} elseif (wl_data.fshell) {
// do something else when using the zwp_fullscreen_shell_v1 protocol
} elseif (wl_data.shell) {
// and something different for the wl_shell_protocol
} else {
g_assert_not_reached();
}
It would be better to avoid duplicating this logic everywhere, and instead:
Have a list of functions for each operation used from the different protocols (initialize surface, enter fullscreen, exit fullscreen, deinitialize surface, set title, etc.)
This can a struct shell_operations with a function pointer for each operation.
For each shell protocol, have a static const instance of the struct with the function pointers set to the corresponding functions.
Have the notion of “current shell protocol being used”.
This can be a pointer to one of the struct shell_operations, its value determined at runtime depending on which protocol(s) the Wayland compositor supports.
Instead of Wayland protocol functions directly, do the calls through the struct with callbacks pointed to as “current shell protocol”.
The text was updated successfully, but these errors were encountered:
Currently in the
FDOWayland platform plug-in we have code that checks which shell protocol is being used, every time that is needed. Like this:It would be better to avoid duplicating this logic everywhere, and instead:
struct shell_operations
with a function pointer for each operation.static const
instance of thestruct
with the function pointers set to the corresponding functions.struct shell_operations
, its value determined at runtime depending on which protocol(s) the Wayland compositor supports.struct
with callbacks pointed to as “current shell protocol”.The text was updated successfully, but these errors were encountered: