File indexing completed on 2025-02-16 14:19:54
0001 /* 0002 KWin - the KDE window manager 0003 This file is part of the KDE project. 0004 0005 SPDX-FileCopyrightText: 2020 Aleix Pol Gonzalez <aleixpol@kde.org> 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 0010 #pragma once 0011 0012 #include "wayland/inputmethod_v1_interface.h" 0013 #include "waylandwindow.h" 0014 #include <QPointer> 0015 0016 namespace KWin 0017 { 0018 class Output; 0019 0020 class InputPanelV1Window : public WaylandWindow 0021 { 0022 Q_OBJECT 0023 public: 0024 InputPanelV1Window(KWaylandServer::InputPanelSurfaceV1Interface *panelSurface); 0025 0026 enum class Mode { 0027 None, 0028 VirtualKeyboard, 0029 Overlay, 0030 }; 0031 Q_ENUM(Mode) 0032 0033 void destroyWindow() override; 0034 bool isPlaceable() const override 0035 { 0036 return false; 0037 } 0038 bool isCloseable() const override 0039 { 0040 return false; 0041 } 0042 bool isResizable() const override 0043 { 0044 return false; 0045 } 0046 bool isMovable() const override 0047 { 0048 return false; 0049 } 0050 bool isMovableAcrossScreens() const override 0051 { 0052 return false; 0053 } 0054 bool acceptsFocus() const override 0055 { 0056 return false; 0057 } 0058 void closeWindow() override 0059 { 0060 } 0061 bool takeFocus() override 0062 { 0063 return false; 0064 } 0065 bool wantsInput() const override 0066 { 0067 return false; 0068 } 0069 bool isInputMethod() const override 0070 { 0071 return true; 0072 } 0073 NET::WindowType windowType(bool /*direct*/, int /*supported_types*/) const override; 0074 QRectF inputGeometry() const override; 0075 0076 Mode mode() const 0077 { 0078 return m_mode; 0079 } 0080 void allow(); 0081 void show(); 0082 void hide(); 0083 0084 protected: 0085 void moveResizeInternal(const QRectF &rect, MoveResizeMode mode) override; 0086 0087 private: 0088 void showTopLevel(KWaylandServer::OutputInterface *output, KWaylandServer::InputPanelSurfaceV1Interface::Position position); 0089 void showOverlayPanel(); 0090 void reposition(); 0091 void handleMapped(); 0092 void maybeShow(); 0093 0094 Mode m_mode = Mode::None; 0095 bool m_allowed = false; 0096 bool m_virtualKeyboardShouldBeShown = false; 0097 const QPointer<KWaylandServer::InputPanelSurfaceV1Interface> m_panelSurface; 0098 }; 0099 0100 }