* incorrect button highlighting
@ 2007-09-11 17:21 Dan Nicolaescu
2007-09-17 6:20 ` Glenn Morris
2007-09-20 18:56 ` Stefan Monnier
0 siblings, 2 replies; 9+ messages in thread
From: Dan Nicolaescu @ 2007-09-11 17:21 UTC (permalink / raw)
To: emacs-devel
Evaluate this code:
(require 'cus-edit)
(defvar my-button-list
'((push-button
:tag "prev"
:help-echo "prev"
:tag-glyph "prev-node"
:action (lambda (widget &optional e) (ding)))
(push-button
:tag "next"
:help-echo "next"
:tag-glyph "next-node"
:action (lambda (widget &optional e) (ding)))))
(defun test-buttons ()
(interactive)
(set (make-local-variable 'widget-button-pressed-face)
custom-button-pressed)
(mapc (lambda (arg) (widget-create arg)) my-button-list)
(widget-setup))
And then do M-x test-buttons RET
No put the mouse over one of the 2 buttons that appear, and both will
be shown using the custom-button-pressed face instead of just the one
that is under the mouse cursor.
Can someone please take a look at this?
Thanks
--dan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: incorrect button highlighting
2007-09-11 17:21 incorrect button highlighting Dan Nicolaescu
@ 2007-09-17 6:20 ` Glenn Morris
2007-09-20 8:05 ` Glenn Morris
2007-09-20 18:56 ` Stefan Monnier
1 sibling, 1 reply; 9+ messages in thread
From: Glenn Morris @ 2007-09-17 6:20 UTC (permalink / raw)
To: Dan Nicolaescu; +Cc: emacs-devel
Dan Nicolaescu wrote:
> No put the mouse over one of the 2 buttons that appear, and both will
> be shown using the custom-button-pressed face instead of just the one
> that is under the mouse cursor.
I think this is a documented limitation of the widget library. From
the "User Interface" section of the widget manual:
*Warning:* In an `editable-field' widget, the editable field must
not be adjacent to another widget--that won't work. You must put
some text in between. Either make this text part of the
`editable-field' widget itself, or insert it with `widget-insert'.
Admittedly, I don't really see that your example is an "editable
field" one, but if you try:
(require 'cus-edit)
(defun foo ()
(interactive)
(switch-to-buffer "*Widget Example*")
(set (make-local-variable 'widget-button-pressed-face) custom-button-pressed)
(widget-create 'push-button
:tag "prev"
:help-echo "prev"
:tag-glyph "prev-node"
:action (lambda (widget &optional e) (ding)))
(insert " ")
(widget-create 'push-button
:tag "next"
:help-echo "next"
:tag-glyph "next-node"
:action (lambda (widget &optional e) (ding)))
(widget-setup))
M-x foo
then it works ok if you insert a space between the two widgets, but
not if you don't.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: incorrect button highlighting
2007-09-17 6:20 ` Glenn Morris
@ 2007-09-20 8:05 ` Glenn Morris
2007-09-20 18:28 ` Stephen Berman
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Glenn Morris @ 2007-09-20 8:05 UTC (permalink / raw)
To: Dan Nicolaescu; +Cc: emacs-devel
Glenn Morris wrote:
> I think this is a documented limitation of the widget library.
Actually, it's nothing to do with widgets. This has the same symptoms:
(progn
(switch-to-buffer "*example*")
(insert-image (create-image "prev-node.xpm")
(propertize "prev" 'mouse-face 'custom-button-pressed-face))
(insert-image (create-image "next-node.xpm")
(propertize "next" 'mouse-face 'custom-button-pressed-face)))
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: incorrect button highlighting
2007-09-20 8:05 ` Glenn Morris
@ 2007-09-20 18:28 ` Stephen Berman
2007-09-20 18:50 ` Stefan Monnier
2007-09-21 12:23 ` Richard Stallman
2 siblings, 0 replies; 9+ messages in thread
From: Stephen Berman @ 2007-09-20 18:28 UTC (permalink / raw)
To: emacs-devel
On Thu, 20 Sep 2007 04:05:03 -0400 Glenn Morris <rgm@gnu.org> wrote:
> Glenn Morris wrote:
>
>> I think this is a documented limitation of the widget library.
>
> Actually, it's nothing to do with widgets. This has the same symptoms:
>
> (progn
> (switch-to-buffer "*example*")
> (insert-image (create-image "prev-node.xpm")
> (propertize "prev" 'mouse-face 'custom-button-pressed-face))
> (insert-image (create-image "next-node.xpm")
> (propertize "next" 'mouse-face 'custom-button-pressed-face)))
It appears to be due to using the same face symbol consecutively.
Compare the following:
(progn
(copy-face 'custom-button-pressed 'copy-button-pressed)
(switch-to-buffer "*example*")
(insert-image (create-image "prev-node.xpm")
(propertize "prev" 'mouse-face 'highlight))
(insert-image (create-image "next-node.xpm")
(propertize "next" 'mouse-face 'highlight))
(insert-image (create-image "prev-node.xpm")
(propertize "prev" 'mouse-face 'copy-button-pressed))
(insert-image (create-image "next-node.xpm")
(propertize "next" 'mouse-face 'custom-button-pressed)))
The first two images, both with the highlight face, show the problem,
the second two, with different face symbols but identical face
definitions, show the face independently, as they should.
Steve Berman
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: incorrect button highlighting
2007-09-20 8:05 ` Glenn Morris
2007-09-20 18:28 ` Stephen Berman
@ 2007-09-20 18:50 ` Stefan Monnier
2007-09-21 12:23 ` Richard Stallman
2 siblings, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2007-09-20 18:50 UTC (permalink / raw)
To: Glenn Morris; +Cc: Dan Nicolaescu, emacs-devel
>> I think this is a documented limitation of the widget library.
I think it's a bug in the widget library.
> Actually, it's nothing to do with widgets. This has the same symptoms:
> (progn
> (switch-to-buffer "*example*")
> (insert-image (create-image "prev-node.xpm")
> (propertize "prev" 'mouse-face 'custom-button-pressed-face))
> (insert-image (create-image "next-node.xpm")
> (propertize "next" 'mouse-face 'custom-button-pressed-face)))
Easy to fix:
> (progn
> (switch-to-buffer "*example*")
> (insert-image (create-image "prev-node.xpm")
> (propertize "prev" 'mouse-face (list 'custom-button-pressed-face)))
> (insert-image (create-image "next-node.xpm")
> (propertize "next" 'mouse-face (list 'custom-button-pressed-face))))
-- Stefan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: incorrect button highlighting
2007-09-20 8:05 ` Glenn Morris
2007-09-20 18:28 ` Stephen Berman
2007-09-20 18:50 ` Stefan Monnier
@ 2007-09-21 12:23 ` Richard Stallman
2007-09-21 13:25 ` Stefan Monnier
2 siblings, 1 reply; 9+ messages in thread
From: Richard Stallman @ 2007-09-21 12:23 UTC (permalink / raw)
To: Glenn Morris; +Cc: dann, emacs-devel
Actually, it's nothing to do with widgets. This has the same symptoms:
(progn
(switch-to-buffer "*example*")
(insert-image (create-image "prev-node.xpm")
(propertize "prev" 'mouse-face 'custom-button-pressed-face))
(insert-image (create-image "next-node.xpm")
(propertize "next" 'mouse-face 'custom-button-pressed-face)))
That in itself is not a bug, it is just the way mouse-face works.
However, its consequence for widgets is a bug.
If the bug is simply due to using the a fixed value of mouse-face
on every widget, does this fix it?
*** wid-edit.el 12 Aug 2007 13:52:30 -0400 1.176.2.2
--- wid-edit.el 20 Sep 2007 16:51:56 -0400
***************
*** 405,411 ****
(unless (widget-get widget :suppress-face)
(overlay-put overlay 'face (widget-apply widget :button-face-get))
(overlay-put overlay 'mouse-face
! (widget-apply widget :mouse-face-get)))
(overlay-put overlay 'pointer 'hand)
(overlay-put overlay 'follow-link follow-link)
(overlay-put overlay 'help-echo help-echo)))
--- 405,421 ----
(unless (widget-get widget :suppress-face)
(overlay-put overlay 'face (widget-apply widget :button-face-get))
(overlay-put overlay 'mouse-face
! ;; Make new list structure for the mouse-face value
! ;; so that different widgets will have
! ;; different `mouse-face' property values
! ;; and will highlight separately.
! (let ((mouse-face-value
! (widget-apply widget :mouse-face-get)))
! ;; If it's a list, copy it.
! (if (listp mouse-face-value)
! (copy-sequence mouse-face-value)
! ;; If it's a symbol, put it in a list.
! (list mouse-face-value)))))
(overlay-put overlay 'pointer 'hand)
(overlay-put overlay 'follow-link follow-link)
(overlay-put overlay 'help-echo help-echo)))
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: incorrect button highlighting
2007-09-21 12:23 ` Richard Stallman
@ 2007-09-21 13:25 ` Stefan Monnier
2007-09-22 11:57 ` Richard Stallman
0 siblings, 1 reply; 9+ messages in thread
From: Stefan Monnier @ 2007-09-21 13:25 UTC (permalink / raw)
To: rms; +Cc: Glenn Morris, dann, emacs-devel
> If the bug is simply due to using the a fixed value of mouse-face
> on every widget, does this fix it?
> *** wid-edit.el 12 Aug 2007 13:52:30 -0400 1.176.2.2
> --- wid-edit.el 20 Sep 2007 16:51:56 -0400
> ***************
> *** 405,411 ****
> (unless (widget-get widget :suppress-face)
> (overlay-put overlay 'face (widget-apply widget :button-face-get))
> (overlay-put overlay 'mouse-face
> ! (widget-apply widget :mouse-face-get)))
> (overlay-put overlay 'pointer 'hand)
> (overlay-put overlay 'follow-link follow-link)
> (overlay-put overlay 'help-echo help-echo)))
> --- 405,421 ----
> (unless (widget-get widget :suppress-face)
> (overlay-put overlay 'face (widget-apply widget :button-face-get))
> (overlay-put overlay 'mouse-face
> ! ;; Make new list structure for the mouse-face value
> ! ;; so that different widgets will have
> ! ;; different `mouse-face' property values
> ! ;; and will highlight separately.
> ! (let ((mouse-face-value
> ! (widget-apply widget :mouse-face-get)))
> ! ;; If it's a list, copy it.
> ! (if (listp mouse-face-value)
> ! (copy-sequence mouse-face-value)
> ! ;; If it's a symbol, put it in a list.
> ! (list mouse-face-value)))))
> (overlay-put overlay 'pointer 'hand)
> (overlay-put overlay 'follow-link follow-link)
> (overlay-put overlay 'help-echo help-echo)))
This problem should only appear with text properties: with overlays, Emacs
should be clever enough to use the end of the overlay as a boundary.
Stefan
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: incorrect button highlighting
2007-09-11 17:21 incorrect button highlighting Dan Nicolaescu
2007-09-17 6:20 ` Glenn Morris
@ 2007-09-20 18:56 ` Stefan Monnier
1 sibling, 0 replies; 9+ messages in thread
From: Stefan Monnier @ 2007-09-20 18:56 UTC (permalink / raw)
To: Dan Nicolaescu; +Cc: emacs-devel
> No put the mouse over one of the 2 buttons that appear, and both will
> be shown using the custom-button-pressed face instead of just the one
> that is under the mouse cursor.
I believe I've just fixed it on the 22 branch.
Stefan
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2007-09-22 11:57 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-11 17:21 incorrect button highlighting Dan Nicolaescu
2007-09-17 6:20 ` Glenn Morris
2007-09-20 8:05 ` Glenn Morris
2007-09-20 18:28 ` Stephen Berman
2007-09-20 18:50 ` Stefan Monnier
2007-09-21 12:23 ` Richard Stallman
2007-09-21 13:25 ` Stefan Monnier
2007-09-22 11:57 ` Richard Stallman
2007-09-20 18:56 ` Stefan Monnier
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.