From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas Seltenreich Newsgroups: gmane.emacs.devel Subject: widget-button-click chokes on frame selection event Date: Sat, 16 Sep 2006 23:38:55 +0200 Message-ID: <87fyercx00.fsf@gate450.dyndns.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1158442784 5560 80.91.229.2 (16 Sep 2006 21:39:44 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 16 Sep 2006 21:39:44 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Sep 16 23:39:42 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GOhsx-0007MB-OG for ged-emacs-devel@m.gmane.org; Sat, 16 Sep 2006 23:39:40 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GOhsw-0000bx-Tb for ged-emacs-devel@m.gmane.org; Sat, 16 Sep 2006 17:39:38 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GOhsS-0000Wx-JD for emacs-devel@gnu.org; Sat, 16 Sep 2006 17:39:08 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GOhsL-0000QF-UI for emacs-devel@gnu.org; Sat, 16 Sep 2006 17:39:05 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GOhsL-0000Pv-I0 for emacs-devel@gnu.org; Sat, 16 Sep 2006 17:39:01 -0400 Original-Received: from [129.13.185.218] (helo=smtp2.rz.uni-karlsruhe.de) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1GOhun-0006j0-Hl for emacs-devel@gnu.org; Sat, 16 Sep 2006 17:41:33 -0400 Original-Received: from rzstud2.stud.uni-karlsruhe.de (exim@rzstud2.stud.uni-karlsruhe.de [193.196.41.38]) by smtp2.rz.uni-karlsruhe.de with esmtp (Exim 4.50 #1) id 1GOhsH-00046Z-Cg; Sat, 16 Sep 2006 23:38:57 +0200 Original-Received: from uwi7 by rzstud2.stud.uni-karlsruhe.de with local (Exim 4.43) id 1GOhsH-0004A1-0Q for emacs-devel@gnu.org; Sat, 16 Sep 2006 23:38:57 +0200 Original-To: emacs-devel@gnu.org X-Face: $:F<87a[gD1?#R6S3j21cr1&C&7bd63GHC.tSdskUb}hhwG(ci*=D5kJ<_N+p9q(7-, PnG. Et.Yh List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:59924 Archived-At: 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 #) posn-point(#) widget-event-point((switch-frame #)) (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 (# 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 * 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))