Commit graph

157 commits

Author SHA1 Message Date
Admin
bdf760b58b wasm media 2026-03-09 18:00:25 +01:00
Admin
7a9274ebf8 wasm media 2026-03-09 17:43:54 +01:00
offline-ant
7c7d91b8ad
platform: video/camera subsystem with media plugin architecture (#929)
Video playback: extended API with volume, playback rate, seek ranges,
buffered ranges, can_play_type, audio-only mode. Unified player wrapping
native backend (AVPlayer/GStreamer/MediaFoundation) with software fallback.
YUV shader pipeline (BT.601/709/2020, NV12 biplanar, rotation).

Camera: V4L2 backend (Linux), expanded NDK Camera2 (Android), AVCapture
stream refactor (iOS/macOS) with shared session architecture. NV12
zero-copy paths on iOS (CVMetalTextureCache) and Android (AImage planes).
Camera preview modes (texture/native/auto).

Video encoding: H264 hardware encode on Apple (VideoToolbox) and Android
(MediaCodec). Camera-to-encoder pipeline with pixel buffer passthrough.

Media plugin system: externalized codec implementation via MediaPlugin
trait. MsePlayer, VideoFrameDecoder, MediaVideoEncoder, SoftwareVideoPlayer
interfaces. Runtime codec capability query and merge.

Includes camera example app.

Co-authored-by: ant <ant@offline.click>
2026-03-08 13:10:58 +01:00
offline-ant
814fe4d9cd
platform: native mobile selection handles (#930)
* platform: popup window API with X11/Wayland support

- Add popup window type for context menus and dropdowns
- Wayland: xdg_popup with grab for compositor-driven dismiss
- X11: override-redirect windows with pointer grab
- Explicit-close semantics: app must handle PopupDismissed
- Fix Wayland crash on repeated context menu open/close
- Emit WindowClosed before PopupDismissed in PopupDone

* platform: native mobile selection handles

iOS: custom UIView selection handles with UIPanGestureRecognizer (all versions),
UITextSelectionDisplayInteraction for native highlights (iOS 16+),
MakepadSelectionRect for UITextInput protocol.

Android: custom SelectionHandleView with GradientDrawable oval, touch drag
listeners, JNI bridge for handle drag events.

Widgets: TextFlow clipboard action integration (show on touch up with selection,
hide on touch down/focus lost, TextCut handler), PortalList select-all and
clipboard actions, selection bounding rect computation for popup positioning.

Includes text_selection example app.

---------

Co-authored-by: ant <ant@offline.click>
2026-03-08 12:15:31 +01:00
offline-ant
04dea089bd
platform: small fixes and quality improvements (#928)
- Android log levels: map log! macro levels to Android log priorities
  (ERROR=6, WARN=5, INFO=4). Some devices suppress DEBUG by default.
- cargo-makepad android: show help text instead of panicking on missing
  or invalid subcommand.
- Android build: discover .class files dynamically instead of hardcoding
  ~25 individual paths. Add Java 8 source/target flags.
- Remove deprecated AsyncTask import from MakepadNetwork.java.
- Studio stdout: add newline after JSON messages for JSON-lines parsing.
- Studio stdout: skip profiler timing in stdout mode to avoid overhead.
- Script thread: fix panic on empty call stack in call_has_me/call_has_try.
- Cursor: reset to Default on FingerHoverOut in TextFlow and TextInput.

Co-authored-by: ant <ant@offline.click>
2026-03-08 11:24:18 +01:00
Admin
24a9b0627d remove apprs 2026-03-08 10:28:40 +01:00
Sabin Regmi
713628a89f
Load script resources per-handle (avoid global loads) (#923)
Replace broad cx.load_all_script_resources() calls with a targeted cx.load_script_resource(handle) to only request the specific resource needed. Refactor script resource loading (platform/src/script/res.rs) by extracting load_script_resource_impl(handle, crate_manifests) and exposing load_script_resource(handle); keep load_all_script_resources() by iterating per-handle. Improve wasm handling: resolve web_url per-resource, set explicit error states when missing, and fire async HTTP requests safely. Remove an early call to load_all_script_resources() from web startup. Additional changes: serve precompressed .br files in the local wasm dev server (with COOP/COEP headers when threaded), add wasm-specific font/theme script entries for widgets, and update various callers (draw shaders, widgets, math_view, gltf/view_splat, image) to use the per-handle loader. These changes reduce unnecessary global loads and limit network/file operations to only required resources.
2026-03-06 16:01:07 +01:00
offline-ant
d19f99d1ef
selection: clipboard delegate, primary selection, mobile handles (#912)
* selection: clipboard delegate, primary selection, mobile UI, handles, accessibility

Level 0: Route clipboard through Makepad instead of arboard. Custom
ClipboardDelegate in havishell forwards set_text/get_text/clear through
Makepad's CopyToClipboard and pending paste state. Fix Wayland serial
constraint by queuing CopyToClipboard when no serial is available.

Level 1: Primary selection (Linux). Add CxOsOp::SetPrimarySelection,
Wayland zwp_primary_selection_device_manager_v1 protocol bindings, X11
PRIMARY atom handling. HAVI stores selection text in SharedDocumentSelection
and calls set_primary_selection on change.

Level 2: Mobile clipboard actions UI. Long-press selects word and shows
native clipboard toolbar. TextCopy/TextCut events return selection text.

Level 3: Selection handle API. Add CxOsOp Show/Update/HideSelectionHandles,
Event::SelectionHandleDrag, and HAVI integration for handle drag events.
Platform stubs for all backends.

Level 4: Accessibility plumbing. Add CxOsOp::AccessibilityUpdate with
type-erased Box<dyn Any + Send> payload. HAVI implements
notify_accessibility_tree_update to forward accesskit::TreeUpdate through
Makepad. Platform no-op stubs.

* wayland: handle primary selection data_offer child objects

---------

Co-authored-by: ant <ant@offline.click>
2026-03-06 12:17:25 +01:00
Admin
1924bc2f6b cleanup 2026-03-05 23:45:21 +01:00
Admin
c9bd068a70 parity! 2026-03-05 23:45:21 +01:00
Admin
4207f0d4e9 nearly there 2026-03-05 23:45:21 +01:00
Admin
3b0f5a5c40 almost 2026-03-05 23:45:21 +01:00
Admin
394ee17864 shadows 2026-03-05 23:45:21 +01:00
Admin
8c3f839ee3 base correct 2026-03-05 23:45:21 +01:00
Admin
8ee09a8466 improving.. 2026-03-05 23:45:21 +01:00
Admin
00ce91ab5e right direction 2026-03-05 23:45:21 +01:00
Admin
7f313a6261 mb3d experiment 2026-03-05 23:45:21 +01:00
Sabin Regmi
8e3ae8ea1c
Add --no-threads option and runtime thread checks (#918)
Introduce a single-threaded wasm build mode and add defensive runtime handling for missing wasm threading support.

- CLI: add --no-threads flag and WasmConfig.threads to control threaded vs single-threaded builds. Parse and strip wasm-specific options before forwarding build/run args.
- Build: select target features and RUSTFLAGS based on threading; omit atomics/bulk-memory features for single-threaded builds. Adjust generated server instructions to require COOP/COEP only for threaded builds.
- Dev server: conditionally include COOP/COEP headers when serving threaded wasm artifacts.
- JS runtime (platform/src/os/web/web.js): guard audio worklet startup and thread creation on wasm._has_thread_support; make alloc_thread_stack return null with clear console warnings when required exports or alignment are missing; pass allocated thread_info to workers.

These changes enable building and running a single-threaded wasm variant without COOP/COEP server requirements and improve runtime resilience when threading features are unavailable.
2026-03-05 20:53:20 +01:00
Admin
4a87f4ca31 fix scrolling 2026-03-04 09:16:48 +01:00
Admin
c0125ba11d widget tree fixup 2026-03-03 20:19:06 +01:00
Admin
cb92b61b66 terminal otw 2026-03-03 17:47:24 +01:00
Admin
81483d4555 y flip webgl rendertartet 2026-03-03 09:42:54 +01:00
Admin
0f3864a44a rename network 2026-03-03 09:18:19 +01:00
Admin
5d6472c2a0 add studio proto 2026-03-02 12:30:33 +01:00
Admin
b437899d82 remote control 2026-03-02 12:07:59 +01:00
Admin
462fd3dcec remote working 2026-03-02 10:40:33 +01:00
Admin
2b06c8846a filter proto 2026-03-02 09:32:23 +01:00
Admin
1ef52d6553 wasm 2026-03-01 20:22:11 +01:00
Admin
01a4985e86 backend proto splitoff 2026-03-01 10:12:00 +01:00
offline-ant
0ce6ec05e8
Apple metal and compile updates (#903)
Merge actool partial Info.plist into main plist for iOS 15 icon support.

Co-authored-by: ant <ant@offline.click>
2026-02-28 11:36:48 +01:00
offline-ant
f0907d6782
Fix missing app icons on iOS 15 by adding classic idiom entries to asset catalog (#902)
The Contents.json only had a single universal+platform entry, which is
only recognized by iOS 16+. Add classic per-idiom entries (iphone, ipad,
ios-marketing) so actool compiles both sets into Assets.car. iOS 15
falls back to the idiom-based entries.

Co-authored-by: ant <ant@offline.click>
2026-02-28 11:16:59 +01:00
offline-ant
e1d3653de2
iOS: app icons, fullscreen, iOS 15 support, GL texture fix, NSLog logging (#897)
Co-authored-by: ant <ant@offline.click>
2026-02-27 16:42:47 +01:00
offline-ant
fdc918a890
iOS: GL render bridge (EAGL+IOSurface) and ios build command (#894)
* iOS: add GL render bridge (EAGL+IOSurface), fix linking, fix warnings

- Add EaglRenderBridge for iOS (GLES 3.0 context sharing textures with
  Metal via IOSurface), mirroring macOS CglRenderBridge
- Add iOS GlRenderBridge inner field and Cx methods
  (create_gl_render_bridge, create_gl_render_bridge_texture, restore_gl_context)
- Widen IOSurface support from macos-only to macos/ios/tvos in apple_sys
  and metal.rs (CxOsTexture fields, update_shared_texture, etc.)
- Expose metal_device() accessor on IosApp
- Replace removed SSLSetEnableCertVerify with SSLSetSessionOption
  (kSSLSessionOptionBreakOnServerAuth) to fix iOS linker error
- Remove unused apple_util::* imports in ios.rs and ios_app.rs
- Fix iOS deployment target from 26.0 to 17.0 in cargo_makepad

* cargo-makepad: add apple ios build command, expose IosBuildResult fields

---------

Co-authored-by: ant <ant@offline.click>
2026-02-27 08:40:41 +01:00
offline-ant
f71bdf48f7
android: add launch splash themes to cargo-makepad manifests (#895)
Co-authored-by: ant <ant@offline.click>
2026-02-27 08:40:26 +01:00
offline-ant
4f34bce7ee
cargo-makepad: isolate android/apple target dirs from desktop builds (#896)
Android defaults to target/android/, apple to target/apple/.
Prevents cross-platform builds from invalidating each other's caches.

Co-authored-by: ant <ant@offline.click>
2026-02-27 08:40:14 +01:00
offline-ant
b3cec2dd2d
cargo-makepad android: use crate name for Rust .so lookup (#893)
Co-authored-by: ant <ant@offline.click>
2026-02-26 20:00:04 +01:00
offline-ant
31f2a41038
cargo-makepad: cross-platform icon build pipeline and desktop packaging (#890)
Refactor app icon handling into a unified app_icon module that replaces
the old window_icon.rs. Build-time icon generation produces platform-
native formats (ICO with multiple sizes for Windows, ICNS for macOS,
multi-resolution PNGs for Linux/Wayland/X11).

Add `cargo makepad desktop` subcommand for desktop packaging with
automatic icon detection from MAKEPAD_APP_ICON_PATH env var, or from
Cargo package metadata.

Resolve binary names from [[bin]] targets in Cargo.toml so .app bundles,
.exe outputs, and APK labels use the correct name instead of defaulting
to the package name.

Use llvm-rc for Windows .res generation (cross-compilation compatible)
with absolute link paths for reliable resource embedding.

Co-authored-by: ant <ant@offline.click>
2026-02-26 11:33:26 +01:00
Admin
8b42b20198 restore merge script 2026-02-26 10:09:28 +01:00
Admin
9cf7fbb8b7 new merge script 2026-02-26 10:08:25 +01:00
offline-ant
2631876982
Add cross-platform window icon support (#877)
Add WindowIcon and WindowIconBuffer types to platform/src/window.rs with
RGBA8 pixel buffer data. Embed a default 64x64 Makepad icon generated at
runtime (dark rounded rect with white M glyph).

Platform backends:

- Windows: CreateIcon from RGBA->BGRA data, set on WNDCLASSEXW.hIcon
- X11: XChangeProperty with _NET_WM_ICON atom (RGBA->ARGB u32 array)
- macOS: NSBitmapImageRep + NSImage, setApplicationIconImage on NSApp
- Wayland: vendor xdg-toplevel-icon-v1 protocol, regenerate bindings,
  bind wl_shm + xdg_toplevel_icon_manager_v1 globals, create shm buffer
  icon when compositor supports it, silent fallback to app_id otherwise.
  Use configurable create_app_id field (default "Makepad").

Codegen: extend tools/wayland_codegen to generate xdg toplevel_icon
bindings into libs/linux/wayland-protocols/src/xdg.rs.

Co-authored-by: ant <ant@offline.click>
2026-02-24 17:30:43 +01:00
Admin
81c3dc5dd9 fix android sdk install issues 2026-02-24 17:06:21 +01:00
Admin
f37bb78aaf fix linux 2026-02-24 16:49:11 +01:00
Admin
35f01b85a0 ssl sockets 2026-02-24 16:28:21 +01:00
Admin
7816d8da43 network refactor 2026-02-24 14:04:37 +01:00
Admin
ca17ee8baa splice out a makepad-network crate 2026-02-23 23:21:31 +01:00
Admin
1b38aad46f tunnel 2026-02-23 16:55:20 +01:00
Admin
00c64eb965 message refactor
;
2026-02-23 16:46:48 +01:00
Julián Montes de Oca
6bc8fde866
Video Widget: Support on MacOS & iOS (#863)
* Add macOS video playback support using AVPlayer + CVMetalTextureCache

Extends the Video widget from Android-only to also support macOS with
hardware-accelerated, zero-copy video rendering through Metal. Uses
AVPlayer for decoding and CVMetalTextureCache to map decoded frames
directly to MTLTextures without CPU copies.

Key changes:
- New AppleVideoPlayer module (AVPlayer + CVPixelBuffer → MTLTexture pipeline)
- FFI bindings for CVMetalTextureCache, CMTime, and related Apple APIs
- Video frame polling integrated into macOS paint cycle
- TextureFormat::VideoRGB ungated from Android-only to all platforms
- Video widget made cross-platform (TextureHandleReady wait is Android-only)
- Fixed shader aspect ratio bug (&&→|| for non-positive dimension check)
- Added video demo to uizoo and scratchpad examples

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

* Add iOS video playback support

* Enhance video playback functionality with seek support and current position tracking

Key changes:
- Added `seek_video_playback` operation to allow seeking to specific timestamps.
- Introduced `current_position_ms` field in `VideoTextureUpdatedEvent` for tracking playback position.
- Implemented seeking functionality across iOS, macOS, and Android platforms.
- Updated Video widget to support new controls and indicators for seeking.

* Improve error handling for unsupported texture pixel formats

* Make volume icon drawing  use fixed width

* Make play/pause drawing use fixed width

* Remove video from scratchpad

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 15:19:21 +01:00
offline-ant
209c660226
Fix some build issues + upgrade android to r28 ndk. (#862)
* fix: add **/* glob to Linux NDK unzip to match subdirectories

`*` alone doesn't match `/` on Linux unzip builds with WILD_STOP_AT_DIR,
causing only top-level files to be extracted. Adding `**/*` ensures bin/,
lib64/, sysroot/ subdirectories are included.

* Auto-bundle NDK shared library deps (e.g. libc++_shared.so) into APK

When libmakepad.so has NEEDED entries for shared libraries provided by
the NDK sysroot (like libc++_shared.so from C++ dependencies), those
libraries were not being included in the APK, causing runtime dlopen
failures on device.

Add bundle_ndk_shared_deps() which uses the NDK's llvm-readelf to scan
libmakepad.so for NEEDED entries, then copies any matching .so files
from the NDK sysroot base lib dir into the APK. System libraries
(present in the API-level subdirectory) are excluded since they are
provided by the Android OS at runtime.

The detection is general-purpose and not hardcoded to any specific
library name.

* fix: make SYS_GETTID arch-conditional (186 on x86_64, 178 on aarch64)

The constant was hardcoded to 178 (correct for aarch64 but maps to
query_module on x86_64), causing Android's seccomp filter to kill the
process immediately on x86_64 emulators.

* Upgrade Android NDK from r25 to r28, fix x86_64 seccomp crash

cargo_makepad:
- sdk.rs: NDK version 25.2.9519653 → 28.2.13676358, download URLs r25c → r28b
- sdk.rs: Update NDK_IN extract paths for all platforms (Windows, macOS, Linux)
- sdk.rs: macOS NDK extraction is now host-aware (darwin-aarch64 for Apple Silicon)
- compile.rs: MacosAarch64 uses native darwin-aarch64 prebuilt (no more Rosetta)
- compile.rs: ndk_prebuilt_dir() split for MacosX64 vs MacosAarch64

platform:
- libc_sys.rs: Make SYS_GETTID arch-conditional (186 on x86_64, 178 on aarch64)
  Was hardcoded to 178 which maps to query_module on x86_64, causing
  Android seccomp to kill the process on x86_64 emulators
- android.rs: Add pub display field on CxOs, pub make_current() on CxAndroidDisplay
  for Servo embedding support

* Fix GLSL struct constructor crash on Android GLES drivers

The r28 script-based shader backend (shader_glsl.rs) generates GLSL
struct constructor syntax in the vertex/fragment main() unpack code,
e.g.: vb_geom = QuadVertex(vec2(packed_geometry_0.x, ...));

Some GLES drivers (notably Android emulator ANGLE/SwiftShader) reject
this with 'Structure constructor arguments do not match structure
fields', even though it's valid per the GLES 3.0 spec.

This is a regression from r28. The old r25 shader compiler
(generate_glsl.rs) used VarUnpacker::unpack_var which generated direct
swizzle assignments (vb_geom.xy = packed_geometry_0.xy), never struct
constructors in the unpack path. The r25 branch is not affected.

Fix: generate per-sub-field assignments for struct-typed variables in
the main() geometry/instance/varying unpack code, matching the r25
behavior. Struct constructors in user shader function bodies are
unaffected.

* fix(android): Proper fullscreen support on API 30+ and FullscreenWindow/NormalizeWindow ops

Android platform changes:
- Add CxOsOp::FullscreenWindow handler: sets os.fullscreen flag and calls JNI setFullScreen
- Add CxOsOp::NormalizeWindow handler: clears os.fullscreen and exits fullscreen

MakepadActivity.java:
- onCreate: On API 30+, switch from legacy Theme.NoTitleBar.Fullscreen to
  Theme_DeviceDefault_NoActionBar to avoid FLAG_FULLSCREEN conflict
- onCreate: Call setDecorFitsSystemWindows(false) and set
  LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS before setContentView so SurfaceView
  is laid out at y=0 from the start
- Refactor setFullScreen into applyFullScreen with proper WindowInsetsController
  API on API 30+ (hide/show statusBars + navigationBars)
- Legacy path (pre-API 30) uses full immersive sticky flags
- ResizingLayout.onApplyWindowInsets: Return WindowInsets.CONSUMED to prevent
  system bar insets from offsetting child SurfaceView

* Fix Android touch radius DPI scaling and revert aggressive fullscreen inset handling

- Divide touch.radius by dpi_factor alongside touch.abs for correct touch sizing
- Return insets instead of consuming them in ResizingLayout so child views get proper insets
- Remove premature setDecorFitsSystemWindows/cutout mode override; let apps opt in via FullscreenWindow

* Make DrawImage image_scale/image_pan fields pub

Needed by external crates (e.g. servo makepad_shell) that create custom
widgets using DrawImage and need to flip the Y axis for GL render textures.

---------

Co-authored-by: ant <ant@offline.click>
2026-02-21 10:30:56 +01:00
Admin
74059d928c drawcall fixing 2026-02-21 06:50:39 +01:00