postiffm / bibledit-desktop

Desktop version of Bibledit
GNU General Public License v3.0
4 stars 6 forks source link

gtk3: File | Export does not open in center of screen #52

Closed postiffm closed 6 years ago

postiffm commented 6 years ago

It seems like the upper left corner of the assistant dialog is in the center of the screen. This puts the remainder of the dialog box in the lower right quadrant of the screen.

It is similar with other assistants, but the problem is more pronounced with this one since it is larger than some of the other ones.

rluzynski commented 6 years ago

Please try removing (sic!) this line:

 gtk_window_set_position (GTK_WINDOW(assistant), GTK_WIN_POS_CENTER_ON_PARENT);

it is assistants.cpp:54. The documentation of this function is not perfect, the comments in the source code of gtkwindow.c explain that this will never work reliably because “this may well end up fighting the WM or user” and even “it gets in an infinite loop with at least one WM”.

Removing this line and leaving default settings gave good results on my test virtual machine (Fedora 26 + GNOME 3). Please test in your environment as well. grep says this function is called 60 times in Bibledit Desktop, you may review all occurrences and check if removing them all works better. The same effect is caused by the "window_position" property in a builder file, like:

  <property name="window_position">center</property>

which occurs 14 times in templates/*.xml.

This change may be unrelated with porting to GTK3, you can try doing the same in the master branch (with GTK2) as well and eventually push it to master now if you find it working good. I have not tried master, though.

postiffm commented 6 years ago

Thanks for this. Won't be able to get to it for a few days. I /thought/ that the set_position method would set the initial position, or was at least a suggestion to the manager of the window. But if this is not the case, I'm happy to remove the code. I'll give it a test.

postiffm commented 6 years ago

See commit 7467bec in the master branch. The export assistant dialog still does not open in the center of the screen, but there must be another reason for this than the gtk_window_set_position call.