https://github.com/user-attachments/assets/64629375-1a0c-49ea-b974-0f5b2d8c2a63
https://github.com/user-attachments/assets/b02640f4-dbce-4a94-a438-bfa20faab7e5
Screenshot.2026-06-26.185453.png (view on web)https://github.com/wxWidgets/wxWidgets/pull/26635
(3 files)
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
@memoarfaa pushed 1 commit.
—
View it on GitHub or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
@stevecor commented on this pull request.
> RECT rcBorder;
wxCopyRectToRECT(GetSize(), rcBorder);
+ if ((border == wxBORDER_RAISED || border == wxBORDER_SUNKEN) && wxMSWDarkMode::IsActive())
Can we use wxMSWDarkMode::DrawDarkModeEdge() for all the dark mode border styles, and not just these two? The border drawn by DrawThemeParentBackground() does not look good on Windows prior to build 26200. On 26200, the border looks basically the same as wxBORDER_SIMPLE no matter the style, which isn't great.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
@vadz commented on this pull request.
Thanks, this is a lot of code but I guess it's unavoidable.
It would be nice to tidy up this code to use proper types and RAII helpers, please let me know if you plan to do it.
In include/wx/msw/private/darkmode.h:
> @@ -45,6 +45,13 @@ void AllowForWindow(HWND hwnd,
const wchar_t* themeName = L"Explorer",
const wchar_t* themeId = nullptr);
+// Draws a raised or sunken border using two shades (light/dark)
+// for dark mode. The rectangle `rc` is in device coordinates (e.g., window).
+// Draws a raised or sunken border with three shades (light, mid, dark)
+// to mimic the classic Windows 3D effect, using dark-mode colours.
+// The rectangle `rc` is in device coordinates (e.g., the full window).
+void DrawDarkModeEdge(HDC hdc, const RECT& rc, int borderStyle, int thickness);
This should take parameter of proper type:
⬇️ Suggested change-void DrawDarkModeEdge(HDC hdc, const RECT& rc, int borderStyle, int thickness); +void DrawDarkModeEdge(HDC hdc, const RECT& rc, wxBorder borderStyle, int thickness);
> @@ -3835,7 +3835,8 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result,
{
// Determine whether we should draw a border.
bool drawBorder = false;
- switch ( DoTranslateBorder(GetBorder()) )
+ int border = DoTranslateBorder(GetBorder());
⬇️ Suggested change
- int border = DoTranslateBorder(GetBorder()); + wxBorder border = DoTranslateBorder(GetBorder());
(maybe also make it const).
> {
- ::DrawThemeParentBackground(GetHwnd(), GetHdcOf(*impl), &rcBorder);
+ // For flat styles (wxBORDER_THEME, wxBORDER_STATIC, wxBORDER_SIMPLE)
+ // Keep your themed drawing:
This is weird, who is "you" here?
> } - // Draw the border - hTheme.DrawBackground(GetHdcOf(*impl), rcBorder, EP_EDITTEXT, ETS_NORMAL); + ReleaseDC(hwnd, dc); + + /* Call default proc with our Clip Riogn to get the scrollbars etc. also painted */
Typo
⬇️ Suggested change- /* Call default proc with our Clip Riogn to get the scrollbars etc. also painted */ + /* Call default proc with our clip region to get the scrollbars etc. also painted */
> - processed = true;
+ HWND hwnd = GetHWND();
+ RECT rcWin, rcClient;
+ RECT rcVscroll = {};
+ RECT rcHscroll = {};
+ ::GetWindowRect(hwnd, &rcWin);
+ ::GetClientRect(hwnd, &rcClient); // Get the client area dimensions.
+ const auto thickness = MSWGetBorderThickness();
+ RECT rcClip = rcWin;
+ rcClip.left += thickness;
+ rcClip.top += thickness;
+ rcClip.right -= thickness;
+ rcClip.bottom -= thickness;
+
+ /* New clipping region passed to default proc to exclude border */
+ HRGN cliprgn = CreateRectRgnIndirect(&rcClip);
Should use AutoHRGN for this one.
> + HBRUSH brushOuterTL = CreateSolidBrush(colTopLeftOuter); + HBRUSH brushInner = CreateSolidBrush(clrMid); + HBRUSH brushOuterBR = CreateSolidBrush(colBottomRightOuter);
These really should be AutoHBRUSHs.
> + // For sunken edges, the colours are reversed: top/left use shadow, + // bottom/right use highlight, and the middle band is still mid-tone
@memoarfaa pushed 1 commit.
—
View it on GitHub or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
@memoarfaa pushed 1 commit.
—
View it on GitHub or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
@memoarfaa commented on this pull request.
In include/wx/msw/private/darkmode.h:
> @@ -45,6 +45,13 @@ void AllowForWindow(HWND hwnd,
const wchar_t* themeName = L"Explorer",
const wchar_t* themeId = nullptr);
+// Draws a raised or sunken border using two shades (light/dark)
+// for dark mode. The rectangle `rc` is in device coordinates (e.g., window).
+// Draws a raised or sunken border with three shades (light, mid, dark)
+// to mimic the classic Windows 3D effect, using dark-mode colours.
+// The rectangle `rc` is in device coordinates (e.g., the full window).
+void DrawDarkModeEdge(HDC hdc, const RECT& rc, int borderStyle, int thickness);
this is done.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
@memoarfaa commented on this pull request.
> @@ -3835,7 +3835,8 @@ wxWindowMSW::MSWHandleMessage(WXLRESULT *result,
{
// Determine whether we should draw a border.
bool drawBorder = false;
- switch ( DoTranslateBorder(GetBorder()) )
+ int border = DoTranslateBorder(GetBorder());
this also
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
@memoarfaa commented on this pull request.
> + HBRUSH brushOuterTL = CreateSolidBrush(colTopLeftOuter); + HBRUSH brushInner = CreateSolidBrush(clrMid); + HBRUSH brushOuterBR = CreateSolidBrush(colBottomRightOuter);
this now RAII helpers.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
> + // For sunken edges, the colours are reversed: top/left use shadow, + // bottom/right use highlight, and the middle band is still mid-tone
@memoarfaa commented on this pull request.
> - processed = true;
+ HWND hwnd = GetHWND();
+ RECT rcWin, rcClient;
+ RECT rcVscroll = {};
+ RECT rcHscroll = {};
+ ::GetWindowRect(hwnd, &rcWin);
+ ::GetClientRect(hwnd, &rcClient); // Get the client area dimensions.
+ const auto thickness = MSWGetBorderThickness();
+ RECT rcClip = rcWin;
+ rcClip.left += thickness;
+ rcClip.top += thickness;
+ rcClip.right -= thickness;
+ rcClip.bottom -= thickness;
+
+ /* New clipping region passed to default proc to exclude border */
+ HRGN cliprgn = CreateRectRgnIndirect(&rcClip);
this done
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
@vadz @stevecorThanks for the feedback!
1- Renamed to DrawDarkModeBorder() and extended support to all border styles (SIMPLE, STATIC, THEME, RAISED, SUNKEN).
2- Improved GDI resource management with AutoHRGN.
3- I also added RAII helpers (wxPaintDCEx, off-screen wxMemoryDC buffering, etc.) in the dark mode painting path to avoid flicker and ensure clean resource management.
4- see attached use-case diagram
Regarding the focus ring: some native controls (e.g. internal tab page editors, and similar) should skip drawing the extra focus ring.
https://github.com/user-attachments/assets/d8db6adc-4efc-4c00-8f12-97f554d4386f
—
Reply to this email directly, view it on GitHub, or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()
@memoarfaa pushed 1 commit.
—
View it on GitHub or unsubscribe.
Triage notifications, keep track of coding agent tasks and review pull requests on the go with GitHub Mobile for iOS and Android. Download it today!
You are receiving this because you are subscribed to this thread.![]()