Skip to content

[Win32] Remove OS.IsAppThemed() — always true on Windows 10+#3345

Draft
HeikoKlare wants to merge 1 commit into
eclipse-platform:masterfrom
HeikoKlare:win32-remove-is-app-themed
Draft

[Win32] Remove OS.IsAppThemed() — always true on Windows 10+#3345
HeikoKlare wants to merge 1 commit into
eclipse-platform:masterfrom
HeikoKlare:win32-remove-is-app-themed

Conversation

@HeikoKlare
Copy link
Copy Markdown
Contributor

Summary

OS.IsAppThemed() always returns true on Windows 8 and later. Since SWT targets Windows 10+, every !OS.IsAppThemed() branch is unreachable dead code and every if (OS.IsAppThemed()) guard can be reduced to its body.

This removes all 70+ call sites across 21 widget files and cleans up the OS.java declarations that became unused as a result.

Changes to widget code

  • Dead !OS.IsAppThemed() branches deleted — Classic theme fallbacks for DrawFrameControl/DFCS_* checkbox and arrow drawing, TBSTYLE_TRANSPARENT clearing, RTL text-clipping space-padding, ILC_MASK image list flag, XP marquee workaround in ProgressBar, separator workaround in CoolBar
  • if (OS.IsAppThemed()) guards unwrapped — Explorer theme setup in Tree/Table createHandle, themed checkbox image lists, THEME_BACKGROUND handling in drawBackground/wmColorChild/WM_ERASEBKGND/WM_MOVE/wmNCPaint, setBoundsInPixels, widgetStyle bits, and more
  • Ternary OS.IsAppThemed() ? x : y replaced with xGroup Y-offset adjustments, ToolBar TBSTYLE_TRANSPARENT style bit
  • Stale //TEMPORARY CODE commented-out blocks removedCoolBar.java and TabFolder.java
  • Group.fixText(boolean enabled)enabled parameter removed (became unused after the Classic-theme RTL space-padding workaround was deleted)

Changes to OS.java

Removed OS.IsAppThemed() itself (declaration + auto-generated os.c/os_stats.h), and the following declarations that became entirely unused:

Removed Was used in
DrawFrameControl() Non-themed checkbox/arrow drawing in Table, Tree, Button
DFCS_BUTTONCHECK/CHECKED/FLAT/INACTIVE/PUSHED/SCROLLDOWN/SCROLLLEFT/SCROLLRIGHT/SCROLLUP, DFC_BUTTON/SCROLL Arguments to DrawFrameControl
ImageList_AddMasked() Non-themed setCheckboxImageList() (replaced by ImageList_Add)
BS_BITMAP, BS_ICON Non-themed RTL clipping workaround in Button.enableWidget()

Test plan

  • Verify themed rendering of checkboxes in Table and Tree (checked, unchecked, mixed, disabled states)
  • Verify arrow Button draws correctly via theme
  • Verify ToolBar layout with SWT.RIGHT, SWT.FLAT, and mixed text+image items
  • Verify Group size/trim/client-area calculations with RTL and FLIP_TEXT_DIRECTION styles
  • Verify ExpandBar with and without custom foreground/background/font
  • Run existing Win32 widget test suite

🤖 Generated with Claude Code

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 31, 2026

Test Results (win32)

   30 files  ±0     30 suites  ±0   4m 19s ⏱️ -12s
4 698 tests ±0  4 623 ✅ ±0  75 💤 ±0  0 ❌ ±0 
1 228 runs  ±0  1 204 ✅ ±0  24 💤 ±0  0 ❌ ±0 

Results for commit 4d00ad4. ± Comparison against base commit 81da08f.

♻️ This comment has been updated with latest results.

@HeikoKlare HeikoKlare force-pushed the win32-remove-is-app-themed branch from 3009103 to 63b6de3 Compare May 31, 2026 09:04
Windows Classic theme was removed in Windows 8. Since SWT targets
Windows 10 and later, OS.IsAppThemed() unconditionally returns true,
making every !OS.IsAppThemed() branch unreachable dead code and every
if (OS.IsAppThemed()) guard reducible to its body.

Removes all 70+ call sites across 21 widget files:
- Dead !OS.IsAppThemed() else-branches are deleted (Classic theme
  fallbacks for DrawFrameControl, DFCS_* drawing, TBSTYLE_TRANSPARENT
  clearing, RTL text-clipping space-padding, ILC_MASK flag, etc.)
- if (OS.IsAppThemed()) guards are unwrapped to unconditional code
  (Explorer theme setup in Tree/Table createHandle, themed checkbox
  image lists in Tree/Table, THEME_BACKGROUND checks, wmColorChild,
  WM_ERASEBKGND, WM_MOVE, wmNCPaint, widgetStyle bits, etc.)
- Ternary OS.IsAppThemed() ? x : y expressions replaced with x
  (Group offsetY adjustments, ToolBar widgetStyle TBSTYLE_TRANSPARENT)
- Stale TEMPORARY CODE commented-out blocks removed (CoolBar, TabFolder)
- Group.fixText(boolean enabled): enabled parameter removed as it became
  unused once the Classic-theme space-padding workaround was deleted
- OS.IsAppThemed() declaration removed from OS.java (and auto-generated
  os.c / os_stats.h updated accordingly)

The following OS.java declarations became unused as a result and are
also removed:
- OS.DrawFrameControl() and its eleven associated constants
  (DFCS_BUTTONCHECK, DFCS_CHECKED, DFCS_FLAT, DFCS_INACTIVE,
  DFCS_PUSHED, DFCS_SCROLLDOWN, DFCS_SCROLLLEFT, DFCS_SCROLLRIGHT,
  DFCS_SCROLLUP, DFC_BUTTON, DFC_SCROLL) — only used in the non-themed
  checkbox and arrow-button drawing fallbacks
- OS.ImageList_AddMasked() — only used in the non-themed
  setCheckboxImageList() path (replaced by ImageList_Add)
- OS.BS_BITMAP and OS.BS_ICON — only used in the non-themed
  Button.enableWidget() RTL clipping workaround

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@HeikoKlare HeikoKlare force-pushed the win32-remove-is-app-themed branch from 63b6de3 to 4d00ad4 Compare May 31, 2026 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant