From f8eabec04b5c5823b405440561add3cc47282f11 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Tue, 3 Nov 2020 09:53:15 +0000 Subject: risc os: wimputils: Helper to check OS support for text-selection. --- frontends/riscos/wimputils.h | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'frontends') 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 +#include + +#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 -- cgit v1.2.3