lanoxx / tilda

A Gtk based drop down terminal for Linux and Unix
GNU General Public License v2.0
1.28k stars 161 forks source link

Tilda keybinding problem on xUbuntu 16.04 #243

Open jackluo923 opened 8 years ago

jackluo923 commented 8 years ago

Tilda cannot pull up (hide) when mouse cursor is inside the terminal window. This issue is gone when tilda is started with root (sudo tilda).

How can I debug this?

lanoxx commented 8 years ago

Hi,

with issues like this its best to try a few different window managers first, like metacity, compiz, mutter, etc. I am not sure which window manager xUbuntu is using by default. If you cannot reproduce with one of the more mainstream window managers, especially metacity and compiz, then its likely a problem with your window manager.

Also check if you have any of the auto-hide options enabled in tilda and if they are maybe causing trouble for you.

jackluo923 commented 8 years ago

@lanoxx The default xUbuntu 16.04 distribution is using the xfwm4 (xfce 4). Is there any good place to start debugging?

lanoxx commented 8 years ago

Assuming you have recompiled tilda from source you can pass the --enable-maintainer-flags option to the autogen.sh script, this will enable tracing in tilda and you will see whats happening in the code. Look at what messages are output when the issue appears and then set the breakpoint to the function which outputs that message.

ers35 commented 8 years ago

I had the same problem on Xubuntu 16.04. sudo apt install ibus ibus-gtk ibus-gtk3, logout, and login solved the problem for me.

lvscar commented 8 years ago

after install ibus-gtk , this problem solved for me.

sk011 commented 8 years ago

I had same problem. Clear install of Xubuntu 16.04, but install ibus-gtk and ibus-gtk3 no solved this problem Solved! Thanks

hdodenhof commented 8 years ago

This also happens on Linux Mint 18 with Cinnamon 3, was working fine on Linux Mint 17.3 with Cinnamon 2.8.

Installing ibus ibus-gtk ibus-gtk3 unfortunately did not work for me.

I compiled the current master from source and these are the outputs I get:

Pull down:

Got KeyPress! keycode: 49, modifiers: 16
Current event time 1670482
Calling handler for 'dead_circumflex'...
key_grabber.c: FUNCTION ENTERED: onKeybindingPull
key_grabber.c: FUNCTION ENTERED: pull
tilda_window.c: FUNCTION ENTERED: focus_term
key_grabber.c: FUNCTION ENTERED: tilda_window_set_active
debug: pull_down(): MOVED DOWN
Got KeyRelease! 

Pull up without mouse hovering Tilda:

Got KeyPress! keycode: 49, modifiers: 16
Current event time 1815250
Calling handler for 'dead_circumflex'...
key_grabber.c: FUNCTION ENTERED: onKeybindingPull
key_grabber.c: FUNCTION ENTERED: pull
debug: pull_up(): MOVED UP
Got KeyRelease!

Pull up with mouse hovering Tilda:

Got KeyPress! keycode: 49, modifiers: 16
Current event time 1831618
Calling handler for 'dead_circumflex'...
key_grabber.c: FUNCTION ENTERED: onKeybindingPull
key_grabber.c: FUNCTION ENTERED: pull
Tilda window not focused but visible
key_grabber.c: FUNCTION ENTERED: tilda_window_set_active
Got KeyRelease! 

Pulling up also does not work, if i focus another window while Tilda is pulled down. When focussing another window Tilda logs tilda_window.c: FUNCTION ENTERED: focus_out_event_cb - I then need to trigger pull up twice for Tilda to actually pull up:

Got KeyPress! keycode: 49, modifiers: 16
Current event time 2269785
Calling handler for 'dead_circumflex'...
key_grabber.c: FUNCTION ENTERED: onKeybindingPull
key_grabber.c: FUNCTION ENTERED: pull
tilda_window.c: FUNCTION ENTERED: focus_term
key_grabber.c: FUNCTION ENTERED: tilda_window_set_active
debug: pull_down(): MOVED DOWN
Got KeyRelease! 
tilda_window.c: FUNCTION ENTERED: focus_out_event_cb
Got KeyPress! keycode: 49, modifiers: 16
Current event time 2271865
Calling handler for 'dead_circumflex'...
key_grabber.c: FUNCTION ENTERED: onKeybindingPull
key_grabber.c: FUNCTION ENTERED: pull
Tilda window not focused but visible
key_grabber.c: FUNCTION ENTERED: tilda_window_set_active
Got KeyRelease! 
tilda_window.c: FUNCTION ENTERED: focus_out_event_cb
Got KeyPress! keycode: 49, modifiers: 16
Current event time 2272369
Calling handler for 'dead_circumflex'...
key_grabber.c: FUNCTION ENTERED: onKeybindingPull
key_grabber.c: FUNCTION ENTERED: pull
debug: pull_up(): MOVED UP
Got KeyRelease! 

Is there anything else I could supply to help debugging this? Thanks!

lanoxx commented 8 years ago

@hdodenhof Do you have the pull down animation enabled? If not does the problem go away when you enable it? If its enabled, did you try disabling it? The pull code behaves differently depending on whether animation is active or not.

Looking at the log output, it can see that Tilda has no problem with the keybinding. Since pull is being called there must be a problem with the showing and positioning of Tilda. Most likely that is due to some specific behaviour of your window manager. If we can identify the specific issue with your window manager I can add some additional code to make Tilda compatible with your window manager.

I am using metacity as window manager and currently cannot reproduce this problem. Could you install metacity and try to run metacity --replace, if the issue goes away that would confirm its a window manager issue. Otherwise we need to look at other options.

lanoxx commented 8 years ago

I also think its unlikely that ibus is involved in this issue. That is an input method framework, and tilda has no specific dependencies on ibus.

hdodenhof commented 8 years ago

I do have the pull down animation enabled, disabling it doesn't make any difference.

Metacity is installed in Mint by default (3.18.5-0ubuntu0.1), running metacity --replace did not improve the behaviour. I do have very limited knowledge of Linux window managers so I'm not sure if metacity --replace did what it is supposed to do.

Before:

$ wmctrl -m
Name: Mutter (Muffin)
Class: N/A
PID: N/A
Window manager's "showing the desktop" mode: N/A

After:

$ wmctrl -m
Name: Metacity
Class: N/A
PID: N/A
Window manager's "showing the desktop" mode: N/A
hdodenhof commented 8 years ago

So I digged a little into the code and what I found is that tw->focus_loss_on_keypress is false when pull is called in key_grabber.c while the mouse hovers the Tilda window or any other window has focus - it's true in the other cases. tw->focus_loss_on_keypress being false makes needsFocus true and with that the if branch that only focuses Tilda but does not actually pull the window up is active.

I just disabled that if branch and that seems to be a workaround, at least for my setup. I haven't seen any side effects but I doubt this is a proper solution - maybe it helps pinning down the root cause though.

DanteMarshal commented 6 years ago

Then I guess next step to check is to see what happens on focus. I Guess maybe on focus event, having mouse hovering on tilda makes tw->focus_loss_on_keypress false, which should be true. It's just a guess though. As @hdodenhof mentioned, changing "Non-focus Pull-up Behavior" under "General" in preferences to "Hide Terminal" fixes the problem, But it's still a bug.