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 stop responding to pull up/down key after closing the preference dialog #86

Closed sudaraka closed 10 years ago

sudaraka commented 10 years ago

Reproduce:

Problem was introduced in the commit ad12e4d4a019d9cfdf1cbf9277a39876c6e45925, by digging around the code I found that after closing the preference dialog, it stop calling the focus_out_event_cb on focus out events. My understanding of the language and GTK is not enough to come up with a solution, however glad to provide any further details if necessary.

P.s. I'm using a tiling window manager (i3wm), not sure if that has anything to do with this.

lanoxx commented 10 years ago

Hi,

Thank you for your post. This is quite a huge regression. I will take a look at the issue and see if i can fix it.

On 13.09.2014, at 15:31, Sudaraka Wijesinghe notifications@github.com wrote:

Reproduce:

Open Tilda window Right click -> Preferences Close preference dialog Press pull up/down key (F12 in my case) and window stays open Problem was introduced in the commit ad12e4d, by digging around the code I found that after closing the preference dialog, it stop calling the focus_out_event_cb on focus out events. My understanding of the language and GTK is not enough to come up with a solution, however glad to provide any further details if necessary.

P.s. I'm using a tiling window manager (i3wm), not sure if that has anything to do with this.

— Reply to this email directly or view it on GitHub.

lanoxx commented 10 years ago

Hi, I cannot reproduce this here using metacity. Are you completely unable to hide the tilda window even if you press F12 multiple times? Or is it maybe just the case the the window looses focus and the first press of F12 focuses it and then the second press hides it? Otherwise there might be some kind of difference between i3wm and metacity.

sudaraka commented 10 years ago

It completely stop responding to the F12, even if I click and/or type in the terminal. Once this happen the only way I can close the terminal is by quitting Tilda completely.

I notice that once it goes to this non responding state focus_loss_on_keypress is always set to zero and doesn't change (as I mentioned earlier focus_out_event_cb is not being called to change it).

I'm attaching my configuration just in-case there is something there you need to look at.

On 09/13/14 20:58, Sebastian Geiger wrote:

Hi, I cannot reproduce this here using metacity. Are you completely unable to hide the tilda window even if you press F12 multiple times? Or is it maybe just the case the the window looses focus and the first press of F12 focuses it and then the second press hides it? Otherwise there might be some kind of difference between i3wm and metacity.

— Reply to this email directly or view it on GitHub https://github.com/lanoxx/tilda/issues/86#issuecomment-55497232.

tilda_config_version = "1.1.12"

image = ""

command = ""

font = "Monaco for Powerline 11" key = "F12" addtab_key = "t" fullscreen_key = "F11" closetab_key = "w" nexttab_key = "Page_Down" prevtab_key = "Page_Up" movetableft_key = "Page_Up" movetabright_key = "Page_Down" gototab_1_key = "1" gototab_2_key = "2" gototab_3_key = "3" gototab_4_key = "4" gototab_5_key = "5" gototab_6_key = "6" gototab_7_key = "7" gototab_8_key = "8" gototab_9_key = "9" gototab_10_key = "0" copy_key = "c" paste_key = "v" quit_key = "q" title = "Tilda" background_color = "white"

working_dir = ""

web_browser = "x-www-browser" wordchars = "-A-Za-z0-9,./?%&#:" lines = 1024 max_width = 1920 max_height = 1080 min_width = 1 min_height = 1 transparency = 50 x_pos = 0 y_pos = 0 tab_pos = 0 backspace_key = 0 delete_key = 1 d_set_title = 3 command_exit = 2 scheme = 3 slide_sleep_usec = 20000 animation_orientation = 0 timer_resolution = 200 auto_hide_time = 2000 on_last_terminal_exit = 2 palette_scheme = 0 show_on_monitor_number = 0 title_max_length = 25 palette = {6939, 7453, 7710, 63993, 25186, 29297, 33410, 46260, 5140, 65021, 38807, 7966, 9766, 35722, 53970, 35979, 21588, 65278, 22102, 49858, 54998, 52428, 52428, 50886, 20560, 21331, 21588, 65535, 22873, 38293, 47031, 60395, 17990, 65278, 60909, 27756, 25186, 44461, 58339, 49086, 41120, 65278, 38035, 55511, 58853, 63736, 63736, 62194} scrollbar_pos = 2 back_red = 0 back_green = 0 back_blue = 0 text_red = 65535 text_green = 65535 text_blue = 65535 scroll_history_infinite = false scroll_background = false scroll_on_output = false notebook_border = false antialias = true scrollbar = false use_image = false grab_focus = true above = true notaskbar = true bold = true blinks = true scroll_on_key = true bell = false run_command = false pinned = true animation = false hidden = true centered_horizontally = false centered_vertically = false enable_transparency = false double_buffer = false auto_hide_on_focus_lost = false auto_hide_on_mouse_leave = false title_max_length_flag = true

sudaraka commented 10 years ago

I tried this in XFCE (Xubuntu) and couldn't duplicate the issue. So I guess this is something related to i3wm (or tiling window managers in general?)

One thing I noticed different in XFCE is that preferences dialog seems to steal the focus from main terminal window, I can't focus on the main terminal while the dialog is open, however in i3wm it opens in a separate tile and main window is still can be focused (by mouse or F12) while the dialog is open.

Also on i3wm, F12 still works while the preferences dialog is open, it only stop working after I close the dialog. Is it possible that "focus-out-event" signal handler somehow being detached when the dialog closes?

lanoxx commented 10 years ago

Hi,

focus_loss_on_keypress is always set to zero and doesn't change [...] It completely stops responding to the F12, even if I click and/or type in the terminal.

Actually pressing F12 should focus the window if focus_loss_on_keypress is zero, does that still happen or is this also ignored? Maybe you can send me the debug output from the terminal so I can see which functions are being called?

