[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Widget-mode does not handle windows correctly after clicking buttons
From: |
Gerd Moellmann |
Subject: |
Re: Widget-mode does not handle windows correctly after clicking buttons |
Date: |
24 Oct 2001 13:56:28 +0200 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.1.50 |
Torsten Hilbrich <Torsten.Hilbrich@gmx.net> writes:
> Debugger entered--Lisp error: (wrong-type-argument window-live-p #<window
> 15>)
Thanks for the report, Torsten. Does this work for you:
*** wid-edit.el 2001/10/24 11:53:11 1.100
--- wid-edit.el 2001/10/24 11:55:35
***************
*** 864,916 ****
;; Mouse click on a widget button. Do the following
;; in a save-excursion so that the click on the button
;; doesn't change point.
! (save-selected-window
! (save-excursion
! (mouse-set-point event)
! (let* ((overlay (widget-get button :button-overlay))
! (face (overlay-get overlay 'face))
! (mouse-face (overlay-get overlay 'mouse-face)))
! (unwind-protect
! ;; Read events, including mouse-movement events
;; until we receive a release event. Highlight/
! ;; unhighlight the button the mouse was initially
! ;; on when we move over it.
! (let ((track-mouse t))
! (save-excursion
! (when face ; avoid changing around image
! (overlay-put overlay
! 'face widget-button-pressed-face)
! (overlay-put overlay
! 'mouse-face
widget-button-pressed-face))
! (unless (widget-apply button :mouse-down-action event)
! (while (not (widget-button-release-event-p event))
! (setq event (read-event)
! pos (widget-event-point event))
! (if (and pos
! (eq (get-char-property pos 'button)
! button))
! (when face
! (overlay-put overlay
! 'face
! widget-button-pressed-face)
! (overlay-put overlay
! 'mouse-face
! widget-button-pressed-face))
! (overlay-put overlay 'face face)
! (overlay-put overlay 'mouse-face mouse-face))))
! ;; When mouse is released over the button, run
! ;; its action function.
! (when (and pos
! (eq (get-char-property pos 'button)
button))
! (widget-apply-action button event))))
! (overlay-put overlay 'face face)
! (overlay-put overlay 'mouse-face mouse-face))))
(unless (pos-visible-in-window-p (widget-event-point event))
(mouse-set-point event)
(beginning-of-line)
! (recenter)))
(let ((up t) command)
;; Mouse click not on a widget button. Find the global
--- 864,920 ----
;; Mouse click on a widget button. Do the following
;; in a save-excursion so that the click on the button
;; doesn't change point.
! (let ((old-selected-window (selected-window)))
! (progn
! (save-excursion
! (mouse-set-point event)
! (let* ((overlay (widget-get button :button-overlay))
! (face (overlay-get overlay 'face))
! (mouse-face (overlay-get overlay 'mouse-face)))
! (unwind-protect
! ;; Read events, including mouse-movement events
;; until we receive a release event. Highlight/
! ;; unhighlight the button the mouse was initially
! ;; on when we move over it.
! (let ((track-mouse t))
! (save-excursion
! (when face ; avoid changing around image
! (overlay-put overlay
! 'face widget-button-pressed-face)
! (overlay-put overlay
! 'mouse-face
widget-button-pressed-face))
! (unless (widget-apply button :mouse-down-action
event)
! (while (not (widget-button-release-event-p event))
! (setq event (read-event)
! pos (widget-event-point event))
! (if (and pos
! (eq (get-char-property pos 'button)
! button))
! (when face
! (overlay-put overlay
! 'face
! widget-button-pressed-face)
! (overlay-put overlay
! 'mouse-face
! widget-button-pressed-face))
! (overlay-put overlay 'face face)
! (overlay-put overlay 'mouse-face
mouse-face))))
! ;; When mouse is released over the button, run
! ;; its action function.
! (when (and pos
! (eq (get-char-property pos 'button)
button))
! (widget-apply-action button event))))
! (overlay-put overlay 'face face)
! (overlay-put overlay 'mouse-face mouse-face))))
(unless (pos-visible-in-window-p (widget-event-point event))
(mouse-set-point event)
(beginning-of-line)
! (recenter))
!
! (when (window-live-p old-selected-window)
! (select-window old-selected-window))))
(let ((up t) command)
;; Mouse click not on a widget button. Find the global