454 lines
15 KiB
Diff
454 lines
15 KiB
Diff
From 04de1501e65758a6290e66f9591d491bb20c4e6f Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
|
|
Date: Mon, 15 Feb 2016 15:37:37 +0000
|
|
Subject: [PATCH 3/5] rename X11WindowProvider to a NativeWindowHandle provider
|
|
|
|
sort of thing and genericize it
|
|
|
|
(cherry picked from commit e35e762d564da18b0b508112f3e4d78fd26ba99c)
|
|
|
|
Change-Id: I27e1e47f2b371e5269db079cfc1262d056105f80
|
|
---
|
|
vcl/Library_vcl.mk | 2 +-
|
|
vcl/inc/unx/gtk/gtkframe.hxx | 7 ++-
|
|
vcl/inc/unx/nativewindowhandleprovider.hxx | 25 ++++++++
|
|
vcl/inc/unx/salframe.h | 6 +-
|
|
vcl/inc/unx/x11/x11display.hxx | 25 --------
|
|
vcl/inc/unx/x11windowprovider.hxx | 28 ---------
|
|
vcl/opengl/x11/gdiimpl.cxx | 4 +-
|
|
vcl/unx/generic/app/saldata.cxx | 56 ++++++++++++++++-
|
|
vcl/unx/generic/gdi/nativewindowhandleprovider.cxx | 17 +++++
|
|
vcl/unx/generic/gdi/salgdi.cxx | 2 +-
|
|
vcl/unx/generic/gdi/x11windowprovider.cxx | 72 ----------------------
|
|
vcl/unx/generic/window/salframe.cxx | 2 +-
|
|
vcl/unx/gtk/gtksalframe.cxx | 2 +-
|
|
vcl/unx/gtk3/gtk3gtkframe.cxx | 2 +-
|
|
14 files changed, 111 insertions(+), 139 deletions(-)
|
|
create mode 100644 vcl/inc/unx/nativewindowhandleprovider.hxx
|
|
delete mode 100644 vcl/inc/unx/x11/x11display.hxx
|
|
delete mode 100644 vcl/inc/unx/x11windowprovider.hxx
|
|
create mode 100644 vcl/unx/generic/gdi/nativewindowhandleprovider.cxx
|
|
delete mode 100644 vcl/unx/generic/gdi/x11windowprovider.cxx
|
|
|
|
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
|
|
index a9fe72f..da80ab6 100644
|
|
--- a/vcl/Library_vcl.mk
|
|
+++ b/vcl/Library_vcl.mk
|
|
@@ -581,7 +581,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 da629b7..f7edd73 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>
|
|
|
|
@@ -66,7 +66,8 @@ class GtkDnDTransferable;
|
|
typedef void GDBusConnection;
|
|
#endif
|
|
|
|
-class GtkSalFrame : public SalFrame, public X11WindowProvider
|
|
+class GtkSalFrame : public SalFrame
|
|
+ , public NativeWindowHandleProvider
|
|
{
|
|
struct IMHandler
|
|
{
|
|
@@ -518,7 +519,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/nativewindowhandleprovider.hxx b/vcl/inc/unx/nativewindowhandleprovider.hxx
|
|
new file mode 100644
|
|
index 0000000..1d85cb4
|
|
--- /dev/null
|
|
+++ b/vcl/inc/unx/nativewindowhandleprovider.hxx
|
|
@@ -0,0 +1,25 @@
|
|
+/* -*- 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/.
|
|
+ */
|
|
+
|
|
+#ifndef INCLUDED_VCL_UNX_NATIVEWINDOWHANDLEPROVIDER
|
|
+#define INCLUDED_VCL_UNX_NATIVEWINDOWHANDLEPROVIDER
|
|
+
|
|
+#include <vcl/dllapi.h>
|
|
+
|
|
+class VCL_PLUGIN_PUBLIC NativeWindowHandleProvider
|
|
+{
|
|
+public:
|
|
+ virtual ~NativeWindowHandleProvider();
|
|
+
|
|
+ virtual sal_uIntPtr GetNativeWindowHandle() = 0;
|
|
+};
|
|
+
|
|
+#endif
|
|
+
|
|
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
|
diff --git a/vcl/inc/unx/salframe.h b/vcl/inc/unx/salframe.h
|
|
index 9ba1957..9848e1e 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/inc/unx/x11/x11display.hxx b/vcl/inc/unx/x11/x11display.hxx
|
|
deleted file mode 100644
|
|
index 9cb2ea5..0000000
|
|
--- a/vcl/inc/unx/x11/x11display.hxx
|
|
+++ /dev/null
|
|
@@ -1,25 +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/.
|
|
- */
|
|
-
|
|
-#ifndef INCLUDED_VCL_INC_UNX_X11_X11DISPLAY_HXX
|
|
-#define INCLUDED_VCL_INC_UNX_X11_X11DISPLAY_HXX
|
|
-
|
|
-#include <prex.h>
|
|
-#include <X11/Xproto.h>
|
|
-#include <postx.h>
|
|
-
|
|
-#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/inc/unx/x11windowprovider.hxx b/vcl/inc/unx/x11windowprovider.hxx
|
|
deleted file mode 100644
|
|
index 776c8e4..0000000
|
|
--- a/vcl/inc/unx/x11windowprovider.hxx
|
|
+++ /dev/null
|
|
@@ -1,28 +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/.
|
|
- */
|
|
-
|
|
-#ifndef INCLUDED_VCL_UNX_X11WINDOWPROVIDER
|
|
-#define INCLUDED_VCL_UNX_X11WINDOWPROVIDER
|
|
-
|
|
-#include <prex.h>
|
|
-#include <postx.h>
|
|
-
|
|
-#include <vcl/dllapi.h>
|
|
-
|
|
-class VCL_PLUGIN_PUBLIC X11WindowProvider
|
|
-{
|
|
-public:
|
|
- virtual ~X11WindowProvider();
|
|
-
|
|
- virtual Window GetX11Window() = 0;
|
|
-};
|
|
-
|
|
-#endif
|
|
-
|
|
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
|
diff --git a/vcl/opengl/x11/gdiimpl.cxx b/vcl/opengl/x11/gdiimpl.cxx
|
|
index b1bc724..fc49e25 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 3f9d184..92f4679 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/unx/generic/gdi/nativewindowhandleprovider.cxx b/vcl/unx/generic/gdi/nativewindowhandleprovider.cxx
|
|
new file mode 100644
|
|
index 0000000..3afd26e
|
|
--- /dev/null
|
|
+++ b/vcl/unx/generic/gdi/nativewindowhandleprovider.cxx
|
|
@@ -0,0 +1,17 @@
|
|
+/* -*- 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 "unx/nativewindowhandleprovider.hxx"
|
|
+
|
|
+NativeWindowHandleProvider::~NativeWindowHandleProvider()
|
|
+{
|
|
+}
|
|
+
|
|
+
|
|
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|
|
diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx
|
|
index 738d59b..f5ffead 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 5f7d289..0000000
|
|
--- 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 accoringly 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 c0e3e75..63f7c9d 100644
|
|
--- a/vcl/unx/generic/window/salframe.cxx
|
|
+++ b/vcl/unx/generic/window/salframe.cxx
|
|
@@ -4133,7 +4133,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 3b6caa6..d44207e 100644
|
|
--- a/vcl/unx/gtk/gtksalframe.cxx
|
|
+++ b/vcl/unx/gtk/gtksalframe.cxx
|
|
@@ -3929,7 +3929,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 3914de5..a88c5d0 100644
|
|
--- a/vcl/unx/gtk3/gtk3gtkframe.cxx
|
|
+++ b/vcl/unx/gtk3/gtk3gtkframe.cxx
|
|
@@ -3926,7 +3926,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);
|
|
}
|
|
--
|
|
2.7.1
|
|
|