-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce floating & fullscreen modes (#144)
* add fullscreen compositor demo * Start experimenting with always fullscreen mode * update deps * update docs * start adding wasm gtk4 build * fix breakage due to emscripten change * fix sdk bugs + get rid of examples http-proxy setup * fix eslint * remove pipx * update yarn * update docker file
- Loading branch information
Showing
805 changed files
with
160,021 additions
and
5,347 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
plugins: | ||
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs | ||
spec: "@yarnpkg/plugin-workspace-tools" | ||
compressionLevel: mixed | ||
|
||
enableGlobalCache: false | ||
|
||
yarnPath: .yarn/releases/yarn-3.6.3.cjs | ||
nodeLinker: pnpm | ||
|
||
npmPublishAccess: public | ||
|
||
npmRegistryServer: "https://registry.npmjs.org/" | ||
#npmAuthToken: ${TOKEN} | ||
|
||
yarnPath: .yarn/releases/yarn-4.5.0.cjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
About | ||
= | ||
|
||
Example of a compositor running a single remote GTK4 demo application. The GTK4 demo application is expected to be | ||
provided externally by a compositor-proxy, e.g. `packages/compositor-proxy-cli` in this repo. | ||
|
||
Running | ||
= | ||
|
||
- `yarn install` | ||
- `yarn start` | ||
- Go to `http://localhost:8080` | ||
|
||
The remote url is hard-coded inside `src/index.ts` as `http://localhost:8081/gtk4-demo` but can easily be adjusted to e.g. `https://my.domain.com/someapp` in case | ||
you want to run your own remote compositor-proxy. | ||
|
||
The fullscreen application can be installed as a [Progressive Web App](https://en.wikipedia.org/wiki/Progressive_web_app) or PWA by browsers that support it. | ||
When installed as a PWA, the application will still be running remotely but will be integrated as it were a local application. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<title>New Application</title> | ||
<link rel="manifest" href="/app.webmanifest"> | ||
<style> | ||
* { margin:0; padding:0; } | ||
html, body { width:100%; height:100%; } | ||
canvas { height: 100vh; width: 100vw; display:block; } | ||
</style> | ||
</head> | ||
<body> | ||
<script type="module" src="src/index.ts"></script> | ||
<canvas id="output"></canvas> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"name": "@gfld/example-canvas-compositor", | ||
"version": "1.0.0-rc1", | ||
"type": "module", | ||
"description": "HTML5 Wayland Demo Web Client Simple Shm", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/udevbe/greenfield.git" | ||
}, | ||
"keywords": [ | ||
"wayland", | ||
"html5", | ||
"client", | ||
"demo", | ||
"web" | ||
], | ||
"author": "Erik De Rijcke <[email protected]> (http://www.udev.be)", | ||
"license": "AGPL-3.0", | ||
"bugs": { | ||
"url": "https://github.com/udevbe/greenfield/issues" | ||
}, | ||
"homepage": "https://github.com/udevbe/greenfield#readme", | ||
"scripts": { | ||
"start": "yarn run vite dev", | ||
"build": "yarn run vite build", | ||
"preview": "yarn run vite preview" | ||
}, | ||
"dependencies": { | ||
"@gfld/compositor": "workspace:^" | ||
}, | ||
"devDependencies": { | ||
"typescript": "^5.5.2", | ||
"vite": "^5.3.1", | ||
"vite-plugin-glsl": "^1.3.0" | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
examples/compositor/experimental-fullscreen/public/GTK_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions
11
examples/compositor/experimental-fullscreen/public/app.webmanifest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"name": "gtk4-demo", | ||
"display": "standalone", | ||
"start_url": ".", | ||
"icons": [ | ||
{ | ||
"src": "GTK_logo.svg", | ||
"sizes": "any" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { createAppLauncher, createCompositorSession, initWasm } from '@gfld/compositor' | ||
|
||
const wasmLibs = initWasm() | ||
|
||
async function main() { | ||
await wasmLibs | ||
|
||
// create new compositor context | ||
const session = await createCompositorSession({ mode: 'experimental-fullscreen' }) | ||
// notify user of errors | ||
session.userShell.events.notify = (variant: string, message: string) => window.alert(message) | ||
|
||
// Get an HTML5 canvas for use as an output for the compositor. | ||
const canvas = document.getElementById('output') as HTMLCanvasElement | ||
// hook up the canvas to our compositor | ||
session.userShell.actions.initScene(() => ({ canvas, id: canvas.id })) | ||
// make compositor global protocol objects available to client | ||
session.globals.register() | ||
|
||
const appContext = createAppLauncher(session, 'remote').launch(new URL('http://localhost:8081/gtk4-demo'), (childAppContext) => { | ||
childAppContext.onStateChange = (state) => { | ||
// log child app state | ||
console.log(`Child app is ${state}`) | ||
} | ||
}) | ||
|
||
// log app state | ||
appContext.onStateChange = (state) => { | ||
console.log(`App state is ${state}`) | ||
} | ||
|
||
appContext.onNameChanged = (name) => { | ||
window.document.title = name | ||
} | ||
window.document.title = appContext.name ?? "" | ||
} | ||
|
||
window.onload = () => { | ||
main() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"compilerOptions": { | ||
"moduleResolution": "Node16", | ||
"target": "es2018", | ||
"module": "esnext", | ||
"esModuleInterop": true, | ||
"strict": true, | ||
"sourceMap": true, | ||
"outDir": "dist", | ||
"lib": [ | ||
"dom", | ||
"dom.iterable", | ||
"esnext" | ||
] | ||
}, | ||
"include": ["src"] | ||
} |
15 changes: 15 additions & 0 deletions
15
examples/compositor/experimental-fullscreen/vite.config.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { defineConfig } from "vite"; | ||
|
||
export default defineConfig({ | ||
base: "./", | ||
server: { | ||
host: 'localhost', | ||
port: 8080, | ||
strictPort: true, | ||
cors: false, | ||
headers: { | ||
'Cross-Origin-Opener-Policy': 'same-origin', | ||
'Cross-Origin-Embedder-Policy': 'require-corp', | ||
}, | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Currently broken because of a stack overflow bug. If you're feeling adventurous you can enable the gtk4 build in the sdk and gives this example a try. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import subprocess | ||
import sys | ||
|
||
repodir = sys.argv[1] | ||
profile = sys.argv[2] | ||
|
||
sys.stdout.write("/* This file is auto-generated. Do not edit. */\n") | ||
sys.stdout.write("#pragma once\n") | ||
sys.stdout.write("\n") | ||
sys.stdout.write(f"#define PROFILE \"{profile}\"\n") | ||
|
||
short_sha = os.environ.get('CI_COMMIT_SHORT_SHA') | ||
if short_sha is None: | ||
cmd = ["git", "-C", repodir, "rev-parse", "--short", "HEAD"] | ||
try: | ||
with subprocess.Popen(cmd, stdout=subprocess.PIPE) as p: | ||
short_sha = p.stdout.read().decode('utf-8').rstrip("\n") | ||
except FileNotFoundError: | ||
short_sha = '' | ||
if profile != 'default': | ||
short_sha = 'devel' | ||
|
||
sys.stdout.write(f"#define VCS_TAG \"{short_sha}\"\n") |
Oops, something went wrong.