diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2019-08-09 19:26:34 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2019-08-09 19:26:34 +0000 |
| commit | 70b6d9d7d2969ea704780cad5017a43a66e9670a (patch) | |
| tree | c15aab233f465a933c9a9947129e61430746aa60 | |
| parent | README: remove empty lines in between list items (diff) | |
input: don't paste from primary if client is mouse tracking
| -rw-r--r-- | input.c | 2 | ||||
| -rw-r--r-- | selection.c | 2 | ||||
| -rw-r--r-- | selection.h | 1 |
3 files changed, 3 insertions, 2 deletions
@@ -433,7 +433,7 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer, break; } } else { - if (term->mouse.count == 1 && button == BTN_MIDDLE) + if (term->mouse.count == 1 && button == BTN_MIDDLE && selection_enabled(term)) selection_from_primary(term); selection_cancel(term); } diff --git a/selection.c b/selection.c index 586b1c3d..8dd00da0 100644 --- a/selection.c +++ b/selection.c @@ -17,7 +17,7 @@ #define min(x, y) ((x) < (y) ? (x) : (y)) #define max(x, y) ((x) > (y) ? (x) : (y)) -static bool +bool selection_enabled(const struct terminal *term) { return term->mouse_tracking == MOUSE_NONE || term->kbd.shift; diff --git a/selection.h b/selection.h index 8622c04a..d7b96d01 100644 --- a/selection.h +++ b/selection.h @@ -8,6 +8,7 @@ extern const struct wl_data_device_listener data_device_listener; extern const struct zwp_primary_selection_device_v1_listener primary_selection_device_listener; +bool selection_enabled(const struct terminal *term); void selection_start(struct terminal *term, int col, int row); void selection_update(struct terminal *term, int col, int row); void selection_finalize(struct terminal *term, uint32_t serial); |
