mirror of
https://codeberg.org/dwl/dwl.git
synced 2025-10-26 09:44:14 +00:00
add support for security-context-v1
This commit is contained in:
parent
ab4cb6e283
commit
0be928b222
31
dwl.c
31
dwl.c
@ -59,6 +59,7 @@
|
|||||||
#include <wlr/types/wlr_xdg_decoration_v1.h>
|
#include <wlr/types/wlr_xdg_decoration_v1.h>
|
||||||
#include <wlr/types/wlr_xdg_output_v1.h>
|
#include <wlr/types/wlr_xdg_output_v1.h>
|
||||||
#include <wlr/types/wlr_xdg_shell.h>
|
#include <wlr/types/wlr_xdg_shell.h>
|
||||||
|
#include <wlr/types/wlr_security_context_v1.h>
|
||||||
#include <wlr/util/log.h>
|
#include <wlr/util/log.h>
|
||||||
#include <wlr/util/region.h>
|
#include <wlr/util/region.h>
|
||||||
#include <xkbcommon/xkbcommon.h>
|
#include <xkbcommon/xkbcommon.h>
|
||||||
@ -66,6 +67,7 @@
|
|||||||
#include <wlr/xwayland.h>
|
#include <wlr/xwayland.h>
|
||||||
#include <xcb/xcb.h>
|
#include <xcb/xcb.h>
|
||||||
#include <xcb/xcb_icccm.h>
|
#include <xcb/xcb_icccm.h>
|
||||||
|
#include <wlr/xwayland/shell.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
@ -387,6 +389,10 @@ static struct wlr_pointer_constraints_v1 *pointer_constraints;
|
|||||||
static struct wlr_relative_pointer_manager_v1 *relative_pointer_mgr;
|
static struct wlr_relative_pointer_manager_v1 *relative_pointer_mgr;
|
||||||
static struct wlr_pointer_constraint_v1 *active_constraint;
|
static struct wlr_pointer_constraint_v1 *active_constraint;
|
||||||
|
|
||||||
|
static struct wlr_security_context_manager_v1 *security_context_manager;
|
||||||
|
static struct wlr_export_dmabuf_manager_v1 *export_dmabuf_manager;
|
||||||
|
static struct wlr_screencopy_manager_v1 *screencopy_manager;
|
||||||
|
|
||||||
static struct wlr_cursor *cursor;
|
static struct wlr_cursor *cursor;
|
||||||
static struct wlr_xcursor_manager *cursor_mgr;
|
static struct wlr_xcursor_manager *cursor_mgr;
|
||||||
|
|
||||||
@ -2441,6 +2447,24 @@ setsel(struct wl_listener *listener, void *data)
|
|||||||
wlr_seat_set_selection(seat, event->source, event->serial);
|
wlr_seat_set_selection(seat, event->source, event->serial);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
filter_global(const struct wl_client *client,
|
||||||
|
const struct wl_global *global, void *data) {
|
||||||
|
const struct wlr_security_context_v1_state *security_context;
|
||||||
|
#ifdef XWAYLAND
|
||||||
|
if (global == xwayland->shell_v1->global && client == xwayland->server->client) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
security_context = wlr_security_context_manager_v1_lookup_client(security_context_manager, (struct wl_client *)client);
|
||||||
|
if (security_context != NULL) {
|
||||||
|
if (global == screencopy_manager->global || global == export_dmabuf_manager->global) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
setup(void)
|
setup(void)
|
||||||
{
|
{
|
||||||
@ -2458,6 +2482,8 @@ setup(void)
|
|||||||
dpy = wl_display_create();
|
dpy = wl_display_create();
|
||||||
event_loop = wl_display_get_event_loop(dpy);
|
event_loop = wl_display_get_event_loop(dpy);
|
||||||
|
|
||||||
|
wl_display_set_global_filter(dpy, filter_global,NULL);
|
||||||
|
|
||||||
/* The backend is a wlroots feature which abstracts the underlying input and
|
/* The backend is a wlroots feature which abstracts the underlying input and
|
||||||
* output hardware. The autocreate option will choose the most suitable
|
* output hardware. The autocreate option will choose the most suitable
|
||||||
* backend based on the current environment, such as opening an X11 window
|
* backend based on the current environment, such as opening an X11 window
|
||||||
@ -2514,9 +2540,10 @@ setup(void)
|
|||||||
compositor = wlr_compositor_create(dpy, 6, drw);
|
compositor = wlr_compositor_create(dpy, 6, drw);
|
||||||
wlr_subcompositor_create(dpy);
|
wlr_subcompositor_create(dpy);
|
||||||
wlr_data_device_manager_create(dpy);
|
wlr_data_device_manager_create(dpy);
|
||||||
wlr_export_dmabuf_manager_v1_create(dpy);
|
export_dmabuf_manager = wlr_export_dmabuf_manager_v1_create(dpy);
|
||||||
wlr_screencopy_manager_v1_create(dpy);
|
screencopy_manager = wlr_screencopy_manager_v1_create(dpy);
|
||||||
wlr_data_control_manager_v1_create(dpy);
|
wlr_data_control_manager_v1_create(dpy);
|
||||||
|
security_context_manager = wlr_security_context_manager_v1_create(dpy);
|
||||||
wlr_primary_selection_v1_device_manager_create(dpy);
|
wlr_primary_selection_v1_device_manager_create(dpy);
|
||||||
wlr_viewporter_create(dpy);
|
wlr_viewporter_create(dpy);
|
||||||
wlr_single_pixel_buffer_manager_v1_create(dpy);
|
wlr_single_pixel_buffer_manager_v1_create(dpy);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user