Improved visible region logic

This commit is contained in:
wheaney 2024-10-09 08:42:59 -07:00
parent 60aa409c8f
commit dbef7f5c80
2 changed files with 18 additions and 8 deletions

View File

@ -255,8 +255,9 @@ export default class BreezyDesktopExtension extends Extension {
this._overlay.set_position(targetMonitor.x, targetMonitor.y);
this._overlay.set_size(targetMonitor.width, targetMonitor.height);
const textureSourceActor = Main.layoutManager.uiGroup;
const overlayContent = new Clutter.Actor({clip_to_allocation: true});
this._ui_clone = new Clutter.Clone({ source: Main.layoutManager.uiGroup });
this._ui_clone = new Clutter.Clone({ source: textureSourceActor });
this._ui_clone.x = -targetMonitor.x;
this._ui_clone.y = -targetMonitor.y;
overlayContent.add_child(this._ui_clone);
@ -280,6 +281,10 @@ export default class BreezyDesktopExtension extends Extension {
this._xr_effect = new XREffect({
target_monitor: targetMonitor,
target_framerate: refreshRate,
texture_monitor_position: {
x: targetMonitor.x - textureSourceActor.x,
y: targetMonitor.y - textureSourceActor.y
},
display_distance: this.settings.get_double('display-distance'),
toggle_display_distance_start: this.settings.get_double('toggle-display-distance-start'),
toggle_display_distance_end: this.settings.get_double('toggle-display-distance-end'),

View File

@ -168,15 +168,14 @@ function setIntermittentUniformVariables() {
texcoordXLimitsRight[1] = 0.75;
}
}
const monitor_coords_relative = [texture_actor.x - this.target_monitor.x, texture_actor.y - this.target_monitor.y];
Globals.logger.log(`texture_actor: ${texture_actor.x}, ${texture_actor.y}, ${texture_actor.width}, ${texture_actor.height}`);
const texcoordVisibleArea = [
monitor_coords_relative[0] / texture_actor.width,
monitor_coords_relative[1] / texture_actor.height,
(monitor_coords_relative[0] + this.target_monitor.width) / texture_actor.width,
(monitor_coords_relative[1] + this.target_monitor.height) / texture_actor.height
this.texture_monitor_position.x / texture_actor.width,
this.texture_monitor_position.y / texture_actor.height,
(this.texture_monitor_position.x + this.target_monitor.width) / texture_actor.width,
(this.texture_monitor_position.y + this.target_monitor.height) / texture_actor.height
]
const lensVector = [lensDistanceRatio, lensFromCenter, 0.0];
@ -184,8 +183,8 @@ function setIntermittentUniformVariables() {
// our overlay doesn't quite cover the full screen texture, which allows us to see some of the real desktop
// underneath, so we trim three pixels around the entire edge of the texture
const trimWidthPercent = 3.0 / this.target_monitor.width;
const trimHeightPercent = 3.0 / this.target_monitor.height;
const trimWidthPercent = 3.0 / texture_actor.width;
const trimHeightPercent = 3.0 / texture_actor.height;
// all these values are transferred directly, unmodified from the driver
transferUniformFloat(this, 'look_ahead_cfg', dataView, LOOK_AHEAD_CFG);
@ -268,6 +267,12 @@ export const XREffect = GObject.registerClass({
'Target framerate for this effect',
GObject.ParamFlags.READWRITE, 30, 240, 60
),
'texture-monitor-position': GObject.ParamSpec.jsobject(
'texture-monitor-position',
'Texture Monitor Position',
'Coordinates of the monitor relative to the target actor texture',
GObject.ParamFlags.READWRITE
),
'display-distance': GObject.ParamSpec.double(
'display-distance',
'Display Distance',