From 05e4463230d8ae9880ac3aef38ca12f09d30d960 Mon Sep 17 00:00:00 2001 From: Chris Young Date: Sun, 8 Jan 2017 13:21:32 +0000 Subject: Update corewindow scrollbars when user resizes window --- frontends/amiga/corewindow.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'frontends/amiga/corewindow.c') diff --git a/frontends/amiga/corewindow.c b/frontends/amiga/corewindow.c index 548ecac86..2417d7b8b 100644 --- a/frontends/amiga/corewindow.c +++ b/frontends/amiga/corewindow.c @@ -66,6 +66,8 @@ #include "amiga/schedule.h" #include "amiga/utf8.h" +static void ami_cw_get_window_dimensions(struct core_window *cw, int *width, int *height); + static void ami_cw_scroller_top(struct ami_corewindow *ami_cw, ULONG *restrict x, ULONG *restrict y) { @@ -538,6 +540,31 @@ ami_cw_drag_end(struct ami_corewindow *ami_cw, int x, int y) ami_cw->dragging = false; } +/** + * User has resized window + */ + +static void +ami_cw_newsize(struct ami_corewindow *ami_cw) +{ + int win_w, win_h; + ami_cw_get_window_dimensions(ami_cw, &win_w, &win_h); + + if(ami_cw->objects[GID_CW_HSCROLL] != NULL) { + RefreshSetGadgetAttrs((struct Gadget *)ami_cw->objects[GID_CW_HSCROLL], ami_cw->win, NULL, + SCROLLER_Visible, win_w, + TAG_DONE); + } + + if(ami_cw->objects[GID_CW_VSCROLL] != NULL) { + RefreshSetGadgetAttrs((struct Gadget *)ami_cw->objects[GID_CW_VSCROLL], ami_cw->win, NULL, + SCROLLER_Visible, win_h, + TAG_DONE); + } + + ami_cw_redraw(ami_cw, NULL); +} + /** * Main event loop for our core window * @@ -681,7 +708,7 @@ ami_cw_event(void *w) break; case WMHI_NEWSIZE: - ami_cw_redraw(ami_cw, NULL); + ami_cw_newsize(ami_cw); break; case WMHI_CLOSEWINDOW: -- cgit v1.2.3