diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-02-15 15:55:40 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-02-15 16:37:52 +0000 |
commit | c0d4f3ad3307c7a0d0fddd8c413ef0cc91d382ae (patch) | |
tree | f30934800bb4bc5324ff83e4d0b72a0c2070fc5e /vcl/unx | |
parent | e35e762d564da18b0b508112f3e4d78fd26ba99c (diff) |
implement wayland handle passing for gstreamer
Change-Id: I3b0effe35ad7b37ff7ab3de2a3b78b6312779139
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkframe.cxx | 34 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkobject.cxx | 4 |
2 files changed, 30 insertions, 8 deletions
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 <gtk/gtk.h> #include <prex.h> #include <X11/Xatom.h> -#include <gdk/gdkx.h> +#if defined(GDK_WINDOWING_X11) +# include <gdk/gdkx.h> +#endif +#if defined(GDK_WINDOWING_WAYLAND) +# include <gdk/gdkwayland.h> +#endif #include <postx.h> #include <dlfcn.h> @@ -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<long>(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<sal_uIntPtr>(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<long>(this); m_aSystemData.pSalFrame = nullptr; m_aSystemData.pWidget = m_pSocket; |