aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2014-05-18 11:26:48 -0400
committerJesse Luehrs <doy@tozt.net>2014-07-04 22:39:07 -0400
commitfacc84d16683f03a3366f71f6ea280ec352a83b8 (patch)
treef0f44c189bafe87bd82f69702a90ba71b8076a07
parent033b80e9ef340e75a56a37eab803bb4858415061 (diff)
downloadrunes-facc84d16683f03a3366f71f6ea280ec352a83b8.tar.gz
runes-facc84d16683f03a3366f71f6ea280ec352a83b8.zip
simplify
-rw-r--r--src/window-xlib.c15
1 files 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;
}