mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-06 13:05:47 +00:00
Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b1405c4f5 | ||
|
|
8cdedbe18a | ||
|
|
0f39d71f95 | ||
|
|
1dc49b527b | ||
|
|
cc3fec0768 | ||
|
|
a8af973726 | ||
|
|
ed1f8dd2b6 | ||
|
|
e8aaae1343 |
No files matched your search
@@ -3210,23 +3210,32 @@ static void touch_down(int id, double x, double y) {
|
||||
struct surface *target = touch_target_at(x, y);
|
||||
if (!target) return;
|
||||
struct wl_client *client = wl_resource_get_client(target->resource);
|
||||
/* A down on an id that is still held means that sequence's up was lost: end it first. The
|
||||
* fingers still down are counted only after that - counted before, a lost up left any_active
|
||||
* set, and on the pointer path every later touch was dropped (a tap or swipe did nothing). */
|
||||
if (g_touch_points[id].surface) touch_cancel_client(client);
|
||||
int any_active = 0;
|
||||
for (int i = 0; i < MAX_TOUCH_POINTS; i++) {
|
||||
struct surface *active = g_touch_points[i].surface;
|
||||
if (!active) continue;
|
||||
any_active = 1;
|
||||
if (active != target) {
|
||||
touch_cancel_all();
|
||||
any_active = 0;
|
||||
break;
|
||||
}
|
||||
any_active = 1;
|
||||
}
|
||||
if (g_touch_points[id].surface) touch_cancel_client(client);
|
||||
struct seat_touch *st;
|
||||
int has_touch = 0;
|
||||
for_each_touch_of(client, st) has_touch = 1;
|
||||
/* One line per gesture (first finger), so a test can see where a touch went. */
|
||||
if (!any_active) {
|
||||
char name[160];
|
||||
describe(target, name, sizeof(name));
|
||||
banner_log("touch", "%s gets %s", name, has_touch ? "touch" : "the pointer (it takes no touch)");
|
||||
}
|
||||
if (!has_touch) {
|
||||
if (any_active) return;
|
||||
if (any_active) return; /* one finger drives the pointer; a second one is ignored */
|
||||
g_touch_points[id].surface = target;
|
||||
g_touch_points[id].pointer_fallback = 1;
|
||||
pointer_event(x, y, BTN_LEFT, 1);
|
||||
|
||||
@@ -1231,7 +1231,13 @@ class SessionActivity : ComponentActivity(), SurfaceHolder.Callback {
|
||||
WaylandCompositor.nativeSendTouch(action, event.getPointerId(index), (x * 1919f).toInt(), (y * 1079f).toInt())
|
||||
}
|
||||
when (event.actionMasked) {
|
||||
MotionEvent.ACTION_DOWN, MotionEvent.ACTION_POINTER_DOWN -> sendTouch(0, event.actionIndex)
|
||||
// A first finger starts a new gesture, and Android has ended every earlier one: whatever
|
||||
// the compositor still holds (an up lost to the drawer opening mid-touch) goes first.
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
WaylandCompositor.nativeSendTouch(3, -1, 0, 0)
|
||||
sendTouch(0, event.actionIndex)
|
||||
}
|
||||
MotionEvent.ACTION_POINTER_DOWN -> sendTouch(0, event.actionIndex)
|
||||
MotionEvent.ACTION_MOVE -> for (index in 0 until event.pointerCount) sendTouch(1, index)
|
||||
MotionEvent.ACTION_UP, MotionEvent.ACTION_POINTER_UP -> sendTouch(2, event.actionIndex)
|
||||
MotionEvent.ACTION_CANCEL -> WaylandCompositor.nativeSendTouch(3, -1, 0, 0)
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
.frames/
|
||||
@@ -0,0 +1,18 @@
|
||||
# DroidDeck boot animation
|
||||
|
||||
A 4.2 second, 1920×1080, 60 fps startup animation built directly from the geometry and colors of `../droiddeck-mark.svg`.
|
||||
|
||||
The mark is split into its left bridge-like half, blue orb, and right crescent. The left half drops in and lands rotated as a bridge, the orb bounces onto it, the crescent lands as a cap, the stack teeters, then all three spring back into the exact source-logo geometry. A restrained blue floor glow and final pulse provide the only added visual treatment.
|
||||
|
||||
Outputs:
|
||||
|
||||
- `droiddeck-boot.webm` — VP9/YUV420p, intended boot-movie asset.
|
||||
- `droiddeck-boot.mp4` — H.264/YUV420p preview / general playback copy.
|
||||
|
||||
To rebuild on macOS with Google Chrome, Node 24+, and ffmpeg installed:
|
||||
|
||||
```sh
|
||||
./build.sh
|
||||
```
|
||||
|
||||
`boot.html` is the animation source. `render.mjs` drives Chrome through the DevTools protocol and captures deterministic frames; no generated imagery is involved.
|
||||
@@ -0,0 +1,176 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<style>
|
||||
html,body{margin:0;width:100%;height:100%;overflow:hidden;background:#000}
|
||||
svg{display:block;width:100vw;height:100vh}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<svg id="scene" viewBox="0 0 1920 1080" xmlns="http://www.w3.org/2000/svg">
|
||||
<defs>
|
||||
<radialGradient id="ambient" cx="50%" cy="62%" r="42%">
|
||||
<stop offset="0" stop-color="#0b1c2b"/>
|
||||
<stop offset=".38" stop-color="#05090e"/>
|
||||
<stop offset="1" stop-color="#000"/>
|
||||
</radialGradient>
|
||||
<radialGradient id="orbGlow" cx="50%" cy="50%" r="50%">
|
||||
<stop offset="0" stop-color="#1A9FFF" stop-opacity=".32"/>
|
||||
<stop offset=".48" stop-color="#1A9FFF" stop-opacity=".10"/>
|
||||
<stop offset="1" stop-color="#1A9FFF" stop-opacity="0"/>
|
||||
</radialGradient>
|
||||
<filter id="softBlur"><feGaussianBlur stdDeviation="18"/></filter>
|
||||
<filter id="blueBloom" x="-80%" y="-80%" width="260%" height="260%">
|
||||
<feGaussianBlur stdDeviation="7" result="b"/>
|
||||
<feMerge><feMergeNode in="b"/><feMergeNode in="SourceGraphic"/></feMerge>
|
||||
</filter>
|
||||
<filter id="pieceShadow" x="-60%" y="-60%" width="220%" height="220%">
|
||||
<feDropShadow dx="0" dy="8" stdDeviation="8" flood-color="#000" flood-opacity=".55"/>
|
||||
</filter>
|
||||
<mask id="negative-space" maskUnits="userSpaceOnUse" x="-31.98" y="0" width="207.92" height="223.72">
|
||||
<rect x="-31.98" y="0" width="207.92" height="223.72" fill="#fff"/>
|
||||
<circle cx="63.98" cy="111.86" r="71.81" fill="#000"/>
|
||||
<rect x="56.055" y="0" width="15.83" height="45" fill="#000"/>
|
||||
<rect x="56.055" y="178.72" width="15.83" height="45" fill="#000"/>
|
||||
</mask>
|
||||
<clipPath id="leftClip"><rect x="-80" y="-40" width="144" height="310"/></clipPath>
|
||||
<clipPath id="rightClip"><rect x="63.98" y="-40" width="180" height="310"/></clipPath>
|
||||
</defs>
|
||||
|
||||
<rect width="1920" height="1080" fill="url(#ambient)"/>
|
||||
<ellipse id="floorGlow" cx="960" cy="760" rx="330" ry="68" fill="#1A9FFF" opacity="0" filter="url(#softBlur)"/>
|
||||
<ellipse id="floorShadow" cx="960" cy="752" rx="235" ry="24" fill="#000" opacity=".55" filter="url(#softBlur)"/>
|
||||
|
||||
<g id="logoRoot" transform="translate(960 530) scale(2.35) translate(-63.98 -111.86)">
|
||||
<g id="stack">
|
||||
<g id="leftPiece" filter="url(#pieceShadow)" clip-path="url(#leftClip)">
|
||||
<path fill="#1b1b1b" mask="url(#negative-space)" d="M-31.98 0H63.97c61.84 0 111.96 50.08 111.96 111.86S125.81 223.72 63.97 223.72H-31.98V0Z"/>
|
||||
</g>
|
||||
<g id="rightPiece" filter="url(#pieceShadow)" clip-path="url(#rightClip)">
|
||||
<path fill="#1b1b1b" mask="url(#negative-space)" d="M-31.98 0H63.97c61.84 0 111.96 50.08 111.96 111.86S125.81 223.72 63.97 223.72H-31.98V0Z"/>
|
||||
</g>
|
||||
<g id="orbWrap" filter="url(#blueBloom)">
|
||||
<circle id="orb" cx="63.98" cy="111.86" r="55.98" fill="#1A9FFF"/>
|
||||
</g>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
<circle id="pulse" cx="960" cy="530" r="165" fill="none" stroke="#1A9FFF" stroke-width="2" opacity="0"/>
|
||||
<rect id="fade" width="1920" height="1080" fill="#000" opacity="1"/>
|
||||
</svg>
|
||||
<script>
|
||||
const left = document.getElementById('leftPiece');
|
||||
const right = document.getElementById('rightPiece');
|
||||
const orb = document.getElementById('orbWrap');
|
||||
const stack = document.getElementById('stack');
|
||||
const fade = document.getElementById('fade');
|
||||
const floorGlow = document.getElementById('floorGlow');
|
||||
const floorShadow = document.getElementById('floorShadow');
|
||||
const pulse = document.getElementById('pulse');
|
||||
const C = {lx:16, ly:111.86, cx:63.98, cy:111.86};
|
||||
|
||||
const clamp=(v,a=0,b=1)=>Math.max(a,Math.min(b,v));
|
||||
const mix=(a,b,t)=>a+(b-a)*t;
|
||||
const outCubic=t=>1-Math.pow(1-clamp(t),3);
|
||||
const inCubic=t=>Math.pow(clamp(t),3);
|
||||
const smooth=t=>{t=clamp(t);return t*t*(3-2*t)};
|
||||
const outBack=t=>{t=clamp(t);const c1=1.70158,c3=c1+1;return 1+c3*Math.pow(t-1,3)+c1*Math.pow(t-1,2)};
|
||||
const outBounce=t=>{
|
||||
t=clamp(t); const n=7.5625,d=2.75;
|
||||
if(t<1/d)return n*t*t;
|
||||
if(t<2/d){t-=1.5/d;return n*t*t+.75}
|
||||
if(t<2.5/d){t-=2.25/d;return n*t*t+.9375}
|
||||
t-=2.625/d;return n*t*t+.984375;
|
||||
};
|
||||
function tf(tx,ty,rot,sx=1,sy=1,cx=C.cx,cy=C.cy){
|
||||
return `translate(${tx.toFixed(3)} ${ty.toFixed(3)}) translate(${cx} ${cy}) rotate(${rot.toFixed(3)}) scale(${sx.toFixed(4)} ${sy.toFixed(4)}) translate(${-cx} ${-cy})`;
|
||||
}
|
||||
function setOpacity(el,v){el.setAttribute('opacity',String(clamp(v)))}
|
||||
function windowed(t,a,b){return clamp((t-a)/(b-a))}
|
||||
window.setBootTime=(t)=>{
|
||||
// Overall reveal and end fade.
|
||||
const intro = smooth(windowed(t,0.00,0.20));
|
||||
const outro = smooth(windowed(t,3.82,4.14));
|
||||
fade.setAttribute('opacity', String(1-intro + outro*intro));
|
||||
|
||||
// LEFT PIECE: drops first, rotated into a little bridge.
|
||||
let lp=windowed(t,0.16,0.86);
|
||||
let leftY=mix(-360,138,outBounce(lp));
|
||||
let leftR=mix(74,90,outCubic(lp));
|
||||
if(t>0.86 && t<1.18){
|
||||
const q=windowed(t,0.86,1.18);
|
||||
leftY=138 + Math.sin(q*Math.PI*3)*10*(1-q);
|
||||
leftR=90 + Math.sin(q*Math.PI*2)*2.8*(1-q);
|
||||
}
|
||||
const leftVis=smooth(windowed(t,0.08,0.26));
|
||||
|
||||
// ORB: falls onto the bridge and gives it a tiny comic bounce.
|
||||
let op=windowed(t,0.78,1.48);
|
||||
let orbY=mix(-430,-48,outBounce(op));
|
||||
let orbS=1;
|
||||
if(t>1.34 && t<1.62){
|
||||
const q=windowed(t,1.34,1.62);
|
||||
orbS=1 + Math.sin(q*Math.PI)*0.055;
|
||||
}
|
||||
const orbVis=smooth(windowed(t,0.72,0.92));
|
||||
|
||||
// RIGHT CRESCENT: arrives last as a curved cap.
|
||||
let rp=windowed(t,1.32,2.02);
|
||||
let rightY=mix(-500,-92,outBounce(rp));
|
||||
let rightX=mix(44,8,outCubic(rp));
|
||||
let rightR=mix(-38,-92,outCubic(rp));
|
||||
const rightVis=smooth(windowed(t,1.24,1.46));
|
||||
|
||||
// Stack balances after the third piece lands.
|
||||
let wobble=0, wobbleX=0, wobbleY=0;
|
||||
if(t>=1.88 && t<2.70){
|
||||
const q=windowed(t,1.88,2.70);
|
||||
const amp=7.5*(1-q*.40);
|
||||
wobble=Math.sin(q*Math.PI*5.4)*amp;
|
||||
wobbleX=Math.sin(q*Math.PI*5.4)*8*(1-q*.45);
|
||||
wobbleY=Math.abs(Math.sin(q*Math.PI*5.4))*2.8;
|
||||
}
|
||||
|
||||
// Snap all three pieces back into the exact source logo.
|
||||
const sp=outBack(windowed(t,2.56,3.08));
|
||||
if(t>=2.56){
|
||||
leftY=mix(leftY,0,sp);
|
||||
leftR=mix(leftR,0,sp);
|
||||
orbY=mix(orbY,0,sp);
|
||||
orbS=mix(orbS,1,sp);
|
||||
rightY=mix(rightY,0,sp);
|
||||
rightX=mix(rightX,0,sp);
|
||||
rightR=mix(rightR,0,sp);
|
||||
wobble*=1-sp; wobbleX*=1-sp; wobbleY*=1-sp;
|
||||
}
|
||||
|
||||
// Tiny final settle/breath.
|
||||
let settleScale=1;
|
||||
if(t>=2.86 && t<3.34){
|
||||
const q=windowed(t,2.86,3.34);
|
||||
settleScale=1 + Math.sin(q*Math.PI*2)*0.016*(1-q);
|
||||
}
|
||||
|
||||
left.setAttribute('transform',tf(0,leftY,leftR,1,1,C.lx,C.ly));
|
||||
right.setAttribute('transform',tf(rightX,rightY,rightR));
|
||||
orb.setAttribute('transform',tf(0,orbY,0,orbS,orbS));
|
||||
stack.setAttribute('transform',`translate(${wobbleX.toFixed(3)} ${wobbleY.toFixed(3)}) translate(${C.cx} ${C.cy}) rotate(${wobble.toFixed(3)}) scale(${settleScale.toFixed(4)}) translate(${-C.cx} ${-C.cy})`);
|
||||
setOpacity(left,leftVis); setOpacity(orb,orbVis); setOpacity(right,rightVis);
|
||||
|
||||
// Ground response and restrained blue halo.
|
||||
const impact1=Math.max(0,1-Math.abs(t-.86)/.18);
|
||||
const impact2=Math.max(0,1-Math.abs(t-1.48)/.20);
|
||||
const impact3=Math.max(0,1-Math.abs(t-2.02)/.20);
|
||||
const finalGlow=smooth(windowed(t,2.68,3.18))*(1-outro);
|
||||
floorGlow.setAttribute('opacity',String(clamp(.035 + impact1*.05 + impact2*.10 + impact3*.07 + finalGlow*.15)));
|
||||
floorShadow.setAttribute('rx',String(215 + impact1*18 + impact2*10 + finalGlow*20));
|
||||
|
||||
const pp=windowed(t,2.90,3.42);
|
||||
pulse.setAttribute('r',String(mix(150,245,outCubic(pp))));
|
||||
pulse.setAttribute('opacity',String(pp>0&&pp<1 ? Math.sin(pp*Math.PI)*.16 : 0));
|
||||
};
|
||||
window.setBootTime(0);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Executable
+15
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
rm -rf .frames
|
||||
mkdir -p .frames
|
||||
node render.mjs 0 84
|
||||
node render.mjs 84 168
|
||||
node render.mjs 168 252
|
||||
ffmpeg -y -hide_banner -loglevel error -framerate 60 -i .frames/%04d.png \
|
||||
-c:v libx264 -preset slow -crf 17 -pix_fmt yuv420p -movflags +faststart \
|
||||
-t 4.2 droiddeck-boot.mp4
|
||||
ffmpeg -y -hide_banner -loglevel error -framerate 60 -i .frames/%04d.png \
|
||||
-c:v libvpx-vp9 -row-mt 1 -crf 24 -b:v 0 -pix_fmt yuv420p -an \
|
||||
-t 4.2 droiddeck-boot.webm
|
||||
rm -rf .frames
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,64 @@
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import {spawn} from 'node:child_process';
|
||||
|
||||
const here=path.dirname(new URL(import.meta.url).pathname);
|
||||
const outDir=path.join(here,'.frames');
|
||||
fs.mkdirSync(outDir,{recursive:true});
|
||||
const start=Number(process.argv[2]||0);
|
||||
const end=Number(process.argv[3]||252);
|
||||
const chrome='/Applications/Google Chrome.app/Contents/MacOS/Google Chrome';
|
||||
const port=9333+start;
|
||||
const profile='/tmp/droiddeck-boot-chrome-'+process.pid+'-'+start;
|
||||
fs.rmSync(profile,{recursive:true,force:true});
|
||||
const pageUrl='file://'+path.join(here,'boot.html');
|
||||
const child=spawn(chrome,[
|
||||
'--headless=new','--hide-scrollbars','--disable-sync','--no-first-run',
|
||||
'--disable-background-networking','--disable-component-update',
|
||||
`--remote-debugging-port=${port}`,`--user-data-dir=${profile}`,
|
||||
'--window-size=1920,1080',pageUrl
|
||||
],{stdio:'ignore'});
|
||||
|
||||
const sleep=ms=>new Promise(r=>setTimeout(r,ms));
|
||||
let wsUrl;
|
||||
for(let i=0;i<80;i++){
|
||||
try{
|
||||
const pages=await (await fetch(`http://127.0.0.1:${port}/json`)).json();
|
||||
wsUrl=pages.find(p=>p.type==='page')?.webSocketDebuggerUrl;
|
||||
if(wsUrl) break;
|
||||
}catch{}
|
||||
await sleep(100);
|
||||
}
|
||||
if(!wsUrl) throw new Error('Chrome DevTools endpoint did not start');
|
||||
const ws=new WebSocket(wsUrl);
|
||||
await new Promise((resolve,reject)=>{ws.onopen=resolve;ws.onerror=reject});
|
||||
let nextId=1;
|
||||
const pending=new Map();
|
||||
ws.onmessage=e=>{
|
||||
const msg=JSON.parse(e.data);
|
||||
if(msg.id && pending.has(msg.id)){
|
||||
const {resolve,reject}=pending.get(msg.id); pending.delete(msg.id);
|
||||
msg.error ? reject(new Error(JSON.stringify(msg.error))) : resolve(msg.result);
|
||||
}
|
||||
};
|
||||
function send(method,params={}){
|
||||
const id=nextId++;
|
||||
ws.send(JSON.stringify({id,method,params}));
|
||||
return new Promise((resolve,reject)=>pending.set(id,{resolve,reject}));
|
||||
}
|
||||
await send('Page.enable');
|
||||
await send('Runtime.enable');
|
||||
await send('Emulation.setDeviceMetricsOverride',{width:1920,height:1080,deviceScaleFactor:1,mobile:false});
|
||||
await sleep(300);
|
||||
|
||||
const fps=60, duration=4.2, frames=Math.ceil(fps*duration);
|
||||
for(let i=start;i<Math.min(end,frames);i++){
|
||||
const t=i/fps;
|
||||
await send('Runtime.evaluate',{expression:`window.setBootTime(${t.toFixed(6)})`,awaitPromise:true});
|
||||
const shot=await send('Page.captureScreenshot',{format:'png',fromSurface:true,captureBeyondViewport:false});
|
||||
fs.writeFileSync(path.join(outDir,String(i).padStart(4,'0')+'.png'),Buffer.from(shot.data,'base64'));
|
||||
if(i%30===0) process.stdout.write(`rendered ${i}/${frames}\n`);
|
||||
}
|
||||
ws.close();
|
||||
child.kill('SIGTERM');
|
||||
console.log(`done: ${start}-${Math.min(end,frames)-1}`);
|
||||
@@ -16,6 +16,17 @@ library list, before anything is published.
|
||||
3.16.29: realtime-priority Vulkan queues on request (`GAMESCOPE_FORCE_VULKAN_REALTIME=1`)
|
||||
without CAP_SYS_NICE, which proot can never have; and the gamepad-driven cursor sprite following
|
||||
the X pointer that XTest moves (it sat frozen).
|
||||
- `0110-wayland-backend-touch.patch` - this app: the nested Wayland backend bound only the host's
|
||||
pointer and keyboard, so a finger on the phone's screen never reached Steam. It now binds
|
||||
`wl_touch` too and hands each finger to wlserver's touch path (`wlserver_touchdown` / `motion` /
|
||||
`up`) - the one a Steam Deck's touchscreen drives - so what a touch does follows the client's
|
||||
touch mode (Steam's Big Picture sets Passthrough: a real touch, rows scroll under a finger).
|
||||
Finger ids are offset by one, since the nested pointer already moves wlserver's touch 0.
|
||||
- `0111-wayland-pointer-warps-in-passthrough.patch` - this app: the nested pointer's motion goes to
|
||||
wlserver as touch 0, and in Passthrough (Big Picture's touch mode) a motion for a touch that is not
|
||||
down moves nothing - so in the app's touchpad mode the Steam client saw no hover and a click landed
|
||||
wherever the pointer had last been. The motion now always warps the real pointer as well
|
||||
(`bAlwaysWarpCursor`), which the other touch modes did already.
|
||||
|
||||
Sixteen more of Armada's patches are DRM/lease/HDR-on-KMS work for a native display, which this
|
||||
app's Wayland-hosted gamescope never reaches, or need a newer gamescope than the runtime has.
|
||||
@@ -0,0 +1,121 @@
|
||||
diff --git a/src/Backends/WaylandBackend.cpp b/src/Backends/WaylandBackend.cpp
|
||||
index d74268b..bf72267 100644
|
||||
--- a/src/Backends/WaylandBackend.cpp
|
||||
+++ b/src/Backends/WaylandBackend.cpp
|
||||
@@ -601,6 +601,17 @@ namespace gamescope
|
||||
void Wayland_Keyboard_RepeatInfo( wl_keyboard *pKeyboard, int32_t nRate, int32_t nDelay );
|
||||
static const wl_keyboard_listener s_KeyboardListener;
|
||||
|
||||
+ // Touch from the host compositor (DroidDeck): each finger goes to wlserver's touch path,
|
||||
+ // the one a Steam Deck's touchscreen drives, instead of being dropped.
|
||||
+ void Wayland_Touch_Down( wl_touch *pTouch, uint32_t uSerial, uint32_t uTime, wl_surface *pSurface, int32_t nId, wl_fixed_t fX, wl_fixed_t fY );
|
||||
+ void Wayland_Touch_Up( wl_touch *pTouch, uint32_t uSerial, uint32_t uTime, int32_t nId );
|
||||
+ void Wayland_Touch_Motion( wl_touch *pTouch, uint32_t uTime, int32_t nId, wl_fixed_t fX, wl_fixed_t fY );
|
||||
+ void Wayland_Touch_Frame( wl_touch *pTouch );
|
||||
+ void Wayland_Touch_Cancel( wl_touch *pTouch );
|
||||
+ static const wl_touch_listener s_TouchListener;
|
||||
+ bool TouchToOutput( wl_surface *pSurface, wl_fixed_t fX, wl_fixed_t fY, double *pflX, double *pflY );
|
||||
+ std::unordered_map<int32_t, wl_surface *> m_TouchSurfaces;
|
||||
+
|
||||
void Wayland_RelativePointer_RelativeMotion( zwp_relative_pointer_v1 *pRelativePointer, uint32_t uTimeHi, uint32_t uTimeLo, wl_fixed_t fDx, wl_fixed_t fDy, wl_fixed_t fDxUnaccel, wl_fixed_t fDyUnaccel );
|
||||
static const zwp_relative_pointer_v1_listener s_RelativePointerListener;
|
||||
};
|
||||
@@ -636,6 +647,16 @@ namespace gamescope
|
||||
.modifiers = WAYLAND_USERDATA_TO_THIS( CWaylandInputThread, Wayland_Keyboard_Modifiers ),
|
||||
.repeat_info = WAYLAND_USERDATA_TO_THIS( CWaylandInputThread, Wayland_Keyboard_RepeatInfo ),
|
||||
};
|
||||
+ const wl_touch_listener CWaylandInputThread::s_TouchListener =
|
||||
+ {
|
||||
+ .down = WAYLAND_USERDATA_TO_THIS( CWaylandInputThread, Wayland_Touch_Down ),
|
||||
+ .up = WAYLAND_USERDATA_TO_THIS( CWaylandInputThread, Wayland_Touch_Up ),
|
||||
+ .motion = WAYLAND_USERDATA_TO_THIS( CWaylandInputThread, Wayland_Touch_Motion ),
|
||||
+ .frame = WAYLAND_USERDATA_TO_THIS( CWaylandInputThread, Wayland_Touch_Frame ),
|
||||
+ .cancel = WAYLAND_USERDATA_TO_THIS( CWaylandInputThread, Wayland_Touch_Cancel ),
|
||||
+ .shape = WAYLAND_NULL(),
|
||||
+ .orientation = WAYLAND_NULL(),
|
||||
+ };
|
||||
const zwp_relative_pointer_v1_listener CWaylandInputThread::s_RelativePointerListener =
|
||||
{
|
||||
.relative_motion = WAYLAND_USERDATA_TO_THIS( CWaylandInputThread, Wayland_RelativePointer_RelativeMotion ),
|
||||
@@ -3067,6 +3088,81 @@ namespace gamescope
|
||||
wl_keyboard_add_listener( m_pKeyboard, &s_KeyboardListener, this );
|
||||
}
|
||||
}
|
||||
+
|
||||
+ if ( !!( uCapabilities & WL_SEAT_CAPABILITY_TOUCH ) != !!m_pTouch )
|
||||
+ {
|
||||
+ if ( m_pTouch )
|
||||
+ {
|
||||
+ wl_touch_release( m_pTouch );
|
||||
+ m_pTouch = nullptr;
|
||||
+ m_TouchSurfaces.clear();
|
||||
+ }
|
||||
+ else
|
||||
+ {
|
||||
+ m_pTouch = wl_seat_get_touch( m_pSeat );
|
||||
+ wl_touch_add_listener( m_pTouch, &s_TouchListener, this );
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ // Touch
|
||||
+
|
||||
+ bool CWaylandInputThread::TouchToOutput( wl_surface *pSurface, wl_fixed_t fX, wl_fixed_t fY, double *pflX, double *pflY )
|
||||
+ {
|
||||
+ if ( !pSurface || !IsGamescopeToplevel( pSurface ) )
|
||||
+ return false;
|
||||
+ CWaylandPlane *pPlane = (CWaylandPlane *)wl_surface_get_user_data( pSurface );
|
||||
+ if ( !pPlane )
|
||||
+ return false;
|
||||
+ auto oState = pPlane->GetCurrentState();
|
||||
+ if ( !oState || !g_nOutputWidth || !g_nOutputHeight )
|
||||
+ return false;
|
||||
+ uint32_t uScale = oState->uFractionalScale;
|
||||
+ *pflX = ( wl_fixed_to_double( fX ) * uScale / 120.0 + oState->nDestX ) / g_nOutputWidth;
|
||||
+ *pflY = ( wl_fixed_to_double( fY ) * uScale / 120.0 + oState->nDestY ) / g_nOutputHeight;
|
||||
+ return true;
|
||||
+ }
|
||||
+ // Touch ids are offset by one: the nested pointer already moves wlserver's touch 0.
|
||||
+ void CWaylandInputThread::Wayland_Touch_Down( wl_touch *pTouch, uint32_t uSerial, uint32_t uTime, wl_surface *pSurface, int32_t nId, wl_fixed_t fX, wl_fixed_t fY )
|
||||
+ {
|
||||
+ double flX, flY;
|
||||
+ if ( !TouchToOutput( pSurface, fX, fY, &flX, &flY ) )
|
||||
+ return;
|
||||
+ m_TouchSurfaces[ nId ] = pSurface;
|
||||
+ wlserver_lock();
|
||||
+ wlserver_touchdown( flX, flY, nId + 1, ++m_uFakeTimestamp );
|
||||
+ wlserver_unlock();
|
||||
+ }
|
||||
+ void CWaylandInputThread::Wayland_Touch_Up( wl_touch *pTouch, uint32_t uSerial, uint32_t uTime, int32_t nId )
|
||||
+ {
|
||||
+ if ( m_TouchSurfaces.erase( nId ) == 0 )
|
||||
+ return;
|
||||
+ wlserver_lock();
|
||||
+ wlserver_touchup( nId + 1, ++m_uFakeTimestamp );
|
||||
+ wlserver_unlock();
|
||||
+ }
|
||||
+ void CWaylandInputThread::Wayland_Touch_Motion( wl_touch *pTouch, uint32_t uTime, int32_t nId, wl_fixed_t fX, wl_fixed_t fY )
|
||||
+ {
|
||||
+ auto it = m_TouchSurfaces.find( nId );
|
||||
+ if ( it == m_TouchSurfaces.end() )
|
||||
+ return;
|
||||
+ double flX, flY;
|
||||
+ if ( !TouchToOutput( it->second, fX, fY, &flX, &flY ) )
|
||||
+ return;
|
||||
+ wlserver_lock();
|
||||
+ wlserver_touchmotion( flX, flY, nId + 1, ++m_uFakeTimestamp );
|
||||
+ wlserver_unlock();
|
||||
+ }
|
||||
+ void CWaylandInputThread::Wayland_Touch_Frame( wl_touch *pTouch )
|
||||
+ {
|
||||
+ }
|
||||
+ void CWaylandInputThread::Wayland_Touch_Cancel( wl_touch *pTouch )
|
||||
+ {
|
||||
+ wlserver_lock();
|
||||
+ for ( auto &[ nId, pSurface ] : m_TouchSurfaces )
|
||||
+ wlserver_touchup( nId + 1, ++m_uFakeTimestamp );
|
||||
+ wlserver_unlock();
|
||||
+ m_TouchSurfaces.clear();
|
||||
}
|
||||
|
||||
void CWaylandInputThread::Wayland_Seat_Name( wl_seat *pSeat, const char *pName )
|
||||
@@ -0,0 +1,16 @@
|
||||
diff --git a/src/Backends/WaylandBackend.cpp b/src/Backends/WaylandBackend.cpp
|
||||
index bf72267..c400978 100644
|
||||
--- a/src/Backends/WaylandBackend.cpp
|
||||
+++ b/src/Backends/WaylandBackend.cpp
|
||||
@@ -3223,7 +3223,10 @@ namespace gamescope
|
||||
double flY = ( wl_fixed_to_double( fSurfaceY ) * uScale / 120.0 + oState->nDestY ) / g_nOutputHeight;
|
||||
|
||||
wlserver_lock();
|
||||
- wlserver_touchmotion( flX, flY, 0, ++m_uFakeTimestamp );
|
||||
+ // Always move the real pointer too: in Passthrough (what Steam's Big Picture asks for) a
|
||||
+ // touch motion for an id that is not down moves nothing, so hover never reached the
|
||||
+ // client and a click landed wherever the pointer had last been.
|
||||
+ wlserver_touchmotion( flX, flY, 0, ++m_uFakeTimestamp, true );
|
||||
wlserver_unlock();
|
||||
}
|
||||
void CWaylandInputThread::Wayland_Pointer_Button( wl_pointer *pPointer, uint32_t uSerial, uint32_t uTime, uint32_t uButton, uint32_t uState )
|
||||
@@ -1,2 +1,2 @@
|
||||
GAMESCOPE_TAG=gamescope-3.16.29-p1
|
||||
GAMESCOPE_SHA256=522d1835d84e4a64a843e095bbe341f68b10f8467f38c0e72ae4ef20b675b873
|
||||
GAMESCOPE_TAG=gamescope-3.16.29-p3
|
||||
GAMESCOPE_SHA256=566e3b93931f37c30375d440d15ee76452892b842d2dc854cd3c06b926c8451b
|
||||
Reference in new issue
Block a user