mirror of
https://github.com/swaywm/sway.git
synced 2025-01-21 16:26:37 +00:00
tree/view: add getters for sandbox properties
This commit is contained in:
parent
e3f0ba4cd9
commit
cff16d32f9
|
@ -221,6 +221,12 @@ const char *view_get_window_role(struct sway_view *view);
|
|||
|
||||
uint32_t view_get_window_type(struct sway_view *view);
|
||||
|
||||
const char *view_get_sandbox_engine(struct sway_view *view);
|
||||
|
||||
const char *view_get_sandbox_app_id(struct sway_view *view);
|
||||
|
||||
const char *view_get_sandbox_instance_id(struct sway_view *view);
|
||||
|
||||
const char *view_get_shell(struct sway_view *view);
|
||||
|
||||
void view_get_constraints(struct sway_view *view, double *min_width,
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include <wlr/types/wlr_foreign_toplevel_management_v1.h>
|
||||
#include <wlr/types/wlr_fractional_scale_v1.h>
|
||||
#include <wlr/types/wlr_output_layout.h>
|
||||
#include <wlr/types/wlr_security_context_v1.h>
|
||||
#include <wlr/types/wlr_server_decoration.h>
|
||||
#include <wlr/types/wlr_subcompositor.h>
|
||||
#include <wlr/types/wlr_xdg_decoration_v1.h>
|
||||
|
@ -154,6 +155,34 @@ uint32_t view_get_window_type(struct sway_view *view) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const struct wlr_security_context_v1_state *security_context_from_view(
|
||||
struct sway_view *view) {
|
||||
const struct wl_client *client =
|
||||
wl_resource_get_client(view->surface->resource);
|
||||
const struct wlr_security_context_v1_state *security_context =
|
||||
wlr_security_context_manager_v1_lookup_client(
|
||||
server.security_context_manager_v1, client);
|
||||
return security_context;
|
||||
}
|
||||
|
||||
const char *view_get_sandbox_engine(struct sway_view *view) {
|
||||
const struct wlr_security_context_v1_state *security_context =
|
||||
security_context_from_view(view);
|
||||
return security_context ? security_context->sandbox_engine : NULL;
|
||||
}
|
||||
|
||||
const char *view_get_sandbox_app_id(struct sway_view *view) {
|
||||
const struct wlr_security_context_v1_state *security_context =
|
||||
security_context_from_view(view);
|
||||
return security_context ? security_context->app_id : NULL;
|
||||
}
|
||||
|
||||
const char *view_get_sandbox_instance_id(struct sway_view *view) {
|
||||
const struct wlr_security_context_v1_state *security_context =
|
||||
security_context_from_view(view);
|
||||
return security_context ? security_context->instance_id : NULL;
|
||||
}
|
||||
|
||||
const char *view_get_shell(struct sway_view *view) {
|
||||
switch(view->type) {
|
||||
case SWAY_VIEW_XDG_SHELL:
|
||||
|
|
Loading…
Reference in a new issue