GNOME Bugzilla – Bug 764730
win32: GtkDialog wrong position to parent using GTK_DIALOG_USE_HEADER_BAR
Last modified: 2016-04-12 11:24:48 UTC
Since GTK 3.20 GtkDialog is shown in wrong position to parent window if using GTK_DIALOG_USE_HEADER_BAR flag. Same code did work correctly for me with GTK 3.18 of same platform - dialog was centered on parent window. In GTK 3.20 CSD was enabled on MS windows platform. Found nothing special with my code, added gtk_window_set_position for sure: dialog = gtk_dialog_new_with_buttons ( _("some text"), GTK_WINDOW(parent), GtkDialogFlags(GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT|GTK_DIALOG_USE_HEADER_BAR), _("_OK"), GTK_RESPONSE_OK, _("_Cancel"), GTK_RESPONSE_CANCEL, NULL); gtk_window_set_transient_for(GTK_WINDOW(dialog), GTK_WINDOW(parent)); gtk_window_set_position (GTK_WINDOW(dialog), GTK_WIN_POS_CENTER_ON_PARENT); ... Details on setup if relevant: - Using GTK 3.20.2 build, msys2 environment - multiple monitor configuration
Thanks for taking the time to report this. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find. *** This bug has been marked as a duplicate of bug 764722 ***
What is a "wrong" position, and what is a "right" one? Does it happen in non-multimonitor setup? It will be easier to reproduce (and fix) if there's a C program that reproduces it (doesn't have to be minimal - as long as it's easy to build; even better if gtk3-demo or gtk3-widget-factory or gtksrc/tests/testgtk have functionality that exposes this bug). If you build your own gtk, see if https://git.gnome.org/browse/gtk+/commit/?h=gtk-3-20&id=f233609c9328d03222a19e37db78caedb8b7e9c5 fixes this (it fixed a bug that made tooltops appear in top-left corner of the virtual screen). Nacho, the description is too vague to be sure that this is indeed a duplicate of bug 764722.
Happens with single display too. Dialog window for described case is positioned always if close to top left display corner (circa on position 24,24). If I remove GTK_DIALOG_USE_HEADER_BAR flag dialog window position is correct again, centered on parent.
Created attachment 325572 [details] issue reproducer reproducer attached, built with gcc reproducer.c `pkg-config --cflags --libs gtk+-3.0 gmodule-2.0` -m64
This bug does not seem to be a duplicate of bug 764722. Applying or not applying a fix for that bug to 3.20.2 does not the difference, *this* bug still happens. However, running the testcase against gtk+-3.0 git master (a93e477, to be specific) does not reproduce the bug anymore.
tried a few tarballs The bug appeared between 3.20.1 and 3.20.2, so it'll be easy to find now.
This bug was introduced by commit ba91d7d3a92d58dfe8058d31854c135353b87e01 and fixed in master (by commit a91237d65e91cf7dc1581fabf9245ca89e988088, i think).
Reproducer works correctly using GTK 3.20.3. Not using gtk in MS windows frequently, but looks to me good job was done in past two gtk3 releases. Thanks to all involved.