Mercurial > minori
annotate dep/animia/src/win/wayland.cc @ 254:d14f8e0e40c3
[UNFINISHED] *: update anime button
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Wed, 07 Feb 2024 07:57:37 -0500 |
parents | 84e0a3c4737a |
children |
rev | line source |
---|---|
199
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
1 #include "animia/win/wayland.h" |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
2 #include "animia.h" |
216
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
3 #include "animia/win.h" |
223
84e0a3c4737a
library: implement menu bar buttons
Paper <mrpapersonic@gmail.com>
parents:
221
diff
changeset
|
4 #include "animia/util.h" |
199
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
5 |
216
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
6 #include <cstring> |
199
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
7 #include <iostream> |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
8 |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
9 #include "animia/win/wayland/ext-foreign-toplevel-list-v1.h" |
216
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
10 #include "animia/win/wayland/wlr-foreign-toplevel-management-unstable-v1.h" |
199
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
11 #include <wayland-client.h> |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
12 |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
13 namespace animia::internal::wayland { |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
14 |
216
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
15 /* zwlr-foreign-toplevel-management-v1 implementation */ |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
16 static void zwlr_foreign_handle_handle_title(void* data, struct zwlr_foreign_toplevel_handle_v1* handle, |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
17 const char* title) { |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
18 if (title) |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
19 reinterpret_cast<Window*>(data)->text = title; |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
20 } |
199
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
21 |
216
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
22 static void zwlr_foreign_handle_handle_app_id(void* data, struct zwlr_foreign_toplevel_handle_v1* handle, |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
23 const char* app_id) { |
199
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
24 if (app_id) |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
25 reinterpret_cast<Window*>(data)->class_name = app_id; |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
26 } |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
27 |
216
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
28 static void zwlr_foreign_handle_handle_done(void* data, struct zwlr_foreign_toplevel_handle_v1* handle) { |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
29 if (handle) |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
30 zwlr_foreign_toplevel_handle_v1_destroy(handle); |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
31 } |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
32 |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
33 static void zwlr_foreign_handle_handle_state(void* data, struct zwlr_foreign_toplevel_handle_v1* handle, |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
34 struct wl_array*) { |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
35 } |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
36 |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
37 static void zwlr_foreign_handle_handle_parent(void* data, struct zwlr_foreign_toplevel_handle_v1* handle, |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
38 struct zwlr_foreign_toplevel_handle_v1*) { |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
39 } |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
40 |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
41 static void zwlr_foreign_handle_handle_output_enter(void* data, struct zwlr_foreign_toplevel_handle_v1* handle, |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
42 struct wl_output*) { |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
43 } |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
44 |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
45 static void zwlr_foreign_handle_handle_output_leave(void* data, struct zwlr_foreign_toplevel_handle_v1* handle, |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
46 struct wl_output*) { |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
47 } |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
48 |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
49 static void zwlr_foreign_handle_handle_closed(void* data, struct zwlr_foreign_toplevel_handle_v1* handle) { |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
50 } |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
51 |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
52 static const struct zwlr_foreign_toplevel_handle_v1_listener zwlr_handle_listener = { |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
53 .title = zwlr_foreign_handle_handle_title, |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
54 .app_id = zwlr_foreign_handle_handle_app_id, |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
55 .output_enter = zwlr_foreign_handle_handle_output_enter, |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
56 .output_leave = zwlr_foreign_handle_handle_output_leave, |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
57 .state = zwlr_foreign_handle_handle_state, |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
58 .done = zwlr_foreign_handle_handle_done, |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
59 .closed = zwlr_foreign_handle_handle_closed, |
221
53211cb1e7f5
library: add initial library stuff
Paper <paper@paper.us.eu.org>
parents:
219
diff
changeset
|
60 .parent = zwlr_foreign_handle_handle_parent |
53211cb1e7f5
library: add initial library stuff
Paper <paper@paper.us.eu.org>
parents:
219
diff
changeset
|
61 }; |
216
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
62 |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
63 static void zwlr_toplevel_manager_handle_toplevel(void* data, struct zwlr_foreign_toplevel_manager_v1* manager, |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
64 struct zwlr_foreign_toplevel_handle_v1* handle) { |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
65 std::vector<Window>* windows = reinterpret_cast<std::vector<Window>*>(data); |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
66 if (!windows) |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
67 return; |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
68 |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
69 windows->push_back({0}); |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
70 zwlr_foreign_toplevel_handle_v1_add_listener(handle, &zwlr_handle_listener, &*windows->end()); |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
71 } |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
72 |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
73 static void zwlr_toplevel_manager_handle_finished(void*, struct zwlr_foreign_toplevel_manager_v1*) { |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
74 } |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
75 |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
76 static const struct zwlr_foreign_toplevel_manager_v1_listener zwlr_toplevel_manager_listener = { |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
77 .toplevel = zwlr_toplevel_manager_handle_toplevel, |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
78 .finished = zwlr_toplevel_manager_handle_finished, |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
79 }; |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
80 |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
81 /* ext_foreign_handle stuff */ |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
82 static void ext_foreign_handle_handle_app_id(void* data, struct ext_foreign_toplevel_handle_v1* handle, |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
83 const char* app_id) { |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
84 if (app_id) |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
85 reinterpret_cast<Window*>(data)->class_name = app_id; |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
86 } |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
87 |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
88 static void ext_foreign_handle_handle_title(void* data, struct ext_foreign_toplevel_handle_v1* handle, |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
89 const char* title) { |
199
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
90 if (title) |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
91 reinterpret_cast<Window*>(data)->text = title; |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
92 } |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
93 |
223
84e0a3c4737a
library: implement menu bar buttons
Paper <mrpapersonic@gmail.com>
parents:
221
diff
changeset
|
94 static void ext_foreign_handle_handle_identifier(void* data, ext_foreign_toplevel_handle_v1* handle, const char* identifier) { |
84e0a3c4737a
library: implement menu bar buttons
Paper <mrpapersonic@gmail.com>
parents:
221
diff
changeset
|
95 if (identifier) { |
84e0a3c4737a
library: implement menu bar buttons
Paper <mrpapersonic@gmail.com>
parents:
221
diff
changeset
|
96 reinterpret_cast<Window*>(data)->id = util::StringToInt(identifier, 0); |
84e0a3c4737a
library: implement menu bar buttons
Paper <mrpapersonic@gmail.com>
parents:
221
diff
changeset
|
97 } |
221
53211cb1e7f5
library: add initial library stuff
Paper <paper@paper.us.eu.org>
parents:
219
diff
changeset
|
98 } |
53211cb1e7f5
library: add initial library stuff
Paper <paper@paper.us.eu.org>
parents:
219
diff
changeset
|
99 |
199
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
100 static void ext_foreign_handle_handle_done(void* data, struct ext_foreign_toplevel_handle_v1* handle) { |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
101 if (handle) |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
102 ext_foreign_toplevel_handle_v1_destroy(handle); |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
103 } |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
104 |
216
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
105 static void ext_foreign_handle_handle_closed(void*, struct ext_foreign_toplevel_handle_v1*) { |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
106 } |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
107 |
199
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
108 static const struct ext_foreign_toplevel_handle_v1_listener ext_handle_listener = { |
216
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
109 .closed = ext_foreign_handle_handle_closed, |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
110 .done = ext_foreign_handle_handle_done, |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
111 .title = ext_foreign_handle_handle_title, |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
112 .app_id = ext_foreign_handle_handle_app_id, |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
113 .identifier = ext_foreign_handle_handle_identifier // for now |
199
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
114 }; |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
115 |
216
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
116 static void ext_toplevel_list_handle_toplevel(void* data, struct ext_foreign_toplevel_list_v1* list, |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
117 struct ext_foreign_toplevel_handle_v1* handle) { |
199
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
118 std::vector<Window>* windows = reinterpret_cast<std::vector<Window>*>(data); |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
119 if (!windows) |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
120 return; |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
121 |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
122 windows->push_back({0}); |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
123 ext_foreign_toplevel_handle_v1_add_listener(handle, &ext_handle_listener, &*windows->end()); |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
124 } |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
125 |
216
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
126 static void ext_toplevel_list_handle_finished(void*, ext_foreign_toplevel_list_v1*) { |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
127 } |
199
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
128 |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
129 static const struct ext_foreign_toplevel_list_v1_listener ext_toplevel_list_listener = { |
216
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
130 .toplevel = ext_toplevel_list_handle_toplevel, .finished = ext_toplevel_list_handle_finished}; |
199
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
131 |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
132 /* -- Global data -- */ |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
133 struct global_data { |
216
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
134 struct ext_foreign_toplevel_list_v1* ext_toplevel_list = nullptr; |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
135 struct zwlr_foreign_toplevel_manager_v1* zwlr_toplevel_mgr = nullptr; |
199
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
136 std::vector<Window> windows; |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
137 }; |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
138 |
216
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
139 static void registry_handle_global(void* data, struct wl_registry* registry, uint32_t name, const char* interface, |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
140 uint32_t version) { |
199
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
141 struct global_data* global = reinterpret_cast<struct global_data*>(data); |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
142 |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
143 if (!std::strcmp(interface, ext_foreign_toplevel_list_v1_interface.name)) { |
219
2f6d27fcdf7d
dep/animia: wayland: fixup wlroots code
Paper <paper@paper.us.eu.org>
parents:
216
diff
changeset
|
144 if (global->zwlr_toplevel_mgr) |
216
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
145 return; // we don't need this then |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
146 |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
147 global->ext_toplevel_list = reinterpret_cast<struct ext_foreign_toplevel_list_v1*>( |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
148 wl_registry_bind(registry, name, &ext_foreign_toplevel_list_v1_interface, 1)); |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
149 |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
150 ext_foreign_toplevel_list_v1_add_listener(global->ext_toplevel_list, &ext_toplevel_list_listener, |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
151 &global->windows); |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
152 } else if (!std::strcmp(interface, zwlr_foreign_toplevel_manager_v1_interface.name)) { |
219
2f6d27fcdf7d
dep/animia: wayland: fixup wlroots code
Paper <paper@paper.us.eu.org>
parents:
216
diff
changeset
|
153 if (global->ext_toplevel_list || version < 3) |
216
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
154 return; // we don't need this then |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
155 |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
156 global->zwlr_toplevel_mgr = reinterpret_cast<struct zwlr_foreign_toplevel_manager_v1*>( |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
157 wl_registry_bind(registry, name, &zwlr_foreign_toplevel_manager_v1_interface, 1)); |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
158 |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
159 zwlr_foreign_toplevel_manager_v1_add_listener(global->zwlr_toplevel_mgr, &zwlr_toplevel_manager_listener, |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
160 &global->windows); |
199
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
161 } |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
162 } |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
163 |
216
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
164 static void registry_handle_global_remove(void*, wl_registry*, uint32_t) { |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
165 } |
199
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
166 |
216
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
167 static const struct wl_registry_listener registry_listener = {.global = registry_handle_global, |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
168 .global_remove = registry_handle_global_remove}; |
199
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
169 |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
170 /* BAH! humbug... */ |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
171 struct sync_data { |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
172 bool loop = true; |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
173 int sync = 0; |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
174 |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
175 struct global_data global = {0}; |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
176 |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
177 struct wl_callback* callback = nullptr; |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
178 struct wl_display* display = nullptr; |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
179 }; |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
180 |
216
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
181 static void sync_handle_done(void* data, struct wl_callback* callback, uint32_t other_data); |
199
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
182 static const struct wl_callback_listener sync_callback_listener = { |
216
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
183 .done = sync_handle_done, |
199
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
184 }; |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
185 |
216
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
186 static void sync_handle_done(void* data, struct wl_callback* callback, uint32_t other_data) { |
199
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
187 struct sync_data* sync = reinterpret_cast<struct sync_data*>(data); |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
188 |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
189 wl_callback_destroy(callback); |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
190 sync->callback = nullptr; |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
191 |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
192 if (sync->sync == 0) { |
219
2f6d27fcdf7d
dep/animia: wayland: fixup wlroots code
Paper <paper@paper.us.eu.org>
parents:
216
diff
changeset
|
193 if (!sync->global.ext_toplevel_list && !sync->global.zwlr_toplevel_mgr) { |
216
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
194 std::cerr << "animia/wayland: Wayland server doesn't support ext-foreign-toplevel-list-v1 nor " |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
195 "wlr-foreign-toplevel-management-unstable-v1!" |
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
196 << std::endl; |
199
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
197 sync->loop = false; |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
198 return; |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
199 } |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
200 |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
201 sync->sync++; |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
202 sync->callback = wl_display_sync(sync->display); |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
203 wl_callback_add_listener(sync->callback, &sync_callback_listener, sync); |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
204 |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
205 /* we may need another sync here if there are protocol extensions for |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
206 * ext_foreign_toplevel_list. |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
207 * |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
208 * more info: https://git.sr.ht/~leon_plickat/lswt/tree/toplevel-info/item/lswt.c |
216
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
209 */ |
199
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
210 } else { |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
211 /* we've received everything we need! */ |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
212 sync->loop = false; |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
213 } |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
214 } |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
215 |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
216 /* here comes the actual function we can use */ |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
217 bool EnumerateWindows(window_proc_t window_proc) { |
216
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
218 struct sync_data sync = {.display = wl_display_connect(NULL)}; |
199
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
219 |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
220 if (!sync.display) { |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
221 std::cerr << "animia/wayland: Can't connect to display" << std::endl; |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
222 return false; |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
223 } |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
224 |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
225 struct global_data global; |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
226 |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
227 struct wl_registry* registry = wl_display_get_registry(sync.display); |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
228 wl_registry_add_listener(registry, ®istry_listener, &sync.global); |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
229 |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
230 sync.callback = wl_display_sync(sync.display); |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
231 wl_callback_add_listener(sync.callback, &sync_callback_listener, &sync); |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
232 |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
233 while (sync.loop && wl_display_dispatch(sync.display)); |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
234 |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
235 for (const auto& window : global.windows) |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
236 if (!window_proc({0}, window)) |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
237 return false; |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
238 |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
239 wl_display_disconnect(sync.display); |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
240 |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
241 return true; |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
242 } |
9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
Paper <mrpapersonic@gmail.com>
parents:
diff
changeset
|
243 |
216
8a482049b968
dep/animia: win/wayland: add UNTESTED support for wlroots protocols
Paper <mrpapersonic@gmail.com>
parents:
199
diff
changeset
|
244 } // namespace animia::internal::wayland |