From cf8abc46393487276a6df87be35f9687b6696c34 Mon Sep 17 00:00:00 2001 From: gambas Date: Mon, 18 Jan 2021 22:03:21 +0100 Subject: [PATCH] Make 'gb.gtk' compile again. [GB.GTK] * BUG: Make 'gb.gtk' compile again. --- gb.gtk/src/gmainwindow.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gb.gtk/src/gmainwindow.cpp b/gb.gtk/src/gmainwindow.cpp index 8318ee04a..ca0bae5a2 100644 --- a/gb.gtk/src/gmainwindow.cpp +++ b/gb.gtk/src/gmainwindow.cpp @@ -958,7 +958,19 @@ void gMainWindow::center() { if (!isTopLevel()) return; - PLATFORM.Window.Center(GTK_WINDOW(border)); + #ifdef GTK3 + PLATFORM.Window.Center(GTK_WINDOW(border)); + #else + GdkRectangle rect; + int x, y; + + 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