all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* widget-button-click chokes on frame selection event
@ 2006-09-16 21:38 Andreas Seltenreich
  2006-09-17 21:04 ` Richard Stallman
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Seltenreich @ 2006-09-16 21:38 UTC (permalink / raw)


When a click on a widget button also switches frames, there's a chance
that it triggers the following error:

--8<---------------cut here---------------start------------->8---
Debugger entered--Lisp error: (wrong-type-argument listp #<frame emacs@tp 0xb4d9610>)
  posn-point(#<frame emacs@tp 0xb4d9610>)
  widget-event-point((switch-frame #<frame emacs@tp 0xb4d9610>))
  (setq pos (widget-event-point event))
  (while (not (widget-button-release-event-p event)) (setq event (read-event)) (when (and mouse-1 ...) (push event unread-command-events) (setq event oevent) (throw ... t)) (setq pos (widget-event-point event)) (if (and pos ...) (when face ... ...) (overlay-put overlay ... face) (overlay-put overlay ... mouse-face)))
  (let ((track-mouse t)) (while (not ...) (setq event ...) (when ... ... ... ...) (setq pos ...) (if ... ... ... ...)))
  (if (widget-apply button :mouse-down-action event) nil (let (...) (while ... ... ... ... ...)))
  (unless (widget-apply button :mouse-down-action event) (let (...) (while ... ... ... ... ...)))
  (save-excursion (when face (overlay-put overlay ... pressed-face) (overlay-put overlay ... pressed-face)) (unless (widget-apply button :mouse-down-action event) (let ... ...)) (when (and pos ...) (widget-apply-action button event)))
  (unwind-protect (save-excursion (when face ... ...) (unless ... ...) (when ... ...)) (overlay-put overlay (quote face) face) (overlay-put overlay (quote mouse-face) mouse-face))
  (let* ((overlay ...) (pressed-face ...) (face ...) (mouse-face ...)) (unwind-protect (save-excursion ... ... ...) (overlay-put overlay ... face) (overlay-put overlay ... mouse-face)))
  (save-excursion (goto-char (posn-point ...)) (let* (... ... ... ...) (unwind-protect ... ... ...)))
  (progn (select-window (posn-window ...)) (save-excursion (goto-char ...) (let* ... ...)))
  (unwind-protect (progn (select-window ...) (save-excursion ... ...)) (dolist (elt save-selected-window-alist) (and ... ... ...)) (if (window-live-p save-selected-window-window) (select-window save-selected-window-window)))
  (save-current-buffer (unwind-protect (progn ... ...) (dolist ... ...) (if ... ...)))
  (let ((save-selected-window-window ...) (save-selected-window-alist ...)) (save-current-buffer (unwind-protect ... ... ...)))
  (save-selected-window (select-window (posn-window ...)) (save-excursion (goto-char ...) (let* ... ...)))
  (catch (quote button-press-cancelled) (save-selected-window (select-window ...) (save-excursion ... ...)) nil)
  (or (null button) (catch (quote button-press-cancelled) (save-selected-window ... ...) nil))
  (if (or (null button) (catch ... ... nil)) (progn (let ... ... ... ...)))
  (when (or (null button) (catch ... ... nil)) (let (... command) (if mouse-1 ... ...) (when up ...) (when command ...)))
  (let* ((oevent event) (mouse-1 ...) (pos ...) (start ...) (button ...)) (when (or ... ...) (let ... ... ... ...)))
  (if (widget-event-point event) (let* (... ... ... ... ...) (when ... ...)) (message "You clicked somewhere weird."))
  widget-button-click((down-mouse-1 (#<window 3075 on *Widget Example*> 364 (56 . 210) -76405506 nil 364 (7 . 13) nil (0 . 2) (8 . 16))))
  call-interactively(widget-button-click)
--8<---------------cut here---------------end--------------->8---

I did not see it happen while working with multiple frames on a single
display yet, but it occurs frequently enough to be annoying when
working on multiple displays.

The attached patch fixes it for me.

regards,
andreas

2006-09-16  Andreas Seltenreich  <uwi7@rz.uni-karlsruhe.de>

	* wid-edit.el (widget-button-click): Don't call widget-event-point
	on non-mouse events to avoid error when a click triggered a
	switch-frame event.

Index: wid-edit.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/wid-edit.el,v
retrieving revision 1.166
diff -u -r1.166 wid-edit.el
--- wid-edit.el	16 Feb 2006 15:58:32 -0000	1.166
+++ wid-edit.el	16 Sep 2006 21:13:26 -0000
@@ -959,7 +959,9 @@
 				  (push event unread-command-events)
 				  (setq event oevent)
 				  (throw 'button-press-cancelled t))
-				(setq pos (widget-event-point event))
+				(if (or (mouse-movement-p event)
+					(widget-button-release-event-p event))
+				    (setq pos (widget-event-point event)))
 				(if (and pos
 					 (eq (get-char-property pos 'button)
 					     button))

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-09-17 21:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-16 21:38 widget-button-click chokes on frame selection event Andreas Seltenreich
2006-09-17 21:04 ` Richard Stallman
2006-09-17 21:49   ` Andreas Seltenreich

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.