And got rid of message pumping in unix/window.c. Woo! Gotta clean it up a bit first though...
This commit is contained in:
parent
e17e69f2ad
commit
3f1540b84a
|
@ -165,15 +165,35 @@ void uiWindowContentSize(uiWindow *w, int *width, int *height)
|
||||||
// TODO can't reduce the size this way
|
// TODO can't reduce the size this way
|
||||||
void uiWindowSetContentSize(uiWindow *w, int width, int height)
|
void uiWindowSetContentSize(uiWindow *w, int width, int height)
|
||||||
{
|
{
|
||||||
|
GtkAllocation childAlloc;
|
||||||
|
gint winWidth, winHeight;
|
||||||
|
|
||||||
dbgPrintSizes(w, "BEFORE SET");
|
dbgPrintSizes(w, "BEFORE SET");
|
||||||
|
|
||||||
w->changingSize = TRUE;
|
// we need to resize the child holder widget to the given size
|
||||||
gtk_widget_set_size_request(w->childHolderWidget, width, height);
|
// we can't resize that without running the event loop
|
||||||
// MAJOR TODO REMOVE THIS.
|
// but we can do gtk_window_set_size()
|
||||||
while (w->changingSize)
|
// so how do we deal with the differences in sizes?
|
||||||
if (!uiMainStep(1))
|
// simple arithmetic, of course!
|
||||||
break; // stop early if uiQuit() called
|
|
||||||
gtk_widget_set_size_request(w->childHolderWidget, -1, -1);
|
// from what I can tell, the return from gtk_widget_get_allocation(w->window) and gtk_window_get_size(w->window) will be the same
|
||||||
|
// this is not affected by Wayland and not affected by GTK+ builtin CSD
|
||||||
|
// so we can safely juse use them to get the real window size!
|
||||||
|
// since we're using gtk_window_resize(), use the latter
|
||||||
|
gtk_window_get_size(w->window, &winWidth, &winHeight);
|
||||||
|
|
||||||
|
// now get the child holder widget's current allocation
|
||||||
|
gtk_widget_get_allocation(w->childHolderWidget, &childAlloc);
|
||||||
|
// and punch that out of the window size
|
||||||
|
winWidth -= childAlloc.width;
|
||||||
|
winHeight -= childAlloc.height;
|
||||||
|
|
||||||
|
// now we just need to add the new size back in
|
||||||
|
winWidth += width;
|
||||||
|
winHeight += height;
|
||||||
|
// and set it
|
||||||
|
// TODO will this move the window?
|
||||||
|
gtk_window_resize(w->window, width, height);
|
||||||
|
|
||||||
dbgPrintSizes(w, "AFTER SET");
|
dbgPrintSizes(w, "AFTER SET");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue