diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md new file mode 100644 index 0000000000..2bb79371ed --- /dev/null +++ b/.github/copilot-instructions.md @@ -0,0 +1,158 @@ +# GitHub Copilot Instructions for Eclipse Platform SWT + +## Project Overview + +This is the **Eclipse Platform SWT** (Standard Widget Toolkit) repository - a cross-platform GUI library for JVM-based desktop applications. SWT is the foundation for the Eclipse IDE and many other desktop applications. + +## Architecture + +SWT consists of two main parts: +1. **Java code** - Platform-independent widget implementations and APIs +2. **Native code (C)** - Platform-specific implementations using native windowing systems + +### Platform Support +- **Linux**: GTK3 (stable) and GTK4 (experimental) +- **Windows**: Win32 API +- **macOS**: Cocoa + +### Key Components +- `bundles/org.eclipse.swt` - Main SWT bundle with Java and native code +- `bundles/org.eclipse.swt.svg` - SVG support +- `bundles/org.eclipse.swt.tools` - Build and development tools +- `binaries/` - Platform-specific binary fragments +- `examples/` - Example code and snippets +- `tests/` - JUnit tests + +## Build System + +### Technology Stack +- **Build Tool**: Maven with Tycho plugin +- **Java Version**: Java 17 (compiler target), Java 21 (build/runtime in CI) +- **Supported Architectures**: x86_64, aarch64, loongarch64, ppc64le, riscv64 + +### Build Commands +```bash +# Build the entire project +mvn clean verify + +# Build specific platform binary +mvn clean verify -Dnative=gtk.linux.x86_64 + +# Skip tests +mvn clean verify -DskipTests +``` + +### Building Natives +To rebuild native libraries: +1. Ensure the appropriate binary project is imported in your workspace (e.g., `binaries/org.eclipse.swt.gtk.linux.x86_64`) +2. Native build scripts are platform-specific and located in the binary fragments +3. For GTK on Linux: See `docs/gtk-dev-guide.md` for detailed instructions + +## Coding Standards + +### Java Code +- **Indentation**: Tabs (as per Eclipse project conventions) +- **Line Length**: Keep lines reasonably short, no strict limit +- **Naming**: Follow standard Java conventions (camelCase for methods/variables, PascalCase for classes) +- **Comments**: Use JavaDoc for public APIs; inline comments where needed for clarity +- **Assertions**: Use assertions for runtime checks (enabled in tests, disabled in production) + +### Native Code (C) +- **Platform-specific**: Code goes in platform folders (gtk/, win32/, cocoa/) +- **JNI**: Communication between Java and native code uses JNI +- **OS.java**: Central file for native method declarations +- Do not commit binaries! They will be build and comitted by the CI. + +### Code Organization +- Platform-independent code: `bundles/org.eclipse.swt/Eclipse SWT/common/` +- Platform-specific code: `bundles/org.eclipse.swt/Eclipse SWT/{gtk,win32,cocoa}/` +- Emulated widgets: `bundles/org.eclipse.swt/Eclipse SWT/emulated/` + +## Testing + +### Running Tests +```bash +# Run all tests +mvn clean verify + +# Run specific test class +mvn test -Dtest=ClassName +``` + +### Test Location +- Main tests: `tests/org.eclipse.swt.tests/` +- Tests automatically run with assertions enabled + +### Writing Tests +- Follow existing test patterns in the repository +- Platform-specific tests should be in appropriate fragments +- Use JUnit for all tests + +## Development Workflow + +### Making Changes + +1. **Java-only changes**: Can be tested without rebuilding natives +2. **Native changes**: Require rebuilding the platform-specific binary fragment +3. **Cross-platform changes**: Test on all affected platforms + +### Pull Request Guidelines +- Sign the Eclipse Foundation Contributor License Agreement (CLA) +- Ensure all tests pass +- Follow the contribution guidelines in CONTRIBUTING.md +- Reference related GitHub issues + +### CI/CD +- GitHub Actions runs builds on Linux, Windows, and macOS +- Matrix builds test with Java 21 on all platforms +- All tests must pass before merge + +## Important Files and Patterns + +### Key Files +- `OS.java` - Central native method declarations for platform integration +- `Display.java` - Main event loop and display management +- `Widget.java` - Base class for all widgets +- `Control.java` - Base class for all controls + +### Common Patterns +- **Resource Management**: Always dispose of SWT resources (Display, Shell, Image, etc.) +- **Threading**: UI operations must run on the UI thread (use `Display.asyncExec()` or `Display.syncExec()`) +- **Event Handling**: Use listeners (typed or untyped) for event handling +- **Layout Management**: Use layout managers (GridLayout, FillLayout, etc.) instead of absolute positioning + +## Platform-Specific Considerations + +### GTK (Linux) +- Communication from Java to C happens through `OS.java` +- GTK3 is stable; GTK4 is experimental +- Can be toggled using `SWT_GTK4` environment variable +- See `docs/gtk-dev-guide.md` for comprehensive GTK development guide + +### Windows +- Uses Win32 API +- WebView2 support available (see `Readme.WebView2.md`) +- Platform-specific code in `win32/` directories + +### macOS +- Uses Cocoa framework +- Supports both x86_64 and aarch64 (Apple Silicon) +- Platform-specific code in `cocoa/` directories + +## Resources + +- **Main README**: [`README.md`](../README.md) +- **Contributing Guide**: [`CONTRIBUTING.md`](../CONTRIBUTING.md) +- **GTK Development Guide**: [`docs/gtk-dev-guide.md`](../docs/gtk-dev-guide.md) +- **GitHub Discussions**: Use for questions and general discussions +- **GitHub Issues**: Use for bug reports and feature requests + +## Tips for Copilot + +- When generating SWT code, always include proper resource disposal +- Remember that SWT is not thread-safe - UI operations need Display.syncExec/asyncExec +- Platform-specific code should go in the appropriate platform directory +- When adding native methods, declare them in `OS.java` first +- Follow existing code patterns in the repository for consistency +- Use snippets in `examples/org.eclipse.swt.snippets/` as reference examples +- Consider cross-platform compatibility when making changes diff --git a/.github/instructions/GTK.instructions.md b/.github/instructions/GTK.instructions.md new file mode 100644 index 0000000000..91b7b907fc --- /dev/null +++ b/.github/instructions/GTK.instructions.md @@ -0,0 +1,10 @@ +--- +applyTo: "bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/*.c,bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/*.h" +--- + +- Due to the copilot environment setup in copilot-setup-steps.yml we always use x86_64 architecture +- Always carefully investigate exsiting GTK functions the gtk-dev files are installed in the system +- The GTK docs can be found here https://www.gtk.org/docs/ +- Be carefull between the difference of GTK3 and GTK4 we need to check for specific versions in some places already +- The GTK3 > GTK4 migration guide can be found here https://docs.gtk.org/gtk4/migrating-3to4.html +- You will find a shell script ./build_gtk.sh that must be used to compile the code for testing changes diff --git a/.github/workflows/copilot-setup-steps.yml b/.github/workflows/copilot-setup-steps.yml new file mode 100644 index 0000000000..33113ac302 --- /dev/null +++ b/.github/workflows/copilot-setup-steps.yml @@ -0,0 +1,44 @@ +name: "Copilot Setup Steps" + +# Automatically run the setup steps when they are changed to allow for easy validation, and +# allow manual testing through the repository's "Actions" tab +on: + workflow_dispatch: + pull_request: + paths: + - .github/workflows/copilot-setup-steps.yml + +jobs: + # The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot. + copilot-setup-steps: + runs-on: ubuntu-latest + permissions: + contents: read + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + lfs: false + + - name: Set up JDK + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + cache: 'maven' + + - name: Set up Maven + uses: stCarolas/setup-maven@v5 + with: + maven-version: '3.9.11' + - name: Prepare Linux Build + run: | + sudo apt-get update -qq + sudo apt-get install -qq -y libgtk-3-dev libgtk-4-dev freeglut3-dev webkit2gtk-driver + mkdir -p /home/runner/build/gtk && mkdir -p /home/runner/build/tmp + + echo "cd $GITHUB_WORKSPACE/bundles/org.eclipse.swt && java -Dws=gtk -Darch=x86_64 build-scripts/CollectSources.java -nativeSources '/home/runner/build/gtk'" >> $GITHUB_WORKSPACE/build_gtk.sh + echo "cd /home/runner/build/gtk && SWT_JAVA_HOME=${JAVA_HOME} MODEL=x86_64 OUTPUT_DIR=/home/runner/build/tmp ./build.sh install clean" >> $GITHUB_WORKSPACE/build_gtk.sh + echo "cd $GITHUB_WORKSPACE" >> $GITHUB_WORKSPACE/build_gtk.sh + chmod +x $GITHUB_WORKSPACE/build_gtk.sh + diff --git a/.gitignore b/.gitignore index b8efd10ade..687859ea78 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ pom.tycho /binaries/org.eclipse.swt.*/src/ tmpdir/ +‎build_gtk.sh diff --git a/docs/GTK4_DEPRECATION_STATUS.md b/docs/GTK4_DEPRECATION_STATUS.md new file mode 100644 index 0000000000..564e662785 --- /dev/null +++ b/docs/GTK4_DEPRECATION_STATUS.md @@ -0,0 +1,741 @@ +# GTK4 Deprecation Status Report + +**Generated:** 2025-10-31 11:26:36 UTC +**Build Command:** `./build_gtk.sh` + +## Executive Summary + +- **Total Deprecation Warnings:** 159 +- **Unique Deprecated Functions:** 149 +- **Affected Categories:** 23 + +### Warnings by Category + +| Category | Functions | Warnings | Migration Target | +|----------|-----------|----------|------------------| +| Gtk Tree View | 55 | 55 | GtkColumnView and GtkColumnViewColumn, GtkListView | +| Gtk Tree Store | 9 | 13 | GtkTreeListModel | +| Gtk Combo Box | 11 | 11 | GtkDropDown, GtkDropDown and GtkStringList | +| Gtk List Store | 7 | 11 | GListStore | +| Gtk Tree Model | 10 | 11 | GListModel | +| Gtk Tree Path | 10 | 11 | GListModel | +| Gtk Style Context | 10 | 10 | TBD | +| Gtk Tree Selection | 10 | 10 | TBD | +| Gtk Cell Renderer | 8 | 8 | TBD | +| Gtk Cell Layout | 4 | 4 | TBD | +| Gtk Message Dialog | 2 | 2 | TBD | +| Gtk Widget Get | 2 | 2 | gtk_widget_compute_bounds | +| Gdk Display Put | 1 | 1 | TBD | +| Gdk Surface Create | 1 | 1 | TBD | +| Gtk Cell View | 1 | 1 | TBD | +| ... and 8 more | ... | ... | ... | + +## Detailed Analysis by Category + +### Gtk Tree View + +**Status:** 55 functions deprecated, 55 total warnings + +**GTK4 Migration Target(s):** GtkColumnView and GtkColumnViewColumn, GtkListView + +
+Show 55 deprecated functions + +| Function | Usage Count | Source Location | +|----------|-------------|-----------------| +| `gtk_tree_view_collapse_row` | 1 | `os.c:8280` | +| `gtk_tree_view_column_add_attribute` | 1 | `os.c:8293` | +| `gtk_tree_view_column_cell_get_position` | 1 | `os.c:8310` | +| `gtk_tree_view_column_cell_get_size` | 1 | `gtk4.c:2418` | +| `gtk_tree_view_column_cell_set_cell_data` | 1 | `os.c:8324` | +| `gtk_tree_view_column_clear` | 1 | `os.c:8334` | +| `gtk_tree_view_column_get_button` | 1 | `os.c:8345` | +| `gtk_tree_view_column_get_fixed_width` | 1 | `os.c:8357` | +| `gtk_tree_view_column_get_reorderable` | 1 | `os.c:8369` | +| `gtk_tree_view_column_get_resizable` | 1 | `os.c:8381` | +| `gtk_tree_view_column_get_visible` | 1 | `os.c:8393` | +| `gtk_tree_view_column_get_width` | 1 | `os.c:8405` | +| `gtk_tree_view_column_new` | 1 | `os.c:8417` | +| `gtk_tree_view_column_pack_end` | 1 | `os.c:8428` | +| `gtk_tree_view_column_pack_start` | 1 | `os.c:8438` | +| `gtk_tree_view_column_set_alignment` | 1 | `os.c:8448` | +| `gtk_tree_view_column_set_cell_data_func` | 1 | `os.c:8458` | +| `gtk_tree_view_column_set_clickable` | 1 | `os.c:8468` | +| `gtk_tree_view_column_set_fixed_width` | 1 | `os.c:8478` | +| `gtk_tree_view_column_set_min_width` | 1 | `os.c:8488` | +| `gtk_tree_view_column_set_reorderable` | 1 | `os.c:8498` | +| `gtk_tree_view_column_set_resizable` | 1 | `os.c:8508` | +| `gtk_tree_view_column_set_sizing` | 1 | `os.c:8518` | +| `gtk_tree_view_column_set_sort_indicator` | 1 | `os.c:8528` | +| `gtk_tree_view_column_set_sort_order` | 1 | `os.c:8538` | +| `gtk_tree_view_column_set_visible` | 1 | `os.c:8548` | +| `gtk_tree_view_column_set_widget` | 1 | `os.c:8558` | +| `gtk_tree_view_convert_bin_window_to_tree_coords` | 1 | `os.c:8572` | +| `gtk_tree_view_convert_bin_window_to_widget_coords` | 1 | `os.c:8589` | +| `gtk_tree_view_create_row_drag_icon` | 1 | `os.c:8603` | +| `gtk_tree_view_expand_row` | 1 | `os.c:8615` | +| `gtk_tree_view_get_background_area` | 1 | `os.c:8628` | +| `gtk_tree_view_get_cell_area` | 1 | `os.c:8642` | +| `gtk_tree_view_get_column` | 1 | `os.c:8655` | +| `gtk_tree_view_get_columns` | 1 | `os.c:8667` | +| `gtk_tree_view_get_cursor` | 1 | `os.c:8682` | +| `gtk_tree_view_get_expander_column` | 1 | `os.c:8696` | +| `gtk_tree_view_get_grid_lines` | 1 | `os.c:8708` | +| `gtk_tree_view_get_headers_visible` | 1 | `os.c:8720` | +| `gtk_tree_view_get_path_at_pos` | 1 | `os.c:8740` | +| `gtk_tree_view_get_selection` | 1 | `os.c:8757` | +| `gtk_tree_view_get_visible_rect` | 1 | `os.c:8770` | +| `gtk_tree_view_insert_column` | 1 | `os.c:8783` | +| `gtk_tree_view_move_column_after` | 1 | `os.c:8794` | +| `gtk_tree_view_new_with_model` | 1 | `os.c:8805` | +| `gtk_tree_view_remove_column` | 1 | `os.c:8816` | +| `gtk_tree_view_row_expanded` | 1 | `os.c:8827` | +| `gtk_tree_view_scroll_to_cell` | 1 | `os.c:8838` | +| `gtk_tree_view_scroll_to_point` | 1 | `os.c:8848` | +| `gtk_tree_view_set_cursor` | 1 | `os.c:8858` | +| `gtk_tree_view_set_drag_dest_row` | 1 | `os.c:8868` | +| `gtk_tree_view_set_grid_lines` | 1 | `os.c:8878` | +| `gtk_tree_view_set_headers_visible` | 1 | `os.c:8888` | +| `gtk_tree_view_set_model` | 1 | `os.c:8898` | +| `gtk_tree_view_set_search_column` | 1 | `os.c:8908` | + +
+ +### Gtk Tree Store + +**Status:** 9 functions deprecated, 13 total warnings + +**GTK4 Migration Target(s):** GtkTreeListModel + +
+Show 9 deprecated functions + +| Function | Usage Count | Source Location | +|----------|-------------|-----------------| +| `gtk_tree_store_append` | 1 | `os.c:8136` | +| `gtk_tree_store_clear` | 1 | `os.c:8146` | +| `gtk_tree_store_insert` | 1 | `os.c:8156` | +| `gtk_tree_store_insert_after` | 1 | `os.c:8166` | +| `gtk_tree_store_newv` | 1 | `os.c:8179` | +| `gtk_tree_store_prepend` | 1 | `os.c:8192` | +| `gtk_tree_store_remove` | 1 | `os.c:8202` | +| `gtk_tree_store_set` | 5 | `os.c:8212` | +| `gtk_tree_store_set_value` | 1 | `os.c:8269` | + +
+ +### Gtk Combo Box + +**Status:** 11 functions deprecated, 11 total warnings + +**GTK4 Migration Target(s):** GtkDropDown, GtkDropDown and GtkStringList + +
+Show 11 deprecated functions + +| Function | Usage Count | Source Location | +|----------|-------------|-----------------| +| `gtk_combo_box_get_active` | 1 | `os.c:4165` | +| `gtk_combo_box_get_child` | 1 | `gtk4.c:1017` | +| `gtk_combo_box_get_model` | 1 | `os.c:4177` | +| `gtk_combo_box_popdown` | 1 | `os.c:4188` | +| `gtk_combo_box_popup` | 1 | `os.c:4198` | +| `gtk_combo_box_set_active` | 1 | `os.c:4208` | +| `gtk_combo_box_text_insert` | 1 | `os.c:4222` | +| `gtk_combo_box_text_new` | 1 | `os.c:4236` | +| `gtk_combo_box_text_new_with_entry` | 1 | `os.c:4248` | +| `gtk_combo_box_text_remove` | 1 | `os.c:4259` | +| `gtk_combo_box_text_remove_all` | 1 | `os.c:4269` | + +
+ +### Gtk List Store + +**Status:** 7 functions deprecated, 11 total warnings + +**GTK4 Migration Target(s):** GListStore + +
+Show 7 deprecated functions + +| Function | Usage Count | Source Location | +|----------|-------------|-----------------| +| `gtk_list_store_append` | 1 | `os.c:5430` | +| `gtk_list_store_clear` | 1 | `os.c:5440` | +| `gtk_list_store_insert` | 1 | `os.c:5450` | +| `gtk_list_store_newv` | 1 | `os.c:5463` | +| `gtk_list_store_remove` | 1 | `os.c:5476` | +| `gtk_list_store_set` | 5 | `os.c:5486` | +| `gtk_list_store_set_value` | 1 | `os.c:5543` | + +
+ +### Gtk Tree Model + +**Status:** 10 functions deprecated, 11 total warnings + +**GTK4 Migration Target(s):** GListModel + +
+Show 10 deprecated functions + +| Function | Usage Count | Source Location | +|----------|-------------|-----------------| +| `gtk_tree_model_get` | 2 | `os.c:7752` | +| `gtk_tree_model_get_iter` | 1 | `os.c:7779` | +| `gtk_tree_model_get_iter_first` | 1 | `os.c:7791` | +| `gtk_tree_model_get_n_columns` | 1 | `os.c:7803` | +| `gtk_tree_model_get_path` | 1 | `os.c:7815` | +| `gtk_tree_model_get_value` | 1 | `os.c:7838` | +| `gtk_tree_model_iter_children` | 1 | `os.c:7849` | +| `gtk_tree_model_iter_n_children` | 1 | `os.c:7861` | +| `gtk_tree_model_iter_next` | 1 | `os.c:7873` | +| `gtk_tree_model_iter_nth_child` | 1 | `os.c:7885` | + +
+ +### Gtk Tree Path + +**Status:** 10 functions deprecated, 11 total warnings + +**GTK4 Migration Target(s):** GListModel + +
+Show 10 deprecated functions + +| Function | Usage Count | Source Location | +|----------|-------------|-----------------| +| `gtk_tree_path_append_index` | 1 | `os.c:7896` | +| `gtk_tree_path_compare` | 1 | `os.c:7907` | +| `gtk_tree_path_free` | 1 | `os.c:7918` | +| `gtk_tree_path_get_depth` | 1 | `os.c:7929` | +| `gtk_tree_path_get_indices` | 1 | `os.c:7941` | +| `gtk_tree_path_new` | 1 | `os.c:7953` | +| `gtk_tree_path_new_from_string` | 2 | `os.c:7965` | +| `gtk_tree_path_next` | 1 | `os.c:7992` | +| `gtk_tree_path_prev` | 1 | `os.c:8003` | +| `gtk_tree_path_up` | 1 | `os.c:8015` | + +
+ +### Gtk Style Context + +**Status:** 10 functions deprecated, 10 total warnings + +
+Show 10 deprecated functions + +| Function | Usage Count | Source Location | +|----------|-------------|-----------------| +| `gtk_style_context_add_class` | 1 | `os.c:7078` | +| `gtk_style_context_add_provider` | 1 | `os.c:7090` | +| `gtk_style_context_get_border` | 1 | `gtk4.c:2310` | +| `gtk_style_context_get_color` | 1 | `gtk4.c:2324` | +| `gtk_style_context_get_margin` | 1 | `gtk4.c:2338` | +| `gtk_style_context_get_padding` | 1 | `gtk4.c:2352` | +| `gtk_style_context_remove_class` | 1 | `os.c:7102` | +| `gtk_style_context_restore` | 1 | `os.c:7114` | +| `gtk_style_context_save` | 1 | `os.c:7124` | +| `gtk_style_context_set_state` | 1 | `os.c:7134` | + +
+ +### Gtk Tree Selection + +**Status:** 10 functions deprecated, 10 total warnings + +
+Show 10 deprecated functions + +| Function | Usage Count | Source Location | +|----------|-------------|-----------------| +| `gtk_tree_selection_count_selected_rows` | 1 | `os.c:8027` | +| `gtk_tree_selection_get_selected_rows` | 1 | `os.c:8041` | +| `gtk_tree_selection_path_is_selected` | 1 | `os.c:8055` | +| `gtk_tree_selection_select_all` | 1 | `os.c:8066` | +| `gtk_tree_selection_select_iter` | 1 | `os.c:8076` | +| `gtk_tree_selection_set_mode` | 1 | `os.c:8086` | +| `gtk_tree_selection_set_select_function` | 1 | `os.c:8096` | +| `gtk_tree_selection_unselect_all` | 1 | `os.c:8106` | +| `gtk_tree_selection_unselect_iter` | 1 | `os.c:8116` | +| `gtk_tree_selection_unselect_path` | 1 | `os.c:8126` | + +
+ +### Gtk Cell Renderer + +**Status:** 8 functions deprecated, 8 total warnings + +
+Show 8 deprecated functions + +| Function | Usage Count | Source Location | +|----------|-------------|-----------------| +| `gtk_cell_renderer_get_fixed_size` | 1 | `os.c:3932` | +| `gtk_cell_renderer_get_padding` | 1 | `os.c:3949` | +| `gtk_cell_renderer_get_preferred_height_for_width` | 1 | `os.c:3966` | +| `gtk_cell_renderer_get_preferred_size` | 1 | `os.c:3983` | +| `gtk_cell_renderer_pixbuf_new` | 1 | `os.c:3997` | +| `gtk_cell_renderer_set_fixed_size` | 1 | `os.c:4008` | +| `gtk_cell_renderer_text_new` | 1 | `os.c:4019` | +| `gtk_cell_renderer_toggle_new` | 1 | `os.c:4031` | + +
+ +### Gtk Cell Layout + +**Status:** 4 functions deprecated, 4 total warnings + +
+Show 4 deprecated functions + +| Function | Usage Count | Source Location | +|----------|-------------|-----------------| +| `gtk_cell_layout_clear` | 1 | `os.c:3882` | +| `gtk_cell_layout_get_cells` | 1 | `os.c:3893` | +| `gtk_cell_layout_pack_start` | 1 | `os.c:3904` | +| `gtk_cell_layout_set_attributes` | 1 | `os.c:3916` | + +
+ +### Gtk Message Dialog + +**Status:** 2 functions deprecated, 2 total warnings + +
+Show 2 deprecated functions + +| Function | Usage Count | Source Location | +|----------|-------------|-----------------| +| `gtk_message_dialog_format_secondary_text` | 1 | `os.c:5569` | +| `gtk_message_dialog_new` | 1 | `os.c:5587` | + +
+ +### Gtk Widget Get + +**Status:** 2 functions deprecated, 2 total warnings + +**GTK4 Migration Target(s):** gtk_widget_compute_bounds + +
+Show 2 deprecated functions + +| Function | Usage Count | Source Location | +|----------|-------------|-----------------| +| `gtk_widget_get_allocation` | 1 | `os.c:9014` | +| `gtk_widget_get_style_context` | 1 | `os.c:9309` | + +
+ +### Gdk Display Put + +**Status:** 1 functions deprecated, 1 total warnings + +
+Show 1 deprecated functions + +| Function | Usage Count | Source Location | +|----------|-------------|-----------------| +| `gdk_display_put_event` | 1 | `os.c:758` | + +
+ +### Gdk Surface Create + +**Status:** 1 functions deprecated, 1 total warnings + +
+Show 1 deprecated functions + +| Function | Usage Count | Source Location | +|----------|-------------|-----------------| +| `gdk_surface_create_similar_surface` | 1 | `os.c:2278` | + +
+ +### Gtk Cell View + +**Status:** 1 functions deprecated, 1 total warnings + +
+Show 1 deprecated functions + +| Function | Usage Count | Source Location | +|----------|-------------|-----------------| +| `gtk_cell_view_set_fit_model` | 1 | `os.c:4042` | + +
+ +### Gtk Dialog Add + +**Status:** 1 functions deprecated, 1 total warnings + +
+Show 1 deprecated functions + +| Function | Usage Count | Source Location | +|----------|-------------|-----------------| +| `gtk_dialog_add_button` | 1 | `os.c:4306` | + +
+ +### Gtk Render Background + +**Status:** 1 functions deprecated, 1 total warnings + +
+Show 1 deprecated functions + +| Function | Usage Count | Source Location | +|----------|-------------|-----------------| +| `gtk_render_background` | 1 | `os.c:6697` | + +
+ +### Gtk Render Focus + +**Status:** 1 functions deprecated, 1 total warnings + +
+Show 1 deprecated functions + +| Function | Usage Count | Source Location | +|----------|-------------|-----------------| +| `gtk_render_focus` | 1 | `os.c:6707` | + +
+ +### Gtk Render Frame + +**Status:** 1 functions deprecated, 1 total warnings + +
+Show 1 deprecated functions + +| Function | Usage Count | Source Location | +|----------|-------------|-----------------| +| `gtk_render_frame` | 1 | `os.c:6717` | + +
+ +### Gtk Render Handle + +**Status:** 1 functions deprecated, 1 total warnings + +
+Show 1 deprecated functions + +| Function | Usage Count | Source Location | +|----------|-------------|-----------------| +| `gtk_render_handle` | 1 | `os.c:6727` | + +
+ +### Gtk Css Provider + +**Status:** 1 functions deprecated, 1 total warnings + +**GTK4 Migration Target(s):** gtk_css_provider_load_from_string + +
+Show 1 deprecated functions + +| Function | Usage Count | Source Location | +|----------|-------------|-----------------| +| `gtk_css_provider_load_from_data` | 1 | `gtk4.c:1030` | + +
+ +### Gtk Gesture Set + +**Status:** 1 functions deprecated, 1 total warnings + +
+Show 1 deprecated functions + +| Function | Usage Count | Source Location | +|----------|-------------|-----------------| +| `gtk_gesture_set_sequence_state` | 1 | `gtk4.c:1829` | + +
+ +### Gtk Widget Translate + +**Status:** 1 functions deprecated, 1 total warnings + +**GTK4 Migration Target(s):** gtk_widget_compute_point + +
+Show 1 deprecated functions + +| Function | Usage Count | Source Location | +|----------|-------------|-----------------| +| `gtk_widget_translate_coordinates` | 1 | `gtk4.c:2719` | + +
+ +## GTK4 Migration Guide References + +The following deprecations are documented in the [GTK 3 to GTK 4 Migration Guide](https://docs.gtk.org/gtk4/migrating-3to4.html): + +### GtkTreeView, GtkTreeModel and Cell Renderers + +**Affected:** 55 functions, 55 warnings + +**Migration:** GtkTreeView and related widgets are deprecated. Use GtkListView, GtkColumnView with GListModel. + +**Complexity:** High - Major API redesign + +**Reference:** [GtkTreeView, GtkTreeModel and Cell Renderers](https://docs.gtk.org/gtk4/migrating-3to4.html#stop-using-gtktreeview) + +### GtkComboBox and GtkComboBoxText + +**Affected:** 11 functions, 11 warnings + +**Migration:** Replace with GtkDropDown and GtkStringList. + +**Complexity:** Medium - Different API pattern + +**Reference:** [GtkComboBox and GtkComboBoxText](https://docs.gtk.org/gtk4/migrating-3to4.html#stop-using-gtkcombobox) + +### Cell Renderers + +**Affected:** 13 functions, 13 warnings + +**Migration:** Cell renderers are replaced by list item factories in GTK4. + +**Complexity:** High - Complete redesign + +**Reference:** [Cell Renderers](https://docs.gtk.org/gtk4/migrating-3to4.html#stop-using-gtktreeview) + +### List and Tree Models + +**Affected:** 7 functions, 11 warnings + +**Migration:** Replace with GListModel interface and implementations like GListStore. + +**Complexity:** Medium - API differences + +**Reference:** [List and Tree Models](https://docs.gtk.org/gtk4/migrating-3to4.html#stop-using-gtktreeview) + +### Tree Models + +**Affected:** 9 functions, 13 warnings + +**Migration:** Replace with GtkTreeListModel for hierarchical data. + +**Complexity:** High - Different approach to hierarchy + +**Reference:** [Tree Models](https://docs.gtk.org/gtk4/migrating-3to4.html#stop-using-gtktreeview) + +### Rendering Functions + +**Affected:** 4 functions, 4 warnings + +**Migration:** GtkSnapshot replaces context-based rendering. + +**Complexity:** High - New rendering model + +**Reference:** [Rendering Functions](https://docs.gtk.org/gtk4/migrating-3to4.html#stop-using-gtkstylecontext) + +### Style Context + +**Affected:** 10 functions, 10 warnings + +**Migration:** Many style context functions are deprecated. Use widget-specific APIs. + +**Complexity:** Medium - Use widget methods instead + +**Reference:** [Style Context](https://docs.gtk.org/gtk4/migrating-3to4.html#stop-using-gtkstylecontext) + +## Recommended Migration Plan + +This section outlines a strategic approach to addressing GTK4 deprecations, ordered from simplest to most complex. + +### Phase 1: Simple Replacements (Low Effort) + +These deprecations have direct 1:1 replacements and can be automated or done quickly. + +#### 1.1 Direct Function Replacements +**Complexity:** Low | **Automation Potential:** High + +Functions with simple name changes or parameter updates: + +| Deprecated Function | Replacement | Occurrences | +|---------------------|-------------|-------------| +| `gtk_widget_get_allocation` | `gtk_widget_compute_bounds` | 1 | +| `gtk_css_provider_load_from_data` | `gtk_css_provider_load_from_string` | 1 | +| `gtk_widget_translate_coordinates` | `gtk_widget_compute_point` | 1 | + +**Action Items:** +- [ ] Use search & replace with careful review +- [ ] Test each replacement in snippets +- [ ] Can be partially automated with AI-assisted refactoring + +#### 1.2 Message Dialogs +**Complexity:** Low | **Automation Potential:** Medium + +GtkMessageDialog deprecations can be replaced with GtkAlertDialog. + +**Action Items:** +- [ ] Review 2 message dialog functions +- [ ] Create wrapper functions if needed +- [ ] Update all call sites + +### Phase 2: Style and Rendering (Medium Effort) + +**Complexity:** Medium | **Automation Potential:** Low + +#### 2.1 Style Context Functions +**Affected:** 10 functions + +Many style context methods are deprecated. Migration strategies: +- Use widget-specific methods when available +- For styling, use CSS through GtkCssProvider +- For measurements, use widget geometry methods + +**Action Items:** +- [ ] Audit each style context usage +- [ ] Replace with widget-specific APIs where possible +- [ ] Consider CSS-based alternatives for styling + +#### 2.2 Rendering Functions +**Affected:** ~12 functions + +GTK4 uses GtkSnapshot instead of cairo context rendering. + +**Action Items:** +- [ ] Study GtkSnapshot API +- [ ] Rewrite render functions using snapshot +- [ ] Test rendering in various themes + +### Phase 3: ComboBox Migration (Medium-High Effort) + +**Complexity:** Medium-High | **Automation Potential:** Low + +**Affected:** 11 functions + +GtkComboBox → GtkDropDown migration requires API redesign. + +**Action Items:** +- [ ] Create abstraction layer for combo box functionality +- [ ] Implement using GtkDropDown + GtkStringList +- [ ] Update all combo box usage in SWT +- [ ] Thorough testing of selection, events, data binding + +### Phase 4: TreeView/ListView Migration (High Effort) + +**Complexity:** High | **Automation Potential:** Very Low + +**Affected:** ~114 functions + +This is the largest and most complex migration. + +#### 4.1 Data Model Migration +- GtkListStore → GListStore +- GtkTreeStore → GtkTreeListModel + +#### 4.2 View Migration +- GtkTreeView → GtkListView / GtkColumnView +- Cell renderers → List item factories +- GtkTreeSelection → Selection models (GtkSingleSelection, GtkMultiSelection) + +**Action Items:** +- [ ] Design new list/tree abstraction for SWT +- [ ] Implement GListModel-based data models +- [ ] Create list item factory infrastructure +- [ ] Migrate table widgets +- [ ] Migrate tree widgets +- [ ] Implement selection handling +- [ ] Test all SWT list/tree/table functionality +- [ ] Performance testing with large datasets + +## Automation Recommendations + +### What Can Be Automated (with AI/Copilot) + +1. **Simple Function Replacements** (High Success Rate) + - Direct 1:1 function name changes + - Parameter reordering with same semantics + - Example: `gtk_css_provider_load_from_data` → `gtk_css_provider_load_from_string` + +2. **Pattern-Based Replacements** (Medium Success Rate) + - Converting simple style context usage to widget methods + - Basic message dialog conversions + - Requires: Good test coverage to validate + +3. **Code Generation Assistance** (Medium Success Rate) + - Generating boilerplate for new APIs (list item factories) + - Creating wrapper functions + - Documentation and migration guides + +### What Should Be Manual (Human Required) + +1. **Architectural Changes** (Manual Only) + - TreeView → ListView/ColumnView migration + - Render function → Snapshot conversion + - Selection model redesign + +2. **Complex Logic** (Manual with AI Assistance) + - Custom cell renderer logic → Item factory conversion + - ComboBox with complex models → DropDown migration + - Event handling changes + +3. **Testing and Validation** (Manual Required) + - Visual regression testing + - Performance benchmarking + - Edge case validation + +## Suggested AI-Assisted Workflow + +1. **Phase 1**: Use Copilot for simple replacements + - Generate a list of simple 1:1 replacements + - Review and apply with tests + +2. **Phase 2**: AI-assisted pattern migration + - Provide examples of GTK4 patterns to AI + - Have AI suggest conversions + - Manual review and testing + +3. **Phase 3-4**: Manual with AI research assistance + - Use AI to research GTK4 best practices + - Design architecture manually + - Use AI for boilerplate generation + - Thorough manual testing + +## Priority Recommendations + +**Immediate (Next Sprint):** +- [ ] Phase 1.1: Simple function replacements +- [ ] Set up GTK4 testing environment + +**Short Term (1-2 Months):** +- [ ] Phase 1.2: Message dialogs +- [ ] Phase 2.1: Style context (partial) + +**Medium Term (3-6 Months):** +- [ ] Phase 2.2: Rendering functions +- [ ] Phase 3: ComboBox migration + +**Long Term (6-12 Months):** +- [ ] Phase 4: TreeView/ListView migration (major undertaking) + +## Next Steps + +1. **Review this document** with the team +2. **Prioritize** which phases to tackle first based on GTK4 timeline +3. **Set up GTK4 CI** to track deprecation warnings over time +4. **Create feature branch** for GTK4 migration work +5. **Start with Phase 1** simple replacements to gain momentum + +## Resources + +- [GTK 4 Migration Guide](https://docs.gtk.org/gtk4/migrating-3to4.html) +- [GTK 4 API Reference](https://docs.gtk.org/gtk4/) +- [GListModel Tutorial](https://docs.gtk.org/gio/iface.ListModel.html) +- [GTK 4 List Widgets Guide](https://docs.gtk.org/gtk4/section-list-widget.html) + +--- + +*This document was generated automatically by analyzing build output from `./build_gtk.sh` on 2025-10-31.* \ No newline at end of file