[Bf-blender-cvs] [59e48d8fe4b] master: Wayland: draw opaque background when OpenGL alpha is enabled

Christian Rauch noreply at git.blender.org
Wed Jul 22 04:02:57 CEST 2020


Commit: 59e48d8fe4b72b0d6717820c185ae91b5ae7ab39
Author: Christian Rauch
Date:   Wed Jul 22 10:47:12 2020 +1000
Branches: master
https://developer.blender.org/rB59e48d8fe4b72b0d6717820c185ae91b5ae7ab39

Wayland: draw opaque background when OpenGL alpha is enabled

===================================================================

M	intern/ghost/intern/GHOST_WindowWayland.cpp
M	intern/ghost/intern/GHOST_WindowWayland.h

===================================================================

diff --git a/intern/ghost/intern/GHOST_WindowWayland.cpp b/intern/ghost/intern/GHOST_WindowWayland.cpp
index ef02db7abc3..fe65162d168 100644
--- a/intern/ghost/intern/GHOST_WindowWayland.cpp
+++ b/intern/ghost/intern/GHOST_WindowWayland.cpp
@@ -180,6 +180,10 @@ GHOST_WindowWayland::GHOST_WindowWayland(GHOST_SystemWayland *system,
   wl_surface_commit(w->surface);
   wl_display_roundtrip(m_system->display());
 
+#ifdef GHOST_OPENGL_ALPHA
+  setOpaque();
+#endif
+
   setState(state);
 
   setTitle(title);
@@ -214,6 +218,10 @@ GHOST_TSuccess GHOST_WindowWayland::deactivate()
 
 GHOST_TSuccess GHOST_WindowWayland::notify_size()
 {
+#ifdef GHOST_OPENGL_ALPHA
+  setOpaque();
+#endif
+
   return m_system->pushEvent(
       new GHOST_Event(m_system->getMilliSeconds(), GHOST_kEventWindowSize, this));
 }
@@ -385,6 +393,19 @@ bool GHOST_WindowWayland::isDialog() const
   return w->is_dialog;
 }
 
+#ifdef GHOST_OPENGL_ALPHA
+void GHOST_WindowWayland::setOpaque() const
+{
+  struct wl_region *region;
+
+  /* Make the window opaque. */
+  region = wl_compositor_create_region(m_system->compositor());
+  wl_region_add(region, 0, 0, w->width, w->height);
+  wl_surface_set_opaque_region(w->surface, region);
+  wl_region_destroy(region);
+}
+#endif
+
 /**
  * \param type  The type of rendering context create.
  * \return Indication of success.
diff --git a/intern/ghost/intern/GHOST_WindowWayland.h b/intern/ghost/intern/GHOST_WindowWayland.h
index 23e55fcd6e4..ff1eb60e154 100644
--- a/intern/ghost/intern/GHOST_WindowWayland.h
+++ b/intern/ghost/intern/GHOST_WindowWayland.h
@@ -109,6 +109,10 @@ class GHOST_WindowWayland : public GHOST_Window {
 
   bool isDialog() const override;
 
+#ifdef GHOST_OPENGL_ALPHA
+  void setOpaque() const;
+#endif
+
  private:
   GHOST_SystemWayland *m_system;
   struct window_t *w;



More information about the Bf-blender-cvs mailing list