aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStapleButter <thetotalworm@gmail.com>2017-10-05 01:22:03 +0200
committerStapleButter <thetotalworm@gmail.com>2017-10-05 01:22:03 +0200
commitf714c492b972350f97b0c38eca9b6c73d2ddf488 (patch)
treef9938b74d89a5c6ce18751c37739806f848f5719
parent5d5311c53cb3c94cdeb57abba447969345b89ca4 (diff)
GTK: hook SetMinSize. fuck around with gtk_widget_set_size_request() so the window can be resized smaller than the initial size.
-rw-r--r--src/libui_sdl/libui/ui_unix.h7
-rw-r--r--src/libui_sdl/libui/unix/window.c2
2 files changed, 9 insertions, 0 deletions
diff --git a/src/libui_sdl/libui/ui_unix.h b/src/libui_sdl/libui/ui_unix.h
index 23bd538..fac44bc 100644
--- a/src/libui_sdl/libui/ui_unix.h
+++ b/src/libui_sdl/libui/ui_unix.h
@@ -85,6 +85,11 @@ _UI_EXTERN void uiUnixControlSetContainer(uiUnixControl *, GtkContainer *, gbool
{ \
gtk_widget_grab_focus(type(c)->widget); \
}
+#define uiUnixControlDefaultSetMinSize(type) \
+ static void type ## SetMinSize(uiControl *c, int w, int h) \
+ { \
+ gtk_widget_set_size_request(type(c)->widget, w, h); \
+ }
// TODO this whole addedBefore stuff is a MASSIVE HACK.
#define uiUnixControlDefaultSetContainer(type) \
static void type ## SetContainer(uiUnixControl *c, GtkContainer *container, gboolean remove) \
@@ -112,6 +117,7 @@ _UI_EXTERN void uiUnixControlSetContainer(uiUnixControl *, GtkContainer *, gbool
uiUnixControlDefaultEnable(type) \
uiUnixControlDefaultDisable(type) \
uiUnixControlDefaultSetFocus(type) \
+ uiUnixControlDefaultSetMinSize(type) \
uiUnixControlDefaultSetContainer(type)
#define uiUnixControlAllDefaults(type) \
@@ -133,6 +139,7 @@ _UI_EXTERN void uiUnixControlSetContainer(uiUnixControl *, GtkContainer *, gbool
uiControl(var)->Enable = type ## Enable; \
uiControl(var)->Disable = type ## Disable; \
uiControl(var)->SetFocus = type ## SetFocus; \
+ uiControl(var)->SetMinSize = type ## SetMinSize; \
uiUnixControl(var)->SetContainer = type ## SetContainer;
// TODO document
_UI_EXTERN uiUnixControl *uiUnixAllocControl(size_t n, uint32_t typesig, const char *typenamestr);
diff --git a/src/libui_sdl/libui/unix/window.c b/src/libui_sdl/libui/unix/window.c
index a908f88..0fb1ab3 100644
--- a/src/libui_sdl/libui/unix/window.c
+++ b/src/libui_sdl/libui/unix/window.c
@@ -134,6 +134,7 @@ uiUnixControlDefaultEnabled(uiWindow)
uiUnixControlDefaultEnable(uiWindow)
uiUnixControlDefaultDisable(uiWindow)
uiUnixControlDefaultSetFocus(uiWindow)
+uiUnixControlDefaultSetMinSize(uiWindow)
// TODO?
uiUnixControlDefaultSetContainer(uiWindow)
@@ -310,6 +311,7 @@ uiWindow *uiNewWindow(const char *title, int width, int height, int hasMenubar,
// set client size proper
gtk_widget_set_size_request(w->childHolderWidget, width, height);
+ gtk_widget_set_size_request(w->childHolderWidget, 1, 1);
// show everything in the vbox, but not the GtkWindow itself
gtk_widget_show_all(w->vboxWidget);