From facc84d16683f03a3366f71f6ea280ec352a83b8 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Sun, 18 May 2014 11:26:48 -0400 Subject: simplify --- src/window-xlib.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/window-xlib.c b/src/window-xlib.c index 53cd970..0e6dc60 100644 --- a/src/window-xlib.c +++ b/src/window-xlib.c @@ -845,20 +845,23 @@ static int runes_window_backend_handle_builtin_button_press( static void runes_window_backend_start_selection( RunesTerm *t, int xpixel, int ypixel) { - t->scr.grid->selection_start = runes_window_backend_get_mouse_position( - t, xpixel, ypixel); - t->scr.grid->selection_end = t->scr.grid->selection_start; + struct runes_loc *start = &t->scr.grid->selection_start; + struct runes_loc *end = &t->scr.grid->selection_end; + + *start = runes_window_backend_get_mouse_position(t, xpixel, ypixel); + *end = *start; } static void runes_window_backend_stop_selection( RunesTerm *t, int xpixel, int ypixel, Time time) { RunesWindowBackend *w = &t->w; + struct runes_loc *start = &t->scr.grid->selection_start; + struct runes_loc *end = &t->scr.grid->selection_end; - t->scr.grid->selection_end = runes_window_backend_get_mouse_position( - t, xpixel, ypixel); + *end = runes_window_backend_get_mouse_position(t, xpixel, ypixel); - if ((t->scr.grid->selection_start.row == t->scr.grid->selection_end.row) && (t->scr.grid->selection_start.col == t->scr.grid->selection_end.col)) { + if (start->row == end->row && start->col == end->col) { XSetSelectionOwner(w->dpy, XA_PRIMARY, None, time); w->has_selection = 0; } -- cgit v1.2.3-54-g00ecf