[connections/fix-simultaneous-displays-2: 4/7] display-view: Simplify display widget allocation
- From: Felipe Borges <felipeborges src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [connections/fix-simultaneous-displays-2: 4/7] display-view: Simplify display widget allocation
- Date: Wed, 28 Jul 2021 10:13:22 +0000 (UTC)
commit 5a510de49b0dae703566c35ef518e7f001416a59
Author: Felipe Borges <felipeborges gnome org>
Date: Wed Jul 28 11:45:25 2021 +0200
display-view: Simplify display widget allocation
Each connection has ownership over its display widget, leaving to
the DisplayView object the responsibility of replacing the last
display widget presented with the display the user wants to interact
with at the time.
src/display-view.vala | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/src/display-view.vala b/src/display-view.vala
index 2364023..f008598 100644
--- a/src/display-view.vala
+++ b/src/display-view.vala
@@ -36,7 +36,7 @@ namespace Connections {
[GtkChild]
private unowned Button escape_fullscreen_button;
- private Widget? display;
+ private Connection? connection;
private ulong show_display_id;
@@ -45,21 +45,21 @@ namespace Connections {
}
private void remove_display () {
- if (event_box.get_child () == null)
- return;
-
- display = null;
-
var widget = event_box.get_child ();
if (widget != null)
event_box.remove (widget);
+
+ connection = null;
}
- public void replace_display (Gtk.Widget display) {
- if (event_box.get_child () != null)
- remove_display ();
+ public void replace_display (Connection connection) {
+ if (event_box.get_child () == connection.widget)
+ return;
+
+ remove_display ();
- this.display = display;
+ this.connection = connection;
+ var display = connection.widget;
display.set_events (display.get_events () & ~EventMask.POINTER_MOTION_MASK);
event_box.add (display);
@@ -80,7 +80,7 @@ namespace Connections {
public void connect_to (Connection connection) {
stack.set_visible_child_name ("loading");
- replace_display (connection.widget);
+ replace_display (connection);
if (show_display_id != 0) {
connection.disconnect (show_display_id);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]