mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-24 15:01:16 +01:00
Remove rounded corners on emulation render window
On Windows 11, when playing windowed in a separate window/widget from the main emulator window, we don't want the window to have rounded corners, as it prevents the corner pixels from being visible
This commit is contained in:
parent
e69486d2cb
commit
91067044f1
@ -13,6 +13,7 @@
|
|||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
#include <dwmapi.h>
|
||||||
|
|
||||||
#include "VideoCommon/Present.h"
|
#include "VideoCommon/Present.h"
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
@ -180,6 +181,18 @@ LRESULT PlatformWin32::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam
|
|||||||
return DefWindowProc(hwnd, msg, wParam, lParam);
|
return DefWindowProc(hwnd, msg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case WM_CREATE:
|
||||||
|
{
|
||||||
|
if (hwnd)
|
||||||
|
{
|
||||||
|
// Remove rounded corners from the render window on Windows 11
|
||||||
|
const DWM_WINDOW_CORNER_PREFERENCE corner_preference = DWMWCP_DONOTROUND;
|
||||||
|
DwmSetWindowAttribute(hwnd, DWMWA_WINDOW_CORNER_PREFERENCE, &corner_preference,
|
||||||
|
sizeof(corner_preference));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case WM_SIZE:
|
case WM_SIZE:
|
||||||
{
|
{
|
||||||
if (g_presenter)
|
if (g_presenter)
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <Windows.h>
|
#include <Windows.h>
|
||||||
|
#include <dwmapi.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RenderWidget::RenderWidget(QWidget* parent) : QWidget(parent)
|
RenderWidget::RenderWidget(QWidget* parent) : QWidget(parent)
|
||||||
@ -69,7 +70,7 @@ RenderWidget::RenderWidget(QWidget* parent) : QWidget(parent)
|
|||||||
// (which results in them not getting called)
|
// (which results in them not getting called)
|
||||||
connect(this, &RenderWidget::StateChanged, Host::GetInstance(), &Host::SetRenderFullscreen,
|
connect(this, &RenderWidget::StateChanged, Host::GetInstance(), &Host::SetRenderFullscreen,
|
||||||
Qt::DirectConnection);
|
Qt::DirectConnection);
|
||||||
connect(this, &RenderWidget::HandleChanged, Host::GetInstance(), &Host::SetRenderHandle,
|
connect(this, &RenderWidget::HandleChanged, this, &RenderWidget::OnHandleChanged,
|
||||||
Qt::DirectConnection);
|
Qt::DirectConnection);
|
||||||
connect(this, &RenderWidget::SizeChanged, Host::GetInstance(), &Host::ResizeSurface,
|
connect(this, &RenderWidget::SizeChanged, Host::GetInstance(), &Host::ResizeSurface,
|
||||||
Qt::DirectConnection);
|
Qt::DirectConnection);
|
||||||
@ -133,6 +134,20 @@ void RenderWidget::dropEvent(QDropEvent* event)
|
|||||||
State::LoadAs(Core::System::GetInstance(), path.toStdString());
|
State::LoadAs(Core::System::GetInstance(), path.toStdString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RenderWidget::OnHandleChanged(void* handle)
|
||||||
|
{
|
||||||
|
if (handle)
|
||||||
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
// Remove rounded corners from the render window on Windows 11
|
||||||
|
const DWM_WINDOW_CORNER_PREFERENCE corner_preference = DWMWCP_DONOTROUND;
|
||||||
|
DwmSetWindowAttribute(reinterpret_cast<HWND>(handle), DWMWA_WINDOW_CORNER_PREFERENCE,
|
||||||
|
&corner_preference, sizeof(corner_preference));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
Host::GetInstance()->SetRenderHandle(handle);
|
||||||
|
}
|
||||||
|
|
||||||
void RenderWidget::OnHideCursorChanged()
|
void RenderWidget::OnHideCursorChanged()
|
||||||
{
|
{
|
||||||
UpdateCursor();
|
UpdateCursor();
|
||||||
|
@ -34,6 +34,7 @@ signals:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void HandleCursorTimer();
|
void HandleCursorTimer();
|
||||||
|
void OnHandleChanged(void* handle);
|
||||||
void OnHideCursorChanged();
|
void OnHideCursorChanged();
|
||||||
void OnNeverHideCursorChanged();
|
void OnNeverHideCursorChanged();
|
||||||
void OnLockCursorChanged();
|
void OnLockCursorChanged();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user