The wpe_input_xkb_context_get_default call manages a singleton WPE input (XKB) context for an implementer to easily fetch. However, if the underlying request of building an XKB context (xkb_context_new) fails, a singleton will be created with a managed NULL context. The only safe way for an implementer to utilize other WPE input calls is to call wpe_input_xkb_context_get_context and ensure the returned context is not NULL (a practice not really used). And even if there was a way to recover the environment to ensure xkb_context_new can return a value context, there is no way to rebuild the singleton.
To prevent such a state, this commit tweaks the
wpe_input_xkb_context_get_default call to only store/return a WPE input (XKB) context if the underlying XKB context could be created. This way, implements can know immediately when attempting to prepare WPE input if the environment does not supported input at this time.
The
wpe_input_xkb_context_get_default
call manages a singleton WPE input (XKB) context for an implementer to easily fetch. However, if the underlying request of building an XKB context (xkb_context_new
) fails, a singleton will be created with a managedNULL
context. The only safe way for an implementer to utilize other WPE input calls is to callwpe_input_xkb_context_get_context
and ensure the returned context is notNULL
(a practice not really used). And even if there was a way to recover the environment to ensurexkb_context_new
can return a value context, there is no way to rebuild the singleton.To prevent such a state, this commit tweaks the
wpe_input_xkb_context_get_default
call to only store/return a WPE input (XKB) context if the underlying XKB context could be created. This way, implements can know immediately when attempting to prepare WPE input if the environment does not supported input at this time.