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)
|
if (MAIN_platform_is_wayland)
|
||||||
gtk_window_set_position(GTK_WINDOW(border), GTK_WIN_POS_CENTER_ON_PARENT);
|
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;
|
GdkRectangle rect;
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
|
gtk_widget_realize(border);
|
||||||
gDesktop::availableGeometry(screen(), &rect);
|
gDesktop::availableGeometry(screen(), &rect);
|
||||||
|
|
||||||
x = rect.x + (rect.width - width()) / 2;
|
x = rect.x + (rect.width - width()) / 2;
|
||||||
y = rect.y + (rect.height - height()) / 2;
|
y = rect.y + (rect.height - height()) / 2;
|
||||||
|
|
||||||
move(x, y);
|
move(x, y);
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool gMainWindow::isModal() const
|
bool gMainWindow::isModal() const
|
||||||
|
|
Loading…
Reference in a new issue