diff options
-rw-r--r-- | vcl/Library_vcl.mk | 2 | ||||
-rw-r--r-- | vcl/inc/unx/gtk/gtkframe.hxx | 6 | ||||
-rw-r--r-- | vcl/inc/unx/nativewindowhandleprovider.hxx (renamed from vcl/inc/unx/x11windowprovider.hxx) | 13 | ||||
-rw-r--r-- | vcl/inc/unx/salframe.h | 6 | ||||
-rw-r--r-- | vcl/opengl/x11/gdiimpl.cxx | 4 | ||||
-rw-r--r-- | vcl/unx/generic/app/saldata.cxx | 56 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/nativewindowhandleprovider.cxx (renamed from vcl/inc/unx/x11/x11display.hxx) | 16 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/salgdi.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/generic/gdi/x11windowprovider.cxx | 72 | ||||
-rw-r--r-- | vcl/unx/generic/window/salframe.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/gtk/gtksalframe.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkframe.cxx | 2 |
12 files changed, 77 insertions, 106 deletions
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 22e026efff2f..3270175f5deb 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -580,7 +580,7 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/unx/generic/plugadapt/salplug \ vcl/unx/generic/printer/jobdata \ vcl/unx/generic/printer/ppdparser \ - vcl/unx/generic/gdi/x11windowprovider \ + vcl/unx/generic/gdi/nativewindowhandleprovider \ vcl/unx/generic/window/screensaverinhibitor \ $(if $(filter TRUE,$(ENABLE_CUPS)),\ vcl/unx/generic/printer/cupsmgr \ diff --git a/vcl/inc/unx/gtk/gtkframe.hxx b/vcl/inc/unx/gtk/gtkframe.hxx index 6c7058a6c784..ccef8c5d9a98 100644 --- a/vcl/inc/unx/gtk/gtkframe.hxx +++ b/vcl/inc/unx/gtk/gtkframe.hxx @@ -33,7 +33,7 @@ #include <salframe.hxx> #include <vcl/sysdata.hxx> -#include <unx/x11windowprovider.hxx> +#include <unx/nativewindowhandleprovider.hxx> #include <unx/saltype.h> #include <unx/screensaverinhibitor.hxx> @@ -67,7 +67,7 @@ class GtkDnDTransferable; #endif class GtkSalFrame : public SalFrame - , public X11WindowProvider + , public NativeWindowHandleProvider { struct IMHandler { @@ -521,7 +521,7 @@ public: static GtkSalFrame *getFromWindow( GtkWindow *pWindow ); - virtual Window GetX11Window() override; + virtual sal_uIntPtr GetNativeWindowHandle() override; static void KeyCodeToGdkKey(const vcl::KeyCode& rKeyCode, guint* pGdkKeyCode, GdkModifierType *pGdkModifiers); diff --git a/vcl/inc/unx/x11windowprovider.hxx b/vcl/inc/unx/nativewindowhandleprovider.hxx index 776c8e4c4b34..1d85cb4cf5ef 100644 --- a/vcl/inc/unx/x11windowprovider.hxx +++ b/vcl/inc/unx/nativewindowhandleprovider.hxx @@ -7,20 +7,17 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef INCLUDED_VCL_UNX_X11WINDOWPROVIDER -#define INCLUDED_VCL_UNX_X11WINDOWPROVIDER - -#include <prex.h> -#include <postx.h> +#ifndef INCLUDED_VCL_UNX_NATIVEWINDOWHANDLEPROVIDER +#define INCLUDED_VCL_UNX_NATIVEWINDOWHANDLEPROVIDER #include <vcl/dllapi.h> -class VCL_PLUGIN_PUBLIC X11WindowProvider +class VCL_PLUGIN_PUBLIC NativeWindowHandleProvider { public: - virtual ~X11WindowProvider(); + virtual ~NativeWindowHandleProvider(); - virtual Window GetX11Window() = 0; + virtual sal_uIntPtr GetNativeWindowHandle() = 0; }; #endif diff --git a/vcl/inc/unx/salframe.h b/vcl/inc/unx/salframe.h index 87d38a376f8b..e3c1e58bf594 100644 --- a/vcl/inc/unx/salframe.h +++ b/vcl/inc/unx/salframe.h @@ -27,7 +27,7 @@ #include <unx/saltype.h> #include <unx/saldisp.hxx> #include <unx/screensaverinhibitor.hxx> -#include <unx/x11windowprovider.hxx> +#include <unx/nativewindowhandleprovider.hxx> #include <salframe.hxx> #include <salwtype.hxx> #include <salinst.hxx> @@ -50,7 +50,7 @@ namespace vcl_sal { class WMAdaptor; class NetWMAdaptor; class GnomeWMAdaptor; } #define SHOWSTATE_NORMAL 1 #define SHOWSTATE_HIDDEN 2 -class VCLPLUG_GEN_PUBLIC X11SalFrame : public SalFrame, public X11WindowProvider +class VCLPLUG_GEN_PUBLIC X11SalFrame : public SalFrame, public NativeWindowHandleProvider { friend class vcl_sal::WMAdaptor; friend class vcl_sal::NetWMAdaptor; @@ -261,7 +261,7 @@ public: // done setting up the clipregion virtual void EndSetClipRegion() override; - virtual Window GetX11Window() override; + virtual sal_uIntPtr GetNativeWindowHandle() override; /// @internal void setPendingSizeEvent(); diff --git a/vcl/opengl/x11/gdiimpl.cxx b/vcl/opengl/x11/gdiimpl.cxx index b1bc724c86ee..fc49e2520e58 100644 --- a/vcl/opengl/x11/gdiimpl.cxx +++ b/vcl/opengl/x11/gdiimpl.cxx @@ -47,12 +47,12 @@ void X11OpenGLSalGraphicsImpl::Init() rtl::Reference<OpenGLContext> X11OpenGLSalGraphicsImpl::CreateWinContext() { - X11WindowProvider *pProvider = dynamic_cast<X11WindowProvider*>(mrParent.m_pFrame); + NativeWindowHandleProvider *pProvider = dynamic_cast<NativeWindowHandleProvider*>(mrParent.m_pFrame); if( !pProvider ) return nullptr; - Window aWin = pProvider->GetX11Window(); + sal_uIntPtr aWin = pProvider->GetNativeWindowHandle(); rtl::Reference<OpenGLContext> pContext = OpenGLContext::Create(); pContext->setVCLOnly(); pContext->init( mrParent.GetXDisplay(), aWin, diff --git a/vcl/unx/generic/app/saldata.cxx b/vcl/unx/generic/app/saldata.cxx index 3f9d184a5566..92f4679ae793 100644 --- a/vcl/unx/generic/app/saldata.cxx +++ b/vcl/unx/generic/app/saldata.cxx @@ -48,7 +48,9 @@ #include "unx/sm.hxx" #include "unx/i18n_im.hxx" #include "unx/i18n_xkb.hxx" -#include "unx/x11/x11display.hxx" +#include <prex.h> +#include <X11/Xproto.h> +#include <postx.h> #include "salinst.hxx" #include <osl/signal.h> @@ -374,6 +376,58 @@ SalXLib::~SalXLib() close (m_pTimeoutFDS[1]); } +static Display *OpenX11Display(OString& rDisplay) +{ + /* + * open connection to X11 Display + * try in this order: + * o -display command line parameter, + * o $DISPLAY environment variable + * o default display + */ + + Display *pDisp = nullptr; + + // is there a -display command line parameter? + + sal_uInt32 nParams = osl_getCommandArgCount(); + OUString aParam; + for (sal_uInt32 i=0; i<nParams; i++) + { + osl_getCommandArg(i, &aParam.pData); + if ( aParam == "-display" ) + { + osl_getCommandArg(i+1, &aParam.pData); + rDisplay = OUStringToOString( + aParam, osl_getThreadTextEncoding()); + + if ((pDisp = XOpenDisplay(rDisplay.getStr()))!=nullptr) + { + /* + * if a -display switch was used, we need + * to set the environment accordingly since + * the clipboard build another connection + * to the xserver using $DISPLAY + */ + OUString envVar("DISPLAY"); + osl_setEnvironment(envVar.pData, aParam.pData); + } + break; + } + } + + if (!pDisp && rDisplay.isEmpty()) + { + // Open $DISPLAY or default... + char *pDisplay = getenv("DISPLAY"); + if (pDisplay != nullptr) + rDisplay = OString(pDisplay); + pDisp = XOpenDisplay(pDisplay); + } + + return pDisp; +} + void SalXLib::Init() { SalI18N_InputMethod* pInputMethod = new SalI18N_InputMethod; diff --git a/vcl/inc/unx/x11/x11display.hxx b/vcl/unx/generic/gdi/nativewindowhandleprovider.cxx index 9cb2ea56ccf8..3afd26e31498 100644 --- a/vcl/inc/unx/x11/x11display.hxx +++ b/vcl/unx/generic/gdi/nativewindowhandleprovider.cxx @@ -7,19 +7,11 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifndef INCLUDED_VCL_INC_UNX_X11_X11DISPLAY_HXX -#define INCLUDED_VCL_INC_UNX_X11_X11DISPLAY_HXX +#include "unx/nativewindowhandleprovider.hxx" -#include <prex.h> -#include <X11/Xproto.h> -#include <postx.h> +NativeWindowHandleProvider::~NativeWindowHandleProvider() +{ +} -#include <rtl/string.hxx> - -#include <vcl/dllapi.h> - -VCL_DLLPUBLIC Display* OpenX11Display(OString& rDisplay); - -#endif // INCLUDED_VCL_INC_UNX_X11_X11DISPLAY_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx index 7bc1719770da..1a0e34e53b9c 100644 --- a/vcl/unx/generic/gdi/salgdi.cxx +++ b/vcl/unx/generic/gdi/salgdi.cxx @@ -53,7 +53,7 @@ #include <unx/x11/xlimits.hxx> #include "salgdiimpl.hxx" -#include "unx/x11windowprovider.hxx" +#include "unx/nativewindowhandleprovider.hxx" #include "textrender.hxx" #include "gdiimpl.hxx" #include "opengl/x11/gdiimpl.hxx" diff --git a/vcl/unx/generic/gdi/x11windowprovider.cxx b/vcl/unx/generic/gdi/x11windowprovider.cxx deleted file mode 100644 index e8604ad410ee..000000000000 --- a/vcl/unx/generic/gdi/x11windowprovider.cxx +++ /dev/null @@ -1,72 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#include <vcl/svapp.hxx> - -#include "unx/x11windowprovider.hxx" -#include "unx/x11/x11display.hxx" - -X11WindowProvider::~X11WindowProvider() -{ -} - -Display *OpenX11Display(OString& rDisplay) -{ - /* - * open connection to X11 Display - * try in this order: - * o -display command line parameter, - * o $DISPLAY environment variable - * o default display - */ - - Display *pDisp = nullptr; - - // is there a -display command line parameter? - - sal_uInt32 nParams = osl_getCommandArgCount(); - OUString aParam; - for (sal_uInt32 i=0; i<nParams; i++) - { - osl_getCommandArg(i, &aParam.pData); - if ( aParam == "-display" ) - { - osl_getCommandArg(i+1, &aParam.pData); - rDisplay = OUStringToOString( - aParam, osl_getThreadTextEncoding()); - - if ((pDisp = XOpenDisplay(rDisplay.getStr()))!=nullptr) - { - /* - * if a -display switch was used, we need - * to set the environment accordingly since - * the clipboard build another connection - * to the xserver using $DISPLAY - */ - OUString envVar("DISPLAY"); - osl_setEnvironment(envVar.pData, aParam.pData); - } - break; - } - } - - if (!pDisp && rDisplay.isEmpty()) - { - // Open $DISPLAY or default... - char *pDisplay = getenv("DISPLAY"); - if (pDisplay != nullptr) - rDisplay = OString(pDisplay); - pDisp = XOpenDisplay(pDisplay); - } - - return pDisp; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index aeeae87a78d6..abecfd3e36c3 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -4134,7 +4134,7 @@ void X11SalFrame::EndSetClipRegion() } -Window X11SalFrame::GetX11Window() +sal_uIntPtr X11SalFrame::GetNativeWindowHandle() { return mhWindow; } diff --git a/vcl/unx/gtk/gtksalframe.cxx b/vcl/unx/gtk/gtksalframe.cxx index 4576f36953c6..c164bcd99e19 100644 --- a/vcl/unx/gtk/gtksalframe.cxx +++ b/vcl/unx/gtk/gtksalframe.cxx @@ -3936,7 +3936,7 @@ Size GtkSalDisplay::GetScreenSize( int nDisplayScreen ) return Size( aRect.GetWidth(), aRect.GetHeight() ); } -Window GtkSalFrame::GetX11Window() +sal_uIntPtr GtkSalFrame::GetNativeWindowHandle() { return widget_get_xid(m_pWindow); } diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx index c7d2a408a3e5..e92eb1350990 100644 --- a/vcl/unx/gtk3/gtk3gtkframe.cxx +++ b/vcl/unx/gtk3/gtk3gtkframe.cxx @@ -3904,7 +3904,7 @@ Size GtkSalDisplay::GetScreenSize( int nDisplayScreen ) return Size( aRect.GetWidth(), aRect.GetHeight() ); } -Window GtkSalFrame::GetX11Window() +sal_uIntPtr GtkSalFrame::GetNativeWindowHandle() { return widget_get_xid(m_pWindow); } |