summaryrefslogtreecommitdiff
path: root/desktop/textinput.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2013-03-05 14:51:16 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2013-03-05 22:54:51 +0000
commite8950dee22e82c00dcf48efe2b7125d87776c682 (patch)
treed5226e01f2f9e6b6e55d912a7663ac4d4ec621b7 /desktop/textinput.c
parent461d4576fbbe5a811074224b578d98af9f42de3c (diff)
downloadnetsurf-e8950dee22e82c00dcf48efe2b7125d87776c682.tar.gz
netsurf-e8950dee22e82c00dcf48efe2b7125d87776c682.tar.bz2
Propagate native caret clip rect through core.
Diffstat (limited to 'desktop/textinput.c')
-rw-r--r--desktop/textinput.c30
1 files changed, 19 insertions, 11 deletions
diff --git a/desktop/textinput.c b/desktop/textinput.c
index 6ffa02c86..4d280d536 100644
--- a/desktop/textinput.c
+++ b/desktop/textinput.c
@@ -52,22 +52,19 @@
/**
* Position the caret and assign a callback for key presses.
*
- * \param bw The browser window in which to place the caret
- * \param x X coordinate of the caret
- * \param y Y coordinate
- * \param height Height of caret
- * \param caret_cb Callback function for keypresses
- * \param paste_cb Callback function for pasting text
- * \param move_cb Callback function for caret movement
- * \param p1 Callback private data pointer, passed to callback function
- * \param p2 Callback private data pointer, passed to callback function
+ * \param bw The browser window in which to place the caret
+ * \param x X coordinate of the caret
+ * \param y Y coordinate
+ * \param height Height of caret
+ * \param clip Clip rectangle for caret
*/
-void browser_window_place_caret(struct browser_window *bw,
- int x, int y, int height)
+void browser_window_place_caret(struct browser_window *bw, int x, int y,
+ int height, const struct rect *clip)
{
struct browser_window *root_bw;
int pos_x = 0;
int pos_y = 0;
+ struct rect cr;
/* Find top level browser window */
root_bw = browser_window_get_root(bw);
@@ -76,6 +73,17 @@ void browser_window_place_caret(struct browser_window *bw,
x = x * bw->scale + pos_x;
y = y * bw->scale + pos_y;
+ if (clip != NULL) {
+ cr = *clip;
+ cr.x0 += pos_x;
+ cr.y0 += pos_y;
+ cr.x1 += pos_x;
+ cr.y1 += pos_y;
+ }
+
+ /* TODO: intersect with bw viewport */
+ /* TODO: pass clip rect out to GUI */
+
gui_window_place_caret(root_bw->window, x, y, height * bw->scale);
/* Set focus browser window */