diff options
| author | Po Lu | 2024-09-12 08:22:25 +0800 |
|---|---|---|
| committer | Po Lu | 2024-09-12 08:23:13 +0800 |
| commit | 11e7ae3964e192b0e4bcc437a04278ee727e720b (patch) | |
| tree | cc9f04d810f87187205d5108b46cd9907aaf8299 /src/pgtkselect.c | |
| parent | 9a1c76bf7ff49d886cc8e1a3f360d71e62544802 (diff) | |
| download | emacs-11e7ae3964e192b0e4bcc437a04278ee727e720b.tar.gz emacs-11e7ae3964e192b0e4bcc437a04278ee727e720b.zip | |
Fix bug#72254
* src/pgtkselect.c (Fpgtk_get_selection_internal): If requesting
TARGETS with just one result, return it as a vector.
(bug#72254)
Diffstat (limited to 'src/pgtkselect.c')
| -rw-r--r-- | src/pgtkselect.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/pgtkselect.c b/src/pgtkselect.c index 271411b87ca..9e172c58602 100644 --- a/src/pgtkselect.c +++ b/src/pgtkselect.c | |||
| @@ -1644,10 +1644,24 @@ frame's display, or the first available X display. */) | |||
| 1644 | 1644 | ||
| 1645 | if (NILP (val) && FRAME_LIVE_P (f)) | 1645 | if (NILP (val) && FRAME_LIVE_P (f)) |
| 1646 | { | 1646 | { |
| 1647 | Lisp_Object frame; | 1647 | Lisp_Object frame, val; |
| 1648 | XSETFRAME (frame, f); | 1648 | XSETFRAME (frame, f); |
| 1649 | return pgtk_get_foreign_selection (selection_symbol, target_type, | 1649 | |
| 1650 | time_stamp, frame); | 1650 | val = pgtk_get_foreign_selection (selection_symbol, target_type, |
| 1651 | time_stamp, frame); | ||
| 1652 | |||
| 1653 | /* A window property holding just one item is indistinguishable | ||
| 1654 | from an array of one element, and is always decoded as the | ||
| 1655 | former, producing issues with programs that expect the TARGETS | ||
| 1656 | property always to return vectors, even when the toolkit | ||
| 1657 | reports just one data type. Though X sidesteps this ambiguity | ||
| 1658 | by defining TARGETS as returning at least two properties | ||
| 1659 | TARGETS and MULTIPLE, GTK knows no such scruples, and therefore | ||
| 1660 | symbol values (or nil) should be enclosed in vectors when | ||
| 1661 | TARGETS is being requested. (bug#72254) */ | ||
| 1662 | if (EQ (target_type, QTARGETS) && (NILP (val) || SYMBOLP (val))) | ||
| 1663 | val = make_vector (NILP (val) ? 0 : 1, val); | ||
| 1664 | return val; | ||
| 1651 | } | 1665 | } |
| 1652 | 1666 | ||
| 1653 | if (CONSP (val) && SYMBOLP (XCAR (val))) | 1667 | if (CONSP (val) && SYMBOLP (XCAR (val))) |