summaryrefslogtreecommitdiff
path: root/render/textplain.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2011-07-01 11:16:43 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2011-07-01 11:16:43 +0000
commitf9566b64050c76c9fc78a0b691cf8c83643c847b (patch)
tree1e4027e033afd695a38997c08c5583995f4b0856 /render/textplain.c
parent5639e1e04772db96a7772ec8ba4facf5bf5e6d40 (diff)
downloadnetsurf-f9566b64050c76c9fc78a0b691cf8c83643c847b.tar.gz
netsurf-f9566b64050c76c9fc78a0b691cf8c83643c847b.tar.bz2
Set/unset selection context's browser window on content_open/content_close.
svn path=/trunk/netsurf/; revision=12551
Diffstat (limited to 'render/textplain.c')
-rw-r--r--render/textplain.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/render/textplain.c b/render/textplain.c
index dca563178..6827ab5d8 100644
--- a/render/textplain.c
+++ b/render/textplain.c
@@ -108,6 +108,7 @@ static bool textplain_redraw(struct content *c, struct content_redraw_data *data
static void textplain_open(struct content *c, struct browser_window *bw,
struct content *page, struct box *box,
struct object_params *params);
+void textplain_close(struct content *c);
static nserror textplain_clone(const struct content *old,
struct content **newc);
static content_type textplain_content_type(lwc_string *mime_type);
@@ -132,6 +133,7 @@ static const content_handler textplain_content_handler = {
.mouse_action = textplain_mouse_action,
.redraw = textplain_redraw,
.open = textplain_open,
+ .close = textplain_close,
.clone = textplain_clone,
.type = textplain_content_type,
.no_share = true,
@@ -820,9 +822,24 @@ void textplain_open(struct content *c, struct browser_window *bw,
struct content *page, struct box *box,
struct object_params *params)
{
- textplain_content *textplain = (textplain_content *) c;
+ textplain_content *text = (textplain_content *) c;
+
+ text->bw = bw;
+}
+
+
+/**
+ * Handle a window containing a CONTENT_TEXTPLAIN being closed.
+ */
+
+void textplain_close(struct content *c)
+{
+ textplain_content *text = (textplain_content *) c;
+
+ if (text->bw && text->bw->sel)
+ selection_set_browser_window(text->bw->sel, NULL);
- textplain->bw = bw;
+ text->bw = NULL;
}
/**