Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit dbb951b4 authored by Martin Flöser's avatar Martin Flöser

Dependency inject KWayland::Server::SeatInterface into Xkb

No need to depend on WaylandServer from within Xkb.
parent 08ae17e2
......@@ -48,6 +48,9 @@ KeyboardInputRedirection::KeyboardInputRedirection(InputRedirection *parent)
, m_xkb(new Xkb(parent))
{
connect(m_xkb.data(), &Xkb::ledsChanged, this, &KeyboardInputRedirection::ledsChanged);
if (waylandServer()) {
m_xkb->setSeat(waylandServer()->seat());
}
}
KeyboardInputRedirection::~KeyboardInputRedirection() = default;
......
......@@ -19,7 +19,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*********************************************************************/
#include "xkb.h"
#include "utils.h"
#include "wayland_server.h"
// frameworks
#include <KConfigGroup>
#include <KKeyServer>
......@@ -222,7 +221,7 @@ void Xkb::updateKeymap(xkb_keymap *keymap)
void Xkb::createKeymapFile()
{
if (!waylandServer()) {
if (!m_seat) {
return;
}
// TODO: uninstall keymap on server?
......@@ -254,7 +253,7 @@ void Xkb::createKeymapFile()
delete tmp;
return;
}
waylandServer()->seat()->setKeymap(tmp->handle(), size);
m_seat->setKeymap(tmp->handle(), size);
}
void Xkb::updateModifiers(uint32_t modsDepressed, uint32_t modsLatched, uint32_t modsLocked, uint32_t group)
......@@ -337,10 +336,10 @@ void Xkb::updateModifiers()
void Xkb::forwardModifiers()
{
if (!waylandServer()) {
if (!m_seat) {
return;
}
waylandServer()->seat()->updateKeyboardModifiers(m_modifierState.depressed,
m_seat->updateKeyboardModifiers(m_modifierState.depressed,
m_modifierState.latched,
m_modifierState.locked,
m_currentLayout);
......@@ -502,4 +501,9 @@ quint32 Xkb::numberOfLayouts() const
return xkb_keymap_num_layouts(m_keymap);
}
void Xkb::setSeat(KWayland::Server::SeatInterface *seat)
{
m_seat = QPointer<KWayland::Server::SeatInterface>(seat);
}
}
......@@ -38,6 +38,14 @@ typedef uint32_t xkb_led_index_t;
typedef uint32_t xkb_keysym_t;
typedef uint32_t xkb_layout_index_t;
namespace KWayland
{
namespace Server
{
class SeatInterface;
}
}
namespace KWin
{
......@@ -99,6 +107,8 @@ public:
**/
void forwardModifiers();
void setSeat(KWayland::Server::SeatInterface *seat);
Q_SIGNALS:
void ledsChanged(const LEDs &leds);
......@@ -138,6 +148,8 @@ private:
xkb_mod_index_t latched = 0;
xkb_mod_index_t locked = 0;
} m_modifierState;
QPointer<KWayland::Server::SeatInterface> m_seat;
};
inline
......
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