KWin
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1/*
2 KWin - the KDE window manager
3 This file is part of the KDE project.
4
5 SPDX-FileCopyrightText: 1999, 2000 Matthias Ettrich <ettrich@kde.org>
6 SPDX-FileCopyrightText: 2003 Lubos Lunak <l.lunak@kde.org>
7
8 SPDX-License-Identifier: GPL-2.0-or-later
9*/
10#include "main.h"
11
12#include <config-kwin.h>
13
14#include "atoms.h"
15#include "colors/colormanager.h"
16#include "compositor.h"
17#include "core/outputbackend.h"
18#include "core/rendertarget.h"
19#include "core/session.h"
20#include "cursor.h"
21#include "cursorsource.h"
23#include "input.h"
24#include "inputmethod.h"
25#include "opengl/gltexture.h"
26#include "opengl/glutils.h"
27#include "options.h"
28#include "outline.h"
29#include "pluginmanager.h"
30#include "pointer_input.h"
31#include "scene/cursorscene.h"
32#include "screenedge.h"
33#include "sm.h"
34#include "tabletmodemanager.h"
35#include "utils/xcbutils.h"
36#include "wayland/surface.h"
37#include "workspace.h"
38#include "x11eventfilter.h"
39
40#if KWIN_BUILD_SCREENLOCKER
41#include "screenlockerwatcher.h"
42#endif
43
45
46// KDE
47#include <KAboutData>
48#include <KLocalizedString>
49// Qt
50#include <QCommandLineParser>
51#include <QQuickWindow>
52#include <private/qtx11extras_p.h>
53#include <qplatformdefs.h>
54
55#include <cerrno>
56
57#if __has_include(<malloc.h>)
58#include <malloc.h>
59#endif
60#include <unistd.h>
61
62// xcb
63#include <xcb/damage.h>
64#ifndef XCB_GE_GENERIC
65#define XCB_GE_GENERIC 35
66#endif
67
68Q_DECLARE_METATYPE(KSharedConfigPtr)
69
70namespace KWin
71{
72
76
78 : QApplication(argc, argv)
79 , m_eventFilter(new XcbEventFilter())
80 , m_configLock(false)
81 , m_config(KSharedConfig::openConfig(QStringLiteral("kwinrc")))
82 , m_kxkbConfig()
83 , m_operationMode(mode)
84{
85 qRegisterMetaType<Options::WindowOperation>("Options::WindowOperation");
86 qRegisterMetaType<KWin::EffectWindow *>();
87 qRegisterMetaType<KWin::SurfaceInterface *>("KWin::SurfaceInterface *");
88 qRegisterMetaType<KSharedConfigPtr>();
89 qRegisterMetaType<std::chrono::nanoseconds>();
90}
91
93{
94 m_configLock = lock;
95}
96
98{
99 return m_operationMode;
100}
101
103{
104 m_operationMode = mode;
105}
106
108{
109 return m_operationMode == OperationModeWaylandOnly || m_operationMode == OperationModeXwayland;
110}
111
113{
114 // Prevent KWin from synchronously autostarting kactivitymanagerd
115 // Indeed, kactivitymanagerd being a QApplication it will depend
116 // on KWin startup... this is unsatisfactory dependency wise,
117 // and it turns out that it leads to a deadlock in the Wayland case
118 setProperty("org.kde.KActivities.core.disableAutostart", true);
119
120 setQuitOnLastWindowClosed(false);
121 setQuitLockEnabled(false);
122
123 if (!m_config->isImmutable() && m_configLock) {
124 // TODO: This shouldn't be necessary
125 // config->setReadOnly( true );
126 m_config->reparseConfiguration();
127 }
128 if (!m_kxkbConfig) {
129 m_kxkbConfig = KSharedConfig::openConfig(QStringLiteral("kxkbrc"), KConfig::NoGlobals);
130 }
131 if (!m_inputConfig) {
132 m_inputConfig = KSharedConfig::openConfig(QStringLiteral("kcminputrc"), KConfig::NoGlobals);
133 }
134
136}
137
139{
140 delete options;
141 destroyAtoms();
143 m_session.reset();
144}
145
147{
148 Q_EMIT started();
149}
150
152{
153 delete atoms;
154 atoms = nullptr;
155}
156
158{
159 m_outputBackend.reset();
160}
161
163{
164 crashes = 0;
165}
166
168{
169 crashes = count;
170}
171
173{
174 return crashes > 0;
175}
176
178{
179 KAboutData aboutData(QStringLiteral("kwin"), // The program name used internally
180 i18n("KWin"), // A displayable program name string
181 KWIN_VERSION_STRING, // The program version string
182 i18n("KDE window manager"), // Short description of what the app does
183 KAboutLicense::GPL, // The license this code is released under
184 i18n("(c) 1999-2019, The KDE Developers")); // Copyright Statement
185
186 aboutData.addAuthor(i18n("Matthias Ettrich"), QString(), QStringLiteral("ettrich@kde.org"));
187 aboutData.addAuthor(i18n("Cristian Tibirna"), QString(), QStringLiteral("tibirna@kde.org"));
188 aboutData.addAuthor(i18n("Daniel M. Duley"), QString(), QStringLiteral("mosfet@kde.org"));
189 aboutData.addAuthor(i18n("Luboš Luňák"), QString(), QStringLiteral("l.lunak@kde.org"));
190 aboutData.addAuthor(i18n("Martin Flöser"), QString(), QStringLiteral("mgraesslin@kde.org"));
191 aboutData.addAuthor(i18n("David Edmundson"), QStringLiteral("Maintainer"), QStringLiteral("davidedmundson@kde.org"));
192 aboutData.addAuthor(i18n("Roman Gilg"), QStringLiteral("Maintainer"), QStringLiteral("subdiff@gmail.com"));
193 aboutData.addAuthor(i18n("Vlad Zahorodnii"), QStringLiteral("Maintainer"), QStringLiteral("vlad.zahorodnii@kde.org"));
194 aboutData.addAuthor(i18n("Xaver Hugl"), QStringLiteral("Maintainer"), QStringLiteral("xaver.hugl@gmail.com"));
195 KAboutData::setApplicationData(aboutData);
196}
197
198static const QString s_lockOption = QStringLiteral("lock");
199static const QString s_crashesOption = QStringLiteral("crashes");
200
201void Application::setupCommandLine(QCommandLineParser *parser)
202{
203 QCommandLineOption lockOption(s_lockOption, i18n("Disable configuration options"));
204 QCommandLineOption crashesOption(s_crashesOption, i18n("Indicate that KWin has recently crashed n times"), QStringLiteral("n"));
205
206 parser->setApplicationDescription(i18n("KDE window manager"));
207 parser->addOption(lockOption);
208 parser->addOption(crashesOption);
209 KAboutData::applicationData().setupCommandLine(parser);
210}
211
212void Application::processCommandLine(QCommandLineParser *parser)
213{
214 KAboutData aboutData = KAboutData::applicationData();
215 aboutData.processCommandLine(parser);
216 setConfigLock(parser->isSet(s_lockOption));
217 Application::setCrashCount(parser->value(s_crashesOption).toInt());
218}
219
221{
222#ifdef M_TRIM_THRESHOLD
223 // Prevent fragmentation of the heap by malloc (glibc).
224 //
225 // The default threshold is 128*1024, which can result in a large memory usage
226 // due to fragmentation especially if we use the raster graphicssystem. On the
227 // otherside if the threshold is too low, free() starts to permanently ask the kernel
228 // about shrinking the heap.
229 const int pagesize = sysconf(_SC_PAGESIZE);
230 mallopt(M_TRIM_THRESHOLD, 5 * pagesize);
231#endif // M_TRIM_THRESHOLD
232}
233
235{
236 KLocalizedString::setApplicationDomain(QByteArrayLiteral("kwin"));
237}
238
240{
241 // we want all QQuickWindows with an alpha buffer, do here as Workspace might create QQuickWindows
242 QQuickWindow::setDefaultAlphaBuffer(true);
243
244 // This tries to detect compositing options and can use GLX. GLX problems
245 // (X errors) shouldn't cause kwin to abort, so this is out of the
246 // critical startup section where x errors cause kwin to abort.
247
248 // create workspace.
249 (void)new Workspace();
250 Q_EMIT workspaceCreated();
251}
252
254{
255#if KWIN_BUILD_SCREENLOCKER
256 m_screenLockerWatcher = std::make_unique<ScreenLockerWatcher>();
257#endif
258 auto input = InputRedirection::create(this);
259 input->init();
260 m_platformCursor = createPlatformCursor();
261}
262
264{
265 atoms = new Atoms;
266}
267
269{
270 options = new Options;
271}
272
274{
275 m_pluginManager = std::make_unique<PluginManager>();
276}
277
279{
280 m_colorManager = std::make_unique<ColorManager>();
281}
282
284{
285 m_inputMethod = std::make_unique<InputMethod>();
286}
287
289{
290 m_tabletModeManager = std::make_unique<TabletModeManager>();
291}
292
294{
295 return m_tabletModeManager.get();
296}
297
299{
300 installNativeEventFilter(m_eventFilter.get());
301}
302
304{
305 removeNativeEventFilter(m_eventFilter.get());
306}
307
309{
310 delete InputRedirection::self();
311}
312
314{
315 delete Workspace::self();
316}
317
322
324{
325 m_pluginManager.reset();
326}
327
329{
330 m_colorManager.reset();
331}
332
334{
335 m_inputMethod.reset();
336}
337
338std::unique_ptr<Edge> Application::createScreenEdge(ScreenEdges *edges)
339{
340 return std::make_unique<Edge>(edges);
341}
342
343std::unique_ptr<Cursor> Application::createPlatformCursor()
344{
345 return std::make_unique<InputRedirectionCursor>();
346}
347
348std::unique_ptr<OutlineVisual> Application::createOutline(Outline *outline)
349{
351 return std::make_unique<CompositedOutlineVisual>(outline);
352 }
353 return nullptr;
354}
355
357{
358 new EffectsHandler(compositor, scene);
359}
360
362{
363 if (filter->isGenericEvent()) {
364 m_genericEventFilters.append(new X11EventFilterContainer(filter));
365 } else {
366 m_eventFilters.append(new X11EventFilterContainer(filter));
367 }
368}
369
370static X11EventFilterContainer *takeEventFilter(X11EventFilter *eventFilter,
371 QList<QPointer<X11EventFilterContainer>> &list)
372{
373 for (int i = 0; i < list.count(); ++i) {
374 X11EventFilterContainer *container = list.at(i);
375 if (container->filter() == eventFilter) {
376 return list.takeAt(i);
377 }
378 }
379 return nullptr;
380}
381
383{
384 Q_ASSERT(scale != 0);
385 if (scale != m_xwaylandScale) {
386 m_xwaylandScale = scale;
388 Q_EMIT xwaylandScaleChanged();
389 }
390}
391
393{
394 const bool xwaylandClientsScale = KConfig(QStringLiteral("kdeglobals"))
395 .group(QStringLiteral("KScreen"))
396 .readEntry("XwaylandClientsScale", true);
397
398 KConfigGroup xwaylandGroup = kwinApp()->config()->group(QStringLiteral("Xwayland"));
399 if (xwaylandClientsScale) {
400 xwaylandGroup.writeEntry("Scale", m_xwaylandScale, KConfig::Notify);
401 } else {
402 xwaylandGroup.deleteEntry("Scale", KConfig::Notify);
403 }
404 xwaylandGroup.sync();
405
406 if (x11Connection()) {
407 // rerun the fonts kcm init that does the appropriate xrdb call with the new settings
408 QProcess::startDetached("kcminit", {"kcm_fonts_init", "kcm_style_init"});
409 }
410}
411
413{
414 X11EventFilterContainer *container = nullptr;
415 if (filter->isGenericEvent()) {
416 container = takeEventFilter(filter, m_genericEventFilters);
417 } else {
418 container = takeEventFilter(filter, m_eventFilters);
419 }
420 delete container;
421}
422
423bool Application::dispatchEvent(xcb_generic_event_t *event)
424{
425 static const QList<QByteArray> s_xcbEerrors({QByteArrayLiteral("Success"),
426 QByteArrayLiteral("BadRequest"),
427 QByteArrayLiteral("BadValue"),
428 QByteArrayLiteral("BadWindow"),
429 QByteArrayLiteral("BadPixmap"),
430 QByteArrayLiteral("BadAtom"),
431 QByteArrayLiteral("BadCursor"),
432 QByteArrayLiteral("BadFont"),
433 QByteArrayLiteral("BadMatch"),
434 QByteArrayLiteral("BadDrawable"),
435 QByteArrayLiteral("BadAccess"),
436 QByteArrayLiteral("BadAlloc"),
437 QByteArrayLiteral("BadColor"),
438 QByteArrayLiteral("BadGC"),
439 QByteArrayLiteral("BadIDChoice"),
440 QByteArrayLiteral("BadName"),
441 QByteArrayLiteral("BadLength"),
442 QByteArrayLiteral("BadImplementation"),
443 QByteArrayLiteral("Unknown")});
444
445 kwinApp()->updateX11Time(event);
446
447 const uint8_t x11EventType = event->response_type & ~0x80;
448 if (!x11EventType) {
449 // let's check whether it's an error from one of the extensions KWin uses
450 xcb_generic_error_t *error = reinterpret_cast<xcb_generic_error_t *>(event);
451 const QList<Xcb::ExtensionData> extensions = Xcb::Extensions::self()->extensions();
452 for (const auto &extension : extensions) {
453 if (error->major_code == extension.majorOpcode) {
454 QByteArray errorName;
455 if (error->error_code < s_xcbEerrors.size()) {
456 errorName = s_xcbEerrors.at(error->error_code);
457 } else if (error->error_code >= extension.errorBase) {
458 const int index = error->error_code - extension.errorBase;
459 if (index >= 0 && index < extension.errorCodes.size()) {
460 errorName = extension.errorCodes.at(index);
461 }
462 }
463 if (errorName.isEmpty()) {
464 errorName = QByteArrayLiteral("Unknown");
465 }
466 qCWarning(KWIN_CORE, "XCB error: %d (%s), sequence: %d, resource id: %d, major code: %d (%s), minor code: %d (%s)",
467 int(error->error_code), errorName.constData(),
468 int(error->sequence), int(error->resource_id),
469 int(error->major_code), extension.name.constData(),
470 int(error->minor_code),
471 extension.opCodes.size() > error->minor_code ? extension.opCodes.at(error->minor_code).constData() : "Unknown");
472 return true;
473 }
474 }
475 return false;
476 }
477
478 if (x11EventType == XCB_GE_GENERIC) {
479 xcb_ge_generic_event_t *ge = reinterpret_cast<xcb_ge_generic_event_t *>(event);
480
481 // We need to make a shadow copy of the event filter list because an activated event
482 // filter may mutate it by removing or installing another event filter.
483 const auto eventFilters = m_genericEventFilters;
484
485 for (X11EventFilterContainer *container : eventFilters) {
486 if (!container) {
487 continue;
488 }
489 X11EventFilter *filter = container->filter();
490 if (filter->extension() == ge->extension && filter->genericEventTypes().contains(ge->event_type) && filter->event(event)) {
491 return true;
492 }
493 }
494 } else {
495 // We need to make a shadow copy of the event filter list because an activated event
496 // filter may mutate it by removing or installing another event filter.
497 const auto eventFilters = m_eventFilters;
498
499 for (X11EventFilterContainer *container : eventFilters) {
500 if (!container) {
501 continue;
502 }
503 X11EventFilter *filter = container->filter();
504 if (filter->eventTypes().contains(x11EventType) && filter->event(event)) {
505 return true;
506 }
507 }
508 }
509
510 if (workspace()) {
511 return workspace()->workspaceEvent(event);
512 }
513
514 return false;
515}
516
517static quint32 monotonicTime()
518{
519 timespec ts;
520
521 const int result = clock_gettime(CLOCK_MONOTONIC, &ts);
522 if (result) {
523 qCWarning(KWIN_CORE, "Failed to query monotonic time: %s", strerror(errno));
524 }
525
526 return ts.tv_sec * 1000 + ts.tv_nsec / 1000000L;
527}
528
530{
531 switch (operationMode()) {
533 setX11Time(QX11Info::getTimestamp(), TimestampUpdate::Always);
534 break;
535
537 setX11Time(monotonicTime(), TimestampUpdate::Always);
538 break;
539
540 default:
541 // Do not update the current X11 time stamp if it's the Wayland only session.
542 break;
543 }
544}
545
546void Application::updateX11Time(xcb_generic_event_t *event)
547{
548 xcb_timestamp_t time = XCB_TIME_CURRENT_TIME;
549 const uint8_t eventType = event->response_type & ~0x80;
550 switch (eventType) {
551 case XCB_KEY_PRESS:
552 case XCB_KEY_RELEASE:
553 time = reinterpret_cast<xcb_key_press_event_t *>(event)->time;
554 break;
555 case XCB_BUTTON_PRESS:
556 case XCB_BUTTON_RELEASE:
557 time = reinterpret_cast<xcb_button_press_event_t *>(event)->time;
558 break;
559 case XCB_MOTION_NOTIFY:
560 time = reinterpret_cast<xcb_motion_notify_event_t *>(event)->time;
561 break;
562 case XCB_ENTER_NOTIFY:
563 case XCB_LEAVE_NOTIFY:
564 time = reinterpret_cast<xcb_enter_notify_event_t *>(event)->time;
565 break;
566 case XCB_FOCUS_IN:
567 case XCB_FOCUS_OUT:
568 case XCB_KEYMAP_NOTIFY:
569 case XCB_EXPOSE:
570 case XCB_GRAPHICS_EXPOSURE:
571 case XCB_NO_EXPOSURE:
572 case XCB_VISIBILITY_NOTIFY:
573 case XCB_CREATE_NOTIFY:
574 case XCB_DESTROY_NOTIFY:
575 case XCB_UNMAP_NOTIFY:
576 case XCB_MAP_NOTIFY:
577 case XCB_MAP_REQUEST:
578 case XCB_REPARENT_NOTIFY:
579 case XCB_CONFIGURE_NOTIFY:
580 case XCB_CONFIGURE_REQUEST:
581 case XCB_GRAVITY_NOTIFY:
582 case XCB_RESIZE_REQUEST:
583 case XCB_CIRCULATE_NOTIFY:
584 case XCB_CIRCULATE_REQUEST:
585 // no timestamp
586 return;
587 case XCB_PROPERTY_NOTIFY:
588 time = reinterpret_cast<xcb_property_notify_event_t *>(event)->time;
589 break;
590 case XCB_SELECTION_CLEAR:
591 time = reinterpret_cast<xcb_selection_clear_event_t *>(event)->time;
592 break;
593 case XCB_SELECTION_REQUEST:
594 time = reinterpret_cast<xcb_selection_request_event_t *>(event)->time;
595 break;
596 case XCB_SELECTION_NOTIFY:
597 time = reinterpret_cast<xcb_selection_notify_event_t *>(event)->time;
598 break;
599 case XCB_COLORMAP_NOTIFY:
600 case XCB_CLIENT_MESSAGE:
601 case XCB_MAPPING_NOTIFY:
602 case XCB_GE_GENERIC:
603 // no timestamp
604 return;
605 default:
606 // extension handling
607 if (Xcb::Extensions::self()) {
608 if (eventType == Xcb::Extensions::self()->shapeNotifyEvent()) {
609 time = reinterpret_cast<xcb_shape_notify_event_t *>(event)->server_time;
610 }
611 if (eventType == Xcb::Extensions::self()->damageNotifyEvent()) {
612 time = reinterpret_cast<xcb_damage_notify_event_t *>(event)->timestamp;
613 }
614 }
615 break;
616 }
617 setX11Time(time);
618}
619
620bool XcbEventFilter::nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result)
621{
622 if (eventType == "xcb_generic_event_t") {
623 return kwinApp()->dispatchEvent(static_cast<xcb_generic_event_t *>(message));
624 }
625 return false;
626}
627
628QProcessEnvironment Application::processStartupEnvironment() const
629{
630 return m_processEnvironment;
631}
632
633void Application::setProcessStartupEnvironment(const QProcessEnvironment &environment)
634{
635 m_processEnvironment = environment;
636}
637
638void Application::setOutputBackend(std::unique_ptr<OutputBackend> &&backend)
639{
640 Q_ASSERT(!m_outputBackend);
641 m_outputBackend = std::move(backend);
642}
643
644void Application::setSession(std::unique_ptr<Session> &&session)
645{
646 Q_ASSERT(!m_session);
647 m_session = std::move(session);
648}
649
651{
652 return m_pluginManager.get();
653}
654
656{
657 return m_inputMethod.get();
658}
659
661{
662 return m_colorManager.get();
663}
664
666{
667 return nullptr;
668}
669
670#if KWIN_BUILD_SCREENLOCKER
671ScreenLockerWatcher *Application::screenLockerWatcher() const
672{
673 return m_screenLockerWatcher.get();
674}
675#endif
676
677static PlatformCursorImage grabCursorOpenGL()
678{
679 CursorScene *scene = Compositor::self()->cursorScene();
680 if (!scene) {
681 return PlatformCursorImage();
682 }
683
684 Cursor *cursor = Cursors::self()->currentCursor();
685 Output *output = workspace()->outputAt(cursor->pos());
686
687 const auto texture = GLTexture::allocate(GL_RGBA8, (cursor->geometry().size() * output->scale()).toSize());
688 if (!texture) {
689 return PlatformCursorImage{};
690 }
691 texture->setContentTransform(OutputTransform::FlipY);
692 GLFramebuffer framebuffer(texture.get());
693 RenderTarget renderTarget(&framebuffer);
694
695 SceneDelegate delegate(scene, output);
696 scene->prePaint(&delegate);
697 scene->paint(renderTarget, infiniteRegion());
698 scene->postPaint();
699
700 QImage image = texture->toImage();
701 image.setDevicePixelRatio(output->scale());
702
703 return PlatformCursorImage(image, cursor->hotspot());
704}
705
706static PlatformCursorImage grabCursorSoftware()
707{
708 CursorScene *scene = Compositor::self()->cursorScene();
709 if (!scene) {
710 return PlatformCursorImage();
711 }
712
713 Cursor *cursor = Cursors::self()->currentCursor();
714 Output *output = workspace()->outputAt(cursor->pos());
715
716 QImage image((cursor->geometry().size() * output->scale()).toSize(), QImage::Format_ARGB32_Premultiplied);
717 RenderTarget renderTarget(&image);
718
719 SceneDelegate delegate(scene, output);
720 scene->prePaint(&delegate);
721 scene->paint(renderTarget, infiniteRegion());
722 scene->postPaint();
723
724 image.setDevicePixelRatio(output->scale());
725 return PlatformCursorImage(image, cursor->hotspot());
726}
727
729{
730 Cursor *cursor = Cursors::self()->currentCursor();
731 if (cursor->geometry().isEmpty()) {
732 return PlatformCursorImage();
733 }
734
735 if (auto shapeSource = qobject_cast<ShapeCursorSource *>(cursor->source())) {
736 return PlatformCursorImage(shapeSource->image(), shapeSource->hotspot());
737 }
738
739 // The cursor content is provided by a client, grab the contents of the cursor scene.
740 switch (effects->compositingType()) {
742 return grabCursorOpenGL();
744 return grabCursorSoftware();
745 default:
746 Q_UNREACHABLE();
747 }
748}
749
750void Application::startInteractiveWindowSelection(std::function<void(KWin::Window *)> callback, const QByteArray &cursorName)
751{
752 if (!input()) {
753 callback(nullptr);
754 return;
755 }
756 input()->startInteractiveWindowSelection(callback, cursorName);
757}
758
759void Application::startInteractivePositionSelection(std::function<void(const QPointF &)> callback)
760{
761 if (!input()) {
762 callback(QPointF(-1, -1));
763 return;
764 }
766}
767
768} // namespace
769
770#include "moc_main.cpp"
virtual void createEffectsHandler(Compositor *compositor, WorkspaceScene *scene)
Definition main.cpp:356
void resetCrashesCount()
Definition main.cpp:162
void installNativeX11EventFilter()
Definition main.cpp:298
virtual PlatformCursorImage cursorImage() const
Definition main.cpp:728
void destroyWorkspace()
Definition main.cpp:313
virtual std::unique_ptr< Cursor > createPlatformCursor()
Definition main.cpp:343
void notifyStarted()
Definition main.cpp:146
virtual void performStartup()=0
static int crashes
Definition main.h:371
void destroyColorManager()
Definition main.cpp:328
void createOptions()
Definition main.cpp:268
static void createAboutData()
Definition main.cpp:177
void registerEventFilter(X11EventFilter *filter)
Definition main.cpp:361
virtual std::unique_ptr< OutlineVisual > createOutline(Outline *outline)
Definition main.cpp:348
void createPlugins()
Definition main.cpp:273
void destroyInput()
Definition main.cpp:308
void setOperationMode(OperationMode mode)
Definition main.cpp:102
void createTabletModeManager()
Definition main.cpp:288
static void setupMalloc()
Definition main.cpp:220
void createInput()
Definition main.cpp:253
void updateXTime()
Definition main.cpp:529
virtual void startInteractivePositionSelection(std::function< void(const QPointF &)> callback)
Definition main.cpp:759
virtual XwaylandInterface * xwayland() const
Definition main.cpp:665
void setSession(std::unique_ptr< Session > &&session)
Definition main.cpp:644
Application(OperationMode mode, int &argc, char **argv)
Definition main.cpp:77
void createAtoms()
Definition main.cpp:263
void destroyAtoms()
Definition main.cpp:151
void destroyPlugins()
Definition main.cpp:323
void setOutputBackend(std::unique_ptr< OutputBackend > &&backend)
Definition main.cpp:638
void setX11Time(xcb_timestamp_t timestamp, TimestampUpdate force=TimestampUpdate::OnlyIfLarger)
Definition main.h:154
void processCommandLine(QCommandLineParser *parser)
Definition main.cpp:212
void setProcessStartupEnvironment(const QProcessEnvironment &environment)
Definition main.cpp:633
QProcessEnvironment processStartupEnvironment() const
Definition main.cpp:628
ColorManager * colorManager() const
Definition main.cpp:660
void setConfigLock(bool lock)
Definition main.cpp:92
Session * session() const
Definition main.h:248
void removeNativeX11EventFilter()
Definition main.cpp:303
void destroyInputMethod()
Definition main.cpp:333
void createColorManager()
Definition main.cpp:278
void setXwaylandScale(qreal scale)
Definition main.cpp:382
void updateX11Time(xcb_generic_event_t *event)
Definition main.cpp:546
static void setupLocalizedString()
Definition main.cpp:234
static bool wasCrash()
Definition main.cpp:172
PluginManager * pluginManager() const
Definition main.cpp:650
bool dispatchEvent(xcb_generic_event_t *event)
Definition main.cpp:423
void xwaylandScaleChanged()
InputMethod * inputMethod() const
Definition main.cpp:655
TabletModeManager * tabletModeManager() const
Definition main.cpp:293
virtual void startInteractiveWindowSelection(std::function< void(KWin::Window *)> callback, const QByteArray &cursorName=QByteArray())
Definition main.cpp:750
virtual std::unique_ptr< Edge > createScreenEdge(ScreenEdges *parent)
Definition main.cpp:338
void setupCommandLine(QCommandLineParser *parser)
Definition main.cpp:201
void * x11Connection
Definition main.h:73
bool shouldUseWaylandForCompositing() const
Definition main.cpp:107
void createWorkspace()
Definition main.cpp:239
~Application() override
Definition main.cpp:138
OperationMode operationMode() const
The operation mode used by KWin.
Definition main.cpp:97
static void setCrashCount(int count)
Definition main.cpp:167
void createInputMethod()
Definition main.cpp:283
void applyXwaylandScale()
Definition main.cpp:392
OperationMode
This enum provides the various operation modes of KWin depending on the available Windowing Systems a...
Definition main.h:83
@ OperationModeXwayland
KWin uses Wayland and controls a nested Xwayland server.
Definition main.h:95
@ OperationModeX11
KWin uses only X11 for managing windows and compositing.
Definition main.h:87
@ OperationModeWaylandOnly
KWin uses only Wayland.
Definition main.h:91
void destroyCompositor()
Definition main.cpp:318
void destroyPlatform()
Definition main.cpp:157
void unregisterEventFilter(X11EventFilter *filter)
Definition main.cpp:412
CursorScene * cursorScene() const
Definition compositor.h:64
static bool compositing()
Static check to test whether the Compositor is available and active.
Definition compositor.h:78
static Compositor * self()
Replacement for QCursor.
Definition cursor.h:102
QRectF geometry() const
Definition cursor.cpp:190
CursorSource * source() const
Definition cursor.cpp:698
static Cursors * self()
Definition cursor.cpp:35
Cursor * currentCursor() const
Definition cursor.h:285
Manager class that handles all the effects.
CompositingType compositingType
static std::unique_ptr< GLTexture > allocate(GLenum internalFormat, const QSize &size, int levels=1)
void startInteractivePositionSelection(std::function< void(const QPoint &)> callback)
Definition input.cpp:3388
void startInteractiveWindowSelection(std::function< void(KWin::Window *)> callback, const QByteArray &cursorName)
Definition input.cpp:3378
This class is used to show the outline of a given geometry.
Definition outline.h:38
Class for controlling screen edges.
Definition screenedge.h:222
static Workspace * self()
Definition workspace.h:91
bool workspaceEvent(xcb_generic_event_t *)
Definition events.cpp:147
Output * outputAt(const QPointF &pos) const
X11EventFilter * filter() const
Definition workspace.cpp:85
QList< int > genericEventTypes() const
virtual bool event(xcb_generic_event_t *event)=0
bool isGenericEvent() const
QList< int > eventTypes() const
QList< ExtensionData > extensions() const
Definition xcbutils.cpp:544
int damageNotifyEvent() const
Definition xcbutils.cpp:486
int shapeNotifyEvent() const
Definition xcbutils.cpp:534
static Extensions * self()
Definition xcbutils.cpp:346
bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result) override
Definition main.cpp:620
#define XCB_GE_GENERIC
Definition events.cpp:57
Q_DECLARE_METATYPE(KWin::SwitchEvent::State)
KWIN_EXPORT QRect infiniteRegion()
Definition globals.h:234
Workspace * workspace()
Definition workspace.h:830
@ QPainterCompositing
Definition globals.h:39
@ OpenGLCompositing
Definition globals.h:37
Options * options
Definition main.cpp:73
InputRedirection * input()
Definition input.h:549
EffectsHandler * effects
KWIN_EXPORT Atoms * atoms
Definition main.cpp:74