From 2df1ff0cf7c47ed853ec02e391e6cdccb02c5a73 Mon Sep 17 00:00:00 2001 From: wheaney <42350981+wheaney@users.noreply.github.com> Date: Sat, 6 Apr 2024 00:57:46 -0400 Subject: [PATCH] Fix display issues with fullscreen game --- .../cursormanager.js | 1 - .../breezydesktop@org.xronlinux/extension.js | 19 ++++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/gnome/breezydesktop@org.xronlinux/cursormanager.js b/gnome/breezydesktop@org.xronlinux/cursormanager.js index fa5b5df..71e346d 100644 --- a/gnome/breezydesktop@org.xronlinux/cursormanager.js +++ b/gnome/breezydesktop@org.xronlinux/cursormanager.js @@ -35,7 +35,6 @@ export class CursorManager { // listener doesn't receive any events. Adding a small delay before // starting the whole mouse cloning business helps. this._enableTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT, 500, () => { - // Wait 500ms before starting to check for the _brightness object. this._enableTimeoutId = null; this._enable(); return GLib.SOURCE_REMOVE; diff --git a/gnome/breezydesktop@org.xronlinux/extension.js b/gnome/breezydesktop@org.xronlinux/extension.js index 8040e17..58978b7 100644 --- a/gnome/breezydesktop@org.xronlinux/extension.js +++ b/gnome/breezydesktop@org.xronlinux/extension.js @@ -1,8 +1,8 @@ import Gio from 'gi://Gio'; import GLib from 'gi://GLib'; import GObject from 'gi://GObject'; -import Shell from 'gi://Shell'; import Meta from 'gi://Meta'; +import Shell from 'gi://Shell'; 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);'; 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) { + var now = Date.now(); + var lastPaint = this._last_paint || 0; + var frametime = this._frametime; const data = shared_mem_file.load_contents(null); if (data[0]) { const buffer = new Uint8Array(data[1]).buffer; @@ -261,10 +264,8 @@ export default class BreezyDesktopExtension extends Extension { this.setIntermittentUniformVariables = setIntermittentUniformVariables.bind(this); this.setIntermittentUniformVariables(); - this._repaint_needed = false; GLib.timeout_add(GLib.PRIORITY_DEFAULT, this._frametime, () => { - this._repaint_needed = true; - this.queue_repaint(); + if ((now - lastPaint) > frametime) global.stage.queue_redraw(); 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}`) } - if (this._repaint_needed) { - super.vfunc_paint_target(node, paintContext); - this._repaint_needed = false; - } + super.vfunc_paint_target(node, paintContext); + } else { + super.vfunc_paint_target(node, paintContext); } + this._last_paint = now; } });