diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2014-10-25 19:59:11 +0100 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2014-10-25 19:59:11 +0100 |
commit | b2ff4877e43c33cf26de6f9880745259b5237ebb (patch) | |
tree | 2fe269b525e7f52f2715d9f2482b2ce5a7627cfc /amiga/gui.c | |
parent | 7e95b7ffb107fb8502aec3fd9eebe64127487a85 (diff) | |
download | netsurf-b2ff4877e43c33cf26de6f9880745259b5237ebb.tar.gz netsurf-b2ff4877e43c33cf26de6f9880745259b5237ebb.tar.bz2 |
Remove the vertical scroll bar if there's nothing to scroll
Diffstat (limited to 'amiga/gui.c')
-rw-r--r-- | amiga/gui.c | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/amiga/gui.c b/amiga/gui.c index e39d9e7af..4722b1769 100644 --- a/amiga/gui.c +++ b/amiga/gui.c @@ -2507,6 +2507,24 @@ void ami_get_msg(void) ami_quit_netsurf_delayed(); } +static void gui_window_get_dimensions(struct gui_window *g, int *width, int *height, + bool scaled) +{ + struct IBox *bbox; + if(!g) return; + + GetAttr(SPACE_AreaBox, g->shared->objects[GID_BROWSER], (ULONG *)&bbox); + + *width = bbox->Width; + *height = bbox->Height; + + if(scaled) + { + *width /= g->shared->bw->scale; + *height /= g->shared->bw->scale; + } +} + /* Add a vertical scroller, if not already present * Returns true if changed, false otherwise */ static bool ami_gui_vscroll_add(struct gui_window_2 *gwin) @@ -2566,7 +2584,14 @@ static void ami_gui_vscroll_update(struct gui_window_2 *gwin) if((vscroll == BW_SCROLLING_NO) || browser_window_is_frameset(gwin->bw) == true) { rethink = ami_gui_vscroll_remove(gwin); } else { - rethink = ami_gui_vscroll_add(gwin); + int h, w, wh, ww; + if((browser_window_get_extents(gwin->bw, false, &w, &h) == NSERROR_OK)) { + gui_window_get_dimensions(gwin->bw->window, &ww, &wh, false); + if (h > wh) rethink = ami_gui_vscroll_add(gwin); + else rethink = ami_gui_vscroll_remove(gwin); + } else { + rethink = ami_gui_vscroll_add(gwin); + } } if(rethink) { @@ -4631,24 +4656,6 @@ static void gui_window_set_scroll(struct gui_window *g, int sx, int sy) // g->shared->new_content = false; } -static void gui_window_get_dimensions(struct gui_window *g, int *width, int *height, - bool scaled) -{ - struct IBox *bbox; - if(!g) return; - - GetAttr(SPACE_AreaBox, g->shared->objects[GID_BROWSER], (ULONG *)&bbox); - - *width = bbox->Width; - *height = bbox->Height; - - if(scaled) - { - *width /= g->shared->bw->scale; - *height /= g->shared->bw->scale; - } -} - static void gui_window_update_extent(struct gui_window *g) { struct IBox *bbox; |