mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2025-11-05 13:29:50 -05:00
wayland-server: Add API to control globals visibility
Add a new API to let compositor decide whether or not a wl_global should be advertised to the clients via wl_registry_bind() or display_get_registry() By using its own filter, the compositor can decide which wl_global would be listed to clients. Compositors can use this mechanism to hide their own private interfaces that regular clients should not use. - Hiding interfaces that expose compositor implementation details makes it harder for clients to identify the compositor. Therefore clients are a little less likely to develop compositor-specific workarounds instead of reporting problems upstream. - Hiding can be used to diminish the problems from missing namespacing: if two compositors happen to use the same named global with different interfaces for their special-purpose clients, the client expecting the different interface would probably never see it advertised. Signed-off-by: Olivier Fourdan <ofourdan@redhat.com> Reviewed-by: Jonas Ådahl <jadahl@gmail.com> Reviewed-by: Yong Bakos <ybakos@humanoriented.com> Acked-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
This commit is contained in:
parent
2f72d0a8a8
commit
d915447365
2 changed files with 87 additions and 5 deletions
|
|
@ -28,6 +28,7 @@
|
|||
|
||||
#include <sys/types.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "wayland-util.h"
|
||||
#include "wayland-version.h"
|
||||
|
||||
|
|
@ -168,6 +169,30 @@ wl_global_create(struct wl_display *display,
|
|||
void
|
||||
wl_global_destroy(struct wl_global *global);
|
||||
|
||||
/** A filter function for wl_global objects
|
||||
*
|
||||
* \param client The client object
|
||||
* \param global The global object to show or hide
|
||||
* \param data The user data pointer
|
||||
*
|
||||
* A filter function enables the server to decide which globals to
|
||||
* advertise to each client.
|
||||
*
|
||||
* When a wl_global filter is set, the given callback funtion will be
|
||||
* called during wl_global advertisment and binding.
|
||||
*
|
||||
* This function should return true if the global object should be made
|
||||
* visible to the client or false otherwise.
|
||||
*/
|
||||
typedef bool (*wl_display_global_filter_func_t)(const struct wl_client *client,
|
||||
const struct wl_global *global,
|
||||
void *data);
|
||||
|
||||
void
|
||||
wl_display_set_global_filter(struct wl_display *display,
|
||||
wl_display_global_filter_func_t filter,
|
||||
void *data);
|
||||
|
||||
struct wl_client *
|
||||
wl_client_create(struct wl_display *display, int fd);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue