summaryrefslogtreecommitdiff
path: root/vcl/unx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-02-15 15:37:37 +0000
committerCaolán McNamara <caolanm@redhat.com>2016-02-15 16:37:52 +0000
commite35e762d564da18b0b508112f3e4d78fd26ba99c (patch)
tree064359c707b6a35d0752c8274ec54022d3089adc /vcl/unx
parent0d6328164e32dc8b5cd47e27bfcc2e2f6f906799 (diff)
rename X11WindowProvider to a NativeWindowHandle provider
sort of thing and genericize it Change-Id: I27e1e47f2b371e5269db079cfc1262d056105f80
Diffstat (limited to 'vcl/unx')
-rw-r--r--vcl/unx/generic/app/saldata.cxx56
-rw-r--r--vcl/unx/generic/gdi/nativewindowhandleprovider.cxx17
-rw-r--r--vcl/unx/generic/gdi/salgdi.cxx2
-rw-r--r--vcl/unx/generic/gdi/x11windowprovider.cxx72
-rw-r--r--vcl/unx/generic/window/salframe.cxx2
-rw-r--r--vcl/unx/gtk/gtksalframe.cxx2
-rw-r--r--vcl/unx/gtk3/gtk3gtkframe.cxx2
7 files changed, 76 insertions, 77 deletions
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/unx/generic/gdi/nativewindowhandleprovider.cxx b/vcl/unx/generic/gdi/nativewindowhandleprovider.cxx
new file mode 100644
index 000000000000..3afd26e31498
--- /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 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);
}