Changeset View
Changeset View
Standalone View
Standalone View
src/client/registry.cpp
Show First 20 Lines • Show All 48 Lines • ▼ Show 20 Line(s) | |||||
49 | #include "subcompositor.h" | 49 | #include "subcompositor.h" | ||
50 | #include "textinput_p.h" | 50 | #include "textinput_p.h" | ||
51 | #include "xdgshell.h" | 51 | #include "xdgshell.h" | ||
52 | #include "xdgshell_p.h" | 52 | #include "xdgshell_p.h" | ||
53 | #include "wayland_pointer_p.h" | 53 | #include "wayland_pointer_p.h" | ||
54 | #include "xdgforeign_v2.h" | 54 | #include "xdgforeign_v2.h" | ||
55 | #include "appmenu.h" | 55 | #include "appmenu.h" | ||
56 | #include "server_decoration_palette.h" | 56 | #include "server_decoration_palette.h" | ||
57 | #include "xdgoutput.h" | ||||
57 | // Qt | 58 | // Qt | ||
58 | #include <QDebug> | 59 | #include <QDebug> | ||
59 | // wayland | 60 | // wayland | ||
60 | #include <wayland-client-protocol.h> | 61 | #include <wayland-client-protocol.h> | ||
61 | #include <wayland-fullscreen-shell-client-protocol.h> | 62 | #include <wayland-fullscreen-shell-client-protocol.h> | ||
62 | #include <wayland-plasma-shell-client-protocol.h> | 63 | #include <wayland-plasma-shell-client-protocol.h> | ||
63 | #include <wayland-plasma-window-management-client-protocol.h> | 64 | #include <wayland-plasma-window-management-client-protocol.h> | ||
64 | #include <wayland-idle-client-protocol.h> | 65 | #include <wayland-idle-client-protocol.h> | ||
Show All 13 Lines | |||||
78 | #include <wayland-xdg-shell-v5-client-protocol.h> | 79 | #include <wayland-xdg-shell-v5-client-protocol.h> | ||
79 | #include <wayland-xdg-shell-v6-client-protocol.h> | 80 | #include <wayland-xdg-shell-v6-client-protocol.h> | ||
80 | #include <wayland-relativepointer-unstable-v1-client-protocol.h> | 81 | #include <wayland-relativepointer-unstable-v1-client-protocol.h> | ||
81 | #include <wayland-pointer-gestures-unstable-v1-client-protocol.h> | 82 | #include <wayland-pointer-gestures-unstable-v1-client-protocol.h> | ||
82 | #include <wayland-pointer-constraints-unstable-v1-client-protocol.h> | 83 | #include <wayland-pointer-constraints-unstable-v1-client-protocol.h> | ||
83 | #include <wayland-xdg-foreign-unstable-v2-client-protocol.h> | 84 | #include <wayland-xdg-foreign-unstable-v2-client-protocol.h> | ||
84 | #include <wayland-appmenu-client-protocol.h> | 85 | #include <wayland-appmenu-client-protocol.h> | ||
85 | #include <wayland-server-decoration-palette-client-protocol.h> | 86 | #include <wayland-server-decoration-palette-client-protocol.h> | ||
87 | #include <wayland-xdg-output-unstable-v1-client-protocol.h> | ||||
86 | 88 | | |||
87 | /***** | 89 | /***** | ||
88 | * How to add another interface: | 90 | * How to add another interface: | ||
89 | * * define a new enum value in Registry::Interface | 91 | * * define a new enum value in Registry::Interface | ||
90 | * * define the bind<InterfaceName> method | 92 | * * define the bind<InterfaceName> method | ||
91 | * * define the create<InterfaceName> method | 93 | * * define the create<InterfaceName> method | ||
92 | * * define the <interfaceName>Announced signal | 94 | * * define the <interfaceName>Announced signal | ||
93 | * * define the <interfaceName>Removed signal | 95 | * * define the <interfaceName>Removed signal | ||
▲ Show 20 Lines • Show All 242 Lines • ▼ Show 20 Line(s) | 333 | {Registry::Interface::AppMenu, { | |||
336 | &Registry::appMenuRemoved | 338 | &Registry::appMenuRemoved | ||
337 | }}, | 339 | }}, | ||
338 | {Registry::Interface::ServerSideDecorationPalette, { | 340 | {Registry::Interface::ServerSideDecorationPalette, { | ||
339 | 1, | 341 | 1, | ||
340 | QByteArrayLiteral("org_kde_kwin_server_decoration_palette_manager"), | 342 | QByteArrayLiteral("org_kde_kwin_server_decoration_palette_manager"), | ||
341 | &org_kde_kwin_server_decoration_palette_manager_interface, | 343 | &org_kde_kwin_server_decoration_palette_manager_interface, | ||
342 | &Registry::serverSideDecorationPaletteManagerAnnounced, | 344 | &Registry::serverSideDecorationPaletteManagerAnnounced, | ||
343 | &Registry::serverSideDecorationPaletteManagerRemoved | 345 | &Registry::serverSideDecorationPaletteManagerRemoved | ||
346 | }}, | ||||
347 | {Registry::Interface::XdgOutputUnstableV1, { | ||||
348 | 1, | ||||
349 | QByteArrayLiteral("zxdg_output_manager_v1"), | ||||
350 | &zxdg_output_manager_v1_interface, | ||||
351 | &Registry::xdgOutputAnnounced, | ||||
352 | &Registry::xdgOutputRemoved | ||||
344 | }} | 353 | }} | ||
345 | }; | 354 | }; | ||
346 | 355 | | |||
347 | static quint32 maxVersion(const Registry::Interface &interface) | 356 | static quint32 maxVersion(const Registry::Interface &interface) | ||
348 | { | 357 | { | ||
349 | auto it = s_interfaces.find(interface); | 358 | auto it = s_interfaces.find(interface); | ||
350 | if (it != s_interfaces.end()) { | 359 | if (it != s_interfaces.end()) { | ||
351 | return it.value().maxVersion; | 360 | return it.value().maxVersion; | ||
▲ Show 20 Lines • Show All 296 Lines • ▼ Show 20 Line(s) | |||||
648 | BIND(IdleInhibitManagerUnstableV1, zwp_idle_inhibit_manager_v1) | 657 | BIND(IdleInhibitManagerUnstableV1, zwp_idle_inhibit_manager_v1) | ||
649 | BIND2(ShadowManager, Shadow, org_kde_kwin_shadow_manager) | 658 | BIND2(ShadowManager, Shadow, org_kde_kwin_shadow_manager) | ||
650 | BIND2(BlurManager, Blur, org_kde_kwin_blur_manager) | 659 | BIND2(BlurManager, Blur, org_kde_kwin_blur_manager) | ||
651 | BIND2(ContrastManager, Contrast, org_kde_kwin_contrast_manager) | 660 | BIND2(ContrastManager, Contrast, org_kde_kwin_contrast_manager) | ||
652 | BIND2(SlideManager, Slide, org_kde_kwin_slide_manager) | 661 | BIND2(SlideManager, Slide, org_kde_kwin_slide_manager) | ||
653 | BIND2(DpmsManager, Dpms, org_kde_kwin_dpms_manager) | 662 | BIND2(DpmsManager, Dpms, org_kde_kwin_dpms_manager) | ||
654 | BIND2(AppMenuManager, AppMenu, org_kde_kwin_appmenu_manager) | 663 | BIND2(AppMenuManager, AppMenu, org_kde_kwin_appmenu_manager) | ||
655 | BIND2(ServerSideDecorationPaletteManager, ServerSideDecorationPalette, org_kde_kwin_server_decoration_palette_manager) | 664 | BIND2(ServerSideDecorationPaletteManager, ServerSideDecorationPalette, org_kde_kwin_server_decoration_palette_manager) | ||
665 | BIND(XdgOutputUnstableV1, zxdg_output_manager_v1) | ||||
656 | 666 | | |||
657 | #undef BIND | 667 | #undef BIND | ||
658 | #undef BIND2 | 668 | #undef BIND2 | ||
659 | 669 | | |||
660 | template <class T, typename WL> | 670 | template <class T, typename WL> | ||
661 | T *Registry::Private::create(quint32 name, quint32 version, QObject *parent, WL *(Registry::*bindMethod)(uint32_t, uint32_t) const) | 671 | T *Registry::Private::create(quint32 name, quint32 version, QObject *parent, WL *(Registry::*bindMethod)(uint32_t, uint32_t) const) | ||
662 | { | 672 | { | ||
663 | T *t = new T(parent); | 673 | T *t = new T(parent); | ||
▲ Show 20 Lines • Show All 116 Lines • ▼ Show 20 Line(s) | 789 | { | |||
780 | switch (d->interfaceForName(name)) { | 790 | switch (d->interfaceForName(name)) { | ||
781 | case Interface::IdleInhibitManagerUnstableV1: | 791 | case Interface::IdleInhibitManagerUnstableV1: | ||
782 | return d->create<IdleInhibitManager>(name, version, parent, &Registry::bindIdleInhibitManagerUnstableV1); | 792 | return d->create<IdleInhibitManager>(name, version, parent, &Registry::bindIdleInhibitManagerUnstableV1); | ||
783 | default: | 793 | default: | ||
784 | return nullptr; | 794 | return nullptr; | ||
785 | } | 795 | } | ||
786 | } | 796 | } | ||
787 | 797 | | |||
798 | XdgOutputManager *Registry::createXdgOutputManager(quint32 name, quint32 version, QObject *parent) | ||||
799 | { | ||||
800 | switch(d->interfaceForName(name)) { | ||||
801 | case Interface::XdgOutputUnstableV1: | ||||
802 | return d->create<XdgOutputManager>(name, version, parent, &Registry::bindXdgOutputUnstableV1); | ||||
803 | default: | ||||
804 | return nullptr; | ||||
805 | } | ||||
806 | } | ||||
807 | | ||||
788 | namespace { | 808 | namespace { | ||
789 | static const wl_interface *wlInterface(Registry::Interface interface) | 809 | static const wl_interface *wlInterface(Registry::Interface interface) | ||
790 | { | 810 | { | ||
791 | auto it = s_interfaces.find(interface); | 811 | auto it = s_interfaces.find(interface); | ||
792 | if (it != s_interfaces.end()) { | 812 | if (it != s_interfaces.end()) { | ||
793 | return it.value().interface; | 813 | return it.value().interface; | ||
794 | } | 814 | } | ||
795 | return nullptr; | 815 | return nullptr; | ||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |