Right click and "hide on lose focus"

Bug #843674 reported by Alin Andrei on 2011-09-07
This bug affects 2 people
Affects Status Importance Assigned to Milestone

Bug Description

I really like the new "quake mode" using the "hide window" keybinding and "hide on lose focus" in the latest BZR. However, when enabling "hide on lose focus", if I right click Terminator, the terminal window is hidden - this shouldn't happen on right click. At least, that's the behavior with other terminals that have this option such as Quake and it makes sens not to hide on right click since I'm interacting with Terminator, not some other window.

Chris Jones (cmsj) on 2011-09-23
Changed in terminator:
status: New → Confirmed
importance: Undecided → Medium
Chris Jones (cmsj) on 2013-01-30
Changed in terminator:
milestone: none → 1.0
Chris Jones (cmsj) on 2013-02-28
Changed in terminator:
milestone: 1.0 → 2.0
Stephen Boddy (stephen-j-boddy) wrote :

Actually it's worse than the tickets suggests. For me the window also hides itself when I
1) Try to use the group window
2) Move window (titlebar drag, or Alt+left click and drag)
3) Resize the window (borders, or Alt+middle click and drag)
All these actions cause loss of focus and the window vanishes.

Changed in terminator:
importance: Medium → High
Karthik (hashken) wrote :

Another irritating aspect with this is when we access the indicator bar.

The ideal expectation is that the accessing indicators is independent of the workflow of windows, so we would not expect the terminal to become hidden while accessing Indicators.

But, accessing terminators, causes Terminator to lose focus and it becomes hidden.

Stephen Boddy (stephen-j-boddy) wrote :

Hi Bug subscribers, this is the maintainer (Steve Boddy) of Terminator, who took over from Chris.

In case you were not aware there has been a new release 0.98 of Terminator in the last few days which has many changes, fixes and updates. We also have an ongoing GTK3 port which uses a much more up-to-date libvte.

Even with the ~50 issues closed by that release, and discounting the ~90 outstanding wishlist items, we still have an unwieldy 95 bugs. With the oldest approaching it's 6th birthday and some that haven't seen any updates in nearly 5, it is time for a purge.

My intention is to try and get this list down to a minimum, and for that I need your help.

First I'm going to work through, oldest to newest, setting bugs to Incomplete, pending confirmation that they are still an issue. If after a month there is no feedback, the issue will get closed as Invalid. Here's where you come in. I can't always reproduce, or setting up (i.e. other distros) to even test takes a long time, so I'm going to try crowdsourcing this.

1. Get the latest release. Is it still an issue? If yes, set the confirmed-0.98 tag. For bonus points follow the guide http://gnometerminator.blogspot.com/2015/09/so-you-want-to-try-terminator-gtk3.html and see if the GTK3 branch has same issue, and set the confirmed-gtk3 or notaffected-gtk3 tag.

2. Can you reproduce with an empty/default config file? You can pass "-g temp_config" to do this without affecting your existing config. If you already have Terminator running, you'll need to pass -u as well to disable the DBus.

3. If able to, can you reproduce with another user/guest account?

4. If the issue does not already have clear, precise instructions to reproduce with minimal setup/steps, add them.

5. Put as much info about what you are running.
   * Software/library versions (libvte, gtk, pango, cairo, distro, desktop environment, language)
   * Screens (single or multi)
   * Any unusual / custom packages or configs that might be interacting.

6. If possible attach the config file, unless the issue also happens with an empty one, but mention that.

7. Attach the "-d" debug output from 0.98.

Some common things that cause incidents.

* Strange sizing issues or rapidly shrinking windows - Try turning off Window geometry hints.
* Input (esp. broadcasting duplicate chars etc) problems - Try killing IBus.
* Hand editing of the config file can cause various issues - Due to misunderstanding, incorrect structure or typos.
* Some issues are actually in libvte - This is why testing GTK3 is so important.
* segfaults - Unfortunately these are dying inside the C libraries, and it is usually beyond me to fix those.

Many thanks for your assistance, and hopefully this will get us closer to a bug-free Terminator.

Changed in terminator:
status: Confirmed → Incomplete
Stephen Boddy (stephen-j-boddy) wrote :

