diff options
author | 2020-02-13 07:20:33 +0900 | |
---|---|---|
committer | 2020-02-17 21:58:05 +0100 | |
commit | 8608a1c38b4579b09042a52668d2198f22fffad8 (patch) | |
tree | 3a9c592ae73135e381b0ab9a500b741fba52fe65 | |
parent | Specify that output transform applies clockwise rotations (diff) | |
download | sway-8608a1c38b4579b09042a52668d2198f22fffad8.tar.gz sway-8608a1c38b4579b09042a52668d2198f22fffad8.tar.zst sway-8608a1c38b4579b09042a52668d2198f22fffad8.zip |
i3compat: add `window_type` to IPC response
i3 added these in i3/i3#3797
-rw-r--r-- | sway/ipc-json.c | 36 | ||||
-rw-r--r-- | sway/sway-ipc.7.scd | 2 |
2 files changed, 37 insertions, 1 deletions
diff --git a/sway/ipc-json.c b/sway/ipc-json.c index 2e75b595..19fdba11 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c | |||
@@ -85,6 +85,35 @@ static const char *ipc_json_output_transform_description(enum wl_output_transfor | |||
85 | return NULL; | 85 | return NULL; |
86 | } | 86 | } |
87 | 87 | ||
88 | #if HAVE_XWAYLAND | ||
89 | static const char *ipc_json_xwindow_type_description(enum atom_name window_type) { | ||
90 | switch (window_type) { | ||
91 | case NET_WM_WINDOW_TYPE_NORMAL: | ||
92 | return "normal"; | ||
93 | case NET_WM_WINDOW_TYPE_DIALOG: | ||
94 | return "dialog"; | ||
95 | case NET_WM_WINDOW_TYPE_UTILITY: | ||
96 | return "utility"; | ||
97 | case NET_WM_WINDOW_TYPE_TOOLBAR: | ||
98 | return "toolbar"; | ||
99 | case NET_WM_WINDOW_TYPE_SPLASH: | ||
100 | return "splash"; | ||
101 | case NET_WM_WINDOW_TYPE_MENU: | ||
102 | return "menu"; | ||
103 | case NET_WM_WINDOW_TYPE_DROPDOWN_MENU: | ||
104 | return "dropdown_menu"; | ||
105 | case NET_WM_WINDOW_TYPE_POPUP_MENU: | ||
106 | return "popup_menu"; | ||
107 | case NET_WM_WINDOW_TYPE_TOOLTIP: | ||
108 | return "tooltip"; | ||
109 | case NET_WM_WINDOW_TYPE_NOTIFICATION: | ||
110 | return "notification"; | ||
111 | default: | ||
112 | return "unknown"; | ||
113 | } | ||
114 | } | ||
115 | #endif | ||
116 | |||
88 | json_object *ipc_json_get_version(void) { | 117 | json_object *ipc_json_get_version(void) { |
89 | int major = 0, minor = 0, patch = 0; | 118 | int major = 0, minor = 0, patch = 0; |
90 | json_object *version = json_object_new_object(); | 119 | json_object *version = json_object_new_object(); |
@@ -452,6 +481,13 @@ static void ipc_json_describe_view(struct sway_container *c, json_object *object | |||
452 | json_object_object_add(window_props, "window_role", json_object_new_string(role)); | 481 | json_object_object_add(window_props, "window_role", json_object_new_string(role)); |
453 | } | 482 | } |
454 | 483 | ||
484 | uint32_t window_type = view_get_window_type(c->view); | ||
485 | if (window_type) { | ||
486 | json_object_object_add(window_props, "window_type", | ||
487 | json_object_new_string( | ||
488 | ipc_json_xwindow_type_description(window_type))); | ||
489 | } | ||
490 | |||
455 | json_object_object_add(object, "window_properties", window_props); | 491 | json_object_object_add(object, "window_properties", window_props); |
456 | } | 492 | } |
457 | #endif | 493 | #endif |
diff --git a/sway/sway-ipc.7.scd b/sway/sway-ipc.7.scd index 6725b255..ab61f864 100644 --- a/sway/sway-ipc.7.scd +++ b/sway/sway-ipc.7.scd | |||
@@ -382,7 +382,7 @@ node and will have the following properties: | |||
382 | |- window_properties | 382 | |- window_properties |
383 | : object | 383 | : object |
384 | : (Only xwayland views) An object containing the _title_, _class_, _instance_, | 384 | : (Only xwayland views) An object containing the _title_, _class_, _instance_, |
385 | _window\_role_, and _transient\_for_ for the view | 385 | _window\_role_, _window\_type_, and _transient\_for_ for the view |
386 | 386 | ||
387 | 387 | ||
388 | *Example Reply:* | 388 | *Example Reply:* |