summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-09-10 16:07:49 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-09-11 09:50:22 +0200
commit1a547a566eba5943f9e4d9987baf4aee80846dd1 (patch)
tree585cd63ae31d7ec789844208f203a7e68d85954b
parent3428bd5fa3626844355f20997ba690fd04297982 (diff)
hidpi+gtk3: move setting the opengl slide viewport
to when the window size is set, and adjust to gtk3 hidpi scaling factor Change-Id: Id9bd0defd0b6ae640ac57f88133d954202d4bcc3 Reviewed-on: https://gerrit.libreoffice.org/42143 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--include/vcl/opengl/OpenGLContext.hxx1
-rw-r--r--slideshow/source/engine/opengl/TransitionerImpl.cxx1
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx11
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx13
4 files changed, 23 insertions, 3 deletions
diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
index 738f503269d2..b638d70ccc36 100644
--- a/include/vcl/opengl/OpenGLContext.hxx
+++ b/include/vcl/opengl/OpenGLContext.hxx
@@ -158,6 +158,7 @@ public:
private:
virtual bool initWindow();
virtual void destroyCurrentContext();
+ virtual void adjustToNewSize();
protected:
bool InitGL();
diff --git a/slideshow/source/engine/opengl/TransitionerImpl.cxx b/slideshow/source/engine/opengl/TransitionerImpl.cxx
index 95d97533325e..846b5ca8c0c0 100644
--- a/slideshow/source/engine/opengl/TransitionerImpl.cxx
+++ b/slideshow/source/engine/opengl/TransitionerImpl.cxx
@@ -344,7 +344,6 @@ bool OGLTransitionerImpl::initWindowFromSlideShowView( const Reference< presenta
mpContext->swapBuffers();
- glViewport(0, 0, aCanvasArea.Width, aCanvasArea.Height);
CHECK_GL_ERROR();
return true;
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index d2a5fc8a963b..d5ade0408fc5 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -333,14 +333,21 @@ void OpenGLContext::restoreDefaultFramebuffer()
void OpenGLContext::setWinPosAndSize(const Point &rPos, const Size& rSize)
{
- if(m_xWindow)
+ if (m_xWindow)
m_xWindow->SetPosSizePixel(rPos, rSize);
- if( m_pChildWindow )
+ if (m_pChildWindow)
m_pChildWindow->SetPosSizePixel(rPos, rSize);
GLWindow& rGLWin = getModifiableOpenGLWindow();
rGLWin.Width = rSize.Width();
rGLWin.Height = rSize.Height();
+ adjustToNewSize();
+}
+
+void OpenGLContext::adjustToNewSize()
+{
+ const GLWindow& rGLWin = getOpenGLWindow();
+ glViewport(0, 0, rGLWin.Width, rGLWin.Height);
}
void OpenGLContext::setWinSize(const Size& rSize)
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 2e76077521fc..72b71c9d7519 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -978,6 +978,19 @@ private:
}
#endif
+ virtual void adjustToNewSize() override
+ {
+#if GTK_CHECK_VERSION(3,16,0)
+ if (m_pGLArea)
+ {
+ int scale = gtk_widget_get_scale_factor(m_pGLArea);
+ int width = m_aGLWin.Width * scale;
+ int height = m_aGLWin.Height * scale;
+ glViewport(0, 0, width, height);
+ }
+#endif
+ }
+
virtual void makeCurrent() override
{
if (isCurrent())