Bug 1534557 - Implement GtkCompositorWidget::GetEGLNativeWindow() for GET_NATIVE_WINDOW_FROM_COMPOSITOR_WIDGET r=jgilbert
authorsotaro <sotaro.ikeda.g@gmail.com>
Wed, 13 Mar 2019 00:18:49 +0000
changeset 464944 38d13d13f7e7cd7072d69eca90745b5c7ece30c1
parent 464943 33b7a55cdc2012a8004e02e9daeaefa5198ccf5b
child 464945 2e946ccf8cc541440d8304339f6bfd2bf251a6a3
push id112486
push useropoprus@mozilla.com
push dateTue, 19 Mar 2019 16:41:04 +0000
treeherdermozilla-inbound@ee866fb50236 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjgilbert
bugs1534557
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1534557 - Implement GtkCompositorWidget::GetEGLNativeWindow() for GET_NATIVE_WINDOW_FROM_COMPOSITOR_WIDGET r=jgilbert Differential Revision: https://phabricator.services.mozilla.com/D23106
gfx/gl/GLContextProviderEGL.cpp
widget/gtk/GtkCompositorWidget.cpp
widget/gtk/GtkCompositorWidget.h
--- a/gfx/gl/GLContextProviderEGL.cpp
+++ b/gfx/gl/GLContextProviderEGL.cpp
@@ -1,19 +1,18 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
 #if defined(MOZ_WIDGET_GTK)
 #  define GET_NATIVE_WINDOW_FROM_REAL_WIDGET(aWidget) \
     ((EGLNativeWindowType)aWidget->GetNativeData(NS_NATIVE_EGL_WINDOW))
-#  define GET_NATIVE_WINDOW_FROM_COMPOSITOR_WIDGET(aWidget)     \
-    ((EGLNativeWindowType)aWidget->RealWidget()->GetNativeData( \
-        NS_NATIVE_EGL_WINDOW))
+#  define GET_NATIVE_WINDOW_FROM_COMPOSITOR_WIDGET(aWidget) \
+    (aWidget->AsX11()->GetEGLNativeWindow())
 #elif defined(MOZ_WIDGET_ANDROID)
 #  define GET_NATIVE_WINDOW_FROM_REAL_WIDGET(aWidget) \
     ((EGLNativeWindowType)aWidget->GetNativeData(NS_JAVA_SURFACE))
 #  define GET_NATIVE_WINDOW_FROM_COMPOSITOR_WIDGET(aWidget) \
     (aWidget->AsAndroid()->GetEGLNativeWindow())
 #elif defined(XP_WIN)
 #  define GET_NATIVE_WINDOW_FROM_REAL_WIDGET(aWidget) \
     ((EGLNativeWindowType)aWidget->GetNativeData(NS_NATIVE_WINDOW))
@@ -68,16 +67,20 @@
 #include "mozilla/layers/CompositorOptions.h"
 #include "mozilla/widget/CompositorWidget.h"
 #include "nsDebug.h"
 #include "nsIWidget.h"
 #include "nsThreadUtils.h"
 #include "ScopedGLHelpers.h"
 #include "TextureImageEGL.h"
 
+#if defined(MOZ_WIDGET_GTK)
+#  include "mozilla/widget/GtkCompositorWidget.h"
+#endif
+
 #if defined(MOZ_WAYLAND)
 #  include "nsAutoPtr.h"
 #  include "nsDataHashtable.h"
 
 #  include <gtk/gtk.h>
 #  include <gdk/gdkx.h>
 #  include <gdk/gdkwayland.h>
 #  include <wayland-egl.h>
--- a/widget/gtk/GtkCompositorWidget.cpp
+++ b/widget/gtk/GtkCompositorWidget.cpp
@@ -98,10 +98,14 @@ bool GtkCompositorWidget::WaylandRequest
 #endif
 
 LayoutDeviceIntSize GtkCompositorWidget::GetClientSize() { return mClientSize; }
 
 uintptr_t GtkCompositorWidget::GetWidgetKey() {
   return reinterpret_cast<uintptr_t>(mWidget);
 }
 
+EGLNativeWindowType GtkCompositorWidget::GetEGLNativeWindow() {
+  return (EGLNativeWindowType)mWidget->GetNativeData(NS_NATIVE_EGL_WINDOW);
+}
+
 }  // namespace widget
 }  // namespace mozilla
--- a/widget/gtk/GtkCompositorWidget.h
+++ b/widget/gtk/GtkCompositorWidget.h
@@ -1,16 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 widget_gtk_GtkCompositorWidget_h
 #define widget_gtk_GtkCompositorWidget_h
 
+#include "GLDefs.h"
 #include "mozilla/widget/CompositorWidget.h"
 #include "WindowSurfaceProvider.h"
 
 class nsIWidget;
 class nsWindow;
 
 namespace mozilla {
 namespace widget {
@@ -57,16 +58,18 @@ class GtkCompositorWidget : public Compo
 
   nsIWidget* RealWidget() override;
   GtkCompositorWidget* AsX11() override { return this; }
   CompositorWidgetDelegate* AsDelegate() override { return this; }
 
   Display* XDisplay() const { return mXDisplay; }
   Window XWindow() const { return mXWindow; }
 
+  EGLNativeWindowType GetEGLNativeWindow();
+
   // PlatformCompositorWidgetDelegate Overrides
 
   void NotifyClientSizeChanged(const LayoutDeviceIntSize& aClientSize) override;
 
 #ifdef MOZ_WAYLAND
   void RequestsUpdatingEGLSurface() override;
   bool WaylandRequestsUpdatingEGLSurface();
 #endif