Cleanup: Remove WIN32_COMPOSITING

This PR removes unused Win32 code that we've had for about 13 years,
hidden behind a define that we've never enabled. The intent of this
optional code was to allow showing Blender windows as transparent,
something that looked pretty cool back then. The main method used was
an API call of DwmEnableBlurBehindWindow, but this function has not
done anything since Windows 8 because styles and tastes have changed.

Pull Request: https://projects.blender.org/blender/blender/pulls/137620
This commit is contained in:
Harley Acheson
2025-04-16 22:01:29 +02:00
committed by Harley Acheson
parent f2cfa822da
commit 2e1a12905d
5 changed files with 5 additions and 66 deletions

View File

@@ -159,10 +159,6 @@ static int weight_pixel_format(PIXELFORMATDESCRIPTOR &pfd, PIXELFORMATDESCRIPTOR
if (preferredPFD.cAlphaBits > 0 && pfd.cAlphaBits > 0) {
weight++;
}
#ifdef WIN32_COMPOSITING
if ((preferredPFD.dwFlags & PFD_SUPPORT_COMPOSITION) && (pfd.dwFlags & PFD_SUPPORT_COMPOSITION))
weight++;
#endif
return weight;
}
@@ -339,15 +335,9 @@ struct DummyContextWGL {
1, /* version */
(DWORD)(PFD_SUPPORT_OPENGL | PFD_DRAW_TO_WINDOW |
PFD_DOUBLEBUFFER | /* support double-buffering */
(stereoVisual ? PFD_STEREO : 0) | /* support stereo */
(
#ifdef WIN32_COMPOSITING
/* Support composition for transparent background. */
needAlpha ? PFD_SUPPORT_COMPOSITION :
#endif
0)),
PFD_TYPE_RGBA, /* color type */
(BYTE)(needAlpha ? 32 : 24), /* preferred color depth */
(stereoVisual ? PFD_STEREO : 0)), /* support stereo */
PFD_TYPE_RGBA, /* color type */
(BYTE)(needAlpha ? 32 : 24), /* preferred color depth */
0,
0,
0,
@@ -461,26 +451,6 @@ int GHOST_ContextWGL::_choose_pixel_format_arb_1(bool stereoVisual, bool needAlp
if (nNumFormats > 0) {
iPixelFormat = iPixelFormats[0];
#ifdef WIN32_COMPOSITING
if (needAlpha) {
// scan through all pixel format to make sure one supports compositing
PIXELFORMATDESCRIPTOR pfd;
int i;
for (i = 0; i < nNumFormats; i++) {
if (DescribePixelFormat(m_hDC, iPixelFormats[i], sizeof(PIXELFORMATDESCRIPTOR), &pfd)) {
if (pfd.dwFlags & PFD_SUPPORT_COMPOSITION) {
iPixelFormat = iPixelFormats[i];
break;
}
}
}
if (i == nNumFormats) {
fprintf(stderr, "Warning! Unable to find a pixel format with compositing capability.\n");
}
}
#endif
}
// check pixel format

View File

@@ -8,8 +8,6 @@
#pragma once
// #define WIN32_COMPOSITING
#include "GHOST_Context.hh"
#include <epoxy/wgl.h>

View File

@@ -285,7 +285,6 @@ GHOST_IWindow *GHOST_SystemWin32::createWindow(const char *title,
state,
gpuSettings.context_type,
((gpuSettings.flags & GHOST_gpuStereoVisual) != 0),
false,
(GHOST_WindowWin32 *)parentWindow,
((gpuSettings.flags & GHOST_gpuDebugContext) != 0),
is_dialog,
@@ -618,11 +617,7 @@ GHOST_TSuccess GHOST_SystemWin32::init()
::LoadIcon(nullptr, IDI_APPLICATION);
}
wc.hCursor = ::LoadCursor(0, IDC_ARROW);
wc.hbrBackground =
#ifdef INW32_COMPISITING
(HBRUSH)CreateSolidBrush
#endif
(HBRUSH) GetStockObject(DKGRAY_BRUSH);
wc.hbrBackground = (HBRUSH)GetStockObject(DKGRAY_BRUSH);
wc.lpszMenuName = 0;
wc.lpszClassName = L"GHOST_WindowClass";

View File

@@ -60,7 +60,6 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system,
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
bool wantStereoVisual,
bool alphaBackground,
GHOST_WindowWin32 *parentwindow,
bool is_debug,
bool dialog,
@@ -78,7 +77,6 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system,
m_hasGrabMouse(false),
m_nPressedButtons(0),
m_customCursor(0),
m_wantAlphaBackground(alphaBackground),
m_Bar(nullptr),
m_wintab(nullptr),
m_lastPointerTabletData(GHOST_TABLET_DATA_NONE),
@@ -210,25 +208,6 @@ GHOST_WindowWin32::GHOST_WindowWin32(GHOST_SystemWin32 *system,
::ShowWindow(m_hWnd, nCmdShow);
#ifdef WIN32_COMPOSITING
if (alphaBackground && parentwindowhwnd == 0) {
HRESULT hr = S_OK;
/* Create and populate the Blur Behind structure. */
DWM_BLURBEHIND bb = {0};
/* Enable Blur Behind and apply to the entire client area. */
bb.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION;
bb.fEnable = true;
bb.hRgnBlur = CreateRectRgn(0, 0, -1, -1);
/* Apply Blur Behind. */
hr = DwmEnableBlurBehindWindow(m_hWnd, &bb);
DeleteObject(bb.hRgnBlur);
}
#endif
/* Initialize WINTAB. */
if (system->getTabletAPI() != GHOST_kTabletWinPointer) {
loadWintab(GHOST_kWindowStateMinimized != state);
@@ -656,7 +635,7 @@ GHOST_Context *GHOST_WindowWin32::newDrawingContext(GHOST_TDrawingContextType ty
for (int minor = 6; minor >= 3; --minor) {
GHOST_Context *context = new GHOST_ContextWGL(
m_wantStereoVisual,
m_wantAlphaBackground,
false,
m_hWnd,
m_hDC,
WGL_CONTEXT_CORE_PROFILE_BIT_ARB,

View File

@@ -77,7 +77,6 @@ class GHOST_WindowWin32 : public GHOST_Window {
GHOST_TWindowState state,
GHOST_TDrawingContextType type,
bool wantStereoVisual,
bool alphaBackground,
GHOST_WindowWin32 *parentWindow,
bool is_debug,
bool dialog,
@@ -394,8 +393,6 @@ class GHOST_WindowWin32 : public GHOST_Window {
int m_nPressedButtons;
/** HCURSOR structure of the custom cursor. */
HCURSOR m_customCursor;
/** Request GL context with alpha channel. */
bool m_wantAlphaBackground;
/** ITaskbarList3 structure for progress bar. */
ITaskbarList3 *m_Bar;