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

Function MaaKWinControllerCreate

source/MaaFramework/API/MaaFramework.cpp:286–317  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

284}
285
286MaaController* MaaKWinControllerCreate(const char* device_node, int screen_width, int screen_height, MaaBool use_win32_vk_code)
287{
288 LogFunc << VAR(device_node) << VAR(screen_width) << VAR(screen_height) << VAR(use_win32_vk_code);
289
290#ifndef __linux__
291
292 LogError << "This API " << __FUNCTION__ << " is only available on Linux";
293 return nullptr;
294
295#else
296
297 if (!device_node) {
298 LogError << "device_node is null";
299 return nullptr;
300 }
301
302 if (screen_width <= 0 || screen_height <= 0) {
303 LogError << "Invalid screen dimensions" << VAR(screen_width) << VAR(screen_height);
304 return nullptr;
305 }
306
307 auto control_unit =
308 MAA_NS::KWinControlUnitLibraryHolder::create_control_unit(device_node, screen_width, screen_height, use_win32_vk_code);
309
310 if (!control_unit) {
311 LogError << "Failed to create control unit";
312 return nullptr;
313 }
314
315 return new MAA_CTRL_NS::ControllerAgent(std::move(control_unit));
316#endif
317}
318
319void MaaControllerDestroy(MaaController* ctrl)
320{

Callers

nothing calls this directly

Calls 1

moveFunction · 0.85

Tested by

no test coverage detected