gkngkc / UnityStandaloneFileBrowser

A native file browser for unity standalone platforms
MIT License
2.01k stars 317 forks source link

Linux dialog problem second time it opens #49

Open bdovaz opened 5 years ago

bdovaz commented 5 years ago

@RicardoEPRodrigues

I'm only trying the project on this repo on Ubuntu 18.04 (on a VM).

I open the "BasicSampleScene" and I click on the "Open file" button.

  1. The first time it works as it should.
  2. The second time it opens the dialog behind the Unity window so I can't do nothing and the application freezes because it's waiting the dialog to close.

I see that in "gtk_file_chooser_dialog_new" method there is a parameter to set the parent window and I think that this should fix it but I don't know how to get the active Window. I saw this:

https://developer.gnome.org/gtk3/stable/GtkApplication.html#gtk-application-get-active-window

But we also need a reference to the GtkApplication...

Is there any workaround? Thanks.

RicardoEPRodrigues commented 5 years ago

Hello @bdovaz.

I think the behavior your experiencing (which also happens to me) is a "bug" on the GNOME side, where to avoid losing focus of the main window, GNOME places the dialog behind.

alt + tab is a quick "fix".

The parent window is not the issue here. I think we need to call focus, maybe this is the answer: https://stackoverflow.com/questions/52411284/is-there-a-way-to-switch-focus-between-windows-in-a-single-gtk-application

But I'll have to test it out.

Learner110110 commented 5 years ago

I am similar to you, but I will not respond when I open it for the first time, and the log will not provide any information, have you encountered this situation