-
Notifications
You must be signed in to change notification settings - Fork 0
/
window.cpp
61 lines (53 loc) · 2.36 KB
/
window.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include "window.h"
window::window(int width, int height, int direction, int offset, bool show) {
window::width = width;
window::height = height;
window::direction = direction;
window::offset = offset;
window::show = show;
}
int window::create() {
const QUrl url(QStringLiteral("qrc:/window.qml"));
window::applicationEngine.load(url);
window::edgeWindow = dynamic_cast<QQuickWindow *>(
window::applicationEngine.rootObjects().first());
QScreen *screen = QGuiApplication::primaryScreen();
window::edgeWindow->setProperty("offset", offset);
window::edgeWindow->setProperty("direction", window::direction);
if (window::width != 0) {
window::edgeWindow->setWidth(window::width);
} else {
window::edgeWindow->setProperty("horizontalexpand", true);
}
if (window::height != 0) {
window::edgeWindow->setHeight(window::height);
} else {
window::edgeWindow->setProperty("verticalexpand", true);
}
/*
window::edgeWindow->setProperty("topoffset", screen->availableGeometry().y());
window::edgeWindow->setProperty("leftoffset",
screen->availableGeometry().x());*/
window::edgeWindow->setFlags(Qt::CustomizeWindowHint |
Qt::WindowStaysOnTopHint);
/*window::edgeWindow->setFlags(Qt::FramelessWindowHint |
Qt::WindowStaysOnTopHint | Qt::SplashScreen |
Qt::BypassWindowManagerHint);*/
// KWindowSystem::setOnAllDesktops(window::edgeWindow->winId(), true);
// KWindowSystem::setType(window::edgeWindow->winId(), NET::Dock);
KWindowSystem::setState(window::edgeWindow->winId(), NET::SkipTaskbar |
NET::SkipPager |
NET::SkipSwitcher);
window::edgeWindow->raise();
window::edgeWindow->requestActivate();
KWindowEffects::enableBlurBehind(window::edgeWindow);
return 0;
}
void window::showSlot() {
KWindowSystem::setState(window::edgeWindow->winId(), NET::SkipTaskbar |
NET::SkipPager |
NET::SkipSwitcher);
window::edgeWindow->setProperty("visible", true);
window::edgeWindow->setProperty("show", true);
}
void window::hideSlot() { window::edgeWindow->setProperty("show", false); }