Commit graph

2,973 commits

Author SHA1 Message Date
Admin
d1cd803976 optimising quest renderpath with physics 2026-03-25 22:44:16 +01:00
Kevin Boos
040a158a3d Improve font parsing and text drawing perf with a hybrid caching approach (#986)
* fix windows build by adding missing consts to windows-rs

* Improve font parsing and text drawing perf with a hybrid caching approach

* Reset rustybuzz face cache when cloning FontFace

* fix improper row decorations, back to working properly
2026-03-25 21:28:50 +01:00
Kevin Boos
e69813efe3 fix windows build by adding missing consts to windows-rs (#984) 2026-03-25 21:28:39 +01:00
Admin
483298ba93 foveation 2026-03-25 18:20:38 +01:00
Admin
9b9a35ea7c better physics 2026-03-25 17:39:00 +01:00
Admin
5bf2f03a97 multiview 2026-03-25 17:38:59 +01:00
Admin
1bbc4b6791 finally 2026-03-25 17:38:59 +01:00
Admin
b5349c7083 finally runs 2026-03-25 17:31:52 +01:00
Admin
227bff16d6 xr otw 2026-03-25 17:31:52 +01:00
Sabin Regmi
81034607d7 ft makepad_test (#974)
* ft makepad_test

* Improve run handling, manifest parsing, and stdout newline

Replace dynamic free-port lookup with an ephemeral localhost SocketAddr in test runtime and remove the unused find_free_listen_address helper. Ensure headless stdout messages end with a newline. Simplify send_to_app error handling and add a test that queued bootstrap messages are delivered once an app socket connects. Substantially enhance process_manager: unify cargo flag parsing, parse Cargo.toml to determine package/bin targets, resolve the correct binary name for direct stdio runs, and build the cargo/build+exec script from the resolved args. Add unit tests for manifest parsing and script generation and adjust related call sites.

* test harness

* Preserve test attrs; return Vec for gateway binds

In the test macro (libs/makepad_test/macros/src/lib.rs) preserve wrapper-only attributes (ignore and should_panic) on the generated wrapper test while removing them from the inner function. Added Attribute import, is_wrapper_only_test_attr helper, adjusted attribute filtering and emission, and added unit tests to verify attribute placement and expansion.

In the hub (studio/hub/src/hub.rs) change gateway_bind_candidates to return a Vec<SocketAddr> instead of an iterator and special-case ephemeral port 0 to preserve ephemeral binding; otherwise collect the range of candidate ports into a Vec. Added tests to validate candidate behavior. Also minor formatting/whitespace tweaks and a small IPv6 formatting adjustment.

* Add visible Studio mode and remote client

Enable running UI tests visibly through a running Makepad Studio. Adds a new makepad-network dependency and studio_remote client (libs/makepad_test/src/studio_remote.rs) and integrates it into the runtime via a TestConnection enum. Introduces visible-mode tooling: env vars (MAKEPAD_TEST_VISIBLE, MAKEPAD_TEST_STUDIO, MAKEPAD_TEST_STUDIO_MOUNT, MAKEPAD_TEST_STARTUP_DELAY_MS, MAKEPAD_TEST_ACTION_DELAY_MS, MAKEPAD_TEST_KEEP_OPEN_MS), pacing/delays after actions, and pause-before-shutdown. Splits startup into start_headless_app/start_visible_app, clears existing visible builds before launching, and updates tests, docs (GUIDE.md, README.md), and selector/runtime minor cleanups/formatting.
2026-03-25 16:09:03 +01:00
Sabin Regmi
5f97452a00 Redraw overlay draw_list on open/close (#978)
Explicitly redraw the overlay widget draw_list when opening and closing Modal and PopupNotification. This makes the overlay visible immediately on the first open (before the overlay content has refreshed or established a reusable draw area) and ensures the previous frame isn't left visible too long on close. Keeps existing background redraws intact.
2026-03-25 15:17:41 +01:00
Sabin Regmi
dbdf425555 Introduce UI constants and tweak studio layout (#983)
* Introduce UI constants and tweak studio layout

Consolidate and adjust studio UI sizing, spacing and styling across desktop widgets.

Key changes:
- studio/desktop/src/app_ui.rs: Add STUDIO_HEADER_HEIGHT and StudioDock; use constant for various header/caption heights; reorganize PaneToolbar into grouped Views, adjust spacing/margins, refine caption label styling, and apply custom draw_text/draw_bg for tabs.
- studio/desktop/src/desktop_file_tree.rs: Add STUDIO_FILE_TREE_ROW_HEIGHT and STUDIO_FILE_TREE_NODE_HEIGHT; switch hardcoded row/node heights to constants, adjust padding and pass node_height to FileTree; update DesktopFileTree::ROW_HEIGHT.
- studio/desktop/src/desktop_log_view.rs: Increase LogEmptyItem height, adjust padding/alignment and label text style; update DesktopLogView::EMPTY_ROW_HEIGHT.

Why: unify header/row sizing via constants, improve spacing and visual consistency, and centralize small styling tweaks for easier future adjustments.

* Add TerminalCloseableTab and TerminalAddTab

Define two new tab templates in app_ui.rs: TerminalCloseableTab (closeable terminal tab style with custom close button sizing and colors) and TerminalAddTab (compact "+" add-tab style with centered text and custom background/hover colors). Wire them into the StudioDock templates and switch the terminal_add DockTab to use TerminalAddTab. Update app_backend.rs to insert terminal tabs using TerminalCloseableTab instead of the generic CloseableTab.

* Standardize UI border colors and add draw_bg style

Replace explicit border color values with theme.color_u_hidden for border_color and border_color_2, and set active borders to a subtle bg tint (theme.color_bg_app * 0.92) to reduce visual prominence. Add a new draw_bg style block (with colors and the same hidden/active border settings) and apply the same border adjustments to related UI elements to unify border appearance across the app UI.

* Refactor and restyle app UI components

Add new reusable styles and refine layout/spacing in app_ui.rs. Introduces LogToolbarToggle and SidebarFilterInput styles and applies them to the log toolbar and file tree filter respectively, tightening visual consistency. Adds StudioTerminalView with padding and uses it in TerminalPane. Adjusts several sizes and spacings (log filter width 232 -> 216, clear button 24 -> 20, spacing 6 -> 4, adds 10px spacer View), and updates paddings for buttons. Refactors caption toggles into a shared CaptionChromeToggle (size/icon_walk/border_radius/colors tweaked) and defines CaptionSidebarToggle/CaptionPanelToggle as specializations that set their SVG icons. These changes are primarily visual/layout polish and consolidation of repeated style definitions for maintainability.

* Adjust close button size, margin and colors

Refine the close button styling: add a close_button block and standardize its size to 11x11, update margins (left: 1.0, right: 7.0) and unify draw_button colors/hover/active states to updated hex values. These tweaks align spacing and visual states across tab elements for a cleaner, more consistent UI.

* Adjust app background and empty text colors

Tweak background state multipliers for theme.color_bg_app to slightly brighter values (color: 0.82, hover: 0.88, focus: 0.92, down: 0.85, empty: 0.82 vs previous 0.78/0.86/0.9/0.82/0.78). Also switch empty text colors from theme.color_label_outer_off to theme.color_label_inner_inactive (hover matches), leaving color_empty_focus as theme.color_label_outer. These changes improve contrast and visual consistency for empty and interactive app UI states.
2026-03-25 15:17:23 +01:00
Sabin Regmi
33dea86646 Small Studio UX Nits (#982)
* Add animated sidebar toggle and splitter APIs

Add an animated, persistent sidebar toggle and supporting splitter APIs/UI.

- New icon resource: studio/desktop/resources/icons/icon_sidebar_toggle.svg
- UI: replace hidden caption bar with a visible caption that includes a sidebar toggle button (CaptionSidebarToggle), layout adjustments and related controls.
- App behavior: add SidebarAnimation struct and App fields to track animation state and next-frame. Handle button actions, next-frame stepping, and window drag queries to avoid initiating window drag over the toggle.
- Add App methods to query/set the workspace root splitter position, start/step sidebar animations, toggle sidebar (remember/restore width), and sync tab-bar visibility for mounts.
- Persist mount sidebar restore width by adding sidebar_restore_width to MountState and initializing default.
- Make save_state pub(super) so App can save when animation finishes.
- Widgets: expose splitter position and set_splitter_align on Dock and Splitter to allow programmatic width changes and redrawing.

These changes improve UX by providing a smooth animated sidebar hide/show, remembering user width per mount, and ensuring the dock UI updates correctly during mount/tab changes.

* Persist sidebar_restore_width in mount state

Add an Option<f64> sidebar_restore_width to PersistedMountStateRon and wire it through loading and collection so the sidebar width is saved and restored. Include tests to verify a round-trip serialization/deserialization preserves the value and that missing legacy data defaults to None for backward compatibility.

* Sync run preview splitter state

Hide and restore the Run preview column based on whether run tabs exist. Added run_panel_split_restore to AppData to remember the last editor_split ratio per mount, plus a helper (run_preview_splitter_is_collapsed) and a new method sync_run_preview_splitter that collapses the preview when there are no runs and restores the previous ratio when runs reappear (defaults to Weighted(0.62)). Called sync_run_preview_splitter from relevant places: after creating/ensuring run tabs, when clearing build tabs, when closing run tabs, and at startup to initialize each mount. Also added /.cocoindex_code/ to .gitignore.

* Add bottom panel toggle with animation

Introduce a bottom panel toggle UI and animation support. Adds a new icon resource and CaptionPanelToggle button in the caption bar, moves/adjusts caption layout, and wires the button to toggle the bottom panel. Adds a TerminalShellPane, bottom_terminal_tab, and integrates bottom_panel_tabs into the workspace layout. Implements BottomPanelAnimation, animation helpers (panel_animation_progress, start/step logic), workspace splitter height getters/setters, and toggle/select helpers (toggle_bottom_panel, select_bottom_terminal_panel). Persists mount bottom_panel_restore_height in MountState and persisted state with tests updated. Also updates drag/tab behavior to account for the new bottom terminal tab and routes animation next-frame events.

* Refactor reflow_resize and add wrap test

Rewrite reflow_resize to simplify reflow logic and improve handling of growing/shrinking rows and scrollback. The change always captures the old grid state, builds logical (re-wrapped) scrollback lines, and then branches on whether the new height is greater, less, or equal to the old height. On growth it may pull rows from the logical scrollback when the terminal was full, preserve content when a custom scroll region is present, and correctly update cursor, high-water, saved cursor and bottom_trimmed_rows. On shrink it chooses how many bottom rows to push into scrollback based on cursor position, trimmed rows, and content below the cursor, and trims scrollback to max_scrollback. Also adjust cursor bounds and pending_wrap handling. Add a test (visible_wrapped_prompt_rows_do_not_reflow_on_width_growth) to ensure visible wrapped prompt rows do not get reflowed when the width increases.
2026-03-25 14:12:57 +01:00
Kevin Boos
2c91c12dbf Fix stack nav to make it more like a true stack (#980)
* Removed `remove_all(view_id)` from `push_view()` to allow
  the same view ID on the stack multiple times. Most apps will
  need somethin like this, otherwise they'd have to have a weird
  statically-known set of fixed views that are eligible to be
  on the stack. Robrix, at the least, doesn't have that.
* Fixed `show()` to force-reset the animator state, which was needed
  to make a fresh animation always play (even when animating in "reused" views)
* Reset `state` to `Inactive` in `show()`, otherwise it'll never transition to `Active`
2026-03-24 19:52:37 +01:00
Kevin Boos
2b787c6851 Fix shader compilation bug on linux and window positioning (#979)
TL;DR: the shader compiler needed explicit casts in for loop bounds,
and the window positioning was messed up, causing the app-level title bar
to overlap with the native OS-level title bar (which means you couldn't
see or press the window chrome buttons)

--------

here's an AI-generated summary of the changes, for more details:

On OpenGL ES 3.0 targets (Linux/EGL, Android), shaders containing `for` loops
over `uint` variables failed to compile with a GLSL type-error. The shader
compiler emitted the loop header as:

```glsl
for(uint i = 0; i < 4; i++) { … }
```

The integer literals `0` and `4` are of type `int` in GLSL. GLSL ES 3.0 forbids
implicit casts between `int` and `uint`, so the initialiser and the comparison
both produce a compile error. The other shader backends (Metal/WGSL/Rust) do not
have this restriction, so no corresponding arm existed for GLSL.

**`platform/script/src/shader_control.rs`** — Add a `ShaderBackend::Glsl` arm to
`handle_for_1` that wraps both loop bounds in an explicit constructor call for the
loop variable's type:

```glsl
for(uint i = uint(0); i < uint(4); i++) { … }
```

This satisfies GLSL ES 3.0's strict no-implicit-cast rule and matches the
behavior already implemented for the WGSL backend (which uses typed variable
declarations for the same reason).

**`platform/src/os/linux/opengl.rs`** — Gate the helper functions
`shader_source_hash` and `shader_source_preview` (and their call-sites) behind
`#[cfg(target_os = "android")]`. These functions are only referenced from
Android-specific shader-cache code paths; without the attribute the compiler
emits dead-code warnings on every other Linux/OpenGL build.

- `platform/script/src/shader_control.rs`
- `platform/src/os/linux/opengl.rs`

----------------------------------------------------------------------------

On GNOME (and likely other modern WMs), restoring a saved window position would
consistently produce two visual artifacts:

1. **No WM title bar visible** — the client area was rendered where the title bar
   should appear.
2. **Black bar at the bottom** — the bottom portion of the window surface was not
   covered by rendered content.

The root cause was two related issues in `xlib_window.rs`:

**Issue 1 — `XMoveWindow` called after `XMapWindow` (races with WM reparenting)**

After `XMapWindow`, the window manager asynchronously reparents the client window
into a decoration frame. If `XMoveWindow` is called after reparenting has occurred,
the coordinates are interpreted relative to the WM frame rather than the root
window. For example, calling `XMoveWindow(client, 23, 89)` after GNOME reparents
places the client 89 px from the top of the WM frame. Since the title bar is only
~37 px tall, the client ends up 52 px below the title bar, and its bottom edge
extends 52 px *beyond* the bottom of the WM frame. GNOME responds by resizing or
repositioning the client, producing the rendering artifacts described above.

**Issue 2 — No `USPosition` hint set**

Without the `USPosition` flag in `WM_NORMAL_HINTS`, GNOME ignores the position
provided to `XCreateWindow` and applies its own smart-placement algorithm. This
meant the application relied entirely on the post-map `XMoveWindow` call described
above, which was itself broken.

**`platform/src/os/linux/x11/x11_sys.rs`** — Add the standard `XSizeHints` flag
constants:

- `USPosition` (`1 << 0`) — user-specified x, y
- `USSize` (`1 << 1`) — user-specified width, height
- `PPosition` (`1 << 2`) — program-specified position
- `PSize` (`1 << 3`) — program-specified size

**`platform/src/os/linux/x11/xlib_window.rs`** — Two changes in `XlibWindow::init()`:

1. Before calling `Xutf8SetWMProperties`, populate an `XSizeHints` struct with
   `flags = USPosition | PPosition` (and `x`/`y` set to the requested coordinates)
   when a position was provided. Pass this struct as the `WM_NORMAL_HINTS` argument
   instead of the previous `ptr::null_mut()`. This tells GNOME/Mutter to honor the
   requested position rather than running its own placement heuristic.

2. Move the `XMoveWindow` call to *before* `XMapWindow`. At that point the window is
   still a direct child of the root window, so the coordinates are unambiguously
   root-relative. This eliminates the race with WM reparenting entirely.
2026-03-24 19:52:21 +01:00
Admin
dd46fa0bc8 xr otw 2026-03-23 22:26:59 +01:00
Admin
ab3c57436d xr otw 2026-03-23 22:26:41 +01:00
Admin
ad383b9198 xr otw 2026-03-23 20:52:29 +01:00
Admin
6d38bc52be compiles 2026-03-23 12:56:39 +01:00
Admin
eb0620d3cf no drawdepth 2026-03-23 10:23:17 +01:00
Admin
a169260390 cleanup 2026-03-23 10:12:37 +01:00
Admin
8a13941776 android borked 2026-03-22 17:28:18 +01:00
Admin
dd9c79d21d tree 2026-03-22 13:39:01 +01:00
Admin
111e20b7b2 cleanup xr 2026-03-22 12:24:04 +01:00
Admin
e5e3ddbdec fix xr lib 2026-03-21 15:24:19 +01:00
Admin
b2b31cce5b demo 2026-03-21 11:39:27 +01:00
Sabin Regmi
0ef3e2d9ee Some small web nits from my crazy experiement (#972)
* Schedule loader removal after presented frame

Introduce loader_after_presented_frame_id and add schedule/cancel helpers to remove the canvas loader after a presented animation frame. Cancel any pending requestAnimationFrame when the loader is removed or conditions change, and update update_startup_loader to use the new scheduling logic (remove loader only after seen animation frame and quiet frames threshold). This prevents premature removal and visual glitches while preserving the existing fallback timer.

* small fonts should be used when --profile=small

* dont include large fonts on small profile + fix compress serving

* Refactor window initialization and caption sync

Extract sync_caption_bar_state and sync_caption_title from ensure_initialized and call them before the initialized early-return so caption bar state and title are kept in sync even when the widget is re-applied. ensure_initialized still performs the original one-time setup (pass, depth texture, demo frame), but runtime chrome (VR button and caption visibility/title) is now updated up-front to avoid stale UI state.

* fix --bindgen

* Set imports.env in wasm import patches

Add additional string replacements to ensure imports.env = env is injected into generated JS for different formatting variants of the __wbg_get_imports(...) call. This makes the patch robust to variations like missing const or spacing so the env object is always attached to the wasm imports.

* Revert "Set imports.env in wasm import patches"

This reverts commit 37933234d36b4ee867690cf167474638e81febf7.

* Revert "fix --bindgen"

This reverts commit cb236b202b92a46eda3cb1ee4c678bdf6507081a.

* Reapply "fix --bindgen"

This reverts commit 27df4175bd1889222b928ffb68213aa865d1c839.

* Reapply "Set imports.env in wasm import patches"

This reverts commit 23695b4fa646d8f1b7a31a3fc27eb92f5bce0cf8.

* fix xr compilation error
2026-03-21 11:23:16 +01:00
Kevin Boos
d1cfc5cf2b Fix windows build: add missing constants in vendored windows-rs bindings (#975)
* Fix windows build: add missing constants in vendored windows-rs bindings

* fix more build errors and warnings in windows-rs vendored copy
2026-03-21 11:22:27 +01:00
Kevin Boos
cc764ba3b8 Fix svg draw shaders (#976)
* Fix windows build: add missing constants in vendored windows-rs bindings

* fix more build errors and warnings in windows-rs vendored copy

* Fix SVG parsing and vector drawing
2026-03-21 11:22:02 +01:00
Kevin Boos
4e9cff4f6e cargo makepad: fix android SDK installation (unzip step) on linux (#977)
* Fix windows build: add missing constants in vendored windows-rs bindings

* fix more build errors and warnings in windows-rs vendored copy

* Fix SVG parsing and vector drawing

* Fix erroneous unzip glob pattern that doesn't work on normal linux

* try another approach: unzip everything, cp needed dirs
2026-03-21 11:21:52 +01:00
Admin
c29f03f00a protocol 2026-03-20 10:09:40 +01:00
Admin
2537b8caab protocol 2026-03-20 09:42:35 +01:00
Admin
0b4ee8860d fix android screencap to studio 2026-03-20 09:03:50 +01:00
Kevin Boos
3a263956c8 Restore optional serde derives that were removed in Makepad 2.0 (#973) 2026-03-19 20:07:45 +01:00
Kevin Boos
95090bbc0a Ensure that the Html <br> tag obeys current line spacing settings (#971)
Without this, Html blocks that have both `<br>` and `\n` newlines
(or even just soft line wraps) look quite janky, with poor vertical spacing.
2026-03-19 20:07:28 +01:00
Kevin Boos
9977202cfa Fixed several issue in text drawing, layout, and text flow. (#970)
These are needed to support better formatting of Html code
that mixes multiple different styles together, e.g., inline code
next to normal code, or inline code within a blockquote or a heading.

Full summary of changes:

**File:** `draw/src/shader/draw_text.rs`

Added `#[live(0.0)] pub top_drop: f32` to `TextStyle`. This is a vertical offset expressed as a fraction of font size — positive values shift text downward. It's useful for aligning baselines when mixing fonts with different vertical metrics (e.g., a code font rendered inline with regular text).

**File:** `draw/src/shader/draw_text.rs`

When `temp_y_shift != 0`, the extra shift pixels are now added to `allocate_height()` and the emitted walk rect. This prevents containers (blockquotes, etc.) from clipping the descenders (g, p, q, y) of vertically-shifted text.

**File:** `widgets/src/text_flow.rs`

After selecting the appropriate text style (normal/bold/italic/fixed), `draw_text.temp_y_shift` is now set from that style's `top_drop` value. This allows each style variant to specify its own vertical offset, since `TextFlow` uses a single shared `DrawText` instance for all text rendering.

**File:** `draw/src/turtle.rs`

New public method to mutate `layout.padding.left` after a turtle has been created.

**File:** `widgets/src/text_flow.rs`

After drawing the bullet/number marker, the actual cursor position is now measured and `set_padding_left()` is called so that wrapped continuation lines align with the text after the marker, rather than being over-indented by the estimated `font_based_padding` (which was `2.5 * font_size`).

Additionally, the hardcoded `draw_text(cx, " ")` spacer after the marker was replaced with `walk_margin(cx, self.list_item_marker_pad)` for precise pixel-based control.

**File:** `widgets/src/text_flow.rs`

Added `#[live(5.0)] list_item_marker_pad: f64` — a configurable spacing (in pixels) between the list item marker (bullet/number) and the content text that follows it.
2026-03-19 20:07:13 +01:00
Admin
3a1edd3db1 fix android screencap to studio 2026-03-19 13:59:42 +01:00
Admin
378459462c fix android screencap to studio 2026-03-19 13:57:55 +01:00
Admin
df389d7c5e fix studio 2026-03-19 12:42:27 +01:00
Admin
54249f1958 fix studio 2026-03-19 11:54:38 +01:00
Admin
c1900f6e50 fix studio 2026-03-19 11:42:20 +01:00
Admin
42df96331a fix studio 2026-03-19 11:24:51 +01:00
Admin
7b5f7a177f studio ws fix 2026-03-19 10:42:55 +01:00
Admin
9f445a6c69 cleanup 2026-03-19 10:16:38 +01:00
Admin
059f8a123c helmet with real envmap 2026-03-18 01:29:59 +01:00
Admin
8393979f7b remove dep 2026-03-18 01:02:57 +01:00
Admin
c8b0a7ad4b remove dep 2026-03-18 00:06:32 +01:00
Admin
99bd8d38d4 vulkan debugging 2026-03-17 23:59:07 +01:00
offline-ant
bcd5675051 Fix Mat4f::mul to compute a*b instead of b*a (#966)
Mat4f::mul(a, b) was computing b*a due to transposed summation
indices in the multiplication loop. All call sites (glTF TRS
composition, view-projection, MVP chains, scene hierarchy) are
written expecting standard a*b order, and transform_vec4 uses
standard column-major M*v convention.

Fix: swap the operand bindings so the existing index pattern
produces the correct a*b result.

Add regression test mat4_mul_order that verifies:
- Scale(2)*Translate(5,7) yields tx=10 (scaled translation)
- transform_vec4 on result*(1,1,0,1) yields (12,16)

Co-authored-by: ant <ant@offline.click>
2026-03-17 19:43:02 +01:00
Admin
62a7fd33f4 cef 2026-03-17 19:00:28 +01:00