all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: Tassilo Horn <tsdh@gnu.org>, 19988@debbugs.gnu.org
Subject: bug#19988: 25.0.50; Drag events ending in different frame
Date: Wed, 04 Mar 2015 16:10:58 +0100	[thread overview]
Message-ID: <54F72082.8080709@gmx.at> (raw)
In-Reply-To: <87k2yycfwh.fsf@gnu.org>

 > Is there a reason why drag events cannot work across different frames of
 > the very same Emacs instance?

They could but it's a bit tricky when frames overlap.  And probably some
routines would have to be rewritten because they expect events to happen
on the selected frame.

 > Background: I've written a command that uses drag events to swap buffers
 > of two Emacs windows:

I'd rewrite it (sloppily) as follows:

(defun th/swap-window-buffers-by-dnd (drag-event)
   "Swaps the buffers displayed in the DRAG-EVENT's start and end
window."
   (interactive "e")
   (let ((start-win (cl-caadr drag-event))
	(end-win   (cl-caaddr drag-event)))

     (unless (window-live-p end-win)
       (let* ((selected-frame (selected-frame))
	     (frames (delq selected-frame (frame-list)))
	     position frame window)
	(unwind-protect
	    (catch 'found
	      (while frames
		(select-frame (car frames))
		(setq position (mouse-position))
		(setq window (window-at (cadr position) (cddr position)))
		(when (window-live-p window)
		  (setq end-win window)
		  (throw 'found t))
		(setq frames (cdr frames))))
	  (select-frame selected-frame))))

     (when (and (windowp start-win)
	       (windowp end-win)
	       (not (eq start-win end-win)))
       (let ((bs (window-buffer start-win))
	    (be (window-buffer end-win)))
	(set-window-buffer start-win be)
	(set-window-buffer end-win bs)))))

(global-set-key (kbd "<C-S-drag-mouse-1>")
		#'th/swap-window-buffers-by-dnd)

martin





  parent reply	other threads:[~2015-03-04 15:10 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-03 14:30 bug#19988: 25.0.50; Drag events ending in different frame Tassilo Horn
2015-03-03 20:27 ` Eli Zaretskii
2015-03-04  4:28   ` Stefan Monnier
2015-03-04  7:03     ` Tassilo Horn
2015-03-04 17:22       ` Eli Zaretskii
2015-03-04 21:09         ` Tassilo Horn
2015-03-04 22:58           ` Stefan Monnier
2015-03-05  8:05             ` martin rudalics
2015-03-05 17:05             ` Eli Zaretskii
2015-03-05  3:37           ` Eli Zaretskii
2015-03-05  7:19             ` Tassilo Horn
2015-03-05 17:02               ` Eli Zaretskii
2015-03-05 20:07                 ` Tassilo Horn
2015-03-05 20:15                   ` Eli Zaretskii
2015-03-06  7:12                     ` Tassilo Horn
2015-03-06 14:13                       ` Eli Zaretskii
2015-03-06 16:09                       ` Drew Adams
2015-03-06 18:55                         ` martin rudalics
2015-03-05 17:00             ` Eli Zaretskii
2015-03-05 20:01               ` Tassilo Horn
2015-03-05  8:05           ` martin rudalics
2015-03-04 17:19     ` Eli Zaretskii
2015-03-04 15:10 ` martin rudalics [this message]
2015-03-04 21:14   ` Tassilo Horn
2015-03-05  8:06     ` martin rudalics
2015-03-06 14:37       ` Stefan Monnier
2015-03-06 18:55         ` martin rudalics
2015-03-06 20:19           ` Stefan Monnier
2015-03-06 21:31             ` martin rudalics
2015-03-07  0:49               ` Stefan Monnier
2015-03-07  9:41                 ` martin rudalics
2015-03-09  4:34                   ` Stefan Monnier
2015-03-09  7:53                     ` Jan D.
2015-03-09 10:38                       ` martin rudalics

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54F72082.8080709@gmx.at \
    --to=rudalics@gmx.at \
    --cc=19988@debbugs.gnu.org \
    --cc=tsdh@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.