summaryrefslogtreecommitdiff
path: root/riscos/wimp.c
diff options
context:
space:
mode:
authorRichard Wilson <rjw@netsurf-browser.org>2005-04-09 13:23:55 +0000
committerRichard Wilson <rjw@netsurf-browser.org>2005-04-09 13:23:55 +0000
commitb7d0f95486412a35f875956ce23dfc1984491119 (patch)
tree4a8a0a42c158c69832e53a9225d255a204a12e32 /riscos/wimp.c
parentc4d3ac1d8ff41dd89b827c94471dedf590cf29b7 (diff)
downloadnetsurf-b7d0f95486412a35f875956ce23dfc1984491119.tar.gz
netsurf-b7d0f95486412a35f875956ce23dfc1984491119.tar.bz2
[project @ 2005-04-09 13:23:55 by rjw]
Fallback to default window furniture sizes. svn path=/import/netsurf/; revision=1612
Diffstat (limited to 'riscos/wimp.c')
-rw-r--r--riscos/wimp.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/riscos/wimp.c b/riscos/wimp.c
index 36c832247..3f0d84608 100644
--- a/riscos/wimp.c
+++ b/riscos/wimp.c
@@ -2,7 +2,7 @@
* This file is part of NetSurf, http://netsurf.sourceforge.net/
* Licensed under the GNU General Public License,
* http://www.opensource.org/licenses/gpl-license
- * Copyright 2004 Richard Wilson <not_ginger_matt@users.sourceforge.net>
+ * Copyright 2004, 2005 Richard Wilson <info@tinct.net>
*/
/** \file
@@ -30,12 +30,10 @@
static bool ro_gui_wimp_cache_furniture_sizes(wimp_w w);
static bool ro_gui_wimp_read_eig_factors(os_mode mode, int *xeig, int *yeig);
-/* Wimp_Extend,11 block
-*/
static wimpextend_furniture_sizes furniture_sizes;
static wimp_w furniture_window = NULL;
-static int ro_gui_hscroll_height = -1;
-static int ro_gui_vscroll_width = -1;
+static int ro_gui_hscroll_height = 38;
+static int ro_gui_vscroll_width = 38;
/**
* Gets the horzontal scrollbar height
@@ -43,10 +41,7 @@ static int ro_gui_vscroll_width = -1;
* \param w the window to read (or NULL to read a cached value)
*/
int ro_get_hscroll_height(wimp_w w) {
- if (!w)
- w = dialog_debug;
- if ((furniture_window != w) && (!ro_gui_wimp_cache_furniture_sizes(w)))
- return 38;
+ ro_gui_wimp_cache_furniture_sizes(w);
return ro_gui_hscroll_height;
}
@@ -57,10 +52,7 @@ int ro_get_hscroll_height(wimp_w w) {
* \param w the window to read (or NULL to read a cached value)
*/
int ro_get_vscroll_width(wimp_w w) {
- if (!w)
- w = dialog_debug;
- if ((furniture_window != w) && (!ro_gui_wimp_cache_furniture_sizes(w)))
- return 38;
+ ro_gui_wimp_cache_furniture_sizes(w);
return ro_gui_vscroll_width;
}
@@ -68,28 +60,40 @@ int ro_get_vscroll_width(wimp_w w) {
* Caches window furniture information
*
* \param w the window to cache information from
- * \return true on success, false on error
+ * \return true on success, false on error (default values cached)
*/
bool ro_gui_wimp_cache_furniture_sizes(wimp_w w) {
wimp_version_no version;
os_error *error;
- assert(w);
+ if (!w)
+ w = dialog_debug;
+ if (furniture_window == w)
+ return true;
furniture_sizes.w = w;
error = xwimpextend_get_furniture_sizes(&furniture_sizes);
if (error) {
LOG(("xwimpextend_get_furniture_sizes: 0x%x: %s",
error->errnum, error->errmess));
warn_user("WimpError", error->errmess);
+ ro_gui_vscroll_width = 38;
+ ro_gui_hscroll_height = 38;
return false;
+
}
furniture_window = w;
ro_gui_vscroll_width = furniture_sizes.border_widths.x1;
ro_gui_hscroll_height = furniture_sizes.border_widths.y0;
/* work around inconsistencies in returned sizes beteen wimp versions */
- if ((!xwimpreadsysinfo_version(&version)) &&
- ((int)version <= 398))
+ error = xwimpreadsysinfo_version(&version);
+ if (error) {
+ LOG(("xwimpreadsysinfo_version: 0x%x: %s",
+ error->errnum, error->errmess));
+ warn_user("WimpError", error->errmess);
+ return false;
+ }
+ if ((int)version <= 398)
ro_gui_hscroll_height += 2;
return true;
}