2014-09-02 07:34:31 +00:00
|
|
|
/********************************************************************
|
2014-09-17 13:57:56 +00:00
|
|
|
Copyright 2014 Martin Gräßlin <mgraesslin@kde.org>
|
2014-09-02 07:34:31 +00:00
|
|
|
|
2014-09-17 13:57:56 +00:00
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Lesser General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2.1 of the License, or (at your option) version 3, or any
|
|
|
|
later version accepted by the membership of KDE e.V. (or its
|
|
|
|
successor approved by the membership of KDE e.V.), which shall
|
|
|
|
act as a proxy defined in Section 6 of version 3 of the license.
|
2014-09-02 07:34:31 +00:00
|
|
|
|
2014-09-17 13:57:56 +00:00
|
|
|
This library is distributed in the hope that it will be useful,
|
2014-09-02 07:34:31 +00:00
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2014-09-17 13:57:56 +00:00
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
Lesser General Public License for more details.
|
2014-09-02 07:34:31 +00:00
|
|
|
|
2014-09-17 13:57:56 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
|
|
License along with this library. If not, see <http://www.gnu.org/licenses/>.
|
2014-09-02 07:34:31 +00:00
|
|
|
*********************************************************************/
|
2014-09-17 14:20:56 +00:00
|
|
|
#ifndef WAYLAND_SERVER_SEAT_INTERFACE_H
|
|
|
|
#define WAYLAND_SERVER_SEAT_INTERFACE_H
|
2014-09-02 07:34:31 +00:00
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
#include <QPoint>
|
|
|
|
|
2014-10-14 11:43:24 +00:00
|
|
|
#include <KWayland/Server/kwaylandserver_export.h>
|
2014-11-13 14:07:31 +00:00
|
|
|
#include "global.h"
|
2014-11-26 14:00:44 +00:00
|
|
|
#include "keyboard_interface.h"
|
2014-11-26 09:34:23 +00:00
|
|
|
#include "pointer_interface.h"
|
2015-03-25 12:31:38 +00:00
|
|
|
#include "touch_interface.h"
|
2014-09-17 13:10:43 +00:00
|
|
|
|
2014-09-18 15:14:50 +00:00
|
|
|
struct wl_client;
|
|
|
|
struct wl_resource;
|
|
|
|
|
2014-09-17 14:10:38 +00:00
|
|
|
namespace KWayland
|
2014-09-02 07:34:31 +00:00
|
|
|
{
|
2014-09-17 14:10:38 +00:00
|
|
|
namespace Server
|
2014-09-02 07:34:31 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
class Display;
|
|
|
|
class KeyboardInterface;
|
|
|
|
class SurfaceInterface;
|
|
|
|
|
2014-11-13 14:07:31 +00:00
|
|
|
class KWAYLANDSERVER_EXPORT SeatInterface : public Global
|
2014-09-02 07:34:31 +00:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
|
|
|
|
Q_PROPERTY(bool pointer READ hasPointer WRITE setHasPointer NOTIFY hasPointerChanged)
|
|
|
|
Q_PROPERTY(bool keyboard READ hasKeyboard WRITE setHasKeyboard NOTIFY hasKeyboardChanged)
|
|
|
|
Q_PROPERTY(bool tourch READ hasTouch WRITE setHasTouch NOTIFY hasTouchChanged)
|
2014-11-25 13:24:52 +00:00
|
|
|
Q_PROPERTY(QPointF pointerPos READ pointerPos WRITE setPointerPos NOTIFY pointerPosChanged)
|
2014-11-25 14:29:01 +00:00
|
|
|
Q_PROPERTY(quint32 timestamp READ timestamp WRITE setTimestamp NOTIFY timestampChanged)
|
2014-09-02 07:34:31 +00:00
|
|
|
public:
|
|
|
|
virtual ~SeatInterface();
|
|
|
|
|
2014-09-18 14:35:28 +00:00
|
|
|
QString name() const;
|
|
|
|
bool hasPointer() const;
|
|
|
|
bool hasKeyboard() const;
|
|
|
|
bool hasTouch() const;
|
2014-09-02 07:34:31 +00:00
|
|
|
|
|
|
|
void setName(const QString &name);
|
|
|
|
void setHasPointer(bool has);
|
|
|
|
void setHasKeyboard(bool has);
|
|
|
|
void setHasTouch(bool has);
|
|
|
|
|
2014-11-25 14:29:01 +00:00
|
|
|
void setTimestamp(quint32 time);
|
|
|
|
quint32 timestamp() const;
|
|
|
|
|
2014-11-25 13:24:52 +00:00
|
|
|
// pointer related methods
|
|
|
|
void setPointerPos(const QPointF &pos);
|
|
|
|
QPointF pointerPos() const;
|
2014-11-26 09:34:23 +00:00
|
|
|
void setFocusedPointerSurface(SurfaceInterface *surface, const QPointF &surfacePosition = QPoint());
|
2014-11-25 14:54:28 +00:00
|
|
|
SurfaceInterface *focusedPointerSurface() const;
|
2014-11-25 15:04:07 +00:00
|
|
|
PointerInterface *focusedPointer() const;
|
2014-11-26 09:34:23 +00:00
|
|
|
void setFocusedPointerSurfacePosition(const QPointF &surfacePosition);
|
|
|
|
QPointF focusedPointerSurfacePosition() const;
|
2014-11-26 10:50:52 +00:00
|
|
|
void pointerButtonPressed(quint32 button);
|
|
|
|
void pointerButtonPressed(Qt::MouseButton button);
|
|
|
|
void pointerButtonReleased(quint32 button);
|
|
|
|
void pointerButtonReleased(Qt::MouseButton button);
|
|
|
|
bool isPointerButtonPressed(quint32 button) const;
|
|
|
|
bool isPointerButtonPressed(Qt::MouseButton button) const;
|
|
|
|
quint32 pointerButtonSerial(quint32 button) const;
|
|
|
|
quint32 pointerButtonSerial(Qt::MouseButton button) const;
|
|
|
|
void pointerAxis(Qt::Orientation orientation, quint32 delta);
|
2014-11-25 13:24:52 +00:00
|
|
|
|
2014-11-26 14:00:44 +00:00
|
|
|
// keyboard related methods
|
|
|
|
void setKeymap(int fd, quint32 size);
|
|
|
|
void keyPressed(quint32 key);
|
|
|
|
void keyReleased(quint32 key);
|
|
|
|
void updateKeyboardModifiers(quint32 depressed, quint32 latched, quint32 locked, quint32 group);
|
2015-09-02 14:00:11 +00:00
|
|
|
/**
|
|
|
|
* Sets the key repeat information to be forwarded to all bound keyboards.
|
|
|
|
*
|
|
|
|
* To disable key repeat set a @p charactersPerSecond of @c 0.
|
|
|
|
*
|
|
|
|
* Requires wl_seat version 4.
|
|
|
|
*
|
|
|
|
* @param charactersPerSecond The characters per second rate, value of @c 0 disables key repeating
|
|
|
|
* @param delay The delay on key press before starting repeating keys
|
|
|
|
*
|
|
|
|
* @since 5.5
|
|
|
|
***/
|
|
|
|
void setKeyRepeatInfo(qint32 charactersPerSecond, qint32 delay);
|
2014-11-26 14:00:44 +00:00
|
|
|
quint32 depressedModifiers() const;
|
|
|
|
quint32 latchedModifiers() const;
|
|
|
|
quint32 lockedModifiers() const;
|
|
|
|
quint32 groupModifiers() const;
|
|
|
|
quint32 lastModifiersSerial() const;
|
|
|
|
int keymapFileDescriptor() const;
|
|
|
|
quint32 keymapSize() const;
|
|
|
|
bool isKeymapXkbCompatible() const;
|
|
|
|
QVector<quint32> pressedKeys() const;
|
2015-09-02 14:00:11 +00:00
|
|
|
/**
|
|
|
|
* @returns The key repeat in character per second
|
|
|
|
* @since 5.5
|
|
|
|
* @see setKeyRepeatInfo
|
|
|
|
* @see keyRepeatDelay
|
|
|
|
**/
|
|
|
|
qint32 keyRepeatRate() const;
|
|
|
|
/**
|
|
|
|
* @returns The delay on key press before starting repeating keys
|
|
|
|
* @since 5.5
|
|
|
|
* @see keyRepeatRate
|
|
|
|
* @see setKeyRepeatInfo
|
|
|
|
**/
|
|
|
|
qint32 keyRepeatDelay() const;
|
2014-11-26 14:00:44 +00:00
|
|
|
|
|
|
|
void setFocusedKeyboardSurface(SurfaceInterface *surface);
|
|
|
|
SurfaceInterface *focusedKeyboardSurface() const;
|
|
|
|
KeyboardInterface *focusedKeyboard() const;
|
|
|
|
|
2015-03-25 12:31:38 +00:00
|
|
|
// touch related methods
|
|
|
|
void setFocusedTouchSurface(SurfaceInterface *surface, const QPointF &surfacePosition = QPointF());
|
|
|
|
SurfaceInterface *focusedTouchSurface() const;
|
|
|
|
TouchInterface *focusedTouch() const;
|
|
|
|
void setFocusedTouchSurfacePosition(const QPointF &surfacePosition);
|
|
|
|
QPointF focusedTouchSurfacePosition() const;
|
|
|
|
qint32 touchDown(const QPointF &globalPosition);
|
|
|
|
void touchUp(qint32 id);
|
|
|
|
void touchMove(qint32 id, const QPointF &globalPosition);
|
|
|
|
void touchFrame();
|
|
|
|
void cancelTouchSequence();
|
|
|
|
bool isTouchSequence() const;
|
|
|
|
|
2014-11-05 14:29:18 +00:00
|
|
|
static SeatInterface *get(wl_resource *native);
|
|
|
|
|
2014-09-02 07:34:31 +00:00
|
|
|
Q_SIGNALS:
|
|
|
|
void nameChanged(const QString&);
|
|
|
|
void hasPointerChanged(bool);
|
|
|
|
void hasKeyboardChanged(bool);
|
|
|
|
void hasTouchChanged(bool);
|
2014-11-25 13:24:52 +00:00
|
|
|
void pointerPosChanged(const QPointF &pos);
|
2014-11-25 14:29:01 +00:00
|
|
|
void timestampChanged(quint32);
|
2014-09-02 07:34:31 +00:00
|
|
|
|
2014-11-26 09:34:23 +00:00
|
|
|
void pointerCreated(KWayland::Server::PointerInterface*);
|
2014-11-26 14:00:44 +00:00
|
|
|
void keyboardCreated(KWayland::Server::KeyboardInterface*);
|
2015-03-25 12:31:38 +00:00
|
|
|
void touchCreated(KWayland::Server::TouchInterface*);
|
2014-11-26 09:34:23 +00:00
|
|
|
|
2014-09-02 07:34:31 +00:00
|
|
|
private:
|
|
|
|
friend class Display;
|
2014-11-27 12:38:24 +00:00
|
|
|
friend class DataDeviceManagerInterface;
|
2014-09-02 07:34:31 +00:00
|
|
|
explicit SeatInterface(Display *display, QObject *parent);
|
|
|
|
|
2014-09-18 14:35:28 +00:00
|
|
|
class Private;
|
2014-11-13 14:07:31 +00:00
|
|
|
Private *d_func() const;
|
2014-09-02 07:34:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|