[wayland] Create SeatInterface and sync with WaylandBackend's seat

If not using libinput we get the seat information from the lower
level Wayland server: let's forward the information to our own
SeatInterface.
This commit is contained in:
Martin Gräßlin 2015-02-25 09:35:42 +01:00
parent 5b7b0f91c1
commit 54c2c5db2d
2 changed files with 14 additions and 0 deletions

View file

@ -24,6 +24,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "input.h" #include "input.h"
#include "main.h" #include "main.h"
#include "utils.h" #include "utils.h"
#include "wayland_server.h"
#include <KWayland/Client/buffer.h> #include <KWayland/Client/buffer.h>
#include <KWayland/Client/compositor.h> #include <KWayland/Client/compositor.h>
#include <KWayland/Client/connection_thread.h> #include <KWayland/Client/connection_thread.h>
@ -40,6 +41,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KWayland/Client/subcompositor.h> #include <KWayland/Client/subcompositor.h>
#include <KWayland/Client/subsurface.h> #include <KWayland/Client/subsurface.h>
#include <KWayland/Client/surface.h> #include <KWayland/Client/surface.h>
#include <KWayland/Server/seat_interface.h>
// Qt // Qt
#include <QAbstractEventDispatcher> #include <QAbstractEventDispatcher>
#include <QCoreApplication> #include <QCoreApplication>
@ -256,6 +258,15 @@ WaylandSeat::WaylandSeat(wl_seat *seat, WaylandBackend *backend)
} }
} }
); );
WaylandServer *server = waylandServer();
if (server) {
using namespace KWayland::Server;
SeatInterface *si = server->seat();
connect(m_seat, &Seat::hasKeyboardChanged, si, &SeatInterface::setHasKeyboard);
connect(m_seat, &Seat::hasPointerChanged, si, &SeatInterface::setHasPointer);
connect(m_seat, &Seat::hasTouchChanged, si, &SeatInterface::setHasTouch);
connect(m_seat, &Seat::nameChanged, si, &SeatInterface::setName);
}
} }
WaylandSeat::~WaylandSeat() WaylandSeat::~WaylandSeat()

View file

@ -25,6 +25,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <KWayland/Server/compositor_interface.h> #include <KWayland/Server/compositor_interface.h>
#include <KWayland/Server/display.h> #include <KWayland/Server/display.h>
#include <KWayland/Server/output_interface.h> #include <KWayland/Server/output_interface.h>
#include <KWayland/Server/seat_interface.h>
#include <KWayland/Server/shell_interface.h> #include <KWayland/Server/shell_interface.h>
using namespace KWayland::Server; using namespace KWayland::Server;
@ -69,6 +70,8 @@ void WaylandServer::init(const QByteArray &socketName)
m_shell = m_display->createShell(m_display); m_shell = m_display->createShell(m_display);
m_shell->create(); m_shell->create();
m_display->createShm(); m_display->createShm();
m_seat = m_display->createSeat(m_display);
m_seat->create();
} }
void WaylandServer::initOutputs() void WaylandServer::initOutputs()