summaryrefslogtreecommitdiff
path: root/src/protocols/core
diff options
context:
space:
mode:
authorJS Deck <jsdeckerido@gmail.com>2025-08-04 16:29:39 -0300
committerGitHub <noreply@github.com>2025-08-04 21:29:39 +0200
commit2be309de1df5e4262175fbcc58e6dd8de4e0e6d3 (patch)
tree866629ba5a4b9b45d8720383e4332726444f3566 /src/protocols/core
parent6491bb4fb7c7e86d9168a104d5b87ace4e1b978d (diff)
virtualkeyboard: Add options to skip releasing pressed keys on close and to skip sharing key states (#11214)
Diffstat (limited to 'src/protocols/core')
-rw-r--r--src/protocols/core/Seat.cpp21
-rw-r--r--src/protocols/core/Seat.hpp3
2 files changed, 14 insertions, 10 deletions
diff --git a/src/protocols/core/Seat.cpp b/src/protocols/core/Seat.cpp
index 53123abe..8aa2f36a 100644
--- a/src/protocols/core/Seat.cpp
+++ b/src/protocols/core/Seat.cpp
@@ -305,8 +305,14 @@ CWLKeyboardResource::CWLKeyboardResource(SP<CWlKeyboard> resource_, SP<CWLSeatRe
sendKeymap(g_pSeatManager->m_keyboard.lock());
repeatInfo(g_pSeatManager->m_keyboard->m_repeatRate, g_pSeatManager->m_keyboard->m_repeatDelay);
- if (g_pSeatManager->m_state.keyboardFocus && g_pSeatManager->m_state.keyboardFocus->client() == m_resource->client())
- sendEnter(g_pSeatManager->m_state.keyboardFocus.lock());
+ if (g_pSeatManager->m_state.keyboardFocus && g_pSeatManager->m_state.keyboardFocus->client() == m_resource->client()) {
+ wl_array keys;
+ wl_array_init(&keys);
+
+ sendEnter(g_pSeatManager->m_state.keyboardFocus.lock(), &keys);
+
+ wl_array_release(&keys);
+ }
}
bool CWLKeyboardResource::good() {
@@ -334,7 +340,9 @@ void CWLKeyboardResource::sendKeymap(SP<IKeyboard> keyboard) {
m_resource->sendKeymap(format, fd.get(), size);
}
-void CWLKeyboardResource::sendEnter(SP<CWLSurfaceResource> surface) {
+void CWLKeyboardResource::sendEnter(SP<CWLSurfaceResource> surface, wl_array* keys) {
+ ASSERT(keys);
+
if (!m_owner || m_currentSurface == surface || !surface->getResource()->resource())
return;
@@ -351,12 +359,7 @@ void CWLKeyboardResource::sendEnter(SP<CWLSurfaceResource> surface) {
m_currentSurface = surface;
m_listeners.destroySurface = surface->m_events.destroy.listen([this] { sendLeave(); });
- wl_array arr;
- wl_array_init(&arr);
-
- m_resource->sendEnter(g_pSeatManager->nextSerial(m_owner.lock()), surface->getResource().get(), &arr);
-
- wl_array_release(&arr);
+ m_resource->sendEnter(g_pSeatManager->nextSerial(m_owner.lock()), surface->getResource().get(), keys);
}
void CWLKeyboardResource::sendLeave() {
diff --git a/src/protocols/core/Seat.hpp b/src/protocols/core/Seat.hpp
index 0c14e52a..8b8f6004 100644
--- a/src/protocols/core/Seat.hpp
+++ b/src/protocols/core/Seat.hpp
@@ -12,6 +12,7 @@
#include <cstdint>
#include "../WaylandProtocol.hpp"
#include <wayland-server-protocol.h>
+#include <wayland-util.h>
#include "wayland.hpp"
#include "../../helpers/signal/Signal.hpp"
#include "../../helpers/math/Math.hpp"
@@ -104,7 +105,7 @@ class CWLKeyboardResource {
bool good();
void sendKeymap(SP<IKeyboard> keeb);
- void sendEnter(SP<CWLSurfaceResource> surface);
+ void sendEnter(SP<CWLSurfaceResource> surface, wl_array* keys);
void sendLeave();
void sendKey(uint32_t timeMs, uint32_t key, wl_keyboard_key_state state);
void sendMods(uint32_t depressed, uint32_t latched, uint32_t locked, uint32_t group);