diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-05-12 15:10:21 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-05-12 15:10:21 +0300 |
commit | f7715b33374ae6be20fcc0b1db789c1b8451ead0 (patch) | |
tree | 28f1ea61b2f563e048254180b8c26054adcfb08d /intern/ghost | |
parent | 4d8ec4439f005aed0bb3cf1c3c684a66c9153197 (diff) | |
parent | 65381e220e5e04d60e2959d5ccf4c1ea02144c8c (diff) |
Merge branch 'blender-v2.83-release'
Diffstat (limited to 'intern/ghost')
-rw-r--r-- | intern/ghost/intern/GHOST_SystemX11.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index 91c63a3fb76..5c1f34e3a63 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -2172,14 +2172,24 @@ GHOST_TUns8 *GHOST_SystemX11::getClipboard(bool selection) const else if (owner == None) return (NULL); + /* Restore events so copy doesn't swallow other event types (keyboard/mouse). */ + vector<XEvent> restore_events; + while (1) { /* only get an event if xcout() is doing something */ - if (context != XCLIB_XCOUT_NONE) + bool restore_this_event = false; + if (context != XCLIB_XCOUT_NONE) { XNextEvent(m_display, &evt); + restore_this_event = (evt.type != SelectionNotify); + } /* fetch the selection, or part of it */ getClipboard_xcout(&evt, sseln, target, &sel_buf, &sel_len, &context); + if (restore_this_event) { + restore_events.push_back(evt); + } + /* fallback is needed. set XA_STRING to target and restart the loop. */ if (context == XCLIB_XCOUT_FALLBACK) { context = XCLIB_XCOUT_NONE; @@ -2208,6 +2218,11 @@ GHOST_TUns8 *GHOST_SystemX11::getClipboard(bool selection) const break; } + while (!restore_events.empty()) { + XPutBackEvent(m_display, &restore_events.back()); + restore_events.pop_back(); + } + if (sel_len) { /* only print the buffer out, and free it, if it's not * empty |