Some possible workaround thoughts:

    focus-out signal callback defers (idle_add) the call to hide.
    If one of our own windows/menus pops up, an inhibit flag is set.
    When the window/menu is closed the deferred hide on the main window is called
    In the deferred function, we check if we now have focus, and do not hide
    In the deferred function, we check if inhibit is set and do not hide
    Could create a popup_menu subclass that sets the inhibiter
    Could possibly use a decorator to set/clear the inhibit flag.

Or is there some way to detect when the application loses focus?

Egmont Koblinger (egmont-gmail) wrote :

Another infamous case of temporary focus loss is a keyboard layout change, volume/brightness change, or any other global shortcut in Gnome, see bug 1244090.

I haven't tried this terminator feature, but maybe it just can't be implemented reliable, and maybe the cleanest would be to remove it, lest it confuses people.

Changed in terminator:
milestone: 2.0 → 2.1
Changed in terminator:
status: Incomplete → Triaged

Hi all, I have a solution for the righ-click problem.
However I never contributed using bzr.
Should I attach the patch here or prepare and commit a change using bzr?

The patch for window.py and terminal.py is attached.

Stephen Boddy (stephen-j-boddy) wrote :

Thanks for the patch. I haven't had chance to test it yet. I will say however that usually relatively small patches for sprawling problems often break functionality elsewhere. In fact, reading your patch it only seems to remove a bunch of logic, un-nesting three lines. Beats me how this fixes anything, but I look forward to being embarrassed by having missed whatever is staring me in the face. :-)

Hi Stephen, how are you?
Thank you for the answer!

I fact, what I did was:

1. Created a preventHide attribute in terminal.py
2. setted preventHide to True when the a right-click occurs
3. Checked preventHide in on_focus_out (window.py) and, if it is the case, ignored hidefunc.

It is working for me, however, only for the right-click case.
Anyway, the logic could be fairly used to deal with the other cases.
I pretend to dedicate myself to solve this (other cases) as soon as possible (not so soon because I'm working on my thesis).

I found out why you got it wrong.
I mistakenly reversed the order of files when creating the patch.


Following is attached the correct one.

Hehe. Yeah, that makes a lot more sense now. Sorry I didn't spot the mistake myself. I can't remember every line of code, and due to only glancing at it instead of trying to merge it, I missed the obvious.

Anyhoo. I've tried it, and it does indeed work (yay!) I've modified it a little. The flags on each terminal, and subsequent scanning of them were unnecessary. Instead the flag is on the window, and in the terminals it does get_toplevel (which gives the window object) and sets the flag directly. Just feels a bit more "correct" to me.

On top of that I have put in a fix for the group menu and Preferences window. These no longer cause the window to hide. I haven't yet decided about the behaviour when Preferences are open. At the moment it is possible to get the main window to hide while Preferences is open. Perhaps a semi-permanent block should be implemented until the Preferences window is closed.

Moving and resizing the window with the mouse no longer cause an issue. This might be because I'm in Unity rather than Classic gnome on this machine. Using Alt to move or resize still causes loss of focus and hidden window. I think Unity is grabbing this for the HUD, causing it.

The issues in comment #2 and #5 still apply. I'm not sure if these can be fully resolved.

Committed the main fix as http://bazaar.launchpad.net/~gnome-terminator/terminator/gtk3/revision/1769

Does this bug get left open till all the corner cases are closed too?

I am sure your solution is much more elegant than mine, altough I do not understood the modifications in prefseditor.py.

Maybe the fact this is my first incursion into terminator code (PyGTK and GTK also) explain it.

However, I am glad to help and I intend to continue helping, since I really like Terminator.

I think the bug should remain open. I will dedicate myself to solve this issues. Any help is welcome.

If you opened the Preferences window, the main window loses focus and disappears. The original patch only protected the menu popup from causing the window to close. For me the main window should stay open, as usually I think people would expect to return to the main window after making changes in the Preferences window.

Glad to hear you want to stick at it. There was nothing wrong with your code per say. It did correct the problem, and it's just the experience factor that let me see ways to build upon it.

The remaining cases are ones that will probably be quite difficult to fix (Alt key HUD, Indicators, etc). It's hard to see how Terminator can detect and allow for those.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers