Initial gamma control support

This commit is contained in:
Victor Tran 2023-10-13 21:40:35 +11:00
parent c7362233b4
commit bd03fe54cc
No known key found for this signature in database
5 changed files with 13 additions and 5 deletions

View file

@ -46,6 +46,7 @@ target_sources(plugin-${PLUGIN_NAME} PRIVATE ${SOURCES} ${HEADERS})
wayland-protocols/tdesktopenvironment-protocols/tdesktopenvironment-keygrab-v1.xml
wayland-protocols/tdesktopenvironment-protocols/tdesktopenvironment-accessibility-v1.xml
wayland-protocols/wlr-protocols/unstable/wlr-output-management-unstable-v1.xml
wayland-protocols/wlr-protocols/unstable/wlr-gamma-control-unstable-v1.xml
)
install(DIRECTORY wayland-protocols/tdesktopenvironment-protocols
DESTINATION ${CMAKE_INSTALL_DATADIR}/libtdesktopenvironment/wayland-protocols

View file

@ -251,19 +251,19 @@ QScreen* WaylandScreen::qtScreen() const {
}
void WaylandScreen::set() {
auto config = zwlr_output_manager_v1_create_configuration(d->backend->object(), d->backend->serial());
auto config = zwlr_output_manager_v1_create_configuration(d->backend->QtWayland::zwlr_output_manager_v1::object(), d->backend->serial());
for (auto systemScreen : d->backend->screens()) {
auto screen = qobject_cast<WaylandScreen*>(systemScreen);
auto screenProperties = screen->d;
if (screen->d->powered) {
auto configHead = zwlr_output_configuration_v1_enable_head(config, screen->object());
auto configHead = zwlr_output_configuration_v1_enable_head(config, screen->QtWayland::zwlr_output_head_v1::object());
zwlr_output_configuration_head_v1_set_mode(configHead, screenProperties->modes.at(screenProperties->currentMode)->object());
zwlr_output_configuration_head_v1_set_position(configHead, screenProperties->position.x(), screenProperties->position.y());
zwlr_output_configuration_head_v1_set_transform(configHead, screenProperties->transform);
} else {
zwlr_output_configuration_v1_disable_head(config, screen->object());
zwlr_output_configuration_v1_disable_head(config, screen->QtWayland::zwlr_output_head_v1::object());
}
}

View file

@ -21,12 +21,14 @@
#define WAYLANDSCREEN_H
#include "Screens/systemscreen.h"
#include "qwayland-wlr-gamma-control-unstable-v1.h"
#include "qwayland-wlr-output-management-unstable-v1.h"
class WaylandScreenBackend;
struct WaylandScreenPrivate;
class WaylandScreen : public SystemScreen,
public QtWayland::zwlr_output_head_v1 {
public QtWayland::zwlr_output_head_v1,
public QtWayland::zwlr_gamma_control_v1 {
Q_OBJECT
public:
explicit WaylandScreen(::zwlr_output_head_v1* head, WaylandScreenBackend* backend);

View file

@ -39,6 +39,9 @@ WaylandScreenBackend::WaylandScreenBackend() :
if (!d->registry.init<QtWayland::zwlr_output_manager_v1>(this)) {
tWarn("WaylandScreenBackend") << "The compositor doesn't support the wlr-output-management protocol";
}
if (!d->registry.init<QtWayland::zwlr_gamma_control_manager_v1>(this)) {
tWarn("WaylandScreenBackend") << "The compositor doesn't support the wlr-gamma-control protocol";
}
auto display = reinterpret_cast<wl_display*>(qApp->platformNativeInterface()->nativeResourceForIntegration("display"));
wl_display_roundtrip(display);

View file

@ -21,12 +21,14 @@
#define WAYLANDSCREENBACKEND_H
#include "Screens/private/screenbackend.h"
#include "qwayland-wlr-gamma-control-unstable-v1.h"
#include "qwayland-wlr-output-management-unstable-v1.h"
#include <QObject>
struct WaylandScreenBackendPrivate;
class WaylandScreenBackend : public ScreenBackend,
public QtWayland::zwlr_output_manager_v1 {
public QtWayland::zwlr_output_manager_v1,
public QtWayland::zwlr_gamma_control_manager_v1 {
Q_OBJECT
public:
explicit WaylandScreenBackend();