Mercurial > vim
comparison src/gui_gtk_x11.c @ 13503:5d345460c984 v8.0.1625
patch 8.0.1625: test_quotestar is flaky when run in GTK GUI
commit https://github.com/vim/vim/commit/29dfa5af3c14406573d08609d2e95add4d6b45fb
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Mar 20 21:24:45 2018 +0100
patch 8.0.1625: test_quotestar is flaky when run in GTK GUI
Problem: Test_quotestar is flaky when run in GTK GUI.
Solution: Do not call lose_selection when invoked from
selection_clear_event().
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 20 Mar 2018 21:30:07 +0100 |
parents | ac42c4b11dbc |
children | 1feeefd8cddb |
comparison
equal
deleted
inserted
replaced
13502:4e5d34df2740 | 13503:5d345460c984 |
---|---|
1364 | 1364 |
1365 /**************************************************************************** | 1365 /**************************************************************************** |
1366 * Selection handlers: | 1366 * Selection handlers: |
1367 */ | 1367 */ |
1368 | 1368 |
1369 /* Remember when clip_lose_selection was called from here, we must not call | |
1370 * gtk_selection_owner_set() then. */ | |
1371 static int in_selection_clear_event = FALSE; | |
1372 | |
1369 static gint | 1373 static gint |
1370 selection_clear_event(GtkWidget *widget UNUSED, | 1374 selection_clear_event(GtkWidget *widget UNUSED, |
1371 GdkEventSelection *event, | 1375 GdkEventSelection *event, |
1372 gpointer user_data UNUSED) | 1376 gpointer user_data UNUSED) |
1373 { | 1377 { |
1378 in_selection_clear_event = TRUE; | |
1374 if (event->selection == clip_plus.gtk_sel_atom) | 1379 if (event->selection == clip_plus.gtk_sel_atom) |
1375 clip_lose_selection(&clip_plus); | 1380 clip_lose_selection(&clip_plus); |
1376 else | 1381 else |
1377 clip_lose_selection(&clip_star); | 1382 clip_lose_selection(&clip_star); |
1383 in_selection_clear_event = FALSE; | |
1378 | 1384 |
1379 return TRUE; | 1385 return TRUE; |
1380 } | 1386 } |
1381 | 1387 |
1382 #define RS_NONE 0 /* selection_received_cb() not called yet */ | 1388 #define RS_NONE 0 /* selection_received_cb() not called yet */ |
7046 * Disown the selection. | 7052 * Disown the selection. |
7047 */ | 7053 */ |
7048 void | 7054 void |
7049 clip_mch_lose_selection(VimClipboard *cbd UNUSED) | 7055 clip_mch_lose_selection(VimClipboard *cbd UNUSED) |
7050 { | 7056 { |
7051 gtk_selection_owner_set(NULL, cbd->gtk_sel_atom, gui.event_time); | 7057 if (!in_selection_clear_event) |
7052 gui_mch_update(); | 7058 { |
7059 gtk_selection_owner_set(NULL, cbd->gtk_sel_atom, gui.event_time); | |
7060 gui_mch_update(); | |
7061 } | |
7053 } | 7062 } |
7054 | 7063 |
7055 /* | 7064 /* |
7056 * Own the selection and return OK if it worked. | 7065 * Own the selection and return OK if it worked. |
7057 */ | 7066 */ |