mirror of
https://github.com/getpaseo/paseo.git
synced 2026-12-01 04:36:26 +00:00
fix(gpui): report a fine pointer on GPUI so controls take pointer sizes
pointer-capabilities answers touch-primary for every non-web build, so the GPUI desktop client took iOS touch sizes: 44 pt controls and rows instead of 28 and 36. GPUI reports every pointer as a mouse, so its branch answers fine pointer, no touch screen. iOS, Android and web resolve the same file as before.
This commit is contained in:
@@ -130,6 +130,14 @@ const CASES = [
|
||||
native: path.join(APP_DIR, "modules/paseo-press-feedback/src/ui/feedback.native.tsx"),
|
||||
web: path.join(APP_DIR, "modules/paseo-press-feedback/src/ui/feedback.tsx"),
|
||||
},
|
||||
{
|
||||
label: "pointer capabilities",
|
||||
origin: path.join(APP_DIR, "src/components/ui/control-sizing.ts"),
|
||||
specifier: "@/hooks/pointer-capabilities",
|
||||
gpui: path.join(APP_DIR, "src/hooks/pointer-capabilities.gpui.ts"),
|
||||
native: path.join(APP_DIR, "src/hooks/pointer-capabilities.ts"),
|
||||
web: path.join(APP_DIR, "src/hooks/pointer-capabilities.ts"),
|
||||
},
|
||||
];
|
||||
|
||||
afterEach(() => {
|
||||
|
||||
@@ -123,6 +123,16 @@ test.skipIf(!endpoint || appearanceFixture)(
|
||||
45_000,
|
||||
);
|
||||
|
||||
test.skipIf(!endpoint || appearanceFixture)(
|
||||
"real Paseo sizes controls for a pointer, not for touch",
|
||||
async () => {
|
||||
// Regression: GPUI took the native touch answer, so a 28 pt pointer control rendered at 44.
|
||||
const settings = await nodeWithId("sidebar-settings");
|
||||
expect(settings.frame?.[3]).toBe(28);
|
||||
},
|
||||
20_000,
|
||||
);
|
||||
|
||||
test.skipIf(!endpoint || appearanceFixture)(
|
||||
"real Paseo opens History",
|
||||
async () => {
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import type { PointerCapabilities, PointerCapabilitiesSource } from "./pointer-capabilities";
|
||||
|
||||
export type { PointerCapabilities, PointerCapabilitiesSource };
|
||||
|
||||
// The GPUI desktop client runs in a macOS, Linux, or Windows window. The runtime reports
|
||||
// every pointer as a mouse, so a fine pointer drives the UI and the answer never changes.
|
||||
const GPUI_POINTER_CAPABILITIES: PointerCapabilities = { finePointer: true, touchScreen: false };
|
||||
|
||||
export function usePointerCapabilities(): PointerCapabilities {
|
||||
return GPUI_POINTER_CAPABILITIES;
|
||||
}
|
||||
|
||||
/** True when a mouse-like pointer drives the UI, read at call time. */
|
||||
export function hasFinePointer(): boolean {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** True when touch is the primary input, read at call time. */
|
||||
export function hasTouchPrimaryPointer(): boolean {
|
||||
return false;
|
||||
}
|
||||
Reference in New Issue
Block a user