Skip to content

Conversation

@HeikoKlare
Copy link

@HeikoKlare HeikoKlare commented Mar 22, 2025

❗ This is work in progress only for demonstration purposes.

This introduces a wrapper layer for widgets (see #81 (comment)), making the API widgets only wrapper objects for actual implementations either based on OS-native wrappers or based on custom implementations.

The wrapper has been implemented consistently across all OSes for upstream SWT in this branch: https://github.com/swt-initiative31/prototype-skija/tree/facade
This PR contains a rebase of those changes onto the Skija development state. It is currently only adapted for Windows.

Contributes to #81

Produces consistent height results independent of button text
Thomas Singer and others added 19 commits March 14, 2025 11:15
for checkbox, radio button and arrow button
The transparency flag and argument of SkijaGCs drawText methods have not
been considered. With this change, the background of the text is drawn
if the transparent flag is not set as defined by the API.
Currently, the Text widget based on CSimpleText uses the original
(native) GC. With this change, it performs rendering based on a SkijaGC
if enabled.
Set it in Drawing::getTextExtent
because some implementations will need size hint arguments
* Fix multi-line anchor tag issue.

Anchor tag within a link text can have new line character(\n).
Link should be underlined in multiple lines.
Other improvements.

See #154

* Link widget re-factoring. Extract rendering logic as a
DefaultLinkRenderer.

Extract parse logic as a testable method and add unit test.

* Link: renderer can be final (for now)

* Link: move check for size from Renderer to Link

Later it should be part of Drawing.drawWithGC

* Link: single-line-if-checks without {}

* LinkExample: tiny fixes

* LinkRenderer.TextSegment: simplified

* Link: introduce LinkRenderer.isOverLink

no need to handle internals of LinkRenderer in Link

* LinkRenderer: fix parseLinkText

* DefaultLinkRenderer: remove useless +

* DefaultLinkRenderer: removed code that introduced too large space

---------

Co-authored-by: Thomas Singer <[email protected]>
* Initial implementation of slider widget.

* Slider widget re-factoring into a SliderRenderer.
All the review comments are fixed.

* Decouple event handling and rendering for Slider widget.

Event handling is handled by widget and rendering is handled by
renderer.

* SliderExample: small fixes

* Slider: tiny code fixes

* further drawing fixes

* Minor drawing improvements.

---------

Co-authored-by: Thomas Singer <[email protected]>
Text only subclasses CSimpleText without the latter being used
independently. This merges the two classes.
@github-actions
Copy link

github-actions bot commented Mar 22, 2025

Test Results

  136 files   -   205    136 suites   - 205   1m 23s ⏱️ -58s
3 895 tests  -    61  3 568 ✅  -   104  320 💤 + 36  4 ❌ +4  3 🔥 +3 
3 933 runs   - 7 763  3 606 ✅  - 7 205  320 💤  - 565  4 ❌ +4  3 🔥 +3 

For more details on these failures and errors, see this check.

Results for commit b18fa00. ± Comparison against base commit 14ba19d.

This pull request removes 61 tests.
org.eclipse.swt.graphics.ImageWin32Tests ‑ testImageDataForDifferentFractionalZoomsShouldBeDifferent
org.eclipse.swt.graphics.ImageWin32Tests ‑ testImageShouldHaveDimesionAsPerZoomLevel
org.eclipse.swt.tests.gtk.Test_GtkConverter ‑ test_HeuristicASCII_dollarSign
org.eclipse.swt.tests.gtk.Test_GtkConverter ‑ test_HeuristicASCII_emptyString
org.eclipse.swt.tests.gtk.Test_GtkConverter ‑ test_HeuristicASCII_letterA
org.eclipse.swt.tests.gtk.Test_GtkConverter ‑ test_HeuristicASCII_letters
org.eclipse.swt.tests.gtk.Test_GtkConverter ‑ test_HeuristicUTF16LE_null
org.eclipse.swt.tests.gtk.Test_GtkConverter ‑ test_HeuristicUTF16_AsciiLetters
org.eclipse.swt.tests.gtk.Test_GtkConverter ‑ test_HeuristicUTF16_Asciiletter
org.eclipse.swt.tests.gtk.Test_GtkConverter ‑ test_HeuristicUTF16_LotsOfLetters
…
This pull request skips 43 tests.
org.eclipse.swt.tests.junit.Test_org_eclipse_swt_custom_CCombo ‑ test_setForegroundAlphaLorg_eclipse_swt_graphics_Color
org.eclipse.swt.tests.junit.Test_org_eclipse_swt_custom_CLabel ‑ test_setForegroundAlphaLorg_eclipse_swt_graphics_Color
org.eclipse.swt.tests.junit.Test_org_eclipse_swt_custom_CTabFolder ‑ test_setForegroundAlphaLorg_eclipse_swt_graphics_Color
org.eclipse.swt.tests.junit.Test_org_eclipse_swt_custom_StyledText ‑ test_setForegroundAlphaLorg_eclipse_swt_graphics_Color
org.eclipse.swt.tests.junit.Test_org_eclipse_swt_widgets_Button ‑ test_setForegroundAlphaCheckButton
org.eclipse.swt.tests.junit.Test_org_eclipse_swt_widgets_Button ‑ test_setForegroundAlphaLorg_eclipse_swt_graphics_Color
org.eclipse.swt.tests.junit.Test_org_eclipse_swt_widgets_Button ‑ test_setForegroundAlphaRadiokButton
org.eclipse.swt.tests.junit.Test_org_eclipse_swt_widgets_Canvas ‑ test_setForegroundAlphaLorg_eclipse_swt_graphics_Color
org.eclipse.swt.tests.junit.Test_org_eclipse_swt_widgets_Combo ‑ test_setForegroundAlphaDropDownCombo
org.eclipse.swt.tests.junit.Test_org_eclipse_swt_widgets_Combo ‑ test_setForegroundAlphaLorg_eclipse_swt_graphics_Color
…

♻️ This comment has been updated with latest results.

@HeikoKlare HeikoKlare force-pushed the rebased-facade branch 2 times, most recently from 1fd38b9 to 5ed4b24 Compare March 24, 2025 16:07
Makes the widget hierarchy a facade/wrapper API for potentially
different actual implementations of widgets.

Adapt GTK implementation to Widget facade API

Adapt Cocoa implementation to Widget facade API

Extract IWidget, IControl, and other interfaces

Remove native-specific parts from API methods of native classes
@tmssngr tmssngr force-pushed the master branch 2 times, most recently from 3d97fac to aa02556 Compare June 23, 2025 08:42
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.

8 participants