summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <michael.drake@codethink.co.uk>2020-11-03 09:53:15 +0000
committerMichael Drake <michael.drake@codethink.co.uk>2020-11-03 09:53:15 +0000
commitf8eabec04b5c5823b405440561add3cc47282f11 (patch)
treecf4c2292744a8cc748f8864984bb844a44ff133a
parent833c9957a1137f77e5ab647eeb1a9cf53798fd12 (diff)
downloadnetsurf-f8eabec04b5c5823b405440561add3cc47282f11.tar.gz
netsurf-f8eabec04b5c5823b405440561add3cc47282f11.tar.bz2
risc os: wimputils: Helper to check OS support for text-selection.
-rw-r--r--frontends/riscos/wimputils.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/frontends/riscos/wimputils.h b/frontends/riscos/wimputils.h
index 5225a720e..cb01f1b7c 100644
--- a/frontends/riscos/wimputils.h
+++ b/frontends/riscos/wimputils.h
@@ -24,6 +24,9 @@
#define riscos_wimputils_h_
#include <oslib/wimp.h>
+#include <oslib/wimpreadsysinfo.h>
+
+#include "utils/log.h"
/* Magical union to permit aliasing of wimp_window_state and wimp_open
* Do not use this directly. Use the macros, instead. */
@@ -62,4 +65,27 @@ typedef union vdu_var_list {
#define PTR_OS_VDU_VAR_LIST(l) ((os_vdu_var_list *) (vdu_var_list *) (l))
+/**
+ * Check whether the OS supports text selection in writiable icons.
+ *
+ * \return true if text-selection is supported, false otherwise.
+ */
+bool ns_wimp_has_text_selection(void)
+{
+ wimp_colour bg;
+ wimp_colour fg;
+ os_error *error;
+ wimpreadsysinfotextselection_flags flags;
+
+ error = xwimpreadsysinfo_text_selection(&bg, &fg, &flags);
+ if (error) {
+ NSLOG(netsurf, WARNING,
+ "xwimpreadsysinfo_text_selection: 0x%x: %s",
+ error->errnum, error->errmess);
+ return false;
+ }
+
+ return (flags & wimpreadsysinfotextselectionflags_ENABLED);
+}
+
#endif