Tie some unused settings into the effect, add 1440p virtual monitor button
This commit is contained in:
parent
6b5c0dc307
commit
a31095a9de
|
|
@ -63,6 +63,7 @@ export default class BreezyDesktopExtension extends Extension {
|
|||
this._display_size_binding = null;
|
||||
this._look_ahead_override_binding = null;
|
||||
this._disable_anti_aliasing_binding = null;
|
||||
this._framerate_cap_binding = null;
|
||||
this._optimal_monitor_config_binding = null;
|
||||
this._headset_as_primary_binding = null;
|
||||
this._actor_added_connection = null;
|
||||
|
|
@ -346,10 +347,10 @@ export default class BreezyDesktopExtension extends Extension {
|
|||
this._start_binding = this.settings.bind('toggle-display-distance-start', this._overlay_content, 'toggle-display-distance-start', Gio.SettingsBindFlags.DEFAULT)
|
||||
this._end_binding = this.settings.bind('toggle-display-distance-end', this._overlay_content, 'toggle-display-distance-end', Gio.SettingsBindFlags.DEFAULT);
|
||||
this._display_size_binding = this.settings.bind('display-size', this._overlay_content, 'display-size', Gio.SettingsBindFlags.DEFAULT);
|
||||
this._framerate_cap_binding = this.settings.bind('framerate-cap', this._overlay_content, 'framerate-cap', Gio.SettingsBindFlags.DEFAULT);
|
||||
// this._curved_display_binding = this.settings.bind('curved-display', this._xr_effect, 'curved-display', Gio.SettingsBindFlags.DEFAULT)
|
||||
// this._display_size_binding = this.settings.bind('display-size', this._xr_effect, 'display-size', Gio.SettingsBindFlags.DEFAULT);
|
||||
// this._look_ahead_override_binding = this.settings.bind('look-ahead-override', this._xr_effect, 'look-ahead-override', Gio.SettingsBindFlags.DEFAULT);
|
||||
// this._disable_anti_aliasing_binding = this.settings.bind('disable-anti-aliasing', this._xr_effect, 'disable-anti-aliasing', Gio.SettingsBindFlags.DEFAULT);
|
||||
this._look_ahead_override_binding = this.settings.bind('look-ahead-override', this._overlay_content, 'look-ahead-override', Gio.SettingsBindFlags.DEFAULT);
|
||||
this._disable_anti_aliasing_binding = this.settings.bind('disable-anti-aliasing', this._overlay_content, 'disable-anti-aliasing', Gio.SettingsBindFlags.DEFAULT);
|
||||
|
||||
Meta.disable_unredirect_for_display(global.display);
|
||||
|
||||
|
|
@ -586,11 +587,11 @@ export default class BreezyDesktopExtension extends Extension {
|
|||
Meta.enable_unredirect_for_display(global.display);
|
||||
|
||||
if (this._actor_added_connection) {
|
||||
Main.layoutManager.uiGroup.disconnect(this._actor_added_connection);
|
||||
global.stage.disconnect(this._actor_added_connection);
|
||||
this._actor_added_connection = null;
|
||||
}
|
||||
if (this._actor_removed_connection) {
|
||||
Main.layoutManager.uiGroup.disconnect(this._actor_removed_connection);
|
||||
global.stage.disconnect(this._actor_removed_connection);
|
||||
this._actor_removed_connection = null;
|
||||
}
|
||||
if (this._distance_binding) {
|
||||
|
|
@ -653,6 +654,10 @@ export default class BreezyDesktopExtension extends Extension {
|
|||
this.settings.unbind(this._disable_anti_aliasing_binding);
|
||||
this._disable_anti_aliasing_binding = null;
|
||||
}
|
||||
if (this._framerate_cap_binding) {
|
||||
this.settings.unbind(this._framerate_cap_binding);
|
||||
this._framerate_cap_binding = null;
|
||||
}
|
||||
if (this._overlay) {
|
||||
global.stage.remove_child(this._overlay);
|
||||
this._overlay.destroy();
|
||||
|
|
|
|||
|
|
@ -397,6 +397,13 @@ export const VirtualMonitorEffect = GObject.registerClass({
|
|||
'Whether this monitor is the closest to the camera',
|
||||
GObject.ParamFlags.READWRITE,
|
||||
false
|
||||
),
|
||||
'disable-anti-aliasing': GObject.ParamSpec.boolean(
|
||||
'disable-anti-aliasing',
|
||||
'Disable anti-aliasing',
|
||||
'Disable anti-aliasing for the effect',
|
||||
GObject.ParamFlags.READWRITE,
|
||||
false
|
||||
)
|
||||
}
|
||||
}, class VirtualMonitorEffect extends Shell.GLSLEffect {
|
||||
|
|
@ -612,11 +619,15 @@ export const VirtualMonitorEffect = GObject.registerClass({
|
|||
this.set_uniform_float(this.get_uniform_location('u_look_ahead_ms'), 1, [lookAheadMS(this.imu_snapshots.timestamp_ms, 5)]);
|
||||
this.set_uniform_matrix(this.get_uniform_location("u_imu_data"), false, 4, this.imu_snapshots.imu_data);
|
||||
|
||||
this.get_pipeline().set_layer_filters(
|
||||
0,
|
||||
Cogl.PipelineFilter.LINEAR_MIPMAP_LINEAR,
|
||||
Cogl.PipelineFilter.LINEAR
|
||||
);
|
||||
|
||||
if (!this.disable_anti_aliasing) {
|
||||
// improves sampling quality for smooth text and edges
|
||||
this.get_pipeline().set_layer_filters(
|
||||
0,
|
||||
Cogl.PipelineFilter.LINEAR_MIPMAP_LINEAR,
|
||||
Cogl.PipelineFilter.LINEAR
|
||||
);
|
||||
}
|
||||
|
||||
super.vfunc_paint_target(node, paintContext);
|
||||
}
|
||||
|
|
@ -719,12 +730,28 @@ export const VirtualMonitorsActor = GObject.registerClass({
|
|||
2.5,
|
||||
1.05
|
||||
),
|
||||
'target-framerate': GObject.ParamSpec.double(
|
||||
'target-framerate',
|
||||
'Target Framerate',
|
||||
'Target framerate for the virtual monitors',
|
||||
'framerate-cap': GObject.ParamSpec.double(
|
||||
'framerate-cap',
|
||||
'Framerate Cap',
|
||||
'Maximum framerate to render at',
|
||||
GObject.ParamFlags.READWRITE,
|
||||
1.0, 120.0, 60.0
|
||||
1.0, 240.0, 60.0
|
||||
),
|
||||
'look-ahead-override': GObject.ParamSpec.int(
|
||||
'look-ahead-override',
|
||||
'Look ahead override',
|
||||
'Override the look ahead value',
|
||||
GObject.ParamFlags.READWRITE,
|
||||
-1,
|
||||
45,
|
||||
-1
|
||||
),
|
||||
'disable-anti-aliasing': GObject.ParamSpec.boolean(
|
||||
'disable-anti-aliasing',
|
||||
'Disable anti-aliasing',
|
||||
'Disable anti-aliasing for the effect',
|
||||
GObject.ParamFlags.READWRITE,
|
||||
false
|
||||
)
|
||||
}
|
||||
}, class VirtualMonitorsActor extends Clutter.Actor {
|
||||
|
|
@ -733,7 +760,7 @@ export const VirtualMonitorsActor = GObject.registerClass({
|
|||
|
||||
this.width = this.target_monitor.width;
|
||||
this.height = this.target_monitor.height;
|
||||
this._frametime_ms = Math.floor(1000 / (this.target_framerate ?? 60.0));
|
||||
this._cap_frametime_ms = Math.floor(1000 / this.framerate_cap);
|
||||
|
||||
this._all_monitors = [
|
||||
this.target_monitor,
|
||||
|
|
@ -796,6 +823,7 @@ export const VirtualMonitorsActor = GObject.registerClass({
|
|||
this.bind_property('imu-snapshots', effect, 'imu-snapshots', GObject.BindingFlags.DEFAULT);
|
||||
this.bind_property('focused-monitor-index', effect, 'focused-monitor-index', GObject.BindingFlags.DEFAULT);
|
||||
this.bind_property('display-distance', effect, 'display-distance', GObject.BindingFlags.DEFAULT);
|
||||
this.bind_property('disable-anti-aliasing', effect, 'disable-anti-aliasing', GObject.BindingFlags.DEFAULT);
|
||||
|
||||
const updateEffectDistanceDefault = (() => {
|
||||
effect.display_distance_default = this._display_distance_default();
|
||||
|
|
@ -828,7 +856,7 @@ export const VirtualMonitorsActor = GObject.registerClass({
|
|||
this._redraw_timeline = Clutter.Timeline.new_for_actor(this, 1000);
|
||||
this._redraw_timeline.connect('new-frame', (() => {
|
||||
// let's try to cap the forced redraw rate
|
||||
if (this._last_redraw !== undefined && Date.now() - this._last_redraw < this._frametime_ms) return;
|
||||
if (this._last_redraw !== undefined && Date.now() - this._last_redraw < this._cap_frametime_ms) return;
|
||||
|
||||
Globals.data_stream.refresh_data();
|
||||
this.imu_snapshots = Globals.data_stream.imu_snapshots;
|
||||
|
|
|
|||
|
|
@ -225,6 +225,15 @@
|
|||
<description>
|
||||
Custom monitor product
|
||||
</description>
|
||||
</key>
|
||||
<key name="framerate-cap" type="i">
|
||||
<default>
|
||||
0
|
||||
</default>
|
||||
<summary>Framerate cap</summary>
|
||||
<description>
|
||||
Framerate cap
|
||||
</description>
|
||||
</key>
|
||||
</schema>
|
||||
</schemalist>
|
||||
|
|
|
|||
|
|
@ -32,7 +32,8 @@ class ConnectedDevice(Gtk.Box):
|
|||
# widescreen_mode_switch = Gtk.Template.Child()
|
||||
# widescreen_mode_row = Gtk.Template.Child()
|
||||
# curved_display_switch = Gtk.Template.Child()
|
||||
add_virtual_display_button = Gtk.Template.Child()
|
||||
add_virtual_display_button_1080p = Gtk.Template.Child()
|
||||
add_virtual_display_button_1440p = Gtk.Template.Child()
|
||||
set_toggle_display_distance_start_button = Gtk.Template.Child()
|
||||
set_toggle_display_distance_end_button = Gtk.Template.Child()
|
||||
reassign_toggle_xr_effect_shortcut_button = Gtk.Template.Child()
|
||||
|
|
@ -70,7 +71,8 @@ class ConnectedDevice(Gtk.Box):
|
|||
# self.follow_mode_switch,
|
||||
# self.follow_threshold_scale,
|
||||
# self.curved_display_switch,
|
||||
# self.add_virtual_display_button,
|
||||
self.add_virtual_display_button_1080p,
|
||||
self.add_virtual_display_button_1440p,
|
||||
self.set_toggle_display_distance_start_button,
|
||||
self.set_toggle_display_distance_end_button,
|
||||
self.movement_look_ahead_scale,
|
||||
|
|
@ -114,7 +116,8 @@ class ConnectedDevice(Gtk.Box):
|
|||
self.set_toggle_display_distance_start_button,
|
||||
self.set_toggle_display_distance_end_button
|
||||
])
|
||||
self.add_virtual_display_button.connect('clicked', self.on_add_virtual_display)
|
||||
self.add_virtual_display_button_1080p.connect('clicked', lambda *args: self.on_add_virtual_display(1920, 1080))
|
||||
self.add_virtual_display_button_1440p.connect('clicked', lambda *args: self.on_add_virtual_display(2560, 1440))
|
||||
|
||||
self.state_manager = StateManager.get_instance()
|
||||
# self.state_manager.bind_property('follow-mode', self.follow_mode_switch, 'active', GObject.BindingFlags.DEFAULT)
|
||||
|
|
@ -202,8 +205,8 @@ class ConnectedDevice(Gtk.Box):
|
|||
widget.connect('clicked', lambda *args, widget=widget: on_set_display_distance_toggle(widget))
|
||||
reload_display_distance_toggle_button(widget)
|
||||
|
||||
def on_add_virtual_display(self, widget):
|
||||
VirtualMonitor(1920, 1080, self.on_virtual_display_ready).create()
|
||||
def on_add_virtual_display(self, width, height):
|
||||
VirtualMonitor(width, height, self.on_virtual_display_ready).create()
|
||||
|
||||
def on_virtual_display_ready(self):
|
||||
logger.info("Virtual display ready")
|
||||
|
|
|
|||
|
|
@ -54,11 +54,26 @@
|
|||
<object class="AdwActionRow">
|
||||
<property name="title" translatable="yes"><!-- adjustment slider -->Virtual monitors</property>
|
||||
<property name="valign">2</property>
|
||||
<property name="valign">2</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="add_virtual_display_button">
|
||||
<property name="name">add-virtual-display</property>
|
||||
<property name="valign">3</property>
|
||||
<property name="label" translatable="yes">Add</property>
|
||||
<object class="GtkBox">
|
||||
<property name="spacing">30</property>
|
||||
<property name="width-request">150</property>
|
||||
<property name="margin-start">30</property>
|
||||
<child>
|
||||
<object class="GtkButton" id="add_virtual_display_button_1080p">
|
||||
<property name="name">add-virtual-display</property>
|
||||
<property name="valign">3</property>
|
||||
<property name="label" translatable="yes">Add 1080p</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="add_virtual_display_button_1440p">
|
||||
<property name="name">add-virtual-display</property>
|
||||
<property name="valign">3</property>
|
||||
<property name="label" translatable="yes">Add 1440p</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
|||
Loading…
Reference in New Issue