From 15e8ba0270fac14839fd4dda65418904bfd0c880 Mon Sep 17 00:00:00 2001 From: Adrian Lees Date: Mon, 2 Feb 2009 00:06:31 +0000 Subject: Selection menu and save/download tweaks svn path=/trunk/netsurf/; revision=6349 --- desktop/selection.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'desktop/selection.c') diff --git a/desktop/selection.c b/desktop/selection.c index 9140ebbf0..0d45f1720 100644 --- a/desktop/selection.c +++ b/desktop/selection.c @@ -134,7 +134,8 @@ void selection_reinit(struct selection *s, struct box *root) if (IS_INPUT(root)) { static int next_idx = 0; - root_idx = (next_idx++) << 28; + if (!++next_idx) next_idx = 1; + root_idx = next_idx << 28; } else root_idx = 0; @@ -191,6 +192,20 @@ void selection_init(struct selection *s, struct box *root) } +/** + * Indicate whether the selected text is read only, ie. cannot be modified. + * + * \param s selection object + * \return true iff the selection is read only + */ + +bool selection_read_only(struct selection *s) +{ + return !s->root || !NUMBER_SPACE(s->root->byte_offset); + +} + + /** * Label each text box in the given box subtree with its position * in a textual representation of the content. -- cgit v1.2.3