From 3ead36a8baafea46737706eb4eea4cf079a7fd2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cle=CC=81ment=20Foucault?= Date: Tue, 14 Nov 2023 20:24:55 +0100 Subject: [PATCH] GHOST: Cleanup: Remove GHOST_OPENGL_ALPHA This is never define and has no use in current blender. If we want to keep this functionality, we should at the very least rename it to `GHOST_WINDOW_ALPHA`. Pull Request: https://projects.blender.org/blender/blender/pulls/114815 --- intern/ghost/intern/GHOST_ContextEGL.cc | 5 --- intern/ghost/intern/GHOST_ContextSDL.cc | 4 --- intern/ghost/intern/GHOST_WindowWayland.cc | 39 ---------------------- intern/ghost/intern/GHOST_WindowWayland.hh | 4 --- 4 files changed, 52 deletions(-) diff --git a/intern/ghost/intern/GHOST_ContextEGL.cc b/intern/ghost/intern/GHOST_ContextEGL.cc index e4047b6260f..4166e987f00 100644 --- a/intern/ghost/intern/GHOST_ContextEGL.cc +++ b/intern/ghost/intern/GHOST_ContextEGL.cc @@ -436,11 +436,6 @@ GHOST_TSuccess GHOST_ContextEGL::initializeDrawingContext() attrib_list.push_back(EGL_BLUE_SIZE); attrib_list.push_back(8); -#ifdef GHOST_OPENGL_ALPHA - attrib_list.push_back(EGL_ALPHA_SIZE); - attrib_list.push_back(8); -#endif - if (m_nativeWindow == 0) { /* Off-screen surface. */ attrib_list.push_back(EGL_SURFACE_TYPE); diff --git a/intern/ghost/intern/GHOST_ContextSDL.cc b/intern/ghost/intern/GHOST_ContextSDL.cc index c965d892732..4368506ef86 100644 --- a/intern/ghost/intern/GHOST_ContextSDL.cc +++ b/intern/ghost/intern/GHOST_ContextSDL.cc @@ -90,11 +90,7 @@ GHOST_TSuccess GHOST_ContextSDL::releaseDrawingContext() GHOST_TSuccess GHOST_ContextSDL::initializeDrawingContext() { -#ifdef GHOST_OPENGL_ALPHA - const bool needAlpha = true; -#else const bool needAlpha = false; -#endif SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, m_contextProfileMask); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, m_contextMajorVersion); diff --git a/intern/ghost/intern/GHOST_WindowWayland.cc b/intern/ghost/intern/GHOST_WindowWayland.cc index 7eacbbd4160..79d480f0d9e 100644 --- a/intern/ghost/intern/GHOST_WindowWayland.cc +++ b/intern/ghost/intern/GHOST_WindowWayland.cc @@ -195,10 +195,6 @@ enum eGWL_PendingWindowActions { * The state of the window frame has changed, apply the state from #GWL_Window::frame_pending. */ PENDING_WINDOW_FRAME_CONFIGURE = 0, -# ifdef GHOST_OPENGL_ALPHA - /** Draw an opaque region behind the window. */ - PENDING_OPAQUE_SET, -# endif /** * The DPI for a monitor has changed or the monitors (outputs) * this window is visible on may have changed. Recalculate the windows scale. @@ -767,11 +763,6 @@ static void gwl_window_pending_actions_handle(GWL_Window *win) if (actions[PENDING_WINDOW_FRAME_CONFIGURE]) { gwl_window_frame_update_from_pending(win); } -# ifdef GHOST_OPENGL_ALPHA - if (actions[PENDING_OPAQUE_SET]) { - win->ghost_window->setOpaque(); - } -# endif if (actions[PENDING_OUTPUT_SCALE_UPDATE_DEFERRED]) { gwl_window_pending_actions_tag(win, PENDING_OUTPUT_SCALE_UPDATE); /* Force postponing scale update to ensure all scale information has been taken into account @@ -1595,10 +1586,6 @@ GHOST_WindowWayland::GHOST_WindowWayland(GHOST_SystemWayland *system, /* Call top-level callbacks. */ wl_surface_commit(window_->wl.surface); -#ifdef GHOST_OPENGL_ALPHA - setOpaque(); -#endif - /* NOTE: the method used for XDG & LIBDECOR initialization (using `initial_configure_seen`) * follows the method used in SDL 3.16. */ @@ -1983,19 +1970,6 @@ bool GHOST_WindowWayland::isDialog() const return window_->is_dialog; } -#ifdef GHOST_OPENGL_ALPHA -void GHOST_WindowWayland::setOpaque() const -{ - struct wl_region *region; - - /* Make the window opaque. */ - region = wl_compositor_create_region(system_->wl_compositor()); - wl_region_add(region, 0, 0, UNPACK2(window_->size)); - wl_surface_set_opaque_region(window_->wl.surface, region); - wl_region_destroy(region); -} -#endif - GHOST_Context *GHOST_WindowWayland::newDrawingContext(GHOST_TDrawingContextType type) { switch (type) { @@ -2182,19 +2156,6 @@ GHOST_TSuccess GHOST_WindowWayland::deactivate() GHOST_TSuccess GHOST_WindowWayland::notify_size() { -#ifdef GHOST_OPENGL_ALPHA -# ifdef USE_EVENT_BACKGROUND_THREAD - /* Actual activation is handled when processing pending events. */ - const bool is_main_thread = system_->main_thread_id == std::this_thread::get_id(); - if (!is_main_thread) { - gwl_window_pending_actions_tag(window_, PENDING_OPAQUE_SET); - } -# endif - { - setOpaque(); - } -#endif - return system_->pushEvent_maybe_pending( new GHOST_Event(system_->getMilliSeconds(), GHOST_kEventWindowSize, this)); } diff --git a/intern/ghost/intern/GHOST_WindowWayland.hh b/intern/ghost/intern/GHOST_WindowWayland.hh index db1f941c86e..e3f15ecc2f4 100644 --- a/intern/ghost/intern/GHOST_WindowWayland.hh +++ b/intern/ghost/intern/GHOST_WindowWayland.hh @@ -136,10 +136,6 @@ class GHOST_WindowWayland : public GHOST_Window { bool isDialog() const override; -#ifdef GHOST_OPENGL_ALPHA - void setOpaque() const; -#endif - #ifdef WITH_INPUT_IME void beginIME(int32_t x, int32_t y, int32_t w, int32_t h, bool completed) override; void endIME() override;