From c0d4f3ad3307c7a0d0fddd8c413ef0cc91d382ae Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 15 Feb 2016 15:55:40 +0000 Subject: implement wayland handle passing for gstreamer Change-Id: I3b0effe35ad7b37ff7ab3de2a3b78b6312779139 --- vcl/unx/gtk3/gtk3gtkframe.cxx | 34 +++++++++++++++++++++++++++++----- vcl/unx/gtk3/gtk3gtkobject.cxx | 4 +--- 2 files changed, 30 insertions(+), 8 deletions(-) (limited to 'vcl/unx') diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx index e92eb1350990..ddfde5ade587 100644 --- a/vcl/unx/gtk3/gtk3gtkframe.cxx +++ b/vcl/unx/gtk3/gtk3gtkframe.cxx @@ -48,7 +48,12 @@ #include #include #include -#include +#if defined(GDK_WINDOWING_X11) +# include +#endif +#if defined(GDK_WINDOWING_WAYLAND) +# include +#endif #include #include @@ -1084,9 +1089,7 @@ void GtkSalFrame::InitCommon() //system data m_aSystemData.nSize = sizeof( SystemEnvData ); - static int nWindow = 0; - m_aSystemData.aWindow = nWindow; - ++nWindow; + m_aSystemData.aWindow = GetNativeWindowHandle(m_pWindow); m_aSystemData.aShellWindow = reinterpret_cast(this); m_aSystemData.pSalFrame = this; m_aSystemData.pWidget = m_pWindow; @@ -3904,9 +3907,30 @@ Size GtkSalDisplay::GetScreenSize( int nDisplayScreen ) return Size( aRect.GetWidth(), aRect.GetHeight() ); } +sal_uIntPtr GtkSalFrame::GetNativeWindowHandle(GtkWidget *pWidget) +{ + GdkDisplay *pDisplay = getGdkDisplay(); + GdkWindow *pWindow = gtk_widget_get_window(pWidget); + +#if defined(GDK_WINDOWING_X11) + if (GDK_IS_X11_DISPLAY(pDisplay)) + { + return GDK_WINDOW_XID(pWindow); + } + else +#endif +#if defined(GDK_WINDOWING_WAYLAND) + if (GDK_IS_WAYLAND_DISPLAY(pDisplay)) + { + return reinterpret_cast(gdk_wayland_window_get_wl_surface(pWindow)); + } +#endif + return 0; +} + sal_uIntPtr GtkSalFrame::GetNativeWindowHandle() { - return widget_get_xid(m_pWindow); + return GetNativeWindowHandle(m_pWindow); } void GtkDragSource::startDrag(const datatransfer::dnd::DragGestureEvent& rEvent, diff --git a/vcl/unx/gtk3/gtk3gtkobject.cxx b/vcl/unx/gtk3/gtk3gtkobject.cxx index d213e1c4bba4..062b07f60247 100644 --- a/vcl/unx/gtk3/gtk3gtkobject.cxx +++ b/vcl/unx/gtk3/gtk3gtkobject.cxx @@ -51,9 +51,7 @@ GtkSalObject::GtkSalObject( GtkSalFrame* pParent, bool bShow ) // system data m_aSystemData.nSize = sizeof( SystemEnvData ); - static int nWindow = 0; - m_aSystemData.aWindow = nWindow; - ++nWindow; + m_aSystemData.aWindow = pParent->GetNativeWindowHandle(m_pSocket); m_aSystemData.aShellWindow = reinterpret_cast(this); m_aSystemData.pSalFrame = nullptr; m_aSystemData.pWidget = m_pSocket; -- cgit