Compare commits

..

No commits in common. "29bc1ac19c8471fa9f7bc62cf3cc2ddf4d56aa4b" and "bec66816df0ee8743511dfafb9e95d086090af7e" have entirely different histories.

2 changed files with 13 additions and 57 deletions

View File

@ -5,7 +5,6 @@ import (
"log"
"path/filepath"
"time"
"strings"
"git.leaktechnologies.dev/stu/VT_Player/player/mpvembed"
@ -177,12 +176,7 @@ func buildControls(win *gtk.Window, left, right *pane) *gtk.Box {
defer t.Stop()
for range t.C {
text := metaSummary(left, right)
_ = glib.IdleAdd(func() {
defer func() {
_ = recover()
}()
info.SetText(text)
})
glib.IdleAdd(func() { info.SetText(text) })
}
}()
@ -242,7 +236,6 @@ func getWindowID(w *gdk.Window) uint64 {
if w == nil {
return 0
}
// gdk_x11_window_get_xid only works on X11; return 0 on other backends.
return uint64(gdkWindowGetXID(w))
}
@ -273,43 +266,16 @@ func preferDark() {
}
func setupDragDest(p *pane, win *gtk.Window) {
// Accept URI drops using a target list
target, err := gtk.TargetEntryNew("text/uri-list", gtk.TARGET_OTHER_APP, 0)
if err != nil {
return
}
// DragDestSet requires at least one target; use the URI target.
p.area.DragDestSet(gtk.DEST_DEFAULT_ALL, []gtk.TargetEntry{*target}, gdk.ACTION_COPY)
// Accept URI drops
p.area.DragDestSet(gtk.DEST_DEFAULT_ALL, []gtk.TargetEntry{gtk.TargetEntry{}} /* dummy */, gdk.ACTION_COPY)
p.area.Connect("drag-data-received", func(_ *gtk.DrawingArea, ctx *gdk.DragContext, x, y int, data *gtk.SelectionData, info uint, t uint32) {
defer func() {
if r := recover(); r != nil {
log.Printf("drag handler panic: %v", r)
}
}()
if data == nil {
uris := data.GetURIs()
if len(uris) == 0 {
return
}
raw := data.GetData()
if len(raw) == 0 {
// try text fallback
if txt := data.GetText(); txt != "" {
raw = []byte(txt)
}
}
if len(raw) == 0 {
return
}
// text/uri-list: newline or CRLF separated
lines := strings.Split(string(raw), "\n")
for _, ln := range lines {
ln = strings.TrimSpace(ln)
if ln == "" {
continue
}
if path := uriToPath(ln); path != "" {
loadIntoPane(p, path)
break
}
// Take first URI
if path := uriToPath(uris[0]); path != "" {
loadIntoPane(p, path)
}
})
}

View File

@ -4,27 +4,13 @@
PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
BUILD_OUTPUT="$PROJECT_ROOT/vt_player"
GTK_ENTRY="$PROJECT_ROOT/cmd/gtkplayer"
echo "════════════════════════════════════════════════════════════════"
echo " VT Player - Run Script"
echo "════════════════════════════════════════════════════════════════"
echo ""
# If a GTK entry exists, run it directly (uses mpv embedded)
if [ -d "$GTK_ENTRY" ]; then
echo "🚀 Starting VT Player (GTK/mpv)..."
echo "════════════════════════════════════════════════════════════════"
echo ""
export GDK_BACKEND=x11
export GOCACHE="$PROJECT_ROOT/.cache/go-build"
export GOMODCACHE="$PROJECT_ROOT/.cache/go-mod"
GOCACHE="$GOCACHE" GOMODCACHE="$GOMODCACHE" \
go run "$GTK_ENTRY"
exit $?
fi
# Fallback to legacy binary
# Check if binary exists
if [ ! -f "$BUILD_OUTPUT" ]; then
echo "⚠️ Binary not found. Building..."
echo ""
@ -32,6 +18,7 @@ if [ ! -f "$BUILD_OUTPUT" ]; then
echo ""
fi
# Verify binary exists
if [ ! -f "$BUILD_OUTPUT" ]; then
echo "❌ ERROR: Build failed, cannot run."
exit 1
@ -41,9 +28,12 @@ echo "🚀 Starting VT Player..."
echo "════════════════════════════════════════════════════════════════"
echo ""
# Optional software rendering fallback:
# Default to software (avoid GLX errors); set VTPLAYER_HW=1 to force hardware.
if [ "$VTPLAYER_HW" != "1" ]; then
export FYNE_SW_CANVAS=1
export LIBGL_ALWAYS_SOFTWARE=1
fi
# Run the application
"$BUILD_OUTPUT" "$@"