From 5ce8f0baf1af7ce119c0c3c5b4d32934a1d95a0a Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Sat, 23 May 2020 23:33:52 +0100 Subject: make text selection context an opaque interface --- desktop/selection.c | 21 ++++++++++++++++++++- desktop/selection.h | 22 ++-------------------- 2 files changed, 22 insertions(+), 21 deletions(-) (limited to 'desktop') diff --git a/desktop/selection.c b/desktop/selection.c index 06cfdae8f..4d3d335ef 100644 --- a/desktop/selection.c +++ b/desktop/selection.c @@ -45,6 +45,26 @@ struct selection_string { }; +typedef enum { + DRAG_NONE, + DRAG_START, + DRAG_END +} seln_drag_state; + +struct selection { + struct content *c; + struct box *root; + + unsigned max_idx; /* total bytes in text representation */ + + unsigned start_idx; /* offset in bytes within text representation */ + unsigned end_idx; + + bool defined; + + seln_drag_state drag_state; +}; + /** * Redraws the given range of text. * @@ -236,7 +256,6 @@ struct selection *selection_create(struct content *c) sel = calloc(1, sizeof(struct selection)); if (sel) { selection_prepare(sel, c); - selection_init(sel); } return sel; diff --git a/desktop/selection.h b/desktop/selection.h index 86ff395a1..1b8d91c08 100644 --- a/desktop/selection.h +++ b/desktop/selection.h @@ -30,26 +30,8 @@ struct box; struct browser_window; struct plot_font_style; struct selection_string; - -typedef enum { - DRAG_NONE, - DRAG_START, - DRAG_END -} seln_drag_state; - -struct selection { - struct content *c; - struct box *root; - - unsigned max_idx; /* total bytes in text representation */ - - unsigned start_idx; /* offset in bytes within text representation */ - unsigned end_idx; - - bool defined; - - seln_drag_state drag_state; -}; +struct selection; +struct content; /** * determine if a selecion is active -- cgit v1.2.3