Realize the window widget before trying to center it, as we need the monitor it is displayed on.
[GB.GTK] * BUG: Realize the window widget before trying to center it, as we need the monitor it is displayed on. [GB.GTK3] * BUG: Realize the window widget before trying to center it, as we need the monitor it is displayed on.
This commit is contained in:
parent
6ffcf98d76
commit
588e192a05
1 changed files with 4 additions and 7 deletions
|
@ -998,22 +998,19 @@ void gMainWindow::center()
|
|||
|
||||
if (MAIN_platform_is_wayland)
|
||||
gtk_window_set_position(GTK_WINDOW(border), GTK_WIN_POS_CENTER_ON_PARENT);
|
||||
else
|
||||
gtk_window_set_position(GTK_WINDOW(border), GTK_WIN_POS_CENTER_ALWAYS);
|
||||
|
||||
#else
|
||||
#endif
|
||||
|
||||
GdkRectangle rect;
|
||||
int x, y;
|
||||
|
||||
|
||||
gtk_widget_realize(border);
|
||||
gDesktop::availableGeometry(screen(), &rect);
|
||||
|
||||
|
||||
x = rect.x + (rect.width - width()) / 2;
|
||||
y = rect.y + (rect.height - height()) / 2;
|
||||
|
||||
move(x, y);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
bool gMainWindow::isModal() const
|
||||
|
|
Loading…
Reference in a new issue