KWin
Loading...
Searching...
No Matches
windowsystem.cpp
Go to the documentation of this file.
1/*
2 SPDX-FileCopyrightText: 2019 Martin Flöser <mgraesslin@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
5*/
6#include "windowsystem.h"
7
8#include <KWaylandExtras>
9#include <KWindowSystem>
10
11#include <QGuiApplication>
12#include <QWindow>
13#include <wayland/display.h>
14#include <wayland/seat.h>
15#include <wayland_server.h>
16#include <window.h>
17#include <workspace.h>
18#include <xdgactivationv1.h>
19
20Q_DECLARE_METATYPE(NET::WindowType)
21
22namespace KWin
23{
24
26 : QObject()
27 , KWindowSystemPrivateV2()
28{
29}
30
31void WindowSystem::activateWindow(QWindow *win, long int time)
32{
33 // KWin cannot activate own windows
34}
35
37{
38 // KWin should not use KWindowSystem to set showing desktop state
39}
40
42{
43 // KWin should not use KWindowSystem for showing desktop state
44 return false;
45}
46
47void WindowSystem::requestToken(QWindow *win, uint32_t serial, const QString &appId)
48{
49 auto seat = KWin::waylandServer()->seat();
50 auto token = KWin::waylandServer()->xdgActivationIntegration()->requestPrivilegedToken(nullptr, seat->display()->serial(), seat, appId);
51 // Ensure that xdgActivationTokenArrived is always emitted asynchronously
52 QTimer::singleShot(0, [serial, token] {
53 Q_EMIT KWaylandExtras::self()->xdgActivationTokenArrived(serial, token);
54 });
55}
56
57void WindowSystem::setCurrentToken(const QString &token)
58{
59 // KWin cannot activate own windows
60}
61
62quint32 WindowSystem::lastInputSerial(QWindow *window)
63{
64 auto w = workspace()->findInternal(window);
65 if (!w) {
66 return 0;
67 }
68 return w->lastUsageSerial();
69}
70
71void WindowSystem::exportWindow(QWindow *window)
72{
73 Q_UNUSED(window);
74}
75
76void WindowSystem::unexportWindow(QWindow *window)
77{
78 Q_UNUSED(window);
79}
80
81void WindowSystem::setMainWindow(QWindow *window, const QString &handle)
82{
83 Q_UNUSED(window);
84 Q_UNUSED(handle);
85}
86}
87
88#include "moc_windowsystem.cpp"
SeatInterface * seat() const
XdgActivationV1Integration * xdgActivationIntegration() const
quint32 lastUsageSerial() const
Definition window.cpp:4162
bool showingDesktop() override
void setShowingDesktop(bool showing) override
quint32 lastInputSerial(QWindow *window) override
void requestToken(QWindow *win, uint32_t serial, const QString &app_id) override
void unexportWindow(QWindow *window) override
void setMainWindow(QWindow *window, const QString &handle) override
void setCurrentToken(const QString &token) override
void exportWindow(QWindow *window) override
void activateWindow(QWindow *win, long time) override
Window * findInternal(QWindow *w) const
Finds a Window for the internal window w.
QString requestPrivilegedToken(SurfaceInterface *surface, uint serial, SeatInterface *seat, const QString &appId)
Q_DECLARE_METATYPE(KWin::SwitchEvent::State)
WaylandServer * waylandServer()
Workspace * workspace()
Definition workspace.h:830