From 9ae808c190ddf94856cdfa16acef8cdd5d8f91a4 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 19 May 2016 11:14:18 +0100 Subject: merge duplicate code Change-Id: Iac8f5e9596300bbaaa4b2ce6c6fc4d11793745a5 --- include/vcl/opengl/OpenGLContext.hxx | 1 + vcl/source/opengl/OpenGLContext.cxx | 34 +++++++++++++--------------------- 2 files changed, 14 insertions(+), 21 deletions(-) diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx index 723a99404ef8..1ca86c7acb61 100644 --- a/include/vcl/opengl/OpenGLContext.hxx +++ b/include/vcl/opengl/OpenGLContext.hxx @@ -220,6 +220,7 @@ private: SAL_DLLPRIVATE void InitGLEWDebugging(); SAL_DLLPRIVATE bool initWindow(); SAL_DLLPRIVATE bool ImplInit(); + SAL_DLLPRIVATE void InitChildWindow(SystemChildWindow *pChildWindow); #if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && !defined(LIBO_HEADLESS) SAL_DLLPRIVATE void initGLWindow(Visual* pVisual); #endif diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx index de8c7099ca97..f254974727c9 100644 --- a/vcl/source/opengl/OpenGLContext.cxx +++ b/vcl/source/opengl/OpenGLContext.cxx @@ -1092,6 +1092,14 @@ void OpenGLContext::setWinSize(const Size& rSize) m_aGLWin.Height = rSize.Height(); } +void OpenGLContext::InitChildWindow(SystemChildWindow *pChildWindow) +{ + pChildWindow->SetMouseTransparent(true); + pChildWindow->SetParentClipMode(ParentClipMode::Clip); + pChildWindow->EnableEraseBackground(false); + pChildWindow->SetControlForeground(); + pChildWindow->SetControlBackground(); +} #if defined(_WIN32) @@ -1103,15 +1111,9 @@ bool OpenGLContext::initWindow() m_pChildWindow = VclPtr::Create(mpWindow, 0, &winData, false); } - if( m_pChildWindow ) + if (m_pChildWindow) { - m_pChildWindow->SetMouseTransparent( true ); - m_pChildWindow->SetParentClipMode(ParentClipMode::Clip); - m_pChildWindow->EnableEraseBackground( false ); - m_pChildWindow->SetControlForeground(); - m_pChildWindow->SetControlBackground(); - //m_pChildWindow->EnablePaint(false); - + InitChildWindow(m_pChildWindow.get()); const SystemEnvData* sysData(m_pChildWindow->GetSystemData()); m_aGLWin.hWnd = sysData->hWnd; } @@ -1130,15 +1132,9 @@ bool OpenGLContext::initWindow() m_pChildWindow = VclPtr::Create(mpWindow, 0, &winData, false); } - if( m_pChildWindow ) + if (m_pChildWindow) { - m_pChildWindow->SetMouseTransparent( true ); - m_pChildWindow->SetParentClipMode(ParentClipMode::Clip); - m_pChildWindow->EnableEraseBackground( false ); - m_pChildWindow->SetControlForeground(); - m_pChildWindow->SetControlBackground(); - //m_pChildWindow->EnablePaint(false); - + InitChildWindow(m_pChildWindow.get()); } return true; @@ -1169,11 +1165,7 @@ bool OpenGLContext::initWindow() if (!m_pChildWindow || !pChildSysData) return false; - m_pChildWindow->SetMouseTransparent( true ); - m_pChildWindow->SetParentClipMode( ParentClipMode::NoClip ); - m_pChildWindow->EnableEraseBackground( false ); - m_pChildWindow->SetControlForeground(); - m_pChildWindow->SetControlBackground(); + InitChildWindow(m_pChildWindow.get()); m_aGLWin.dpy = static_cast(pChildSysData->pDisplay); m_aGLWin.win = pChildSysData->aWindow; -- cgit