summaryrefslogtreecommitdiff
path: root/content/content.h
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2013-02-22 12:19:35 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2013-02-22 12:19:35 +0000
commitc2a718075ad321a9cf4678e72645acda5c3471a9 (patch)
treea634c4c47c579aab35839ee3861ef90f92d89b48 /content/content.h
parent2b0cc398bb5b8e5dc90fcc0a71a9a154dd9f2d74 (diff)
downloadnetsurf-c2a718075ad321a9cf4678e72645acda5c3471a9.tar.gz
netsurf-c2a718075ad321a9cf4678e72645acda5c3471a9.tar.bz2
A load of refactoring of how content selection and input work.
Keypresses now go via content interface. Contents don't shove the selection object into browser windows any more. Contents report selection existence by sending message. HTML content keeps track of where selections in it exist. Contents report whether they have input focus via caret setting msg. Caret can be hidden (can still input/paste) or removed. Consolidate textarea selection handling. Make textarea report its selection status changes to client. Various textarea fixes. Changed how we decide when to clear selections, and give focus.
Diffstat (limited to 'content/content.h')
-rw-r--r--content/content.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/content/content.h b/content/content.h
index 2ae0b38be..3f93d603b 100644
--- a/content/content.h
+++ b/content/content.h
@@ -79,6 +79,8 @@ typedef enum {
CONTENT_MSG_DRAGSAVE, /**< Allow drag saving of content */
CONTENT_MSG_SAVELINK, /**< Allow URL to be saved */
CONTENT_MSG_POINTER, /**< Wants a specific mouse pointer set */
+ CONTENT_MSG_SELECTION, /**< A selection made or cleared */
+ CONTENT_MSG_CARET, /**< Caret movement / hiding */
CONTENT_MSG_DRAG /**< A drag started or ended */
} content_msg;
@@ -153,6 +155,25 @@ union content_msg_data {
} savelink;
/** CONTENT_MSG_POINTER - Mouse pointer to set */
browser_pointer_shape pointer;
+ /** CONTENT_MSG_SELECTION - Selection made or cleared */
+ struct {
+ bool selection; /**< false for selection cleared */
+ bool read_only;
+ } selection;
+ /** CONTENT_MSG_CARET - set caret position or, hide caret */
+ struct {
+ enum {
+ CONTENT_CARET_SET_POS,
+ CONTENT_CARET_HIDE,
+ CONTENT_CARET_REMOVE
+ } type;
+ struct {
+ int x; /**< Carret x-coord */
+ int y; /**< Carret y-coord */
+ int height; /**< Carret height */
+ const struct rect *clip; /**< Carret clip rect */
+ } pos; /**< With CONTENT_CARET_SET_POS */
+ } caret;
/** CONTENT_MSG_DRAG - Drag start or end */
struct {
enum {
@@ -219,12 +240,14 @@ void content_mouse_track(struct hlcache_handle *h, struct browser_window *bw,
browser_mouse_state mouse, int x, int y);
void content_mouse_action(struct hlcache_handle *h, struct browser_window *bw,
browser_mouse_state mouse, int x, int y);
+bool content_keypress(struct hlcache_handle *h, uint32_t key);
bool content_redraw(struct hlcache_handle *h, struct content_redraw_data *data,
const struct rect *clip, const struct redraw_context *ctx);
void content_open(struct hlcache_handle *h, struct browser_window *bw,
struct content *page, struct object_params *params);
void content_close(struct hlcache_handle *h);
-struct selection *content_get_selection(struct hlcache_handle *h);
+void content_clear_selection(struct hlcache_handle *h);
+char * content_get_selection(struct hlcache_handle *h);
void content_get_contextual_content(struct hlcache_handle *h,
int x, int y, struct contextual_content *data);
bool content_scroll_at_point(struct hlcache_handle *h,