Also please try this, replace line 187 in key_grabber.c with this line: if (tw->current_state == DOWN && !tw->focus_loss_on_keypress && !gtk_window_is_active(GTK_WINDOW(tw->window))) {

It adds an extra guard to ensure the window is not active, maybe that can work as a work around.

sudaraka commented 10 years ago

Also please try this, replace line 187 in key_grabber.c with this line: |if (tw->current_state == DOWN && !tw->focus_loss_on_keypress && !gtk_window_is_active(GTK_WINDOW(tw->window))) {|

Yes, This solved the problem.

Actually pressing F12 should focus the window if focus_loss_on_keypress is zero, does that still happen or is this also ignored? Maybe you can send me the debug output from the terminal so I can see which functions are being called?

F12 does bring the focus to unfocused terminal window. However second F12 press (or pressing F12 while focus is on the terminal doesn't hide the window).

Hopefully above patch is the right solution, Sending you the debug trace anyway. This is what I did to produce it.

sudaraka commented 10 years ago

tilda.c: FUNCTION ENTERED: main tilda.c: FUNCTION ENTERED: remove_stale_lock_files tilda.c: FUNCTION ENTERED: get_instance_number tilda.c: FUNCTION ENTERED: get_config_file_name tilda.c: FUNCTION ENTERED: create_lock_file tilda.c: FUNCTION ENTERED: parse_cli tilda_window.c: FUNCTION ENTERED: tilda_window_init tilda_window.c: FUNCTION ENTERED: tilda_window_add_tab tilda_terminal.c: FUNCTION ENTERED: tilda_term_init tilda_terminal.c: FUNCTION ENTERED: tilda_term_config_defaults tilda_terminal.c: FUNCTION ENTERED: tilda_term_set_scrollbar_position tilda_terminal.c: FUNCTION ENTERED: start_shell key_grabber.c: FUNCTION ENTERED: generate_animation_positions Got accel 65481, 0 Got keycode 96 Got modmask 0 key_grabber.c: FUNCTION ENTERED: pull debug: pull(): MOVED UP Tilda has started. Press F12 to pull down the window. tilda_terminal.c: FUNCTION ENTERED: window_title_changed_cb callback_func.c: FUNCTION ENTERED: get_window_title tomboykeybinder.c: FUNCTION ENTERED: filter_func Got KeyPress! keycode: 96, modifiers: 0 Current event time 7654189 Calling handler for 'F12'... 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(): MOVED DOWN tomboykeybinder.c: FUNCTION ENTERED: filter_func tomboykeybinder.c: FUNCTION ENTERED: filter_func tilda_window.c: FUNCTION ENTERED: mouse_enter tomboykeybinder.c: FUNCTION ENTERED: filter_func tomboykeybinder.c: FUNCTION ENTERED: filter_func Got KeyRelease! tilda_window.c: FUNCTION ENTERED: focus_out_event_cb tomboykeybinder.c: FUNCTION ENTERED: filter_func Got KeyPress! keycode: 96, modifiers: 0 Current event time 7655379 Calling handler for 'F12'... key_grabber.c: FUNCTION ENTERED: onKeybindingPull key_grabber.c: FUNCTION ENTERED: pull debug: pull(): MOVED UP tilda_window.c: FUNCTION ENTERED: focus_out_event_cb tilda_window.c: FUNCTION ENTERED: mouse_leave tomboykeybinder.c: FUNCTION ENTERED: filter_func tomboykeybinder.c: FUNCTION ENTERED: filter_func tomboykeybinder.c: FUNCTION ENTERED: filter_func tomboykeybinder.c: FUNCTION ENTERED: filter_func tomboykeybinder.c: FUNCTION ENTERED: filter_func Got KeyRelease! tomboykeybinder.c: FUNCTION ENTERED: filter_func Got KeyPress! keycode: 96, modifiers: 0 Current event time 7656148 Calling handler for 'F12'... 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(): MOVED DOWN tomboykeybinder.c: FUNCTION ENTERED: filter_func tomboykeybinder.c: FUNCTION ENTERED: filter_func tilda_window.c: FUNCTION ENTERED: mouse_enter tomboykeybinder.c: FUNCTION ENTERED: filter_func tomboykeybinder.c: FUNCTION ENTERED: filter_func Got KeyRelease! tilda_terminal.c: FUNCTION ENTERED: button_press_cb tilda_terminal.c: FUNCTION ENTERED: popup_menu tilda_window.c: FUNCTION ENTERED: mouse_leave tomboykeybinder.c: FUNCTION ENTERED: filter_func tilda_window.c: FUNCTION ENTERED: focus_out_event_cb tilda_terminal.c: FUNCTION ENTERED: on_popup_hide tilda_terminal.c: FUNCTION ENTERED: menu_config_cb wizard.c: FUNCTION ENTERED: wizard wizard.c: FUNCTION ENTERED: percentage_dimension wizard.c: FUNCTION ENTERED: percentage_dimension Removing grab for 'F12' tilda_window.c: FUNCTION ENTERED: mouse_enter tomboykeybinder.c: FUNCTION ENTERED: filter_func tomboykeybinder.c: FUNCTION ENTERED: filter_func tilda_window.c: FUNCTION ENTERED: mouse_leave tilda_window.c: FUNCTION ENTERED: focus_out_event_cb tomboykeybinder.c: FUNCTION ENTERED: filter_func tomboykeybinder.c: FUNCTION ENTERED: filter_func wizard.c: FUNCTION ENTERED: wizard_closed Got accel 65481, 0 Got keycode 96 Got modmask 0 configsys.c: FUNCTION ENTERED: config_write tomboykeybinder.c: FUNCTION ENTERED: filter_func tomboykeybinder.c: FUNCTION ENTERED: filter_func tilda_window.c: FUNCTION ENTERED: mouse_enter tomboykeybinder.c: FUNCTION ENTERED: filter_func tomboykeybinder.c: FUNCTION ENTERED: filter_func tilda_window.c: FUNCTION ENTERED: mouse_leave tomboykeybinder.c: FUNCTION ENTERED: filter_func Got KeyPress! keycode: 96, modifiers: 0 Current event time 7661910 Calling handler for 'F12'... 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 tomboykeybinder.c: FUNCTION ENTERED: filter_func Got KeyRelease! tomboykeybinder.c: FUNCTION ENTERED: filter_func Got KeyPress! keycode: 96, modifiers: 0 Current event time 7665445 Calling handler for 'F12'... 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 tomboykeybinder.c: FUNCTION ENTERED: filter_func Got KeyRelease! tilda_window.c: FUNCTION ENTERED: mouse_leave tomboykeybinder.c: FUNCTION ENTERED: filter_func tomboykeybinder.c: FUNCTION ENTERED: filter_func tomboykeybinder.c: FUNCTION ENTERED: filter_func Got KeyPress! keycode: 96, modifiers: 0 Current event time 7675608 Calling handler for 'F12'... 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 tomboykeybinder.c: FUNCTION ENTERED: filter_func tomboykeybinder.c: FUNCTION ENTERED: filter_func Got KeyRelease! tilda_window.c: FUNCTION ENTERED: mouse_enter tilda_terminal.c: FUNCTION ENTERED: button_press_cb tilda_terminal.c: FUNCTION ENTERED: popup_menu tilda_window.c: FUNCTION ENTERED: mouse_leave tomboykeybinder.c: FUNCTION ENTERED: filter_func tilda_terminal.c: FUNCTION ENTERED: on_popup_hide tilda_terminal.c: FUNCTION ENTERED: menu_quit_cb tilda_window.c: FUNCTION ENTERED: tilda_window_close_tab tilda_window.c: FUNCTION ENTERED: find_tt_in_g_list tilda_terminal.c: FUNCTION ENTERED: tilda_term_free configsys.c: FUNCTION ENTERED: config_write

sudaraka commented 10 years ago

Thanks.

patrick-brian-mooney commented 7 years ago

Affects me too, using both MATE and Openbox both in Linux Mint 18.2 and Crunchbang++ 9. The problem seems to be that I can't pull the Tilda terminal up when it is in focus, and the only thing that changes the focus effectively is using the mouse to click on another window. (Alt+Tab doesn't effectively change focus for purposes of the "can I pull the Tilda window up?" question.) It doesn't seem to matter whether the mouse is or is not currently hovering over the Tilda window.

So I can pull the Tilda window down by using F12, but pulling it back up requires that I take my hands off the keyboard, move the mouse to another window, click somewhere in the window (picking somewhere in the window that doesn't cause an action to occur), and then move my hands back to the keyboard and hit F12 twice.

Super annoying. :(

mlmullens commented 6 years ago

I just ran into what appears to be similar behavior as that reported here on tilda 1.3.1. Will try building from source to see.

lanoxx commented 6 years ago

Which window manager are you using?

mlmullens commented 6 years ago

cinnamon (mint 18.2)

I tried removing and re-installing tilda with apt-get and moving all of the tilda config files out of ./config/tilda in case it was a configuration issue, but experienced the same behavior with a blank slate as installed via aptitude. I haven't tried compiling from source yet though this morning.

mlmullens commented 6 years ago

Built from master and the 1-3 branches this morning and still experiences the same issue but have not debugged yet.

Edit: My issue is that tilda will not go away if I use the same hotkey that pulled it down. This did previously work (two days ago) but something in that time changed, trying to figure out what it was. The issue I am experiencing does not have anything to do with whether preferences was opened at any time or not though. Tilda opens (slides down) with the hotkey then fails to close (slide up) with the same hotkey (the cursor changes from solid square to hollow square though upon hotkey if focused (doesn't matter which hotkey I use). If I move the focus away from tilda then I can close it with hotkey.

mlmullens commented 6 years ago

FIXED IT! Strange, there is a setting "Non-focus Pull Up Behavior" that has to be set to "Hide Terminal" to get my preferred behavior back. So let that be a tip for anyone experiencing similar issue, check this setting! Whew, that was driving me nuts! (at least on 1.5~alpha but I haven't tried going back yet to see if it was simply this setting - probably was).