File indexing completed on 2024-05-19 05:32:36
0001 /* 0002 SPDX-FileCopyrightText: 2020 Benjamin Port <benjamin.port@enioka.com> 0003 0004 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0005 */ 0006 0007 #pragma once 0008 0009 #include "seat.h" 0010 #include "surface.h" 0011 0012 #include <QObject> 0013 0014 namespace KWin 0015 { 0016 /** 0017 * This is an implementation of wayland-protocols/unstable/keyboard-shortcuts-inhibit/keyboard-shortcuts-inhibit-unstable-v1.xml 0018 * 0019 * This class is just the means to get a @class KeyboardShortcutsInhibitorV1Interface, which is 0020 * the class that will have all of the information we need. 0021 */ 0022 0023 class KeyboardShortcutsInhibitManagerV1Interface; 0024 class KeyboardShortcutsInhibitorV1InterfacePrivate; 0025 class KeyboardShortcutsInhibitManagerV1InterfacePrivate; 0026 0027 class KWIN_EXPORT KeyboardShortcutsInhibitorV1Interface : public QObject 0028 { 0029 Q_OBJECT 0030 0031 public: 0032 ~KeyboardShortcutsInhibitorV1Interface() override; 0033 0034 SurfaceInterface *surface() const; 0035 SeatInterface *seat() const; 0036 void setActive(bool active); 0037 bool isActive() const; 0038 0039 private: 0040 friend class KeyboardShortcutsInhibitManagerV1InterfacePrivate; 0041 explicit KeyboardShortcutsInhibitorV1Interface(SurfaceInterface *surface, 0042 SeatInterface *seat, 0043 KeyboardShortcutsInhibitManagerV1Interface *manager, 0044 wl_resource *resource); 0045 std::unique_ptr<KeyboardShortcutsInhibitorV1InterfacePrivate> d; 0046 }; 0047 0048 /** 0049 * The KeyboardShortcutsInhibitManagerV1Interface allows clients to inhibit global shortcuts. 0050 * 0051 * KeyboardShortcutsInhibitManagerV1Interface correponds to the wayland interface zwp_keyboard_shortcuts_inhibit_manager_v1. 0052 */ 0053 class KWIN_EXPORT KeyboardShortcutsInhibitManagerV1Interface : public QObject 0054 { 0055 Q_OBJECT 0056 0057 public: 0058 explicit KeyboardShortcutsInhibitManagerV1Interface(Display *d, QObject *parent = nullptr); 0059 ~KeyboardShortcutsInhibitManagerV1Interface() override; 0060 0061 /** 0062 * return shortucts inhibitor associated with surface and seat, if no shortcut are associated, return nullptr 0063 */ 0064 KeyboardShortcutsInhibitorV1Interface *findInhibitor(SurfaceInterface *surface, SeatInterface *seat) const; 0065 0066 Q_SIGNALS: 0067 /** 0068 * This signal is emitted when a keyboard shortcuts inhibitor @a inhibitor is created. 0069 */ 0070 void inhibitorCreated(KeyboardShortcutsInhibitorV1Interface *inhibitor); 0071 0072 private: 0073 friend class KeyboardShortcutsInhibitorV1InterfacePrivate; 0074 void removeInhibitor(SurfaceInterface *const surface, SeatInterface *const seat); 0075 std::unique_ptr<KeyboardShortcutsInhibitManagerV1InterfacePrivate> d; 0076 }; 0077 0078 }