MCPcopy Create free account
hub / github.com/MaaXYZ/MaaFramework / prepare_device

Method prepare_device

source/MaaWlRootsControlUnit/Client/WaylandClient.cpp:115–167  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

113}
114
115bool WaylandClient::prepare_device()
116{
117 pointer_.reset(zwlr_virtual_pointer_manager_v1_create_virtual_pointer_with_output(pointer_manager_.get(), seat_.get(), output_.get()));
118 keyboard_.reset(zwp_virtual_keyboard_manager_v1_create_virtual_keyboard(keyboard_manager_.get(), seat_.get()));
119 wl_output_listener output_listener = { };
120 output_listener.done = [](void* data, struct wl_output* wl_output) {
121 std::ignore = wl_output;
122 std::ignore = data;
123 LogTrace << "End of output info";
124 };
125 output_listener.name = [](void* data, struct wl_output* wl_output, const char* name) {
126 std::ignore = wl_output;
127 std::ignore = data;
128 LogTrace << "Output name" << VAR(name);
129 };
130 output_listener.description = [](void* data, struct wl_output* wl_output, const char* description) {
131 std::ignore = wl_output;
132 std::ignore = data;
133 LogTrace << "Output desc" << VAR(description);
134 };
135 output_listener.scale = [](void* data, struct wl_output* wl_output, int32_t factor) {
136 std::ignore = wl_output;
137 std::ignore = data;
138 LogTrace << "Output scale" << VAR(factor);
139 };
140 output_listener.geometry = [](void* data,
141 struct wl_output* wl_output,
142 int32_t x,
143 int32_t y,
144 int32_t physical_width,
145 int32_t physical_height,
146 int32_t subpixel,
147 const char* make,
148 const char* model,
149 int32_t transform) {
150 std::ignore = wl_output;
151 std::ignore = data;
152 LogTrace << "Output geometry" << VAR(x) << VAR(y) << VAR(physical_width) << VAR(physical_height) << VAR(subpixel) << VAR(make)
153 << VAR(model) << VAR(transform);
154 };
155 output_listener.mode = [](void* data, struct wl_output* wl_output, uint32_t flags, int32_t width, int32_t height, int32_t refresh) {
156 std::ignore = wl_output;
157 const auto self = static_cast<WaylandClient*>(data);
158 LogTrace << "Output mode" << VAR(flags) << VAR(width) << VAR(height) << VAR(refresh);
159 if (flags == WL_OUTPUT_MODE_CURRENT) {
160 self->screen_size_ = { width, height };
161 LogDebug << "Setting screen size" << VAR(width) << VAR(height);
162 }
163 };
164 wl_output_add_listener(output_.get(), &output_listener, this);
165 zwlr_virtual_pointer_v1_axis_source(pointer_.get(), WL_POINTER_AXIS_SOURCE_WHEEL);
166 return prepare_keymap() && process_requests();
167}
168
169bool WaylandClient::process_requests() const
170{

Callers

nothing calls this directly

Tested by

no test coverage detected