+ // TODO: do we need to keep track of whether we've started a new build/whatever and only toFront if it's our first time through here since then?
Yes, yes we do. If I have, say, revisiontool start Firefox to show me a bug database entry (because I can't get Chrome to work against :1, which doesn't have hardware accelerated graphics, without crashing gnome-shell and I haven't been able to get VNC to work against :0 since Gnome3 in Jessie), then any attempt to select text in Firefox causes this sort of thing to be vomited into the errors window:
(firefox-esr:17750): GLib-GObject-WARNING **: /build/glib2.0-y6934K/glib2.0-2.42.1/./gobject/gsignal.c:3410: signal name 'selection_changed' is invalid for instance '0x7fb8b2988420' of type 'MaiAtkType919'
(firefox-esr:17750): GLib-GObject-WARNING **: /build/glib2.0-y6934K/glib2.0-2.42.1/./gobject/gsignal.c:3410: signal name 'selection_changed' is invalid for instance '0x7fb8b2988420' of type 'MaiAtkType919'
(firefox-esr:17750): GLib-GObject-WARNING **: /build/glib2.0-y6934K/glib2.0-2.42.1/./gobject/gsignal.c:3410: signal name 'selection_changed' is invalid for instance '0x7fb8b2988420' of type 'MaiAtkType919'
(firefox-esr:17750): GLib-GObject-WARNING **: /build/glib2.0-y6934K/glib2.0-2.42.1/./gobject/gsignal.c:3410: signal name 'selection_changed' is invalid for instance '0x7fb8b2988420' of type 'MaiAtkType919'
... which then pops to the front, having an unfortunate effect on the selection that I was trying to make.
I thought just the second part of this would be enough, but it didn't have any effect that I noticed until I reverted your removal of the first condition too:
--- a/evergreen/src/e/edit/EErrorsWindow.java
+++ b/evergreen/src/e/edit/EErrorsWindow.java
@@ -269,11 +269,15 @@ public class EErrorsWindow extends JFrame {
public void run() {
// You always want the errors window visible if there are errors.
- setVisible(true);
+ // This conditional stops the errors window from grabbing the focus every time it's updated.
+ if (isVisible() == false) {
+ setVisible(true);
+ }
- // And you probably want it on top, so it's visible to a human.
- // TODO: do we need to keep track of whether we've started a new build/whatever and only toFront if it's our first time through here since then?
- toFront();
+ // And you want to let the user know that their job produced output.
+ if (textArea.getLineCount() == 0) {
+ toFront();
+ }
textArea.append(text);
if (isStdErr) {
The first bit on its own isn't enough either.