Changeset View
Standalone View
platform.h
Show All 32 Lines | |||||
33 | namespace KWayland { | 33 | namespace KWayland { | ||
34 | namespace Server { | 34 | namespace Server { | ||
35 | class OutputConfigurationInterface; | 35 | class OutputConfigurationInterface; | ||
36 | } | 36 | } | ||
37 | } | 37 | } | ||
38 | 38 | | |||
39 | namespace KWin | 39 | namespace KWin | ||
40 | { | 40 | { | ||
41 | namespace ColorCorrect { | ||||
42 | class Manager; | ||||
43 | struct GammaRamp; | ||||
44 | } | ||||
41 | 45 | | |||
42 | class Edge; | 46 | class Edge; | ||
43 | class OpenGLBackend; | 47 | class OpenGLBackend; | ||
44 | class QPainterBackend; | 48 | class QPainterBackend; | ||
45 | class Screens; | 49 | class Screens; | ||
46 | class ScreenEdges; | 50 | class ScreenEdges; | ||
47 | class Toplevel; | 51 | class Toplevel; | ||
48 | class WaylandCursorTheme; | 52 | class WaylandCursorTheme; | ||
▲ Show 20 Lines • Show All 247 Lines • ▼ Show 20 Line(s) | 57 | public: | |||
296 | } | 300 | } | ||
297 | qreal initialOutputScale() const { | 301 | qreal initialOutputScale() const { | ||
298 | return m_initialOutputScale; | 302 | return m_initialOutputScale; | ||
299 | } | 303 | } | ||
300 | void setInitialOutputScale(qreal scale) { | 304 | void setInitialOutputScale(qreal scale) { | ||
301 | m_initialOutputScale = scale; | 305 | m_initialOutputScale = scale; | ||
302 | } | 306 | } | ||
303 | 307 | | |||
308 | /** | ||||
309 | * Whether Night Color is supported by the backend. | ||||
310 | * @since 5.11 | ||||
311 | **/ | ||||
312 | bool supportsNightColor() const { | ||||
313 | return m_supportsNightColor; | ||||
314 | } | ||||
315 | | ||||
316 | ColorCorrect::Manager *nightColorManager() { | ||||
317 | return m_nightColor; | ||||
318 | } | ||||
319 | | ||||
320 | virtual int gammaRampSize(int screen) const { | ||||
321 | Q_UNUSED(screen); | ||||
322 | return 0; | ||||
323 | } | ||||
324 | virtual bool setGammaRamp(int screen, ColorCorrect::GammaRamp &gamma) { | ||||
325 | Q_UNUSED(screen); | ||||
326 | Q_UNUSED(gamma); | ||||
327 | return false; | ||||
328 | } | ||||
329 | | ||||
304 | public Q_SLOTS: | 330 | public Q_SLOTS: | ||
305 | void pointerMotion(const QPointF &position, quint32 time); | 331 | void pointerMotion(const QPointF &position, quint32 time); | ||
306 | void pointerButtonPressed(quint32 button, quint32 time); | 332 | void pointerButtonPressed(quint32 button, quint32 time); | ||
307 | void pointerButtonReleased(quint32 button, quint32 time); | 333 | void pointerButtonReleased(quint32 button, quint32 time); | ||
308 | void pointerAxisHorizontal(qreal delta, quint32 time); | 334 | void pointerAxisHorizontal(qreal delta, quint32 time); | ||
309 | void pointerAxisVertical(qreal delta, quint32 time); | 335 | void pointerAxisVertical(qreal delta, quint32 time); | ||
310 | void keyboardKeyPressed(quint32 key, quint32 time); | 336 | void keyboardKeyPressed(quint32 key, quint32 time); | ||
311 | void keyboardKeyReleased(quint32 key, quint32 time); | 337 | void keyboardKeyReleased(quint32 key, quint32 time); | ||
Show All 36 Lines | 373 | QSize initialWindowSize() const { | |||
348 | return m_initialWindowSize; | 374 | return m_initialWindowSize; | ||
349 | } | 375 | } | ||
350 | QByteArray deviceIdentifier() const { | 376 | QByteArray deviceIdentifier() const { | ||
351 | return m_deviceIdentifier; | 377 | return m_deviceIdentifier; | ||
352 | } | 378 | } | ||
353 | void setSupportsPointerWarping(bool set) { | 379 | void setSupportsPointerWarping(bool set) { | ||
354 | m_pointerWarping = set; | 380 | m_pointerWarping = set; | ||
355 | } | 381 | } | ||
382 | void setSupportsNightColor(bool set) { | ||||
davidedmundson: ok, if this is staying in KWin I still want it layered better. Otherwise you're going to find… | |||||
Yes, you're probably right. I left the name because I was a little bit worried, that there are maybe platforms in the future, where the mechanism for changing gamma and changing color temperature is not working the same as in DRM. But probably when a platform can do one of the two things it can do the other one as well. I'll wait until we settled on the right name of the whole (see Martin's comment about the older Color Correction / ICC / Kolor Manager code) to find a better method name for it. Otherwise I would have called it "supportsColorCorrection", in case there is a platform using a different mechanism than gamma ramp adjustment. Or should we ignore this possibility for now as well in your opinion? romangg: Yes, you're probably right. I left the name because I was a little bit worried, that there are… | |||||
I agree with David here: just make it gamma. If in the future we have a difference we can still introduce more variants. graesslin: I agree with David here: just make it gamma. If in the future we have a difference we can still… | |||||
383 | m_supportsNightColor = set; | ||||
384 | } | ||||
356 | 385 | | |||
357 | /** | 386 | /** | ||
358 | * Actual platform specific way to hide the cursor. | 387 | * Actual platform specific way to hide the cursor. | ||
359 | * Sub-classes need to implement if they support hiding the cursor. | 388 | * Sub-classes need to implement if they support hiding the cursor. | ||
360 | * | 389 | * | ||
361 | * This method is invoked by hideCursor if the cursor needs to be hidden. | 390 | * This method is invoked by hideCursor if the cursor needs to be hidden. | ||
362 | * The default implementation does nothing. | 391 | * The default implementation does nothing. | ||
363 | * | 392 | * | ||
Show All 25 Lines | 410 | private: | |||
389 | QSize m_initialWindowSize; | 418 | QSize m_initialWindowSize; | ||
390 | QByteArray m_deviceIdentifier; | 419 | QByteArray m_deviceIdentifier; | ||
391 | bool m_pointerWarping = false; | 420 | bool m_pointerWarping = false; | ||
392 | bool m_outputsEnabled = true; | 421 | bool m_outputsEnabled = true; | ||
393 | int m_initialOutputCount = 1; | 422 | int m_initialOutputCount = 1; | ||
394 | qreal m_initialOutputScale = 1; | 423 | qreal m_initialOutputScale = 1; | ||
395 | EGLDisplay m_eglDisplay; | 424 | EGLDisplay m_eglDisplay; | ||
396 | int m_hideCursorCounter = 0; | 425 | int m_hideCursorCounter = 0; | ||
426 | | ||||
427 | ColorCorrect::Manager *m_nightColor = nullptr; | ||||
428 | bool m_supportsNightColor = false; | ||||
397 | }; | 429 | }; | ||
398 | 430 | | |||
399 | } | 431 | } | ||
400 | 432 | | |||
401 | Q_DECLARE_INTERFACE(KWin::Platform, "org.kde.kwin.Platform") | 433 | Q_DECLARE_INTERFACE(KWin::Platform, "org.kde.kwin.Platform") | ||
402 | 434 | | |||
403 | #endif | 435 | #endif |
ok, if this is staying in KWin I still want it layered better. Otherwise you're going to find it hard to extend it.
Nothing in Platform and subclasses should mention nightmode.
They should all refer to supportsGammaCorrection or something.