KDeclarative

kwindowsystemproxy.cpp
1 /*
2  SPDX-FileCopyrightText: 2015 Kai Uwe Broulik <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.1-or-later
5 */
6 
7 #include "kwindowsystemproxy.h"
8 
9 #include <QMetaMethod>
10 #include <QWindow>
11 
12 #include <kwindowsystem.h>
13 
14 KWindowSystemProxy::KWindowSystemProxy(QObject *parent)
15  : QObject(parent)
16  , m_initialized(false)
17 {
18 
19 }
20 
21 KWindowSystemProxy::~KWindowSystemProxy()
22 {
23 
24 }
25 
26 void KWindowSystemProxy::connectNotify(const QMetaMethod &signal)
27 {
28  if (m_initialized) {
29  return;
30  }
31 
32  if (signal == QMetaMethod::fromSignal(&KWindowSystemProxy::currentDesktopChanged) ||
33  signal == QMetaMethod::fromSignal(&KWindowSystemProxy::desktopNamesChanged) ||
34  signal == QMetaMethod::fromSignal(&KWindowSystemProxy::numberOfDesktopsChanged) ||
35  signal == QMetaMethod::fromSignal(&KWindowSystemProxy::showingDesktopChanged) ||
36  signal == QMetaMethod::fromSignal(&KWindowSystemProxy::compositingActiveChanged)) {
37 
38  connect(KWindowSystem::self(), &KWindowSystem::currentDesktopChanged, this, [this](int currentDesktop) {
39  Q_EMIT currentDesktopChanged(currentDesktop);
40  Q_EMIT currentDesktopNameChanged();
41  });
42 
44  Q_EMIT desktopNamesChanged();
45  Q_EMIT currentDesktopNameChanged();
46  });
47 
49  this, &KWindowSystemProxy::numberOfDesktopsChanged);
51  this, &KWindowSystemProxy::showingDesktopChanged);
53  this, &KWindowSystemProxy::compositingActiveChanged);
54 
55  m_initialized = true;
56  }
57 }
58 
60 {
62 }
63 
64 void KWindowSystemProxy::setCurrentDesktop(int desktop)
65 {
67 }
68 
70 {
72 }
73 
75 {
77 }
78 
80 {
82 }
83 
84 void KWindowSystemProxy::setShowingDesktop(bool showingDesktop)
85 {
86  KWindowSystem::setShowingDesktop(showingDesktop);
87 }
88 
90 {
92 }
93 
95 {
96  if (!window) {
97  return false;
98  }
99 
100  return KWindowSystem::hasWId(window->winId());
101 }
102 
104 {
105  if (window) {
106  KWindowSystem::forceActiveWindow(window->winId(), time);
107  }
108 }
109 
110 void KWindowSystemProxy::setOnAllDesktops(QWindow *window, bool onAllDesktops)
111 {
112  if (window) {
113  KWindowSystem::setOnAllDesktops(window->winId(), onAllDesktops);
114  }
115 }
116 
117 void KWindowSystemProxy::setOnDesktop(QWindow *window, int desktop)
118 {
119  if (window) {
120  KWindowSystem::setOnDesktop(window->winId(), desktop);
121  }
122 }
123 
125 {
126  if (window) {
127  KWindowSystem::setOnActivities(window->winId(), activities);
128  }
129 }
130 
132 {
133  return KWindowSystem::desktopName(desktop);
134 }
135 
136 void KWindowSystemProxy::setDesktopName(int desktop, const QString &name)
137 {
138  KWindowSystem::setDesktopName(desktop, name);
139 }
Q_INVOKABLE void forceActivateWindow(QWindow *window, long time=0)
Sets window window to be the active window.
Q_INVOKABLE void setDesktopName(int desktop, const QString &name)
Sets the name of the specified desktop.
void desktopNamesChanged()
void compositingChanged(bool enabled)
static QString desktopName(int desktop)
static void setOnDesktop(WId win, int desktop)
static void forceActiveWindow(WId win, long time=0)
Q_INVOKABLE bool hasWindow(QWindow *window) const
Test to see if window still managed at present.
bool showingDesktop
Whether "show desktop" is currently active.
static void setOnActivities(WId win, const QStringList &activities)
static int currentDesktop()
Q_INVOKABLE void setOnAllDesktops(QWindow *window, bool onAllDesktops)
Sets window window to be present on all virtual desktops if onAllDesktops true.
Q_INVOKABLE QString desktopName(int desktop) const
Returns the name of the specified desktop.
QString currentDesktopName
The name of the current desktop.
QMetaMethod fromSignal(PointerToMemberFunction signal)
static void setCurrentDesktop(int desktop)
void showingDesktopChanged(bool showing)
bool compositingActive
Whether desktop compositing is active.
static KWindowSystem * self()
void currentDesktopChanged(int desktop)
static bool hasWId(WId id)
static bool showingDesktop()
static void setShowingDesktop(bool showing)
int currentDesktop
The number of the current desktop.
static void setOnAllDesktops(WId win, bool b)
static int numberOfDesktops()
Q_INVOKABLE void setOnDesktop(QWindow *window, int desktop)
Moves window window to desktop desktop.
void numberOfDesktopsChanged(int num)
int numberOfDesktops
The number of desktops.
static bool compositingActive()
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
WId winId() const const
Q_EMITQ_EMIT
Q_INVOKABLE void setOnActivities(QWindow *window, const QStringList &activities)
Moves window window to activities activities.
static void setDesktopName(int desktop, const QString &name)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Tue Aug 11 2020 22:40:17 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.