mirror of
https://github.com/ocornut/imgui.git
synced 2024-11-28 01:20:55 +01:00
Pragma linking with dwmapi.lib (Vista-era, ~9 kb). MinGW users will need to link with -ldwmapi.
This commit is contained in:
parent
6a161b8789
commit
c154629152
@ -18,6 +18,10 @@
|
|||||||
#endif
|
#endif
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <tchar.h>
|
#include <tchar.h>
|
||||||
|
#include <dwmapi.h>
|
||||||
|
|
||||||
|
// Configuration flags to add in your imconfig.h file:
|
||||||
|
//#define IMGUI_IMPL_WIN32_DISABLE_GAMEPAD // Disable gamepad support (this used to be meaningful before <1.81) but we know load XInput dynamically so the option is less relevant now.
|
||||||
|
|
||||||
// Using XInput for gamepad (will load DLL dynamically)
|
// Using XInput for gamepad (will load DLL dynamically)
|
||||||
#ifndef IMGUI_IMPL_WIN32_DISABLE_GAMEPAD
|
#ifndef IMGUI_IMPL_WIN32_DISABLE_GAMEPAD
|
||||||
@ -28,6 +32,7 @@ typedef DWORD (WINAPI *PFN_XInputGetState)(DWORD, XINPUT_STATE*);
|
|||||||
|
|
||||||
// CHANGELOG
|
// CHANGELOG
|
||||||
// (minor and older changes stripped away, please see git history for details)
|
// (minor and older changes stripped away, please see git history for details)
|
||||||
|
// 2021-02-18: Added ImGui_ImplWin32_EnableAlphaCompositing(). Non Visual Studio users will need to link with dwmapi.lib (MinGW/gcc: use -ldwmapi).
|
||||||
// 2021-02-17: Fixed ImGui_ImplWin32_EnableDpiAwareness() attempting to get SetProcessDpiAwareness from shcore.dll on Windows 8 whereas it is only supported on Windows 8.1.
|
// 2021-02-17: Fixed ImGui_ImplWin32_EnableDpiAwareness() attempting to get SetProcessDpiAwareness from shcore.dll on Windows 8 whereas it is only supported on Windows 8.1.
|
||||||
// 2021-01-25: Inputs: Dynamically loading XInput DLL.
|
// 2021-01-25: Inputs: Dynamically loading XInput DLL.
|
||||||
// 2020-12-04: Misc: Fixed setting of io.DisplaySize to invalid/uninitialized data when after hwnd has been closed.
|
// 2020-12-04: Misc: Fixed setting of io.DisplaySize to invalid/uninitialized data when after hwnd has been closed.
|
||||||
@ -457,7 +462,7 @@ void ImGui_ImplWin32_EnableDpiAwareness()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_MSC_VER) && !defined(NOGDI)
|
#if defined(_MSC_VER) && !defined(NOGDI)
|
||||||
#pragma comment(lib, "gdi32") // Link with gdi32.lib for GetDeviceCaps()
|
#pragma comment(lib, "gdi32") // Link with gdi32.lib for GetDeviceCaps(). MinGW will require linking with '-lgdi32'
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
float ImGui_ImplWin32_GetDpiScaleForMonitor(void* monitor)
|
float ImGui_ImplWin32_GetDpiScaleForMonitor(void* monitor)
|
||||||
@ -490,3 +495,43 @@ float ImGui_ImplWin32_GetDpiScaleForHwnd(void* hwnd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------
|
||||||
|
// Transparency related helpers (optional)
|
||||||
|
//--------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
|
#pragma comment(lib, "dwmapi") // Link with dwmapi.lib. MinGW will require linking with '-ldwmapi'
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// [experimental]
|
||||||
|
// Borrowed from GLFW's function updateFramebufferTransparency() in src/win32_window.c
|
||||||
|
// (the Dwm* functions are Vista era functions but we are borrowing logic from GLFW)
|
||||||
|
void ImGui_ImplWin32_EnableAlphaCompositing(void* hwnd)
|
||||||
|
{
|
||||||
|
if (!IsWindowsVistaOrGreater())
|
||||||
|
return;
|
||||||
|
|
||||||
|
BOOL composition;
|
||||||
|
if (FAILED(::DwmIsCompositionEnabled(&composition)) || !composition)
|
||||||
|
return;
|
||||||
|
|
||||||
|
BOOL opaque;
|
||||||
|
DWORD color;
|
||||||
|
if (IsWindows8OrGreater() || (SUCCEEDED(::DwmGetColorizationColor(&color, &opaque)) && !opaque))
|
||||||
|
{
|
||||||
|
HRGN region = ::CreateRectRgn(0, 0, -1, -1);
|
||||||
|
DWM_BLURBEHIND bb = {};
|
||||||
|
bb.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION;
|
||||||
|
bb.hRgnBlur = region;
|
||||||
|
bb.fEnable = TRUE;
|
||||||
|
::DwmEnableBlurBehindWindow((HWND)hwnd, &bb);
|
||||||
|
::DeleteObject(region);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DWM_BLURBEHIND bb = {};
|
||||||
|
bb.dwFlags = DWM_BB_ENABLE;
|
||||||
|
::DwmEnableBlurBehindWindow((HWND)hwnd, &bb);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------
|
||||||
|
@ -18,10 +18,6 @@ IMGUI_IMPL_API bool ImGui_ImplWin32_Init(void* hwnd);
|
|||||||
IMGUI_IMPL_API void ImGui_ImplWin32_Shutdown();
|
IMGUI_IMPL_API void ImGui_ImplWin32_Shutdown();
|
||||||
IMGUI_IMPL_API void ImGui_ImplWin32_NewFrame();
|
IMGUI_IMPL_API void ImGui_ImplWin32_NewFrame();
|
||||||
|
|
||||||
// Configuration
|
|
||||||
// - Disable gamepad support
|
|
||||||
//#define IMGUI_IMPL_WIN32_DISABLE_GAMEPAD
|
|
||||||
|
|
||||||
// Win32 message handler your application need to call.
|
// Win32 message handler your application need to call.
|
||||||
// - Intentionally commented out in a '#if 0' block to avoid dragging dependencies on <windows.h> from this helper.
|
// - Intentionally commented out in a '#if 0' block to avoid dragging dependencies on <windows.h> from this helper.
|
||||||
// - You should COPY the line below into your .cpp code to forward declare the function and then you can call it.
|
// - You should COPY the line below into your .cpp code to forward declare the function and then you can call it.
|
||||||
@ -38,3 +34,8 @@ extern IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg
|
|||||||
IMGUI_IMPL_API void ImGui_ImplWin32_EnableDpiAwareness();
|
IMGUI_IMPL_API void ImGui_ImplWin32_EnableDpiAwareness();
|
||||||
IMGUI_IMPL_API float ImGui_ImplWin32_GetDpiScaleForHwnd(void* hwnd); // HWND hwnd
|
IMGUI_IMPL_API float ImGui_ImplWin32_GetDpiScaleForHwnd(void* hwnd); // HWND hwnd
|
||||||
IMGUI_IMPL_API float ImGui_ImplWin32_GetDpiScaleForMonitor(void* monitor); // HMONITOR monitor
|
IMGUI_IMPL_API float ImGui_ImplWin32_GetDpiScaleForMonitor(void* monitor); // HMONITOR monitor
|
||||||
|
|
||||||
|
// Transparency related helpers (optional) [experimental]
|
||||||
|
// - Use to enable alpha compositing transparency with the desktop.
|
||||||
|
// - Use together with e.g. clearing your framebuffer with zero-alpha.
|
||||||
|
IMGUI_IMPL_API void ImGui_ImplWin32_EnableAlphaCompositing(void* hwnd); // HWND hwnd
|
||||||
|
@ -39,12 +39,15 @@ Breaking Changes:
|
|||||||
|
|
||||||
- Style: renamed rarely used style.CircleSegmentMaxError (old default = 1.60f)
|
- Style: renamed rarely used style.CircleSegmentMaxError (old default = 1.60f)
|
||||||
to style.CircleTessellationMaxError (new default = 0.30f) as its meaning changed. (#3808) [@thedmd]
|
to style.CircleTessellationMaxError (new default = 0.30f) as its meaning changed. (#3808) [@thedmd]
|
||||||
|
- Backends: Win32: Pragma linking with dwmapi.lib (Vista-era, ~9 kb). MinGW users will need to link with -ldwmapi.
|
||||||
|
|
||||||
Other Changes:
|
Other Changes:
|
||||||
|
|
||||||
- ImDrawList: AddCircle, AddCircleFilled(): Tweaked default segment count calculation to honor MaxError
|
- ImDrawList: AddCircle, AddCircleFilled(): Tweaked default segment count calculation to honor MaxError
|
||||||
with more accuracy. Made default segment count always even for better looking result. (#3808) [@thedmd]
|
with more accuracy. Made default segment count always even for better looking result. (#3808) [@thedmd]
|
||||||
- ImDrawList: AddCircle, AddCircleFilled(): New default for style.
|
- ImDrawList: AddCircle, AddCircleFilled(): New default for style.
|
||||||
|
- Backends: Win32: Added ImGui_ImplWin32_EnableAlphaCompositing() to facilitate experimenting with
|
||||||
|
alpha compositing and transparent windows. (#2766, #3447 etc.).
|
||||||
- Backends: OpenGL, Vulkan, DX9, DX10, DX11, DX12, Metal, WebGPU, Allegro: Rework blending equation to
|
- Backends: OpenGL, Vulkan, DX9, DX10, DX11, DX12, Metal, WebGPU, Allegro: Rework blending equation to
|
||||||
preserve alpha in output buffer (using SrcBlendAlpha = ONE, DstBlendAlpha = ONE_MINUS_SRC_ALPHA consistently
|
preserve alpha in output buffer (using SrcBlendAlpha = ONE, DstBlendAlpha = ONE_MINUS_SRC_ALPHA consistently
|
||||||
accross all backends), facilitating compositing of the output buffer with another buffer.
|
accross all backends), facilitating compositing of the output buffer with another buffer.
|
||||||
|
Loading…
Reference in New Issue
Block a user