Changeset View
Changeset View
Standalone View
Standalone View
ksmserver/logout-greeter/shutdowndlg.cpp
- This file was moved from ksmserver/shutdowndlg.cpp.
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Line(s) | |||||
51 | #include <KLocalizedString> | 51 | #include <KLocalizedString> | ||
52 | #include <KUser> | 52 | #include <KUser> | ||
53 | #include <Solid/PowerManagement> | 53 | #include <Solid/PowerManagement> | ||
54 | #include <KWindowEffects> | 54 | #include <KWindowEffects> | ||
55 | #include <KWindowSystem> | 55 | #include <KWindowSystem> | ||
56 | #include <KDeclarative/KDeclarative> | 56 | #include <KDeclarative/KDeclarative> | ||
57 | #include <KSharedConfig> | 57 | #include <KSharedConfig> | ||
58 | #include <KConfigGroup> | 58 | #include <KConfigGroup> | ||
59 | #include <KJob> | | |||
60 | 59 | | |||
61 | #include <stdio.h> | 60 | #include <stdio.h> | ||
62 | #include <netwm.h> | 61 | #include <netwm.h> | ||
63 | 62 | | |||
64 | #include <X11/Xutil.h> | 63 | #include <X11/Xutil.h> | ||
65 | #include <X11/Xatom.h> | 64 | #include <X11/Xatom.h> | ||
66 | #include <fixx11h.h> | 65 | #include <fixx11h.h> | ||
67 | 66 | | |||
68 | #include <kdisplaymanager.h> | 67 | #include <kdisplaymanager.h> | ||
69 | 68 | | |||
70 | #include <config-workspace.h> | 69 | #include <config-workspace.h> | ||
71 | 70 | | |||
72 | #include <KWayland/Client/surface.h> | 71 | #include <KWayland/Client/surface.h> | ||
73 | #include <KWayland/Client/plasmashell.h> | 72 | #include <KWayland/Client/plasmashell.h> | ||
74 | 73 | | |||
75 | Q_DECLARE_METATYPE(Solid::PowerManagement::SleepState) | 74 | Q_DECLARE_METATYPE(Solid::PowerManagement::SleepState) | ||
76 | 75 | | |||
77 | KSMShutdownDlg::KSMShutdownDlg( QWindow* parent, | 76 | KSMShutdownDlg::KSMShutdownDlg( QWindow* parent, | ||
78 | bool maysd, bool choose, KWorkSpace::ShutdownType sdtype, | 77 | bool maysd, bool choose, KWorkSpace::ShutdownType sdtype, | ||
79 | KWayland::Client::PlasmaShell *plasmaShell) | 78 | KWayland::Client::PlasmaShell *plasmaShell) | ||
80 | : QQuickView(parent), | 79 | : QuickViewSharedEngine(parent), | ||
81 | m_result(false), | 80 | m_result(false), | ||
82 | m_waylandPlasmaShell(plasmaShell) | 81 | m_waylandPlasmaShell(plasmaShell) | ||
83 | // this is a WType_Popup on purpose. Do not change that! Not | 82 | // this is a WType_Popup on purpose. Do not change that! Not | ||
84 | // having a popup here has severe side effects. | 83 | // having a popup here has severe side effects. | ||
85 | { | 84 | { | ||
86 | // window stuff | 85 | // window stuff | ||
87 | setClearBeforeRendering(true); | 86 | setClearBeforeRendering(true); | ||
88 | setColor(QColor(Qt::transparent)); | 87 | setColor(QColor(Qt::transparent)); | ||
89 | 88 | | |||
90 | setResizeMode(QQuickView::SizeRootObjectToView); | 89 | setResizeMode(KQuickAddons::QuickViewSharedEngine::SizeRootObjectToView); | ||
91 | 90 | | |||
92 | // Qt doesn't set this on unmanaged windows | 91 | // Qt doesn't set this on unmanaged windows | ||
93 | //FIXME: or does it? | 92 | //FIXME: or does it? | ||
94 | if (KWindowSystem::isPlatformX11()) { | 93 | if (KWindowSystem::isPlatformX11()) { | ||
95 | XChangeProperty( QX11Info::display(), winId(), | 94 | XChangeProperty( QX11Info::display(), winId(), | ||
96 | XInternAtom( QX11Info::display(), "WM_WINDOW_ROLE", False ), XA_STRING, 8, PropModeReplace, | 95 | XInternAtom( QX11Info::display(), "WM_WINDOW_ROLE", False ), XA_STRING, 8, PropModeReplace, | ||
97 | (unsigned char *)"logoutdialog", strlen( "logoutdialog" )); | 96 | (unsigned char *)"logoutdialog", strlen( "logoutdialog" )); | ||
98 | 97 | | |||
▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Line(s) | 152 | { | |||
191 | //decide in backgroundcontrast wether doing things darker or lighter | 190 | //decide in backgroundcontrast wether doing things darker or lighter | ||
192 | //set backgroundcontrast here, because in QEvent::PlatformSurface | 191 | //set backgroundcontrast here, because in QEvent::PlatformSurface | ||
193 | //is too early and we don't have the root object yet | 192 | //is too early and we don't have the root object yet | ||
194 | const QColor backgroundColor = rootObject() ? rootObject()->property("backgroundColor").value<QColor>() : QColor(); | 193 | const QColor backgroundColor = rootObject() ? rootObject()->property("backgroundColor").value<QColor>() : QColor(); | ||
195 | KWindowEffects::enableBackgroundContrast(winId(), true, | 194 | KWindowEffects::enableBackgroundContrast(winId(), true, | ||
196 | 0.4, | 195 | 0.4, | ||
197 | (backgroundColor.value() > 128 ? 1.6 : 0.3), | 196 | (backgroundColor.value() > 128 ? 1.6 : 0.3), | ||
198 | 1.7); | 197 | 1.7); | ||
199 | QQuickView::showFullScreen(); | 198 | KQuickAddons::QuickViewSharedEngine::showFullScreen(); | ||
200 | requestActivate(); | 199 | requestActivate(); | ||
201 | 200 | | |||
202 | KWindowSystem::setState(winId(), NET::SkipTaskbar|NET::SkipPager); | 201 | KWindowSystem::setState(winId(), NET::SkipTaskbar|NET::SkipPager); | ||
203 | 202 | | |||
204 | setKeyboardGrabEnabled(true); | 203 | setKeyboardGrabEnabled(true); | ||
205 | } | 204 | } | ||
206 | 205 | | |||
207 | void KSMShutdownDlg::resizeEvent(QResizeEvent *e) | 206 | void KSMShutdownDlg::resizeEvent(QResizeEvent *e) | ||
208 | { | 207 | { | ||
209 | QQuickView::resizeEvent( e ); | 208 | KQuickAddons::QuickViewSharedEngine::resizeEvent( e ); | ||
210 | 209 | | |||
211 | if( KWindowSystem::compositingActive()) { | 210 | if( KWindowSystem::compositingActive()) { | ||
212 | //TODO: reenable window mask when we are without composite? | 211 | //TODO: reenable window mask when we are without composite? | ||
213 | // clearMask(); | 212 | // clearMask(); | ||
214 | } else { | 213 | } else { | ||
215 | // setMask(m_view->mask()); | 214 | // setMask(m_view->mask()); | ||
216 | } | 215 | } | ||
217 | } | 216 | } | ||
218 | 217 | | |||
219 | bool KSMShutdownDlg::event(QEvent *e) | 218 | bool KSMShutdownDlg::event(QEvent *e) | ||
220 | { | 219 | { | ||
221 | if (e->type() == QEvent::PlatformSurface) { | 220 | if (e->type() == QEvent::PlatformSurface) { | ||
222 | switch (static_cast<QPlatformSurfaceEvent*>(e)->surfaceEventType()) { | 221 | switch (static_cast<QPlatformSurfaceEvent*>(e)->surfaceEventType()) { | ||
223 | case QPlatformSurfaceEvent::SurfaceCreated: | 222 | case QPlatformSurfaceEvent::SurfaceCreated: | ||
224 | setupWaylandIntegration(); | 223 | setupWaylandIntegration(); | ||
225 | KWindowEffects::enableBlurBehind(winId(), true); | 224 | KWindowEffects::enableBlurBehind(winId(), true); | ||
226 | break; | 225 | break; | ||
227 | case QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed: | 226 | case QPlatformSurfaceEvent::SurfaceAboutToBeDestroyed: | ||
228 | delete m_shellSurface; | 227 | delete m_shellSurface; | ||
229 | m_shellSurface = nullptr; | 228 | m_shellSurface = nullptr; | ||
230 | break; | 229 | break; | ||
231 | } | 230 | } | ||
232 | } | 231 | } | ||
233 | return QQuickView::event(e); | 232 | return KQuickAddons::QuickViewSharedEngine::event(e); | ||
234 | } | 233 | } | ||
235 | 234 | | |||
236 | void KSMShutdownDlg::setupWaylandIntegration() | 235 | void KSMShutdownDlg::setupWaylandIntegration() | ||
237 | { | 236 | { | ||
238 | if (m_shellSurface) { | 237 | if (m_shellSurface) { | ||
239 | // already setup | 238 | // already setup | ||
240 | return; | 239 | return; | ||
241 | } | 240 | } | ||
▲ Show 20 Lines • Show All 79 Lines • Show Last 20 Lines |