summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--render/html_redraw.c42
-rw-r--r--render/textinput.c59
-rw-r--r--render/textinput.h17
3 files changed, 2 insertions, 116 deletions
diff --git a/render/html_redraw.c b/render/html_redraw.c
index cad0233ee..29820823a 100644
--- a/render/html_redraw.c
+++ b/render/html_redraw.c
@@ -65,9 +65,6 @@ static bool html_redraw_text_box(struct box *box, int x, int y,
const struct rect *clip, float scale,
colour current_background_color,
const struct redraw_context *ctx);
-static bool html_redraw_caret(struct caret *caret,
- colour current_background_color, float scale,
- const struct redraw_context *ctx);
static bool html_redraw_borders(struct box *box, int x_parent, int y_parent,
int p_width, int p_height, const struct rect *clip,
float scale, const struct redraw_context *ctx);
@@ -838,19 +835,12 @@ bool html_redraw_text_box(struct box *box, int x, int y,
clip, box->height, scale, excluded, ctx))
return false;
- /* does this textbox contain the ghost caret? */
- if (ghost_caret.defined && box == ghost_caret.text_box) {
-
- if (!html_redraw_caret(&ghost_caret, current_background_color,
- scale, ctx))
- return false;
- }
return true;
}
/**
* Redraw a short text string, complete with highlighting
- * (for selection/search) and ghost caret
+ * (for selection/search)
*
* \param utf8_text pointer to UTF-8 text string
* \param utf8_len length of string, in bytes
@@ -1026,36 +1016,6 @@ bool text_redraw(const char *utf8_text, size_t utf8_len,
/**
- * Draw text caret.
- *
- * \param c structure describing text caret
- * \param current_background_color background colour under the caret
- * \param scale current scale setting (1.0 = 100%)
- * \param ctx current redraw context
- * \return true iff successful and redraw should proceed
- */
-
-bool html_redraw_caret(struct caret *c, colour current_background_color,
- float scale, const struct redraw_context *ctx)
-{
- const struct plotter_table *plot = ctx->plot;
- int xc = c->x, y = c->y;
- int h = c->height - 1;
- int w = (h + 7) / 8;
-
- return (plot->line(xc * scale, y * scale,
- xc * scale, (y + h) * scale,
- plot_style_caret) &&
- plot->line((xc - w) * scale, y * scale,
- (xc + w) * scale, y * scale,
- plot_style_caret) &&
- plot->line((xc - w) * scale, (y + h) * scale,
- (xc + w) * scale, (y + h) * scale,
- plot_style_caret));
-}
-
-
-/**
* Draw borders for a box.
*
* \param box box to draw
diff --git a/render/textinput.c b/render/textinput.c
index a12d72aaf..5a6c38778 100644
--- a/render/textinput.c
+++ b/render/textinput.c
@@ -48,10 +48,6 @@
/* Define to enable textinput debug */
#undef TEXTINPUT_DEBUG
-/** ghost caret used to indicate the insertion point when dragging text
- into a textarea/input field */
-struct caret ghost_caret;
-
static bool textbox_delete(struct browser_window *bw, struct box *text_box,
unsigned char_offset, unsigned utf8_len);
@@ -76,59 +72,6 @@ static bool textinput_input_paste_text(struct browser_window *bw,
#define SPACE_LEN(b) ((b->space == 0) ? 0 : 1)
-/**
- * Remove the given text caret from the window by invalidating it
- * and causing its former position to be redrawn.
- *
- * \param c structure describing text caret
- */
-
-void caret_remove(struct caret *c)
-{
- if (c->defined) {
- int w = (c->height + 7) / 8;
- int xc = c->x;
- c->defined = false;
- browser_window_redraw_rect(c->bw,
- xc - w, c->y, 2 * w, c->height);
- }
-}
-
-
-/**
- * Set the given text caret's position within the window (text box
- * and byte/pixel offsets within the UTF-8 content of that text box)
- * and draw it.
- *
- * \param c structure describing text caret
- * \param bw browser window containing caret
- * \param box TEXT box containing caret
- * \param char_offset byte offset within UTF-8 representation
- * \param pixel_offset from left side of box
- */
-
-void caret_set_position(struct caret *c, struct browser_window *bw,
- struct box *text_box, int char_offset, int pixel_offset)
-{
- struct rect r;
- int xc;
- int w;
-
- box_bounds(text_box, &r);
-
- c->bw = bw;
- c->text_box = text_box;
- c->char_offset = char_offset;
-
- c->x = xc = r.x0 + pixel_offset;
- c->y = r.y0;
- c->height = r.y1 - r.y0;
- w = (c->height + 7) / 8;
-
- c->defined = true;
-
- browser_window_redraw_rect(c->bw, xc - w, c->y, w * 2, c->height);
-}
/**
@@ -145,7 +88,7 @@ void caret_set_position(struct caret *c, struct browser_window *bw,
* \return pointer to TEXT box
*/
-struct box *textarea_get_position(struct box *textarea, int x, int y,
+static struct box *textarea_get_position(struct box *textarea, int x, int y,
int *pchar_offset, int *ppixel_offset)
{
/* A textarea is an INLINE_BLOCK containing a single
diff --git a/render/textinput.h b/render/textinput.h
index 30cdc3036..52faa3249 100644
--- a/render/textinput.h
+++ b/render/textinput.h
@@ -31,7 +31,6 @@
struct browser_window;
struct box;
-struct content;
struct caret
@@ -39,7 +38,6 @@ struct caret
bool defined;
struct browser_window *bw;
- struct content *c;
struct box *text_box;
size_t char_offset;
@@ -51,21 +49,6 @@ struct caret
};
-/** There's a single ghost caret used to implement
- * drag-and-drop of text into text areas and input fields.
- */
-
-extern struct caret ghost_caret;
-
-
-void caret_set_position(struct caret *c, struct browser_window *bw,
- struct box *text_box, int char_offset, int pixel_offset);
-void caret_remove(struct caret *c);
-
-struct box *textarea_get_position(struct box *textarea, int x, int y,
- int *pchar_offset, int *ppixel_offset);
-
-
void textinput_textarea_click(struct content *c, browser_mouse_state mouse,
struct box *textarea, int box_x, int box_y, int x, int y);