diff options
author | 2020-02-16 15:14:45 +0900 | |
---|---|---|
committer | 2020-02-17 21:58:05 +0100 | |
commit | d2cab83833691fdde1fbb5b2e4fb0a9786e39e47 (patch) | |
tree | 3081c34be38c7e399c29150c6b0278ff0ee9742b | |
parent | i3compat: add `window_type` to IPC response (diff) | |
download | sway-d2cab83833691fdde1fbb5b2e4fb0a9786e39e47.tar.gz sway-d2cab83833691fdde1fbb5b2e4fb0a9786e39e47.tar.zst sway-d2cab83833691fdde1fbb5b2e4fb0a9786e39e47.zip |
i3compat: add `window_type` to IPC response
i3 added these in i3/i3#3797
-rw-r--r-- | sway/ipc-json.c | 57 |
1 files changed, 32 insertions, 25 deletions
diff --git a/sway/ipc-json.c b/sway/ipc-json.c index 19fdba11..7d3091dd 100644 --- a/sway/ipc-json.c +++ b/sway/ipc-json.c | |||
@@ -86,31 +86,38 @@ static const char *ipc_json_output_transform_description(enum wl_output_transfor | |||
86 | } | 86 | } |
87 | 87 | ||
88 | #if HAVE_XWAYLAND | 88 | #if HAVE_XWAYLAND |
89 | static const char *ipc_json_xwindow_type_description(enum atom_name window_type) { | 89 | static const char *ipc_json_xwindow_type_description(struct sway_view *view) { |
90 | switch (window_type) { | 90 | struct wlr_xwayland_surface *surface = view->wlr_xwayland_surface; |
91 | case NET_WM_WINDOW_TYPE_NORMAL: | 91 | struct sway_xwayland *xwayland = &server.xwayland; |
92 | return "normal"; | 92 | |
93 | case NET_WM_WINDOW_TYPE_DIALOG: | 93 | for (size_t i = 0; i < surface->window_type_len; ++i) { |
94 | return "dialog"; | 94 | xcb_atom_t type = surface->window_type[i]; |
95 | case NET_WM_WINDOW_TYPE_UTILITY: | 95 | if (type == xwayland->atoms[NET_WM_WINDOW_TYPE_NORMAL]) { |
96 | return "utility"; | 96 | return "normal"; |
97 | case NET_WM_WINDOW_TYPE_TOOLBAR: | 97 | } else if (type == xwayland->atoms[NET_WM_WINDOW_TYPE_DIALOG]) { |
98 | return "toolbar"; | 98 | return "dialog"; |
99 | case NET_WM_WINDOW_TYPE_SPLASH: | 99 | } else if (type == xwayland->atoms[NET_WM_WINDOW_TYPE_UTILITY]) { |
100 | return "splash"; | 100 | return "utility"; |
101 | case NET_WM_WINDOW_TYPE_MENU: | 101 | } else if (type == xwayland->atoms[NET_WM_WINDOW_TYPE_TOOLBAR]) { |
102 | return "menu"; | 102 | return "toolbar"; |
103 | case NET_WM_WINDOW_TYPE_DROPDOWN_MENU: | 103 | } else if (type == xwayland->atoms[NET_WM_WINDOW_TYPE_SPLASH]) { |
104 | return "dropdown_menu"; | 104 | return "splash"; |
105 | case NET_WM_WINDOW_TYPE_POPUP_MENU: | 105 | } else if (type == xwayland->atoms[NET_WM_WINDOW_TYPE_MENU]) { |
106 | return "popup_menu"; | 106 | return "menu"; |
107 | case NET_WM_WINDOW_TYPE_TOOLTIP: | 107 | } else if (type == xwayland->atoms[NET_WM_WINDOW_TYPE_DROPDOWN_MENU]) { |
108 | return "tooltip"; | 108 | return "dropdown_menu"; |
109 | case NET_WM_WINDOW_TYPE_NOTIFICATION: | 109 | } else if (type == xwayland->atoms[NET_WM_WINDOW_TYPE_POPUP_MENU]) { |
110 | return "notification"; | 110 | return "popup_menu"; |
111 | default: | 111 | } else if (type == xwayland->atoms[NET_WM_WINDOW_TYPE_TOOLTIP]) { |
112 | return "unknown"; | 112 | return "tooltip"; |
113 | } else if (type == xwayland->atoms[NET_WM_WINDOW_TYPE_NOTIFICATION]) { | ||
114 | return "notification"; | ||
115 | } else { | ||
116 | return "unknown"; | ||
117 | } | ||
113 | } | 118 | } |
119 | |||
120 | return "unknown"; | ||
114 | } | 121 | } |
115 | #endif | 122 | #endif |
116 | 123 | ||
@@ -485,7 +492,7 @@ static void ipc_json_describe_view(struct sway_container *c, json_object *object | |||
485 | if (window_type) { | 492 | if (window_type) { |
486 | json_object_object_add(window_props, "window_type", | 493 | json_object_object_add(window_props, "window_type", |
487 | json_object_new_string( | 494 | json_object_new_string( |
488 | ipc_json_xwindow_type_description(window_type))); | 495 | ipc_json_xwindow_type_description(c->view))); |
489 | } | 496 | } |
490 | 497 | ||
491 | json_object_object_add(object, "window_properties", window_props); | 498 | json_object_object_add(object, "window_properties", window_props); |