Changeset View
Changeset View
Standalone View
Standalone View
plugins/scenes/opengl/scene_opengl.cpp
Show First 20 Lines • Show All 78 Lines • ▼ Show 20 Line(s) | |||||
79 | #endif | 79 | #endif | ||
80 | #ifndef GL_UNKNOWN_CONTEXT_RESET | 80 | #ifndef GL_UNKNOWN_CONTEXT_RESET | ||
81 | #define GL_UNKNOWN_CONTEXT_RESET 0x8255 | 81 | #define GL_UNKNOWN_CONTEXT_RESET 0x8255 | ||
82 | #endif | 82 | #endif | ||
83 | 83 | | |||
84 | namespace KWin | 84 | namespace KWin | ||
85 | { | 85 | { | ||
86 | 86 | | |||
87 | extern int currentRefreshRate(); | | |||
88 | | ||||
89 | | ||||
90 | /** | 87 | /** | ||
91 | * SyncObject represents a fence used to synchronize operations in | 88 | * SyncObject represents a fence used to synchronize operations in | ||
92 | * the kwin command stream with operations in the X command stream. | 89 | * the kwin command stream with operations in the X command stream. | ||
93 | **/ | 90 | **/ | ||
94 | class SyncObject | 91 | class SyncObject | ||
95 | { | 92 | { | ||
96 | public: | 93 | public: | ||
97 | enum State { Ready, TriggerSent, Waiting, Done, Resetting }; | 94 | enum State { Ready, TriggerSent, Waiting, Done, Resetting }; | ||
▲ Show 20 Lines • Show All 720 Lines • ▼ Show 20 Line(s) | |||||
818 | } | 815 | } | ||
819 | 816 | | |||
820 | SceneOpenGLTexture *SceneOpenGL::createTexture() | 817 | SceneOpenGLTexture *SceneOpenGL::createTexture() | ||
821 | { | 818 | { | ||
822 | return new SceneOpenGLTexture(m_backend); | 819 | return new SceneOpenGLTexture(m_backend); | ||
823 | } | 820 | } | ||
824 | 821 | | |||
825 | bool SceneOpenGL::viewportLimitsMatched(const QSize &size) const { | 822 | bool SceneOpenGL::viewportLimitsMatched(const QSize &size) const { | ||
823 | if (kwinApp()->operationMode() != Application::OperationModeX11) { | ||||
824 | // TODO: On Wayland we can't suspend. Find a solution that works here as well! | ||||
825 | return true; | ||||
826 | } | ||||
826 | GLint limit[2]; | 827 | GLint limit[2]; | ||
827 | glGetIntegerv(GL_MAX_VIEWPORT_DIMS, limit); | 828 | glGetIntegerv(GL_MAX_VIEWPORT_DIMS, limit); | ||
828 | if (limit[0] < size.width() || limit[1] < size.height()) { | 829 | if (limit[0] < size.width() || limit[1] < size.height()) { | ||
829 | QMetaObject::invokeMethod(Compositor::self(), "suspend", | 830 | QMetaObject::invokeMethod(static_cast<X11Compositor*>(Compositor::self()), "suspend", | ||
830 | Qt::QueuedConnection, Q_ARG(Compositor::SuspendReason, Compositor::AllReasonSuspend)); | 831 | Qt::QueuedConnection, Q_ARG(X11Compositor::SuspendReason, X11Compositor::AllReasonSuspend)); | ||
831 | return false; | 832 | return false; | ||
832 | } | 833 | } | ||
833 | return true; | 834 | return true; | ||
834 | } | 835 | } | ||
835 | 836 | | |||
836 | void SceneOpenGL::screenGeometryChanged(const QSize &size) | 837 | void SceneOpenGL::screenGeometryChanged(const QSize &size) | ||
837 | { | 838 | { | ||
838 | if (!viewportLimitsMatched(size)) | 839 | if (!viewportLimitsMatched(size)) | ||
▲ Show 20 Lines • Show All 1736 Lines • Show Last 20 Lines |