From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Urs Fleisch Newsgroups: gmane.emacs.bugs Subject: bug#20804: 24.4; XdndDrop does not use time stamp Date: Sat, 13 Jun 2015 10:42:13 +0200 Message-ID: <20150613104213.50d24f9d@pristina> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/1tpx=bNeQHwS4AoYmPooW_d" X-Trace: ger.gmane.org 1434221007 900 80.91.229.3 (13 Jun 2015 18:43:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 13 Jun 2015 18:43:27 +0000 (UTC) To: 20804@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jun 13 20:43:14 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Z3qOf-00033F-Ig for geb-bug-gnu-emacs@m.gmane.org; Sat, 13 Jun 2015 20:43:13 +0200 Original-Received: from localhost ([::1]:56708 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z3qOe-00026Y-Kk for geb-bug-gnu-emacs@m.gmane.org; Sat, 13 Jun 2015 14:43:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53472) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z3qOY-00026E-Qn for bug-gnu-emacs@gnu.org; Sat, 13 Jun 2015 14:43:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z3qOU-0003bk-D1 for bug-gnu-emacs@gnu.org; Sat, 13 Jun 2015 14:43:06 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:38478) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z3qOU-0003be-8w for bug-gnu-emacs@gnu.org; Sat, 13 Jun 2015 14:43:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1Z3qOT-0006Yv-TS for bug-gnu-emacs@gnu.org; Sat, 13 Jun 2015 14:43:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Urs Fleisch Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 13 Jun 2015 18:43:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 20804 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.143422093325134 (code B ref -1); Sat, 13 Jun 2015 18:43:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 13 Jun 2015 18:42:13 +0000 Original-Received: from localhost ([127.0.0.1]:52932 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z3qNg-0006XJ-21 for submit@debbugs.gnu.org; Sat, 13 Jun 2015 14:42:13 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:54899) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Z3h1L-0004LB-9W for submit@debbugs.gnu.org; Sat, 13 Jun 2015 04:42:32 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z3h1E-0007wl-3t for submit@debbugs.gnu.org; Sat, 13 Jun 2015 04:42:25 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:40817) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z3h1D-0007wh-Vr for submit@debbugs.gnu.org; Sat, 13 Jun 2015 04:42:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:40152) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z3h1B-0008NP-UY for bug-gnu-emacs@gnu.org; Sat, 13 Jun 2015 04:42:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z3h17-0007tx-Qu for bug-gnu-emacs@gnu.org; Sat, 13 Jun 2015 04:42:21 -0400 Original-Received: from mail-wi0-x22a.google.com ([2a00:1450:400c:c05::22a]:35206) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z3h17-0007tU-FE for bug-gnu-emacs@gnu.org; Sat, 13 Jun 2015 04:42:17 -0400 Original-Received: by wiga1 with SMTP id a1so33908169wig.0 for ; Sat, 13 Jun 2015 01:42:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:subject:message-id:mime-version:content-type; bh=rmPEPL4x3BXxKqnkFvItzAKDKP89D1LjyngylygnkxY=; b=eh2s2FsOrv069LW2a/DU3E/Lzikvl7iPokmUzEYS4JYFBw8xcX3RqloVewvDEJyjNm CYYt5MsSV+6i4Vc8f8BTP40+g+WF9zeAhxaz7rt/8nVlCnj76WTqYgbMNpqX6L8NdcK5 Lg7qeEL8qj49HlOFxeUReJAbHlOLh6TTG6fMtHb0SYgWV8j2k8S/WDfWihYU3efBx2a4 3Bn/ltQfjWGp1O8uBjLibBds+nKTBlomNJAUcFC/hANKk6eFCZWk2tOkoV3+WFtsjvjM jDdH1uq/MeXHUQk4XUK4iXHySB6M7PJg5w66e5ETa3eBl/TjW/HHHjrtCgbbEPHu9I60 xlVg== X-Received: by 10.180.106.97 with SMTP id gt1mr13531449wib.37.1434184936213; Sat, 13 Jun 2015 01:42:16 -0700 (PDT) Original-Received: from pristina (77-58-180-61.dclient.hispeed.ch. [77.58.180.61]) by mx.google.com with ESMTPSA id l6sm9355419wjz.4.2015.06.13.01.42.15 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 13 Jun 2015 01:42:15 -0700 (PDT) X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.27; x86_64-pc-linux-gnu) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Mailman-Approved-At: Sat, 13 Jun 2015 14:42:10 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:103908 Archived-At: --MP_/1tpx=bNeQHwS4AoYmPooW_d Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi, Drag and drop from Qt 5 applications does not work on Linux (X11). This can be easily reproduced using the draggabletext example from Qt 5 and trying to drop a text into Emacs. I have created a bug report for Qt 5, you can find it at . To resume what I reported there: Emacs receives an XdndDrop message, but the value received by (x-get-selection-internal 'XdndSelection "text/uri-list") is nil. Qt 5 receives the get selection request in QXcbDrag::handleSelectionRequest() (in qxcbdrag.cpp) and only returns the selection if the time stamps match. However, when dropping into Emacs, the time stamps differ and no matching selection is found. Of course, Qt 5 should not be so picky about these time stamps and try to find a matching selection also in the case where the time stamps differ, e.g. using the IDs of XdndAware windows. I have created a patch for Qt which fixes this and I hope that it will be handled by the Qt maintainers. However, I think that also the behavior of Emacs could be improved. It does not use the time stamp which can be found in the XdndDrop message when requesting the selection. The XDND specification states: XdndDrop Sent from source to target to complete the drop. data.l[0] contains the XID of the source window. data.l[1] is reserved for future use (flags). data.l[2] contains the time stamp for retrieving the data. (new in version 1) When passing the value found in data.l[2] as the optional time stamp argument to x-get-selection-internal, dropping from Qt 5 works with Emacs. I have attached a patch fixing this. ~~~~ --- x-dnd.el.orig 2015-06-13 09:52:02.999811917 +0200 +++ x-dnd.el 2015-06-13 09:53:30.808247335 +0200 @@ -496,10 +496,12 @@ ((equal "XdndDrop" message) (if (windowp window) (select-window window)) (let* ((dnd-source (aref data 0)) + (timestamp (aref data 2)) (value (and (x-dnd-current-type window) (x-get-selection-internal 'XdndSelection - (intern (x-dnd-current-type window))))) + (intern (x-dnd-current-type window)) + timestamp))) success action) (setq action (if value ~~~~ Regards, Urs Fleisch In GNU Emacs 24.4.1 (x86_64-pc-linux-gnu, GTK+ Version 3.14.9) of 2015-03-21 on kissel, modified by Debian Windowing system distributor `The X.Org Foundation', version 11.0.11701000 System Description: Ubuntu 15.04 Configured using: `configure --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp --build x86_64-linux-gnu --prefix=/usr --sharedstatedir=/var/lib --libexecdir=/usr/lib --localstatedir=/var/lib --infodir=/usr/share/info --mandir=/usr/share/man --with-pop=yes --enable-locallisppath=/etc/emacs24:/etc/emacs:/usr/local/share/emacs/24.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24.4/site-lisp:/usr/share/emacs/site-lisp --with-x=yes --with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wall' CPPFLAGS=-D_FORTIFY_SOURCE=2 'LDFLAGS=-Wl,-Bsymbolic-functions -Wl,-z,relro'' Important settings: value of $LC_MONETARY: en_US.UTF-8 value of $LC_NUMERIC: en_US.UTF-8 value of $LC_TIME: en_US.UTF-8 value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix Major mode: Emacs-Lisp Minor modes in effect: show-paren-mode: t delete-selection-mode: t recentf-mode: t tooltip-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Recent input: - d n . o r i g C-x b i n i C-g C-a C-SPC M-w C-x b C-s - h a n d l e - x d n d C-s C-a C-y C-SPC C-x C-s M-x e d i f f - b u f f C-g M-x x . o C-g C-x C-f x d - d . o M-x n n n q y C-x 1 M-x r e p o r t - e m Recent messages: Saving file /home/urs/xdnd/emacs/x-dnd.el... Wrote /home/urs/xdnd/emacs/x-dnd.el Quit [2 times] Computing differences between x-dnd.el.orig and x-dnd.el ... Buffer A: Processing difference region 0 of 2 Buffer B: Processing difference region 0 of 2 Processing difference regions ... done Region 1 in buffer A is empty [2 times] Refining difference region 2 ... Quit this Ediff session? (y or n) y Load-path shadows: ~/.emacs.d/vendor/python-mode/python-mode hides /usr/share/emacs24/site-lisp/python-mode/python-mode ~/.emacs.d/vendor/pymacs-0.25/pymacs hides /usr/share/emacs24/site-lisp/pymacs/pymacs /usr/share/emacs24/site-lisp/cmake-data/cmake-mode hides /usr/share/emacs/site-lisp/cmake-mode /usr/share/emacs/24.4/site-lisp/debian-startup hides /usr/share/emacs/site-lisp/debian-startup /usr/share/emacs24/site-lisp/dictionaries-common/flyspell hides /usr/share/emacs/24.4/lisp/textmodes/flyspell /usr/share/emacs24/site-lisp/dictionaries-common/ispell hides /usr/share/emacs/24.4/lisp/textmodes/ispell Features: (shadow sort gnus-util mail-extr emacsbug message format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils ediff-merg ediff-wind ediff-diff ediff-mult ediff-help ediff-init ediff-util ediff misearch multi-isearch dired-aux dired browse-url saveplace paren grep compile comint ansi-color ring cus-start cus-load pymacs advice help-fns delsel recentf tree-widget wid-edit cl-loaddefs cl-lib easymenu server 50magit time-date tooltip electric uniquify ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode prog-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer nadvice loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind gfilenotify dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs) Memory information: ((conses 16 120917 9552) (symbols 48 22357 0) (miscs 40 78 250) (strings 32 21584 8579) (string-bytes 1 718116) (vectors 16 19152) (vector-slots 8 1185919 183954) (floats 8 80 323) (intervals 56 1352 0) (buffers 960 18) (heap 1024 39074 1259)) --MP_/1tpx=bNeQHwS4AoYmPooW_d Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=xdnd.patch --- x-dnd.el.orig 2015-06-13 09:52:02.999811917 +0200 +++ x-dnd.el 2015-06-13 09:53:30.808247335 +0200 @@ -496,10 +496,12 @@ ((equal "XdndDrop" message) (if (windowp window) (select-window window)) (let* ((dnd-source (aref data 0)) + (timestamp (aref data 2)) (value (and (x-dnd-current-type window) (x-get-selection-internal 'XdndSelection - (intern (x-dnd-current-type window))))) + (intern (x-dnd-current-type window)) + timestamp))) success action) (setq action (if value --MP_/1tpx=bNeQHwS4AoYmPooW_d--