mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-05-13 15:20:36 +01:00
input-capture: simplify sendKeymap
This commit is contained in:
parent
7206966a45
commit
cde6ee81d1
1 changed files with 1 additions and 22 deletions
|
@ -45,28 +45,7 @@ void CInputCaptureProtocol::sendMotion(const Vector2D& absolutePosition, const V
|
||||||
void CInputCaptureProtocol::sendKeymap(SP<IKeyboard> keyboard, const UP<CHyprlandInputCaptureManagerV1>& manager) {
|
void CInputCaptureProtocol::sendKeymap(SP<IKeyboard> keyboard, const UP<CHyprlandInputCaptureManagerV1>& manager) {
|
||||||
if (!keyboard)
|
if (!keyboard)
|
||||||
return;
|
return;
|
||||||
|
manager->sendKeymap(HYPRLAND_INPUT_CAPTURE_MANAGER_V1_KEYMAP_FORMAT_XKB_V1, keyboard->xkbKeymapFD.get(), keyboard->xkbKeymapString.length() + 1);
|
||||||
hyprlandInputCaptureManagerV1KeymapFormat format;
|
|
||||||
int fd;
|
|
||||||
uint32_t size;
|
|
||||||
if (keyboard) {
|
|
||||||
format = HYPRLAND_INPUT_CAPTURE_MANAGER_V1_KEYMAP_FORMAT_XKB_V1;
|
|
||||||
fd = keyboard->xkbKeymapFD.get();
|
|
||||||
size = keyboard->xkbKeymapString.length() + 1;
|
|
||||||
} else {
|
|
||||||
format = HYPRLAND_INPUT_CAPTURE_MANAGER_V1_KEYMAP_FORMAT_NO_KEYMAP;
|
|
||||||
fd = open("/dev/null", O_RDONLY | O_CLOEXEC);
|
|
||||||
if (fd < 0) {
|
|
||||||
LOGM(ERR, "Failed to open /dev/null");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
size = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
manager->sendKeymap(format, fd, size);
|
|
||||||
|
|
||||||
if (!keyboard)
|
|
||||||
close(fd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputCaptureProtocol::forceRelease() {
|
void CInputCaptureProtocol::forceRelease() {
|
||||||
|
|
Loading…
Reference in a new issue