|
|
1669df |
From a9e6da0a18db07b94af30ced5e8c8b56737c9408 Mon Sep 17 00:00:00 2001
|
|
|
1669df |
From: Felipe Borges <felipeborges@gnome.org>
|
|
|
1669df |
Date: Wed, 8 Jul 2020 16:56:02 +0200
|
|
|
1669df |
Subject: [PATCH] machine: Prevent displays from overlapping each other
|
|
|
1669df |
|
|
|
1669df |
When a machine display get connected/disconnected, we need to account
|
|
|
1669df |
for what's the current_item being shown and only perform the widget
|
|
|
1669df |
replacement when the current_item is the one that received those
|
|
|
1669df |
signals.
|
|
|
1669df |
|
|
|
1669df |
This is not an ideal solution if we later decide to support multiple
|
|
|
1669df |
monitors, but it fixes various issues users have now with managing
|
|
|
1669df |
multiple machines at the same time.
|
|
|
1669df |
|
|
|
1669df |
To reproduce the most common of these issues you need:
|
|
|
1669df |
1. Run at least two VMs simultaneously
|
|
|
1669df |
2. Restart one VM
|
|
|
1669df |
3. Jump to another VM
|
|
|
1669df |
4. See the restarting VM take over the display (replacing the
|
|
|
1669df |
current one).
|
|
|
1669df |
---
|
|
|
1669df |
src/machine.vala | 16 +++++++++++-----
|
|
|
1669df |
1 file changed, 11 insertions(+), 5 deletions(-)
|
|
|
1669df |
|
|
|
1669df |
diff --git a/src/machine.vala b/src/machine.vala
|
|
|
1669df |
index 795058f2..7526bdd3 100644
|
|
|
1669df |
--- a/src/machine.vala
|
|
|
1669df |
+++ b/src/machine.vala
|
|
|
1669df |
@@ -161,6 +161,7 @@ protected void show_display () {
|
|
|
1669df |
var widget = display.get_display (0);
|
|
|
1669df |
widget_remove (widget);
|
|
|
1669df |
window.display_page.show_display (display, widget);
|
|
|
1669df |
+ window.topbar.status = this.name;
|
|
|
1669df |
widget.grab_focus ();
|
|
|
1669df |
|
|
|
1669df |
store_auth_credentials ();
|
|
|
1669df |
@@ -203,10 +204,13 @@ protected void show_display () {
|
|
|
1669df |
// Translators: The %s will be expanded with the name of the vm
|
|
|
1669df |
window.topbar.status = _("Connecting to %s").printf (name);
|
|
|
1669df |
|
|
|
1669df |
- show_id = _display.show.connect ((id) => { show_display (); });
|
|
|
1669df |
+ show_id = _display.show.connect ((id) => {
|
|
|
1669df |
+ if (window != null && window.current_item == this)
|
|
|
1669df |
+ show_display ();
|
|
|
1669df |
+ });
|
|
|
1669df |
|
|
|
1669df |
hide_id = _display.hide.connect ((id) => {
|
|
|
1669df |
- if (window != null)
|
|
|
1669df |
+ if (window != null && window.current_item == this)
|
|
|
1669df |
window.display_page.remove_display ();
|
|
|
1669df |
});
|
|
|
1669df |
|
|
|
1669df |
@@ -235,8 +239,9 @@ protected void show_display () {
|
|
|
1669df |
}
|
|
|
1669df |
|
|
|
1669df |
load_screenshot ();
|
|
|
1669df |
-
|
|
|
1669df |
- disconnect_display ();
|
|
|
1669df |
+ if (!stay_on_display) {
|
|
|
1669df |
+ disconnect_display ();
|
|
|
1669df |
+ }
|
|
|
1669df |
});
|
|
|
1669df |
|
|
|
1669df |
need_password_id = _display.notify["need-password"].connect (handle_auth);
|
|
|
1669df |
@@ -402,7 +407,8 @@ public virtual void disconnect_display () {
|
|
|
1669df |
}
|
|
|
1669df |
}
|
|
|
1669df |
|
|
|
1669df |
- window.display_page.remove_display ();
|
|
|
1669df |
+ if (window.current_item == this)
|
|
|
1669df |
+ window.display_page.remove_display ();
|
|
|
1669df |
if (!display.should_keep_alive ()) {
|
|
|
1669df |
display.disconnect_it ();
|
|
|
1669df |
display = null;
|
|
|
1669df |
--
|
|
|
1669df |
2.28.0
|
|
|
1669df |
|