Window: Reparenting a window now keeps the title and the enabled state correctly.

[GB.GTK]
* BUG: Window: Reparenting a window now keeps the title and the enabled state correctly.

[GB.GTK3]
* BUG: Window: Reparenting a window now keeps the title and the enabled state correctly.
This commit is contained in:
gambas 2021-04-27 09:22:33 +02:00
parent 58666e3f28
commit 7c87764c29

View file

@ -1141,11 +1141,20 @@ const char* gMainWindow::text()
void gMainWindow::setText(const char *txt)
{
if (_title) g_free(_title);
_title = g_strdup(txt);
if (txt != _title)
{
if (_title)
{
g_free(_title);
_title = NULL;
}
if (txt && *txt)
_title = g_strdup(txt);
}
if (isTopLevel())
gtk_window_set_title(GTK_WINDOW(border), txt);
gtk_window_set_title(GTK_WINDOW(border), _title ? _title : "");
}
bool gMainWindow::hasBorder()
@ -1453,7 +1462,6 @@ void gMainWindow::reparent(gContainer *newpr, int x, int y)
}
else if ((!isTopLevel() && !newpr)
|| (isTopLevel() && isPopup()))
//|| (isTopLevel() && (isPopup() ^ (type == GTK_WINDOW_POPUP))))
{
gtk_window_remove_accel_group(GTK_WINDOW(topLevel()->border), accel);
// TODO: test that
@ -1473,6 +1481,7 @@ void gMainWindow::reparent(gContainer *newpr, int x, int y)
setBackground(bg);
setForeground(fg);
setFont(font());
setText(text());
move(x, y);
w = width();
@ -1482,6 +1491,10 @@ void gMainWindow::reparent(gContainer *newpr, int x, int y)
resize(w, h);
hideHiddenChildren();
gtk_widget_set_sensitive(frame, FALSE);
gtk_widget_set_sensitive(frame, TRUE);
_popup = false; //type == GTK_WINDOW_POPUP;
}
else