Commit f3308e09 authored by Benjamin Port's avatar Benjamin Port
Browse files

Fix class names for keyboard shortcuts inhibit

parent 4a5984a0
......@@ -11,7 +11,7 @@
// WaylandServer
#include "../../src/server/compositor_interface.h"
#include "../../src/server/display.h"
#include "../../src/server/keyboard_shortcuts_inhibit_interface.h"
#include "../../src/server/keyboard_shortcuts_inhibit_v1_interface.h"
#include "../../src/server/seat_interface.h"
#include "KWayland/Client/compositor.h"
......@@ -85,7 +85,7 @@ private:
SeatInterface *m_seat;
CompositorInterface *m_serverCompositor;
KeyboardShortcutsInhibitManagerInterface *m_manager;
KeyboardShortcutsInhibitManagerV1Interface *m_manager;
QVector<SurfaceInterface *> m_surfaces;
QVector<wl_surface *> m_clientSurfaces;
KeyboardShortcutsInhibitManager *m_inhibitManagerClient = nullptr;
......@@ -105,7 +105,7 @@ void TestKeyboardShortcutsInhibitorInterface::initTestCase()
m_serverCompositor = m_display.createCompositor(this);
m_serverCompositor->create();
m_manager = m_display.createKeyboardShortcutsInhibitManager(this);
m_manager = m_display.createKeyboardShortcutsInhibitManagerV1(this);
QVERIFY(m_serverCompositor->isValid());
connect(m_serverCompositor, &CompositorInterface::surfaceCreated, this, [this](SurfaceInterface *surface) {
m_surfaces += surface;
......@@ -185,7 +185,7 @@ void TestKeyboardShortcutsInhibitorInterface::testKeyboardShortcuts()
auto inhibitorClient = new KeyboardShortcutsInhibitor(inhibitorClientV1);
QSignalSpy inhibitorActiveSpy(inhibitorClient, &KeyboardShortcutsInhibitor::inhibitorActive);
QSignalSpy inhibitorInactiveSpy(inhibitorClient, &KeyboardShortcutsInhibitor::inhibitorInactive);
QSignalSpy inhibitorCreatedSpy(m_manager, &KeyboardShortcutsInhibitManagerInterface::inhibitorCreated);
QSignalSpy inhibitorCreatedSpy(m_manager, &KeyboardShortcutsInhibitManagerV1Interface::inhibitorCreated);
QVERIFY(inhibitorCreatedSpy.wait() || inhibitorCreatedSpy.count() == 1);
auto inhibitorServer = m_manager->findInhibitor(surface, m_seat);
......
......@@ -25,7 +25,7 @@ set(SERVER_LIB_SRCS
idleinhibit_interface.cpp
idleinhibit_interface_v1.cpp
keyboard_interface.cpp
keyboard_shortcuts_inhibit_interface.cpp
keyboard_shortcuts_inhibit_v1_interface.cpp
keystate_interface.cpp
linuxdmabuf_v1_interface.cpp
output_interface.cpp
......@@ -370,7 +370,7 @@ set(SERVER_LIB_HEADERS
idle_interface.h
idleinhibit_interface.h
keyboard_interface.h
keyboard_shortcuts_inhibit_interface.h
keyboard_shortcuts_inhibit_v1_interface.h
keystate_interface.h
linuxdmabuf_v1_interface.h
output_interface.h
......
......@@ -15,7 +15,7 @@
#include "fakeinput_interface.h"
#include "idle_interface.h"
#include "idleinhibit_interface_p.h"
#include "keyboard_shortcuts_inhibit_interface.h"
#include "keyboard_shortcuts_inhibit_v1_interface.h"
#include "keystate_interface.h"
#include "linuxdmabuf_v1_interface.h"
#include "logging.h"
......@@ -525,9 +525,9 @@ DataControlDeviceManagerV1Interface *Display::createDataControlDeviceManagerV1(Q
return m;
}
KeyboardShortcutsInhibitManagerInterface *Display::createKeyboardShortcutsInhibitManager(QObject *parent)
KeyboardShortcutsInhibitManagerV1Interface *Display::createKeyboardShortcutsInhibitManagerV1(QObject *parent)
{
auto d = new KeyboardShortcutsInhibitManagerInterface(this, parent);
auto d = new KeyboardShortcutsInhibitManagerV1Interface(this, parent);
connect(this, &Display::aboutToTerminate, d, [d] { delete d; });
return d;
}
......
......@@ -78,7 +78,7 @@ class KeyStateInterface;
class LinuxDmabufUnstableV1Interface;
class TabletManagerInterface;
class DataControlDeviceManagerV1Interface;
class KeyboardShortcutsInhibitManagerInterface;
class KeyboardShortcutsInhibitManagerV1Interface;
/**
* @brief Class holding the Wayland server display loop.
......@@ -323,9 +323,9 @@ public:
TabletManagerInterface *createTabletManagerInterface(QObject *parent = nullptr);
/**
* Creates the KeyboardShortcutsInhibitorInterface
* Creates the KeyboardShortcutsInhibitorV1Interface
*/
KeyboardShortcutsInhibitManagerInterface *createKeyboardShortcutsInhibitManager(QObject *object = nullptr);
KeyboardShortcutsInhibitManagerV1Interface *createKeyboardShortcutsInhibitManagerV1(QObject *parent = nullptr);
/**
* Gets the ClientConnection for the given @p client.
......
......@@ -4,7 +4,7 @@
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#include "keyboard_shortcuts_inhibit_interface.h"
#include "keyboard_shortcuts_inhibit_v1_interface.h"
#include <qwayland-server-keyboard-shortcuts-inhibit-unstable-v1.h>
......@@ -16,15 +16,15 @@ static const int s_version = 1;
namespace KWaylandServer
{
class KeyboardShortcutsInhibitorInterfacePrivate : public QtWaylandServer::zwp_keyboard_shortcuts_inhibitor_v1
class KeyboardShortcutsInhibitorV1InterfacePrivate : public QtWaylandServer::zwp_keyboard_shortcuts_inhibitor_v1
{
public:
KeyboardShortcutsInhibitorInterfacePrivate(SurfaceInterface *surface, SeatInterface *seat,
KeyboardShortcutsInhibitManagerInterface *manager,
KeyboardShortcutsInhibitorInterface *q, wl_resource *resource);
KeyboardShortcutsInhibitorV1InterfacePrivate(SurfaceInterface *surface, SeatInterface *seat,
KeyboardShortcutsInhibitManagerV1Interface *manager,
KeyboardShortcutsInhibitorV1Interface *q, wl_resource *resource);
KeyboardShortcutsInhibitorInterface *q;
QPointer<KeyboardShortcutsInhibitManagerInterface> m_manager;
KeyboardShortcutsInhibitorV1Interface *q;
QPointer<KeyboardShortcutsInhibitManagerV1Interface> m_manager;
SurfaceInterface *const m_surface;
SeatInterface *const m_seat;
bool m_active;
......@@ -35,45 +35,45 @@ protected:
void zwp_keyboard_shortcuts_inhibitor_v1_destroy(Resource *resource) override;
};
class KeyboardShortcutsInhibitManagerInterfacePrivate
class KeyboardShortcutsInhibitManagerV1InterfacePrivate
: public QtWaylandServer::zwp_keyboard_shortcuts_inhibit_manager_v1
{
public:
KeyboardShortcutsInhibitManagerInterfacePrivate(Display *display, KeyboardShortcutsInhibitManagerInterface *q);
KeyboardShortcutsInhibitManagerV1InterfacePrivate(Display *display, KeyboardShortcutsInhibitManagerV1Interface *q);
void zwp_keyboard_shortcuts_inhibit_manager_v1_inhibit_shortcuts(Resource *resource, uint32_t id,
struct ::wl_resource *surface_resource,
struct ::wl_resource *seat_resource) override;
KeyboardShortcutsInhibitorInterface *findInhibitor(SurfaceInterface *surface, SeatInterface *seat) const;
KeyboardShortcutsInhibitorV1Interface *findInhibitor(SurfaceInterface *surface, SeatInterface *seat) const;
void removeInhibitor(SurfaceInterface *const surface, SeatInterface *const seat);
KeyboardShortcutsInhibitManagerInterface *q;
KeyboardShortcutsInhibitManagerV1Interface *q;
Display *const m_display;
QHash<QPair<SurfaceInterface *, SeatInterface *>, KeyboardShortcutsInhibitorInterface *> m_inhibitors;
QHash<QPair<SurfaceInterface *, SeatInterface *>, KeyboardShortcutsInhibitorV1Interface *> m_inhibitors;
protected:
void zwp_keyboard_shortcuts_inhibit_manager_v1_destroy(Resource *resource) override;
};
KeyboardShortcutsInhibitorInterfacePrivate::KeyboardShortcutsInhibitorInterfacePrivate(SurfaceInterface *surface,
SeatInterface *seat,
KeyboardShortcutsInhibitManagerInterface *manager,
KeyboardShortcutsInhibitorInterface *q,
wl_resource *resource)
KeyboardShortcutsInhibitorV1InterfacePrivate::KeyboardShortcutsInhibitorV1InterfacePrivate(SurfaceInterface *surface,
SeatInterface *seat,
KeyboardShortcutsInhibitManagerV1Interface *manager,
KeyboardShortcutsInhibitorV1Interface *q,
wl_resource *resource)
: zwp_keyboard_shortcuts_inhibitor_v1(resource), q(q), m_manager(manager), m_surface(surface), m_seat(seat),
m_active(false)
{
}
void KeyboardShortcutsInhibitorInterfacePrivate::zwp_keyboard_shortcuts_inhibitor_v1_destroy(Resource *resource)
void KeyboardShortcutsInhibitorV1InterfacePrivate::zwp_keyboard_shortcuts_inhibitor_v1_destroy(Resource *resource)
{
wl_resource_destroy(resource->handle);
}
void
KeyboardShortcutsInhibitorInterfacePrivate::zwp_keyboard_shortcuts_inhibitor_v1_destroy_resource(Resource *resource)
KeyboardShortcutsInhibitorV1InterfacePrivate::zwp_keyboard_shortcuts_inhibitor_v1_destroy_resource(Resource *resource)
{
Q_UNUSED(resource)
// Ensure manager don't track anymore this inhibitor
......@@ -83,16 +83,16 @@ KeyboardShortcutsInhibitorInterfacePrivate::zwp_keyboard_shortcuts_inhibitor_v1_
delete q;
}
KeyboardShortcutsInhibitorInterface::KeyboardShortcutsInhibitorInterface(SurfaceInterface *surface, SeatInterface *seat,
KeyboardShortcutsInhibitManagerInterface *manager,
wl_resource *resource)
: QObject(nullptr), d(new KeyboardShortcutsInhibitorInterfacePrivate(surface, seat, manager, this, resource))
KeyboardShortcutsInhibitorV1Interface::KeyboardShortcutsInhibitorV1Interface(SurfaceInterface *surface, SeatInterface *seat,
KeyboardShortcutsInhibitManagerV1Interface *manager,
wl_resource *resource)
: QObject(nullptr), d(new KeyboardShortcutsInhibitorV1InterfacePrivate(surface, seat, manager, this, resource))
{
}
KeyboardShortcutsInhibitorInterface::~KeyboardShortcutsInhibitorInterface() = default;
KeyboardShortcutsInhibitorV1Interface::~KeyboardShortcutsInhibitorV1Interface() = default;
void KeyboardShortcutsInhibitorInterface::setActive(bool active)
void KeyboardShortcutsInhibitorV1Interface::setActive(bool active)
{
if (d->m_active == active) {
return;
......@@ -105,28 +105,28 @@ void KeyboardShortcutsInhibitorInterface::setActive(bool active)
}
}
bool KeyboardShortcutsInhibitorInterface::isActive() const
bool KeyboardShortcutsInhibitorV1Interface::isActive() const
{
return d->m_active;
}
SeatInterface *KeyboardShortcutsInhibitorInterface::seat() const
SeatInterface *KeyboardShortcutsInhibitorV1Interface::seat() const
{
return d->m_seat;
}
SurfaceInterface *KeyboardShortcutsInhibitorInterface::surface() const
SurfaceInterface *KeyboardShortcutsInhibitorV1Interface::surface() const
{
return d->m_surface;
}
KeyboardShortcutsInhibitManagerInterfacePrivate::KeyboardShortcutsInhibitManagerInterfacePrivate(Display *display,
KeyboardShortcutsInhibitManagerInterface *q)
KeyboardShortcutsInhibitManagerV1InterfacePrivate::KeyboardShortcutsInhibitManagerV1InterfacePrivate(Display *display,
KeyboardShortcutsInhibitManagerV1Interface *q)
: zwp_keyboard_shortcuts_inhibit_manager_v1(*display, s_version), q(q), m_display(display)
{
}
void KeyboardShortcutsInhibitManagerInterfacePrivate::zwp_keyboard_shortcuts_inhibit_manager_v1_inhibit_shortcuts(
void KeyboardShortcutsInhibitManagerV1InterfacePrivate::zwp_keyboard_shortcuts_inhibit_manager_v1_inhibit_shortcuts(
Resource *resource, uint32_t id, wl_resource *surface_resource, wl_resource *seat_resource)
{
SeatInterface *seat = SeatInterface::get(seat_resource);
......@@ -140,41 +140,41 @@ void KeyboardShortcutsInhibitManagerInterfacePrivate::zwp_keyboard_shortcuts_inh
wl_resource *inhibitorResource = wl_resource_create(resource->client(),
&zwp_keyboard_shortcuts_inhibitor_v1_interface,
resource->version(), id);
auto inhibitor = new KeyboardShortcutsInhibitorInterface(surface, seat, q, inhibitorResource);
auto inhibitor = new KeyboardShortcutsInhibitorV1Interface(surface, seat, q, inhibitorResource);
m_inhibitors[{surface, seat}] = inhibitor;
Q_EMIT q->inhibitorCreated(inhibitor);
inhibitor->setActive(true);
}
KeyboardShortcutsInhibitorInterface *KeyboardShortcutsInhibitManagerInterfacePrivate::findInhibitor(SurfaceInterface *surface, SeatInterface *seat) const
KeyboardShortcutsInhibitorV1Interface *KeyboardShortcutsInhibitManagerV1InterfacePrivate::findInhibitor(SurfaceInterface *surface, SeatInterface *seat) const
{
return m_inhibitors.value({surface, seat}, nullptr);
}
void KeyboardShortcutsInhibitManagerInterfacePrivate::zwp_keyboard_shortcuts_inhibit_manager_v1_destroy(Resource *resource)
void KeyboardShortcutsInhibitManagerV1InterfacePrivate::zwp_keyboard_shortcuts_inhibit_manager_v1_destroy(Resource *resource)
{
wl_resource_destroy(resource->handle);
}
void KeyboardShortcutsInhibitManagerInterfacePrivate::removeInhibitor(SurfaceInterface *const surface,
SeatInterface *const seat)
void KeyboardShortcutsInhibitManagerV1InterfacePrivate::removeInhibitor(SurfaceInterface *const surface,
SeatInterface *const seat)
{
m_inhibitors.remove({surface, seat});
}
KeyboardShortcutsInhibitManagerInterface::KeyboardShortcutsInhibitManagerInterface(Display *display, QObject *parent)
: QObject(parent), d(new KeyboardShortcutsInhibitManagerInterfacePrivate(display, this))
KeyboardShortcutsInhibitManagerV1Interface::KeyboardShortcutsInhibitManagerV1Interface(Display *display, QObject *parent)
: QObject(parent), d(new KeyboardShortcutsInhibitManagerV1InterfacePrivate(display, this))
{
}
KeyboardShortcutsInhibitManagerInterface::~KeyboardShortcutsInhibitManagerInterface() = default;
KeyboardShortcutsInhibitManagerV1Interface::~KeyboardShortcutsInhibitManagerV1Interface() = default;
KeyboardShortcutsInhibitorInterface *KeyboardShortcutsInhibitManagerInterface::findInhibitor(SurfaceInterface *surface, SeatInterface *seat) const
KeyboardShortcutsInhibitorV1Interface *KeyboardShortcutsInhibitManagerV1Interface::findInhibitor(SurfaceInterface *surface, SeatInterface *seat) const
{
return d->findInhibitor(surface, seat);
}
void KeyboardShortcutsInhibitManagerInterface::removeInhibitor(SurfaceInterface *surface, SeatInterface *seat)
void KeyboardShortcutsInhibitManagerV1Interface::removeInhibitor(SurfaceInterface *surface, SeatInterface *seat)
{
d->removeInhibitor(surface, seat);
}
......
......@@ -4,8 +4,8 @@
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#ifndef WAYLAND_SERVER_KEYBOARD_SHORTCUTS_INHIBIT_INTERFACE_H
#define WAYLAND_SERVER_KEYBOARD_SHORTCUTS_INHIBIT_INTERFACE_H
#ifndef WAYLAND_SERVER_KEYBOARD_SHORTCUTS_INHIBIT_V1_INTERFACE_H
#define WAYLAND_SERVER_KEYBOARD_SHORTCUTS_INHIBIT_V1_INTERFACE_H
#include <KWaylandServer/kwaylandserver_export.h>
#include <QObject>
......@@ -17,63 +17,63 @@ namespace KWaylandServer
/**
* This is an implementation of wayland-protocols/unstable/keyboard-shortcuts-inhibit/keyboard-shortcuts-inhibit-unstable-v1.xml
*
* This class is just the means to get a @class KeyboardShortcutsInhibitorInterface, which is
* This class is just the means to get a @class KeyboardShortcutsInhibitorV1Interface, which is
* the class that will have all of the information we need.
*/
class KeyboardShortcutsInhibitManagerInterface;
class KeyboardShortcutsInhibitorInterfacePrivate;
class KeyboardShortcutsInhibitManagerInterfacePrivate;
class KeyboardShortcutsInhibitManagerV1Interface;
class KeyboardShortcutsInhibitorV1InterfacePrivate;
class KeyboardShortcutsInhibitManagerV1InterfacePrivate;
class KWAYLANDSERVER_EXPORT KeyboardShortcutsInhibitorInterface : public QObject
class KWAYLANDSERVER_EXPORT KeyboardShortcutsInhibitorV1Interface : public QObject
{
Q_OBJECT
public:
~KeyboardShortcutsInhibitorInterface() override;
~KeyboardShortcutsInhibitorV1Interface() override;
SurfaceInterface *surface() const;
SeatInterface *seat() const;
void setActive(bool active);
bool isActive() const;
private:
friend class KeyboardShortcutsInhibitManagerInterfacePrivate;
explicit KeyboardShortcutsInhibitorInterface(SurfaceInterface *surface, SeatInterface *seat, KeyboardShortcutsInhibitManagerInterface *manager, wl_resource *resource);
QScopedPointer<KeyboardShortcutsInhibitorInterfacePrivate> d;
friend class KeyboardShortcutsInhibitManagerV1InterfacePrivate;
explicit KeyboardShortcutsInhibitorV1Interface(SurfaceInterface *surface, SeatInterface *seat, KeyboardShortcutsInhibitManagerV1Interface *manager, wl_resource *resource);
QScopedPointer<KeyboardShortcutsInhibitorV1InterfacePrivate> d;
};
/**
* The KeyboardShortcutsInhibitManagerInterface allows clients to inhibit global shortcuts.
* The KeyboardShortcutsInhibitManagerV1Interface allows clients to inhibit global shortcuts.
*
* KeyboardShortcutsInhibitManagerInterface correponds to the wayland interface zwp_keyboard_shortcuts_inhibit_manager_v1.
* KeyboardShortcutsInhibitManagerV1Interface correponds to the wayland interface zwp_keyboard_shortcuts_inhibit_manager_v1.
*
* @since 5.20
*/
class KWAYLANDSERVER_EXPORT KeyboardShortcutsInhibitManagerInterface : public QObject
class KWAYLANDSERVER_EXPORT KeyboardShortcutsInhibitManagerV1Interface : public QObject
{
Q_OBJECT
public:
~KeyboardShortcutsInhibitManagerInterface() override;
~KeyboardShortcutsInhibitManagerV1Interface() override;
/**
* return shortucts inhibitor associated with surface and seat, if no shortcut are associated, return nullptr
*/
KeyboardShortcutsInhibitorInterface *findInhibitor(SurfaceInterface *surface, SeatInterface *seat) const;
KeyboardShortcutsInhibitorV1Interface *findInhibitor(SurfaceInterface *surface, SeatInterface *seat) const;
Q_SIGNALS:
/**
* This signal is emitted when a keyboard shortcuts inhibitor @a inhibitor is created.
*/
void inhibitorCreated(KeyboardShortcutsInhibitorInterface *inhibitor);
void inhibitorCreated(KeyboardShortcutsInhibitorV1Interface *inhibitor);
private:
friend class Display;
friend class KeyboardShortcutsInhibitorInterfacePrivate;
explicit KeyboardShortcutsInhibitManagerInterface(Display *d, QObject *parent = nullptr);
friend class KeyboardShortcutsInhibitorV1InterfacePrivate;
explicit KeyboardShortcutsInhibitManagerV1Interface(Display *d, QObject *parent = nullptr);
void removeInhibitor(SurfaceInterface *const surface, SeatInterface *const seat);
QScopedPointer<KeyboardShortcutsInhibitManagerInterfacePrivate> d;
QScopedPointer<KeyboardShortcutsInhibitManagerV1InterfacePrivate> d;
};
}
......
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