This seems like a bug in Windows, but I wanted to hear if
there some easy work around before I open a bug in bugzilla.
The following code:
GtkWidget *dialog = gtk_dialog_new_with_buttons("Title",
GTK_WINDOW
(parent_window),
GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_STOCK_CANCEL,
GTK_RESPONSE_CANCEL,
GTK_STOCK_OK,
GTK_RESPONSE_ACCEPT,
NULL);
// add several widgets to dialog->vbox
gtk_widget_show_all(dialog);
does not center the dialog window over its parent in Win32, but the
dialog is placed such that the upper left corner is approximately around the
center of the parent_window. This caused a user to complain that she
always has to manually move the dialog once she does File/Open in my
application. Of course I can manually move the dialog through gdk_window_move()
etc, but the whole point of the "transient" is, as far as I
understand it, to avoid having to do manual window positioning.
The same code works correctly under Linux under fvwm2rc. The gtk version is
roughly the latest in both Linux and Windows.
Thanks in advance!
Regards,
Dov
See:
http://bugzilla.gnome.org/show_bug.cgi?id=559034
http://bugzilla.gnome.org/show_bug.cgi?id=549403
It was supposedly fixed in Jan ‘09 so the fix should be in
the latest versions, and it says the fix was back-ported to 2.14.7 too. So are
you using a version that should have that fix?
If you have the fixed version of GTK and it’s still
not properly centering on the parent, you might want to try adding a call to:
gtk_window_set_position(GTK_WINDOW(dialog),
GTK_WIN_POS_CENTER_ON_PARENT);
Ian