fix(linux): remove Screen typedef collision with X11 Xlib.h (#4979)

* fix(linux): remove unused C Screen typedef that collides with X11 Xlib.h

The GTK4 backend includes <gdk/x11/gdkx.h> for X11 window positioning,
which pulls in <X11/Xlib.h>. Xlib defines its own `Screen` typedef,
conflicting with the identically-named struct in linux_cgo_gtk4.h.

The C Screen struct was unused - the Go code constructs Go Screen structs
directly from GDK monitor data, never referencing C.Screen.

Fixes #4957

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* ci: run GTK4 build and tests on all v3-alpha PRs

The GTK4 CI steps were gated on github.head_ref == 'feature/webkit-gtk6-support',
meaning no other branch ever ran GTK4 compilation checks. This allowed the
Screen typedef collision to slip through undetected.

Now that GTK4 support has been merged, run GTK4 dependency installation,
example builds, and test suite on every PR targeting v3-alpha.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: add GTK4 Screen typedef fix to unreleased changelog

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix changelog

* fix changelog

* fix(ci): pass BUILD_TAGS through to go build in test:example:linux

The GTK4 CI step ran BUILD_TAGS=gtk4 task test:examples but the
Taskfile task ignored the env var, always building with no -tags flag.
Use shell parameter expansion so BUILD_TAGS flows through to go build.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Lea Anthony 2026-02-09 21:44:03 +11:00 committed by GitHub
commit 8eaed8c5f6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 15 additions and 37 deletions

View file

@ -118,8 +118,8 @@ jobs:
packages: libgtk-3-dev libwebkit2gtk-4.1-dev libwayland-dev build-essential pkg-config xvfb x11-xserver-utils at-spi2-core xdg-desktop-portal-gtk
version: 1.0
- name: Install linux dependencies (GTK4) - webkit-gtk6-support branch only
if: matrix.os == 'ubuntu-latest' && github.head_ref == 'feature/webkit-gtk6-support'
- name: Install linux dependencies (GTK4)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-4-dev libwebkitgtk-6.0-dev
@ -150,8 +150,8 @@ jobs:
task test:examples
echo "Example compilation tests (GTK3) completed successfully"
- name: Build Examples (GTK4 experimental)
if: matrix.os == 'ubuntu-latest' && github.head_ref == 'feature/webkit-gtk6-support'
- name: Build Examples (GTK4)
if: matrix.os == 'ubuntu-latest'
working-directory: v3
run: |
echo "Starting example compilation tests (GTK4)..."
@ -180,11 +180,10 @@ jobs:
go test -v ./...
'
- name: Run tests (ubuntu) - GTK4 experimental
if: matrix.os == 'ubuntu-latest' && github.head_ref == 'feature/webkit-gtk6-support'
- name: Run tests (ubuntu) - GTK4
if: matrix.os == 'ubuntu-latest'
working-directory: v3
# Skip all service tests that hang in CI due to GTK4 display requirements
# The services tests require a fully functional GTK4 display which xvfb cannot provide
# Skip service tests that hang in CI due to GTK4 display requirements
run: >
xvfb-run --auto-servernum
sh -c '
@ -243,8 +242,8 @@ jobs:
packages: libgtk-3-dev libwebkit2gtk-4.1-dev libwayland-dev build-essential pkg-config
version: 1.0
- name: Install linux dependencies (GTK4) - webkit-gtk6-support branch only
if: matrix.os == 'ubuntu-latest' && github.head_ref == 'feature/webkit-gtk6-support'
- name: Install linux dependencies (GTK4)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-4-dev libwebkitgtk-6.0-dev
@ -292,8 +291,7 @@ jobs:
cd ..
wails3 build
# Note: GTK4 template builds are not tested here as wails build doesn't
# support -tags flag yet. GTK4 compilation is verified by Go tests.
# GTK4 template builds are covered by the Go example compilation tests above.
build_results:
if: ${{ always() }}

View file

@ -92,14 +92,14 @@ tasks:
GOARCH: amd64
test:example:linux:
summary: Build example for Linux with GTK3 (default)
summary: Build example for Linux (pass BUILD_TAGS env var to add -tags, e.g. BUILD_TAGS=gtk4)
dir: 'examples/{{.DIR}}'
platforms:
- linux
cmds:
- echo "Building example {{.DIR}} for Linux (GTK3)"
- echo "Building example {{.DIR}} for Linux (${BUILD_TAGS:-GTK3})"
- go mod tidy
- go build -o "testbuild-{{.DIR}}-linux"
- go build ${BUILD_TAGS:+-tags $BUILD_TAGS} -o "testbuild-{{.DIR}}-linux"
test:example:linux:gtk4:
summary: Build example for Linux with GTK4 (experimental, opt-in via -tags gtk4)
@ -365,12 +365,7 @@ tasks:
vars:
DIR: "{{.ITEM}}"
platforms: [linux]
# GTK4 tests are run separately via Docker tasks since CI doesn't have GTK4 deps
# - for: { var: EXAMPLEDIRS }
# task: test:example:linux:gtk4
# vars:
# DIR: "{{.ITEM}}"
# platforms: [linux]
# GTK4 example builds are handled in CI via: BUILD_TAGS=gtk4 task test:examples
- for: { var: EXAMPLEDIRS }
task: test:example:windows
vars:

View file

@ -25,6 +25,7 @@ After processing, the content will be moved to the main changelog and this file
## Fixed
<!-- Bug fixes -->
- Fix GTK4 build failure caused by C `Screen` typedef colliding with X11 Xlib.h (#4957)
- Fix dock badge methods consistency on macOS
## Deprecated

View file

@ -29,22 +29,6 @@ typedef struct WindowEvent {
uint event;
} WindowEvent;
typedef struct Screen {
const char* id;
const char* name;
int p_width;
int p_height;
int x;
int y;
int w_width;
int w_height;
int w_x;
int w_y;
float scaleFactor;
double rotation;
bool isPrimary;
} Screen;
typedef struct MenuItemData {
guint id;
GSimpleAction *action;