summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--desktop/treeview.c34
-rw-r--r--frontends/riscos/gui/url_bar.c11
-rw-r--r--frontends/riscos/toolbar.c26
-rw-r--r--frontends/riscos/wimputils.h26
-rw-r--r--tools/convert_font.c6
5 files changed, 82 insertions, 21 deletions
diff --git a/desktop/treeview.c b/desktop/treeview.c
index 27be73746..feb1a7c6e 100644
--- a/desktop/treeview.c
+++ b/desktop/treeview.c
@@ -952,6 +952,34 @@ static void treeview__search_cancel(treeview *tree, bool drop_focus)
treeview__cw_invalidate_area(tree, &r);
}
+/**
+ * Convert from treeview drag to core window drag type.
+ *
+ * \param[in] tree A treeview.
+ * \return Core window drag type.
+ */
+static core_window_drag_status treeview__get_cw_drag_type(
+ const treeview *tree)
+{
+ assert(tree != NULL);
+
+ switch (tree->drag.type) {
+ case TV_DRAG_NONE:
+ return CORE_WINDOW_DRAG_NONE;
+
+ case TV_DRAG_SELECTION:
+ return CORE_WINDOW_DRAG_SELECTION;
+
+ case TV_DRAG_TEXTAREA: /* Fall through.*/
+ case TV_DRAG_SEARCH:
+ return CORE_WINDOW_DRAG_TEXT_SELECTION;
+
+ case TV_DRAG_MOVE:
+ return CORE_WINDOW_DRAG_MOVE;
+ }
+
+ return CORE_WINDOW_DRAG_NONE;
+}
/**
* Callback for textarea_create, in desktop/treeview.h
@@ -978,7 +1006,8 @@ static void treeview_textarea_search_callback(void *data,
/* Textarea drag started */
tree->drag.type = TV_DRAG_SEARCH;
}
- treeview__cw_drag_status(tree, tree->drag.type);
+ treeview__cw_drag_status(tree,
+ treeview__get_cw_drag_type(tree));
break;
case TEXTAREA_MSG_REDRAW_REQUEST:
@@ -4217,7 +4246,8 @@ static void treeview_textarea_callback(void *data, struct textarea_msg *msg)
/* Textarea drag started */
tree->drag.type = TV_DRAG_TEXTAREA;
}
- treeview__cw_drag_status(tree, tree->drag.type);
+ treeview__cw_drag_status(tree,
+ treeview__get_cw_drag_type(tree));
break;
case TEXTAREA_MSG_REDRAW_REQUEST:
diff --git a/frontends/riscos/gui/url_bar.c b/frontends/riscos/gui/url_bar.c
index 15aab3ea5..ec21e9371 100644
--- a/frontends/riscos/gui/url_bar.c
+++ b/frontends/riscos/gui/url_bar.c
@@ -40,6 +40,7 @@
#include "riscos/url_suggest.h"
#include "riscos/wimp.h"
#include "riscos/wimp_event.h"
+#include "riscos/wimputils.h"
#include "riscos/window.h"
#include "riscos/ucstables.h"
#include "riscos/filetype.h"
@@ -983,11 +984,13 @@ ro_gui_url_bar_click(struct url_bar *url_bar,
*/
if (pointer->buttons == wimp_DRAG_SELECT ||
pointer->buttons == wimp_DRAG_ADJUST) {
- if (pointer->i == url_bar->text.icon) {
- if (action != NULL) {
- *action = TOOLBAR_URL_DRAG_URL;
+ if (!ns_wimp_has_text_selection()) {
+ if (pointer->i == url_bar->text.icon) {
+ if (action != NULL) {
+ *action = TOOLBAR_URL_DRAG_URL;
+ }
+ return true;
}
- return true;
}
if (is_point_in_box(&pos, &url_bar->favicon.extent)) {
diff --git a/frontends/riscos/toolbar.c b/frontends/riscos/toolbar.c
index b3acba503..c6a882ab6 100644
--- a/frontends/riscos/toolbar.c
+++ b/frontends/riscos/toolbar.c
@@ -1115,18 +1115,20 @@ bool ro_toolbar_click(wimp_pointer *pointer)
return true;
}
- /* Nothing else has handled this, so try passing it to the
- * URL Complete module.
- *
- * \TODO -- This should really move into the URL Bar module, as
- * URL Complete is really an extension to that.
- */
-
- if (toolbar->url != NULL && toolbar->url_display &&
- ro_gui_url_bar_test_for_text_field_click(toolbar->url,
- pointer)) {
- ro_gui_url_complete_start(toolbar);
- return true;
+ if (pointer->buttons != wimp_DRAG_SELECT &&
+ pointer->buttons != wimp_DRAG_ADJUST) {
+ /* Nothing else has handled this click, so try passing it to
+ * the URL Complete module.
+ *
+ * \TODO -- This should really move into the URL Bar module, as
+ * URL Complete is really an extension to that.
+ */
+ if (toolbar->url != NULL && toolbar->url_display &&
+ ro_gui_url_bar_test_for_text_field_click(
+ toolbar->url, pointer)) {
+ ro_gui_url_complete_start(toolbar);
+ return true;
+ }
}
return false;
diff --git a/frontends/riscos/wimputils.h b/frontends/riscos/wimputils.h
index 5225a720e..b1bd88045 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.
+ */
+static inline 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
diff --git a/tools/convert_font.c b/tools/convert_font.c
index 9f5734b71..d22c85920 100644
--- a/tools/convert_font.c
+++ b/tools/convert_font.c
@@ -290,14 +290,14 @@ static bool generate_font_header(const char *path, struct font_data *data)
for (s = 0; s < 4; s++) {
- fprintf(fp, "const uint8_t *%s_section_table;\n",
+ fprintf(fp, "extern const uint8_t *%s_section_table;\n",
var_lables[s]);
- fprintf(fp, "const uint16_t *%s_sections;\n",
+ fprintf(fp, "extern const uint16_t *%s_sections;\n",
var_lables[s]);
}
- fprintf(fp, "const uint8_t *font_glyph_data;\n");
+ fprintf(fp, "extern const uint8_t *font_glyph_data;\n");
fprintf(fp, "\n\n");