Commit 5e037570 authored by Bhushan Shah's avatar Bhushan Shah 📱 Committed by Bhushan Shah

wayland: adapt to changes in the keyboard and seat interface

parent fb5143d3
......@@ -31,8 +31,8 @@ KeyboardRepeat::~KeyboardRepeat() = default;
void KeyboardRepeat::handleKeyRepeat()
{
// TODO: don't depend on WaylandServer
if (waylandServer()->seat()->keyRepeatRate() != 0) {
m_timer->setInterval(1000 / waylandServer()->seat()->keyRepeatRate());
if (waylandServer()->seat()->keyboard()->keyRepeatRate() != 0) {
m_timer->setInterval(1000 / waylandServer()->seat()->keyboard()->keyRepeatRate());
}
// TODO: better time
emit keyRepeat(m_key, m_time);
......@@ -46,8 +46,8 @@ void KeyboardRepeat::keyEvent(KeyEvent *event)
const quint32 key = event->nativeScanCode();
if (event->type() == QEvent::KeyPress) {
// TODO: don't get these values from WaylandServer
if (m_xkb->shouldKeyRepeat(key) && waylandServer()->seat()->keyRepeatDelay() != 0) {
m_timer->setInterval(waylandServer()->seat()->keyRepeatDelay());
if (m_xkb->shouldKeyRepeat(key) && waylandServer()->seat()->keyboard()->keyRepeatDelay() != 0) {
m_timer->setInterval(waylandServer()->seat()->keyboard()->keyRepeatDelay());
m_key = key;
m_time = event->timestamp();
m_timer->start();
......
......@@ -285,27 +285,7 @@ void Xkb::createKeymapFile()
if (keymapString.isNull()) {
return;
}
const uint size = qstrlen(keymapString.data()) + 1;
QTemporaryFile *tmp = new QTemporaryFile(this);
if (!tmp->open()) {
delete tmp;
return;
}
unlink(tmp->fileName().toUtf8().constData());
if (!tmp->resize(size)) {
delete tmp;
return;
}
uchar *address = tmp->map(0, size);
if (!address) {
return;
}
if (qstrncpy(reinterpret_cast<char*>(address), keymapString.data(), size) == nullptr) {
delete tmp;
return;
}
m_seat->setKeymap(tmp->handle(), size);
m_seat->setKeymapData(keymapString.data());
}
void Xkb::updateModifiers(uint32_t modsDepressed, uint32_t modsLatched, uint32_t modsLocked, uint32_t group)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment