Changeset View
Changeset View
Standalone View
Standalone View
src/server/display.cpp
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Line(s) | |||||
50 | #include "xdgforeign_interface.h" | 50 | #include "xdgforeign_interface.h" | ||
51 | #include "xdgshell_v6_interface_p.h" | 51 | #include "xdgshell_v6_interface_p.h" | ||
52 | #include "xdgshell_stable_interface_p.h" | 52 | #include "xdgshell_stable_interface_p.h" | ||
53 | #include "appmenu_interface.h" | 53 | #include "appmenu_interface.h" | ||
54 | #include "server_decoration_palette_interface.h" | 54 | #include "server_decoration_palette_interface.h" | ||
55 | #include "plasmavirtualdesktop_interface.h" | 55 | #include "plasmavirtualdesktop_interface.h" | ||
56 | #include "xdgoutput_interface.h" | 56 | #include "xdgoutput_interface.h" | ||
57 | #include "xdgdecoration_interface.h" | 57 | #include "xdgdecoration_interface.h" | ||
58 | #include "eglstream_controller_interface.h" | ||||
58 | 59 | | |||
59 | #include <QCoreApplication> | 60 | #include <QCoreApplication> | ||
60 | #include <QDebug> | 61 | #include <QDebug> | ||
61 | #include <QAbstractEventDispatcher> | 62 | #include <QAbstractEventDispatcher> | ||
62 | #include <QSocketNotifier> | 63 | #include <QSocketNotifier> | ||
63 | #include <QThread> | 64 | #include <QThread> | ||
64 | 65 | | |||
65 | #include <wayland-server.h> | 66 | #include <wayland-server.h> | ||
▲ Show 20 Lines • Show All 443 Lines • ▼ Show 20 Line(s) | |||||
509 | 510 | | |||
510 | XdgDecorationManagerInterface *Display::createXdgDecorationManager(XdgShellInterface *shellInterface, QObject *parent) | 511 | XdgDecorationManagerInterface *Display::createXdgDecorationManager(XdgShellInterface *shellInterface, QObject *parent) | ||
511 | { | 512 | { | ||
512 | auto d = new XdgDecorationManagerInterface(this, shellInterface, parent); | 513 | auto d = new XdgDecorationManagerInterface(this, shellInterface, parent); | ||
513 | connect(this, &Display::aboutToTerminate, d, [d] { delete d; }); | 514 | connect(this, &Display::aboutToTerminate, d, [d] { delete d; }); | ||
514 | return d; | 515 | return d; | ||
515 | } | 516 | } | ||
516 | 517 | | |||
518 | EglStreamControllerInterface *Display::createEglStreamControllerInterface(QObject *parent) | ||||
519 | { | ||||
520 | EglStreamControllerInterface *e = new EglStreamControllerInterface(this, parent); | ||||
521 | connect(this, &Display::aboutToTerminate, e, [e] { delete e; }); | ||||
522 | return e; | ||||
523 | } | ||||
524 | | ||||
517 | void Display::createShm() | 525 | void Display::createShm() | ||
518 | { | 526 | { | ||
519 | Q_ASSERT(d->display); | 527 | Q_ASSERT(d->display); | ||
520 | wl_display_init_shm(d->display); | 528 | wl_display_init_shm(d->display); | ||
romangg: There should be always a non-null object returned. Instead check somewhere before the create… | |||||
521 | } | 529 | } | ||
522 | 530 | | |||
523 | void Display::removeOutput(OutputInterface *output) | 531 | void Display::removeOutput(OutputInterface *output) | ||
524 | { | 532 | { | ||
525 | d->outputs.removeAll(output); | 533 | d->outputs.removeAll(output); | ||
526 | delete output; | 534 | delete output; | ||
527 | } | 535 | } | ||
528 | 536 | | |||
▲ Show 20 Lines • Show All 105 Lines • Show Last 20 Lines |
There should be always a non-null object returned. Instead check somewhere before the create call of EglStreamControllerInterface if the library can be loaded. Also this would put the logic and the QLibrary include in the class file and not in display.cpp, what I would prefer.
One could overwrite the Global::create method in the EglStreamControllerInterface child class. From there then call QLibrary::resolve and only if it succeeds the parent create method. Afterwards compositor needs to check Global::isValid.
The control flow would then be in the compositor:
It's unfortunate that the create method is not virtual in Global. We can change this in KF6.