aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-05-27 18:58:18 -0400
committerJesse Luehrs <doy@tozt.net>2014-07-04 22:39:07 -0400
commit9670e562fc024b4048927d691210aaa542dd3e67 (patch)
treea2881f26a79e7c791d9fac21c4b37b95ff064ee5
parent2c3f9b324aa335f4f952548a2c48f493a5b3b081 (diff)
downloadrunes-9670e562fc024b4048927d691210aaa542dd3e67.tar.gz
runes-9670e562fc024b4048927d691210aaa542dd3e67.zip
clear the selection when the window is resized
-rw-r--r--src/window-xlib.c14
1 files changed, 14 insertions, 0 deletions
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;