Fix display issues with fullscreen game

This commit is contained in:
wheaney 2024-04-06 00:57:46 -04:00
parent 864a468684
commit 2df1ff0cf7
2 changed files with 10 additions and 10 deletions

View File

@ -35,7 +35,6 @@ export class CursorManager {
// listener doesn't receive any events. Adding a small delay before // listener doesn't receive any events. Adding a small delay before
// starting the whole mouse cloning business helps. // starting the whole mouse cloning business helps.
this._enableTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 500, () => { this._enableTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 500, () => {
// Wait 500ms before starting to check for the _brightness object.
this._enableTimeoutId = null; this._enableTimeoutId = null;
this._enable(); this._enable();
return GLib.SOURCE_REMOVE; return GLib.SOURCE_REMOVE;

View File

@ -1,8 +1,8 @@
import Gio from 'gi://Gio'; import Gio from 'gi://Gio';
import GLib from 'gi://GLib'; import GLib from 'gi://GLib';
import GObject from 'gi://GObject'; import GObject from 'gi://GObject';
import Shell from 'gi://Shell';
import Meta from 'gi://Meta'; import Meta from 'gi://Meta';
import Shell from 'gi://Shell';
import { CursorManager } from './cursormanager.js'; import { CursorManager } from './cursormanager.js';
@ -245,10 +245,13 @@ export default class BreezyDesktopExtension extends Extension {
const main = 'PS_IMU_Transform(vec4(0, 0, 0, 0), cogl_tex_coord_in[0].xy, cogl_color_out);'; const main = 'PS_IMU_Transform(vec4(0, 0, 0, 0), cogl_tex_coord_in[0].xy, cogl_color_out);';
this.add_glsl_snippet(Shell.SnippetHook.FRAGMENT, code, main, false); this.add_glsl_snippet(Shell.SnippetHook.FRAGMENT, code, main, false);
this._frametime = 10; // 100 FPS this._frametime = Math.floor(1000 / 90); // 90 FPS
} }
vfunc_paint_target(node, paintContext) { vfunc_paint_target(node, paintContext) {
var now = Date.now();
var lastPaint = this._last_paint || 0;
var frametime = this._frametime;
const data = shared_mem_file.load_contents(null); const data = shared_mem_file.load_contents(null);
if (data[0]) { if (data[0]) {
const buffer = new Uint8Array(data[1]).buffer; const buffer = new Uint8Array(data[1]).buffer;
@ -261,10 +264,8 @@ export default class BreezyDesktopExtension extends Extension {
this.setIntermittentUniformVariables = setIntermittentUniformVariables.bind(this); this.setIntermittentUniformVariables = setIntermittentUniformVariables.bind(this);
this.setIntermittentUniformVariables(); this.setIntermittentUniformVariables();
this._repaint_needed = false;
GLib.timeout_add(GLib.PRIORITY_DEFAULT, this._frametime, () => { GLib.timeout_add(GLib.PRIORITY_DEFAULT, this._frametime, () => {
this._repaint_needed = true; if ((now - lastPaint) > frametime) global.stage.queue_redraw();
this.queue_repaint();
return GLib.SOURCE_CONTINUE; return GLib.SOURCE_CONTINUE;
}); });
@ -281,11 +282,11 @@ export default class BreezyDesktopExtension extends Extension {
console.error(`Invalid dataView.byteLength: ${this._dataView.byteLength} !== ${DATA_VIEW_LENGTH}`) console.error(`Invalid dataView.byteLength: ${this._dataView.byteLength} !== ${DATA_VIEW_LENGTH}`)
} }
if (this._repaint_needed) { super.vfunc_paint_target(node, paintContext);
super.vfunc_paint_target(node, paintContext); } else {
this._repaint_needed = false; super.vfunc_paint_target(node, paintContext);
}
} }
this._last_paint = now;
} }
}); });