Commit graph

530 commits

Author SHA1 Message Date
offline-ant
b62592c6ad gl_render_bridge: fix Android EGL wiring and reset GL state on restore (#889)
Fix EGL context initialization on Android to properly wire up the GL
render bridge display/context/surface.

Add GL state reset in restore_gl_context on Linux/Android to prevent
state leakage from external GL consumers (e.g. Servo) back into the
Makepad render pipeline.

Co-authored-by: ant <ant@offline.click>
2026-02-26 11:35:54 +01:00
offline-ant
5edb28bd5e 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
offline-ant
4116b17a9c FOOTGUN FIX: panic on nil return from script_mod! in from_script_mod (#891)
When script_mod! is used with 'let app = startup() do ...' but the
block omits the final 'app' expression, the module returns nil. This
silently creates an App with an empty WidgetRef -- no window, no UI,
no error. The app runs indefinitely doing nothing.

Panic with an actionable message instead of silently succeeding.

Co-authored-by: ant <ant@offline.click>
2026-02-26 11:32:47 +01:00
Admin
956471c1a6 counter splash example 2026-02-26 10:08:25 +01:00
admin
ddebd64601 api 2026-02-25 17:14:39 +01:00
offline-ant
825b824ef4 restore set_window_icon lost during rebase of #877 (#880)
The rebase squash into 6df7c870 used the early draft of window_icon.rs,
dropping the OnceLock-based global setter added in the fixup commit.

Restore from pre-rebase commit 83bf5d62:
- add static GLOBAL_ICON: OnceLock<WindowIcon>
- add pub fn set_window_icon(icon: WindowIcon)
- refactor default_window_icon() to check global override first
- re-export set_window_icon from platform lib.rs

Co-authored-by: ant <ant@offline.click>
2026-02-25 13:05:00 +01:00
Admin
c8ab367b14 little glitches in script engine 2026-02-24 23:32:56 +01:00
Admin
1ea87b2c2d warnings 2026-02-24 21:43:35 +01:00
Admin
aae121f31d fix gc issues 2026-02-24 21:40:08 +01:00
offline-ant
416ff1779a add cross-platform GL render bridge for external GL consumers (#878)
New GlRenderBridge API lets external code (e.g. servo in havi) render
via GL into a makepad-displayable texture with zero-copy.

Platform backends:
- Linux/Android: wraps existing EGL context (EglRenderBridge)
- Windows: ANGLE EGL on D3D11 device via mozangle (AngleRenderBridge)
- macOS: standalone CGL 3.2 Core bridged to Metal via IOSurface (CglRenderBridge)

Cx methods: create_gl_render_bridge, create_gl_render_bridge_texture,
restore_gl_context -- all platform-dispatched via cfg.

Co-authored-by: ant <ant@offline.click>
2026-02-24 17:32:08 +01:00
offline-ant
90415145a7 fix(wayland): negate scroll axis values to match Makepad convention (#875)
Wayland wl_pointer::Axis values are defined as motion-event vectors:
positive vertical = downward on screen. This means positive values
represent content sliding down under the pointer, i.e. the viewport
moving UP.

Makepad's internal scroll convention is positive = viewport moves DOWN.
This matches X11 (button 4/up maps to negative, button 5/down maps to
positive) and macOS (which negates scrollingDeltaY for the same reason).
The web backend also follows this via browser deltaY semantics.

The Wayland backend was passing axis values through without negation,
producing reversed scroll on all Wayland sessions. Negate at the
accumulator stage, consistent with how winit handles the same mismatch
(explicit comment: "Wayland sign convention is the inverse of winit").

The ignored AxisRelativeDirection event is unrelated -- it is a hint
telling clients whether the compositor applied natural-scrolling
inversion to the axis values, intended for widgets like volume sliders
that should track physical finger direction. The axis values themselves
already have natural scrolling applied by the compositor.

Co-authored-by: ant <ant@offline.click>
2026-02-24 17:31:04 +01:00
offline-ant
6df7c870db 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
797098cec5 fix linux 2026-02-24 16:49:11 +01:00
Admin
1bf89646ef ssl sockets 2026-02-24 16:28:21 +01:00
Admin
0aa3533210 network refactor 2026-02-24 14:04:37 +01:00
Admin
582af4b271 splice out a makepad-network crate 2026-02-23 23:21:31 +01:00
Admin
251df9ebec fix dx11 memleak 2026-02-23 18:30:26 +01:00
offline-ant
b41f9eef42 platform: unified StudioToApp dispatch and control channel (#874)
* platform: unified StudioToApp dispatch and control channel

Shared dispatch_studio_msg() in cx_shared.rs handles all common
StudioToApp variants (input, clipboard, screenshot, widget dump, kill).
Each stdin backend resolves window_id for mouse events, then delegates.

Control channel (web_socket.rs) enables StudioToApp dispatch in windowed
apps. Event loops poll it alongside their native event sources.

WindowGeomChange events are emitted on stdin geometry updates.

* fix RunView Y-flip on Linux: flip in shader instead of CPU readback

---------

Co-authored-by: ant <ant@offline.click>
2026-02-23 17:46:41 +01:00
offline-ant
558eebb816 macOS IOSurface render texture support for havishell (#872)
Co-authored-by: ant <ant@offline.click>
2026-02-23 17:45:54 +01:00
offline-ant
e3eb1dab2a fix: map atan2 to atan in GLSL shader backend (#870)
Co-authored-by: ant <ant@offline.click>
2026-02-23 17:45:22 +01:00
offline-ant
5d551e087d wayland: edge-resize, scroll acceleration, seat v5 binding (#868)
Co-authored-by: ant <ant@offline.click>
2026-02-23 17:44:34 +01:00
Admin
582c675c38 fix windows 2026-02-23 17:22:39 +01:00
Admin
36b3a7da68 studio<>app proto cleanup 2026-02-23 15:54:59 +01:00
offline-ant
6a92f1aeb1 Add HideWindowButtons/ShowWindowButtons platform op (#866)
Co-authored-by: ant <ant@offline.click>
2026-02-23 15:19:40 +01:00
Julián Montes de Oca
0774c184a3 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
admin
e3edac9cf8 fix linux windows build 2026-02-23 07:53:05 +01:00
admin
1496c97a7e tweakray 2026-02-22 20:30:14 +01:00
admin
8ced05d753 refactor remote and screenshot proto 2026-02-22 10:57:51 +01:00
admin
b6c847faf2 theme cleanup 2026-02-21 15:40:12 +01:00
Admin
aebab79f7b gpu profiling 2026-02-21 13:29:30 +01:00
Admin
780fb22e0a make splats faster 2026-02-21 12:40:37 +01:00
Admin
f6ed3835bd make splats faster 2026-02-21 12:37:26 +01:00
Admin
7b4d6e34c0 downshift hiccups fixed 2026-02-21 11:51:33 +01:00
Admin
b4123ebfa0 profiler 2026-02-21 11:30:59 +01:00
Admin
5c5bd9cfc4 profiler 2026-02-21 10:37:25 +01:00
offline-ant
29c1fd1de2 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
88baa3eff8 sortable drawcalls 2026-02-21 10:05:07 +01:00
Admin
e5cc73cfe6 splats without sort yet 2026-02-21 08:43:52 +01:00
Admin
9468ba8f53 drawcall fixing 2026-02-21 06:50:39 +01:00
offline-ant
ca14cb4660 Add Servo embedding support: render texture API, EGL access, Image Y-flip (#861)
Three minimal changes to support embedding Servo as a WebView:

1. windowing_backend.rs: Make opengl_cx field pub (was pub(super))
   Servo needs EGL display/context/platform handles to create a shared
   GL context. egl_platform and egl_platform_display have no EGL query
   to retrieve them — they must come from whoever created the display.
   Matches Makepad convention (Cx fields are pub, no accessors).

2. opengl.rs: Add Cx::create_gl_render_texture(width, height)
   Eagerly allocates a RenderBGRAu8 texture and returns (Texture, gl_id).
   Needed because Makepad allocates GL textures lazily during render,
   but Servo needs the GL texture ID at init to attach to its FBO.
   No existing API for eager allocation (update_render_target and
   cx.os.gl() are both pub(crate)).

3. image.rs: Add is_render() Y-flip in Image widget
   FBO render targets are Y-up in OpenGL; Makepad is Y-down.
   CachedView handles this via sample2d_rt shader, but Image widget
   was untested with render textures. set_texture() accepts them but
   displays upside-down. Fixes a genuine gap — no existing Makepad
   code puts RenderBGRAu8 into an Image widget.

Co-authored-by: ant <ant@offline.click>
2026-02-20 16:36:53 +01:00
Admin
9d86689d07 drawcall ordering and git ui 2026-02-20 15:47:56 +01:00
Julián Montes de Oca
40cad5dd37 Restore IME support (#860)
* Restore IME support

* Remove unused voice handling methods from Window
2026-02-20 14:06:02 +01:00
Admin
0a18aad5f2 build fixups 2026-02-19 18:15:34 +01:00
Julián Montes de Oca
41ca84222b Restore video widget (#857) 2026-02-19 16:43:41 +01:00
Admin
a39d9cc535 websocket jitter 2026-02-19 08:51:28 +01:00
Admin
f4fcf17274 git dots 2026-02-19 08:03:39 +01:00
Admin
393ad66d27 ui proto 2026-02-18 21:10:25 +01:00
Admin
c4b92f11a9 change subprocess plumbing to websocket 2026-02-18 14:06:44 +01:00
Admin
539010e57d instance pbr 2026-02-17 08:27:27 +01:00
Admin
99f46c36ba cleanup 2026-02-17 08:04:42 +01:00