From 9670e562fc024b4048927d691210aaa542dd3e67 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 27 May 2014 18:58:18 -0400 Subject: clear the selection when the window is resized --- src/window-xlib.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/window-xlib.c b/src/window-xlib.c index 6f449ae..f07cf41 100644 --- a/src/window-xlib.c +++ b/src/window-xlib.c @@ -95,6 +95,7 @@ static void runes_window_backend_start_selection( RunesTerm *t, int xpixel, int ypixel, Time time); static void runes_window_backend_update_selection( RunesTerm *t, int xpixel, int ypixel); +static void runes_window_backend_clear_selection(RunesTerm *t); static void runes_window_backend_handle_key_event(RunesTerm *t, XKeyEvent *e); static void runes_window_backend_handle_button_event( RunesTerm *t, XButtonEvent *e); @@ -479,6 +480,7 @@ static void runes_window_backend_resize_window( cairo_xlib_surface_set_size( cairo_get_target(w->backend_cr), width - 4, height - 4); runes_display_set_window_size(t); + runes_window_backend_clear_selection(t); } } @@ -645,6 +647,10 @@ static void runes_window_backend_update_selection( struct runes_loc *end = &t->scr.grid->selection_end; struct runes_loc orig_end = *end; + if (!t->scr.has_selection) { + return; + } + *end = runes_window_backend_get_mouse_position(t, xpixel, ypixel); if (orig_end.row != end->row || orig_end.col != end->col) { @@ -653,6 +659,14 @@ static void runes_window_backend_update_selection( } } +static void runes_window_backend_clear_selection(RunesTerm *t) +{ + RunesWindowBackend *w = &t->w; + + XSetSelectionOwner(w->dpy, XA_PRIMARY, None, CurrentTime); + t->scr.has_selection = 0; +} + static void runes_window_backend_handle_key_event(RunesTerm *t, XKeyEvent *e) { RunesWindowBackend *w = &t->w; -- cgit v1.2.3-54-g00ecf