diff options
-rw-r--r-- | include/sway/server.h | 1 | ||||
-rw-r--r-- | protocols/meson.build | 1 | ||||
-rw-r--r-- | sway/ipc-json.c | 25 | ||||
-rw-r--r-- | sway/server.c | 3 |
4 files changed, 30 insertions, 0 deletions
diff --git a/include/sway/server.h b/include/sway/server.h index 6a5a60c8..2d796d04 100644 --- a/include/sway/server.h +++ b/include/sway/server.h | |||
@@ -110,6 +110,7 @@ struct sway_server { | |||
110 | struct wlr_input_method_manager_v2 *input_method; | 110 | struct wlr_input_method_manager_v2 *input_method; |
111 | struct wlr_text_input_manager_v3 *text_input; | 111 | struct wlr_text_input_manager_v3 *text_input; |
112 | struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager; | 112 | struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager; |
113 | struct wlr_content_type_manager_v1 *content_type_manager_v1; | ||
113 | 114 | ||
114 | struct wlr_xdg_activation_v1 *xdg_activation_v1; | 115 | struct wlr_xdg_activation_v1 *xdg_activation_v1; |
115 | struct wl_listener xdg_activation_v1_request_activate; | 116 | struct wl_listener xdg_activation_v1_request_activate; |
diff --git a/protocols/meson.build b/protocols/meson.build index f18ab6f4..71e700bb 100644 --- a/protocols/meson.build +++ b/protocols/meson.build | |||
@@ -16,6 +16,7 @@ protocols = [ | |||
16 | wl_protocol_dir / 'unstable/pointer-constraints/pointer-constraints-unstable-v1.xml', | 16 | wl_protocol_dir / 'unstable/pointer-constraints/pointer-constraints-unstable-v1.xml', |
17 | wl_protocol_dir / 'unstable/tablet/tablet-unstable-v2.xml', | 17 | wl_protocol_dir / 'unstable/tablet/tablet-unstable-v2.xml', |
18 | wl_protocol_dir / 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml', | 18 | wl_protocol_dir / 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml', |
19 | wl_protocol_dir / 'staging/content-type/content-type-v1.xml', | ||
19 | 'wlr-layer-shell-unstable-v1.xml', | 20 | 'wlr-layer-shell-unstable-v1.xml', |
20 | 'idle.xml', | 21 | 'idle.xml', |
21 | 'wlr-input-inhibitor-unstable-v1.xml', | 22 | 'wlr-input-inhibitor-unstable-v1.xml', |
diff --git a/sway/ipc-json.c b/sway/ipc-json.c index d757f21f..73a3d376 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <libevdev/libevdev.h> | 4 | #include <libevdev/libevdev.h> |
5 | #include <stdio.h> | 5 | #include <stdio.h> |
6 | #include <wlr/backend/libinput.h> | 6 | #include <wlr/backend/libinput.h> |
7 | #include <wlr/types/wlr_content_type_v1.h> | ||
7 | #include <wlr/types/wlr_output.h> | 8 | #include <wlr/types/wlr_output.h> |
8 | #include <xkbcommon/xkbcommon.h> | 9 | #include <xkbcommon/xkbcommon.h> |
9 | #include "config.h" | 10 | #include "config.h" |
@@ -201,6 +202,20 @@ static const char *ipc_json_user_idle_inhibitor_description(enum sway_idle_inhib | |||
201 | return NULL; | 202 | return NULL; |
202 | } | 203 | } |
203 | 204 | ||
205 | static const char *ipc_json_content_type_description(enum wp_content_type_v1_type type) { | ||
206 | switch (type) { | ||
207 | case WP_CONTENT_TYPE_V1_TYPE_NONE: | ||
208 | return "none"; | ||
209 | case WP_CONTENT_TYPE_V1_TYPE_PHOTO: | ||
210 | return "photo"; | ||
211 | case WP_CONTENT_TYPE_V1_TYPE_VIDEO: | ||
212 | return "video"; | ||
213 | case WP_CONTENT_TYPE_V1_TYPE_GAME: | ||
214 | return "game"; | ||
215 | } | ||
216 | return NULL; | ||
217 | } | ||
218 | |||
204 | json_object *ipc_json_get_version(void) { | 219 | json_object *ipc_json_get_version(void) { |
205 | int major = 0, minor = 0, patch = 0; | 220 | int major = 0, minor = 0, patch = 0; |
206 | json_object *version = json_object_new_object(); | 221 | json_object *version = json_object_new_object(); |
@@ -602,6 +617,16 @@ static void ipc_json_describe_view(struct sway_container *c, json_object *object | |||
602 | 617 | ||
603 | json_object_object_add(object, "idle_inhibitors", idle_inhibitors); | 618 | json_object_object_add(object, "idle_inhibitors", idle_inhibitors); |
604 | 619 | ||
620 | enum wp_content_type_v1_type content_type = WP_CONTENT_TYPE_V1_TYPE_NONE; | ||
621 | if (c->view->surface != NULL) { | ||
622 | content_type = wlr_surface_get_content_type_v1(server.content_type_manager_v1, | ||
623 | c->view->surface); | ||
624 | } | ||
625 | if (content_type != WP_CONTENT_TYPE_V1_TYPE_NONE) { | ||
626 | json_object_object_add(object, "content_type", | ||
627 | json_object_new_string(ipc_json_content_type_description(content_type))); | ||
628 | } | ||
629 | |||
605 | #if HAVE_XWAYLAND | 630 | #if HAVE_XWAYLAND |
606 | if (c->view->type == SWAY_VIEW_XWAYLAND) { | 631 | if (c->view->type == SWAY_VIEW_XWAYLAND) { |
607 | json_object_object_add(object, "window", | 632 | json_object_object_add(object, "window", |
diff --git a/sway/server.c b/sway/server.c index fd9504cc..ef7d4c4b 100644 --- a/sway/server.c +++ b/sway/server.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <wlr/config.h> | 11 | #include <wlr/config.h> |
12 | #include <wlr/render/wlr_renderer.h> | 12 | #include <wlr/render/wlr_renderer.h> |
13 | #include <wlr/types/wlr_compositor.h> | 13 | #include <wlr/types/wlr_compositor.h> |
14 | #include <wlr/types/wlr_content_type_v1.h> | ||
14 | #include <wlr/types/wlr_data_control_v1.h> | 15 | #include <wlr/types/wlr_data_control_v1.h> |
15 | #include <wlr/types/wlr_drm_lease_v1.h> | 16 | #include <wlr/types/wlr_drm_lease_v1.h> |
16 | #include <wlr/types/wlr_drm.h> | 17 | #include <wlr/types/wlr_drm.h> |
@@ -205,6 +206,8 @@ bool server_init(struct sway_server *server) { | |||
205 | wlr_primary_selection_v1_device_manager_create(server->wl_display); | 206 | wlr_primary_selection_v1_device_manager_create(server->wl_display); |
206 | wlr_viewporter_create(server->wl_display); | 207 | wlr_viewporter_create(server->wl_display); |
207 | wlr_single_pixel_buffer_manager_v1_create(server->wl_display); | 208 | wlr_single_pixel_buffer_manager_v1_create(server->wl_display); |
209 | server->content_type_manager_v1 = | ||
210 | wlr_content_type_manager_v1_create(server->wl_display, 1); | ||
208 | 211 | ||
209 | struct wlr_xdg_foreign_registry *foreign_registry = | 212 | struct wlr_xdg_foreign_registry *foreign_registry = |
210 | wlr_xdg_foreign_registry_create(server->wl_display); | 213 | wlr_xdg_foreign_registry_create(server->wl_display); |