fix(build): ensure gtk4-layer-shell loads before libwayland-client
Tests / Go and GTK tests (push) Failing after 1m44s
Tests / Go and GTK tests (push) Failing after 1m44s
- Update CGO_LDFLAGS in build scripts to include gtk4-layer-shell with the correct load order. - Add a new layershell_link.go file to maintain the dependency on gtk4-layer-shell. - Modify overlay_gtk.go to clarify the importance of load order for Layer Shell functionality. - Enhance run.sh to preload gtk4-layer-shell for proper overlay positioning.
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
//go:build gtk
|
||||
|
||||
package main
|
||||
|
||||
/*
|
||||
#cgo pkg-config: gtk4-layer-shell-0
|
||||
#cgo LDFLAGS: -Wl,--no-as-needed -lgtk4-layer-shell
|
||||
|
||||
// gtk4-layer-shell shims libwayland-client. It must appear before
|
||||
// libwayland-client in the dynamic loader order or gtk_layer_is_supported()
|
||||
// returns false and the overlay becomes an unpositioned normal window.
|
||||
// Referencing the symbol from the main package keeps the dependency alive
|
||||
// even when the external linker would otherwise drop or reorder it.
|
||||
#include <gtk4-layer-shell.h>
|
||||
|
||||
static void captioneer_keep_layershell_linked(void) __attribute__((used));
|
||||
static void captioneer_keep_layershell_linked(void) {
|
||||
(void)gtk_layer_get_major_version;
|
||||
}
|
||||
*/
|
||||
import "C"
|
||||
@@ -4,8 +4,9 @@
|
||||
package overlay
|
||||
|
||||
/*
|
||||
#cgo pkg-config: gtk4 gtk4-x11 gtk4-wayland gtk4-layer-shell-0
|
||||
#cgo LDFLAGS: -lX11
|
||||
#cgo pkg-config: gtk4-layer-shell-0
|
||||
#cgo pkg-config: gtk4 gtk4-x11 gtk4-wayland
|
||||
#cgo LDFLAGS: -Wl,--no-as-needed -lgtk4-layer-shell -lX11
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gtk4-layer-shell.h>
|
||||
@@ -356,7 +357,7 @@ static CaptioneerOverlay *captioneer_overlay_new(
|
||||
}
|
||||
} else if (wayland) {
|
||||
captioneer_append_warning(warnings,
|
||||
"The Wayland compositor does not support Layer Shell; using a normal window without guaranteed always-on-top, placement, taskbar, or fullscreen behavior.");
|
||||
"Layer Shell is unavailable in this process (often a libwayland load-order problem); using a normal window without guaranteed always-on-top or placement. Try rebuilding so libgtk4-layer-shell loads before libwayland-client, or set overlay backend to x11.");
|
||||
}
|
||||
|
||||
GdkMonitor *size_monitor = overlay->monitor;
|
||||
|
||||
Reference in New Issue
Block a user