unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#13979: 24.3.50; NS: scroll-bar not draggable
@ 2013-03-16 19:37 Darren Hoo
  2013-03-17  2:43 ` Stefan Monnier
  2013-03-19 12:41 ` bug#13979: " Stefan Monnier
  0 siblings, 2 replies; 10+ messages in thread
From: Darren Hoo @ 2013-03-16 19:37 UTC (permalink / raw)
  To: 13979

turn on scroll-bar mode
 (scroll-bar-mode t)

then open a file and drag the scroll bar, it shows:

`mouse-on-link-p: Wrong type argument: listp, handle'

the stacktrace:

Debugger entered--Lisp error: (wrong-type-argument listp handle)
  mouse-posn-property((#<window 0x10506e250 on *info*>
vertical-scroll-bar (4 . 428) 95079520 handle) follow-link)
  mouse-on-link-p((#<window 0x10506e250 on *info*> vertical-scroll-bar
(4 . 428) 95079520 handle))
  mouse--down-1-maybe-follows-link(nil)

Also with scroll-bar turned on, horizontally splitted windows can not be
resized by dragging.

In GNU Emacs 24.3.50.3 (x86_64-apple-darwin12.2.1, NS apple-appkit-1187.37)
 of 2013-03-17 on Darren-rMBP
Bzr revision: 112060 jan.h.d@swipnet.se-20130316142237-fbp077v13rwbq20y
Windowing system distributor `Apple', version 10.3.1187
Configured using:
 `configure --with-ns'





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

* bug#13979: 24.3.50; NS: scroll-bar not draggable
  2013-03-16 19:37 bug#13979: 24.3.50; NS: scroll-bar not draggable Darren Hoo
@ 2013-03-17  2:43 ` Stefan Monnier
  2013-03-17  9:45   ` Jan Djärv
  2013-03-19 12:41 ` bug#13979: " Stefan Monnier
  1 sibling, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2013-03-17  2:43 UTC (permalink / raw)
  To: Darren Hoo; +Cc: 13979

> turn on scroll-bar mode
>  (scroll-bar-mode t)

They're on by default, aren't they?

> then open a file and drag the scroll bar, it shows:
> `mouse-on-link-p: Wrong type argument: listp, handle'
> the stacktrace:
> Debugger entered--Lisp error: (wrong-type-argument listp handle)
>   mouse-posn-property((#<window 0x10506e250 on *info*>
> vertical-scroll-bar (4 . 428) 95079520 handle) follow-link)

I can't reproduce it here on GNU/Linux.  I'm not sure if the format of
the posn object quoted above is correct, but can you try the patch
below (which is either a fix, or a workaround)?

> Also with scroll-bar turned on, horizontally splitted windows can not be
> resized by dragging.

I can't reproduce the problem here, either.


        Stefan


=== modified file 'lisp/mouse.el'
--- lisp/mouse.el	2013-03-09 17:14:24 +0000
+++ lisp/mouse.el	2013-03-17 02:39:03 +0000
@@ -709,7 +713,7 @@
   (if (consp pos)
       (let ((w (posn-window pos)) (pt (posn-point pos))
 	    (str (posn-string pos)))
-	(or (and str
+	(or (and (consp str)
 		 (get-text-property (cdr str) property (car str)))
 	    (and pt
 		 (get-char-property pt property w))))





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

* bug#13979: 24.3.50; NS: scroll-bar not draggable
  2013-03-17  2:43 ` Stefan Monnier
@ 2013-03-17  9:45   ` Jan Djärv
  2013-03-17 11:02     ` Jan Djärv
  0 siblings, 1 reply; 10+ messages in thread
From: Jan Djärv @ 2013-03-17  9:45 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 13979, Darren Hoo

Hello.

17 mar 2013 kl. 03:43 skrev Stefan Monnier <monnier@iro.umontreal.ca>:

>> turn on scroll-bar mode
>> (scroll-bar-mode t)
> 
> They're on by default, aren't they?
> 
>> then open a file and drag the scroll bar, it shows:
>> `mouse-on-link-p: Wrong type argument: listp, handle'
>> the stacktrace:
>> Debugger entered--Lisp error: (wrong-type-argument listp handle)
>>  mouse-posn-property((#<window 0x10506e250 on *info*>
>> vertical-scroll-bar (4 . 428) 95079520 handle) follow-link)
> 
> I can't reproduce it here on GNU/Linux.  I'm not sure if the format of
> the posn object quoted above is correct, but can you try the patch
> below (which is either a fix, or a workaround)?
> 

It may be a NS-specific error.  I can reproduce it on OSX.  Emacs-24.3 works fine though, so I assume there has been some change in common code, and that the NS code was not adjusted.

>> Also with scroll-bar turned on, horizontally splitted windows can not be
>> resized by dragging.
> 
> I can't reproduce the problem here, either.
> 

I can on OSX.
The patch below only changes the error message to

mouse-posn-property: Wrong type argument: integer-or-marker-p, vertical-scroll-bar

	Jan D.

> 
>        Stefan
> 
> 
> === modified file 'lisp/mouse.el'
> --- lisp/mouse.el	2013-03-09 17:14:24 +0000
> +++ lisp/mouse.el	2013-03-17 02:39:03 +0000
> @@ -709,7 +713,7 @@
>   (if (consp pos)
>       (let ((w (posn-window pos)) (pt (posn-point pos))
> 	    (str (posn-string pos)))
> -	(or (and str
> +	(or (and (consp str)
> 		 (get-text-property (cdr str) property (car str)))
> 	    (and pt
> 		 (get-char-property pt property w))))
> 
> 






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

* bug#13979: 24.3.50; NS: scroll-bar not draggable
  2013-03-17  9:45   ` Jan Djärv
@ 2013-03-17 11:02     ` Jan Djärv
  2013-03-17 13:12       ` Stefan Monnier
  0 siblings, 1 reply; 10+ messages in thread
From: Jan Djärv @ 2013-03-17 11:02 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 13979, Darren Hoo

Hello.

On OSX the event produced when clicking below the handle looks like:

(down-mouse-1 (#<window 0x103229e50 on *info*> vertical-scroll-bar (0 . 428) 83281193 below-handle))

On Gtk3 it looks like:

(mouse-1 (#<window 0x11a0228 on *info*> vertical-scroll-bar (0 . 0) 0 below-handle))

Gtk does not have y or timestamp, but that hardly matters.
If I remove modifier down, so NS also produces mouse-1, I get:

<vertical-scroll-bar> <mouse-1> is undefined.

If I bind that to ns-handle-scroll-bar-event, everything works OK.

Which code has changed to care about mouse-1 versus down-mouse-1?
As I said, this problem does not exist on 24.3.

	Jan D.

17 mar 2013 kl. 10:45 skrev Jan Djärv <jan.h.d@swipnet.se>:

> Hello.
> 
> 17 mar 2013 kl. 03:43 skrev Stefan Monnier <monnier@iro.umontreal.ca>:
> 
>>> turn on scroll-bar mode
>>> (scroll-bar-mode t)
>> 
>> They're on by default, aren't they?
>> 
>>> then open a file and drag the scroll bar, it shows:
>>> `mouse-on-link-p: Wrong type argument: listp, handle'
>>> the stacktrace:
>>> Debugger entered--Lisp error: (wrong-type-argument listp handle)
>>> mouse-posn-property((#<window 0x10506e250 on *info*>
>>> vertical-scroll-bar (4 . 428) 95079520 handle) follow-link)
>> 
>> I can't reproduce it here on GNU/Linux.  I'm not sure if the format of
>> the posn object quoted above is correct, but can you try the patch
>> below (which is either a fix, or a workaround)?
>> 
> 
> It may be a NS-specific error.  I can reproduce it on OSX.  Emacs-24.3 works fine though, so I assume there has been some change in common code, and that the NS code was not adjusted.
> 
>>> Also with scroll-bar turned on, horizontally splitted windows can not be
>>> resized by dragging.
>> 
>> I can't reproduce the problem here, either.
>> 
> 
> I can on OSX.
> The patch below only changes the error message to
> 
> mouse-posn-property: Wrong type argument: integer-or-marker-p, vertical-scroll-bar
> 
> 	Jan D.
> 
>> 
>>       Stefan
>> 
>> 
>> === modified file 'lisp/mouse.el'
>> --- lisp/mouse.el	2013-03-09 17:14:24 +0000
>> +++ lisp/mouse.el	2013-03-17 02:39:03 +0000
>> @@ -709,7 +713,7 @@
>>  (if (consp pos)
>>      (let ((w (posn-window pos)) (pt (posn-point pos))
>> 	    (str (posn-string pos)))
>> -	(or (and str
>> +	(or (and (consp str)
>> 		 (get-text-property (cdr str) property (car str)))
>> 	    (and pt
>> 		 (get-char-property pt property w))))
>> 
>> 
> 






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

* bug#13979: 24.3.50; NS: scroll-bar not draggable
  2013-03-17 11:02     ` Jan Djärv
@ 2013-03-17 13:12       ` Stefan Monnier
  2013-03-17 14:41         ` Jan D.
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2013-03-17 13:12 UTC (permalink / raw)
  To: Jan Djärv; +Cc: 13979, Darren Hoo

> Which code has changed to care about mouse-1 versus down-mouse-1?

The code that turns mouse-1 into mouse-2 in case of follow-link (which
is now run more often: it used to be done in the mouse-drag-region
command, but is now done in a key-translation-map entry).


        Stefan





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

* bug#13979: 24.3.50; NS: scroll-bar not draggable
  2013-03-17 13:12       ` Stefan Monnier
@ 2013-03-17 14:41         ` Jan D.
  2013-03-17 15:37           ` Stefan Monnier
  0 siblings, 1 reply; 10+ messages in thread
From: Jan D. @ 2013-03-17 14:41 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 13979, Darren Hoo

Hello.

Stefan Monnier skrev 2013-03-17 14:12:
>> Which code has changed to care about mouse-1 versus down-mouse-1?
> The code that turns mouse-1 into mouse-2 in case of follow-link (which
> is now run more often: it used to be done in the mouse-drag-region
> command, but is now done in a key-translation-map entry).
>

So shall we change key-translation-map or is it better for the NS-port 
to use mouse-1 for scroll events?
Actually, the latter is probably best, keeps it in line with other ports.

     Jan D.






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

* bug#13979: 24.3.50; NS: scroll-bar not draggable
  2013-03-17 14:41         ` Jan D.
@ 2013-03-17 15:37           ` Stefan Monnier
  2013-03-18 17:23             ` Jan Djärv
  0 siblings, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2013-03-17 15:37 UTC (permalink / raw)
  To: Jan D.; +Cc: 13979, Darren Hoo

>>> Which code has changed to care about mouse-1 versus down-mouse-1?
>> The code that turns mouse-1 into mouse-2 in case of follow-link (which
>> is now run more often: it used to be done in the mouse-drag-region
>> command, but is now done in a key-translation-map entry).
> So shall we change key-translation-map or is it better for the NS-port to
> use mouse-1 for scroll events?

I don't know the backtrace for your latest problem, but for the other
the bug was in mouse-on-link-p which just needs to be fixed to return
the proper boolean for that case.


        Stefan





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

* bug#13979: 24.3.50; NS: scroll-bar not draggable
  2013-03-17 15:37           ` Stefan Monnier
@ 2013-03-18 17:23             ` Jan Djärv
  0 siblings, 0 replies; 10+ messages in thread
From: Jan Djärv @ 2013-03-18 17:23 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 13979-done, Darren Hoo

Hello.

This has been fixed in trunk.

	Jan D.

17 mar 2013 kl. 16:37 skrev Stefan Monnier <monnier@iro.umontreal.ca>:

>>>> Which code has changed to care about mouse-1 versus down-mouse-1?
>>> The code that turns mouse-1 into mouse-2 in case of follow-link (which
>>> is now run more often: it used to be done in the mouse-drag-region
>>> command, but is now done in a key-translation-map entry).
>> So shall we change key-translation-map or is it better for the NS-port to
>> use mouse-1 for scroll events?
> 
> I don't know the backtrace for your latest problem, but for the other
> the bug was in mouse-on-link-p which just needs to be fixed to return
> the proper boolean for that case.
> 
> 
>        Stefan






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

* bug#13979: NS: scroll-bar not draggable
  2013-03-16 19:37 bug#13979: 24.3.50; NS: scroll-bar not draggable Darren Hoo
  2013-03-17  2:43 ` Stefan Monnier
@ 2013-03-19 12:41 ` Stefan Monnier
  2013-03-19 18:47   ` Jan Djärv
  1 sibling, 1 reply; 10+ messages in thread
From: Stefan Monnier @ 2013-03-19 12:41 UTC (permalink / raw)
  To: 13979

>>>>> Jan said:
> On OSX the event produced when clicking below the handle looks like:
> (down-mouse-1 (#<window 0x103229e50 on *info*> vertical-scroll-bar (0 . 428) 83281193 below-handle))
> On Gtk3 it looks like:
> (mouse-1 (#<window 0x11a0228 on *info*> vertical-scroll-bar (0 . 0) 0 below-handle))

So it seems that we need the patch below instead.  Can you try it (after
removing your earlier patch) and confirm that it also fixes the problem?


        Stefan


=== modified file 'lisp/subr.el'
--- lisp/subr.el	2013-03-08 08:11:59 +0000
+++ lisp/subr.el	2013-03-19 12:40:38 +0000
@@ -1044,14 +1044,16 @@
 		(nth 1 position))))
     (and (symbolp area) area)))
 
-(defsubst posn-point (position)
+(defun posn-point (position)
   "Return the buffer location in POSITION.
 POSITION should be a list of the form returned by the `event-start'
-and `event-end' functions."
+and `event-end' functions.
+Returns nil if POSITION does not correspond to any buffer location (e.g.
+a click on a scroll bar)."
   (or (nth 5 position)
-      (if (consp (nth 1 position))
-	  (car (nth 1 position))
-	(nth 1 position))))
+      (let ((pt (nth 1 position)))
+        (or (car-safe pt)
+            (if (integerp pt) pt)))))
 
 (defun posn-set-point (position)
   "Move point to POSITION.
@@ -1124,12 +1126,14 @@
 and `event-end' functions."
   (nth 3 position))
 
-(defsubst posn-string (position)
+(defun posn-string (position)
   "Return the string object of POSITION.
 Value is a cons (STRING . STRING-POS), or nil if not a string.
 POSITION should be a list of the form returned by the `event-start'
 and `event-end' functions."
-  (nth 4 position))
+  (let ((x (nth 4 position)))
+    ;; Apparently this can also be `handle' or `below-handle' (bug#13979).
+    (when (consp x) x)))
 
 (defsubst posn-image (position)
   "Return the image object of POSITION.






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

* bug#13979: NS: scroll-bar not draggable
  2013-03-19 12:41 ` bug#13979: " Stefan Monnier
@ 2013-03-19 18:47   ` Jan Djärv
  0 siblings, 0 replies; 10+ messages in thread
From: Jan Djärv @ 2013-03-19 18:47 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: 13979

It does.

	Jan D.

19 mar 2013 kl. 13:41 skrev Stefan Monnier <monnier@iro.umontreal.ca>:

>>>>>> Jan said:
>> On OSX the event produced when clicking below the handle looks like:
>> (down-mouse-1 (#<window 0x103229e50 on *info*> vertical-scroll-bar (0 . 428) 83281193 below-handle))
>> On Gtk3 it looks like:
>> (mouse-1 (#<window 0x11a0228 on *info*> vertical-scroll-bar (0 . 0) 0 below-handle))
> 
> So it seems that we need the patch below instead.  Can you try it (after
> removing your earlier patch) and confirm that it also fixes the problem?
> 
> 
>        Stefan
> 
> 
> === modified file 'lisp/subr.el'
> --- lisp/subr.el	2013-03-08 08:11:59 +0000
> +++ lisp/subr.el	2013-03-19 12:40:38 +0000
> @@ -1044,14 +1044,16 @@
> 		(nth 1 position))))
>     (and (symbolp area) area)))
> 
> -(defsubst posn-point (position)
> +(defun posn-point (position)
>   "Return the buffer location in POSITION.
> POSITION should be a list of the form returned by the `event-start'
> -and `event-end' functions."
> +and `event-end' functions.
> +Returns nil if POSITION does not correspond to any buffer location (e.g.
> +a click on a scroll bar)."
>   (or (nth 5 position)
> -      (if (consp (nth 1 position))
> -	  (car (nth 1 position))
> -	(nth 1 position))))
> +      (let ((pt (nth 1 position)))
> +        (or (car-safe pt)
> +            (if (integerp pt) pt)))))
> 
> (defun posn-set-point (position)
>   "Move point to POSITION.
> @@ -1124,12 +1126,14 @@
> and `event-end' functions."
>   (nth 3 position))
> 
> -(defsubst posn-string (position)
> +(defun posn-string (position)
>   "Return the string object of POSITION.
> Value is a cons (STRING . STRING-POS), or nil if not a string.
> POSITION should be a list of the form returned by the `event-start'
> and `event-end' functions."
> -  (nth 4 position))
> +  (let ((x (nth 4 position)))
> +    ;; Apparently this can also be `handle' or `below-handle' (bug#13979).
> +    (when (consp x) x)))
> 
> (defsubst posn-image (position)
>   "Return the image object of POSITION.
> 
> 
> 






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

end of thread, other threads:[~2013-03-19 18:47 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-16 19:37 bug#13979: 24.3.50; NS: scroll-bar not draggable Darren Hoo
2013-03-17  2:43 ` Stefan Monnier
2013-03-17  9:45   ` Jan Djärv
2013-03-17 11:02     ` Jan Djärv
2013-03-17 13:12       ` Stefan Monnier
2013-03-17 14:41         ` Jan D.
2013-03-17 15:37           ` Stefan Monnier
2013-03-18 17:23             ` Jan Djärv
2013-03-19 12:41 ` bug#13979: " Stefan Monnier
2013-03-19 18:47   ` Jan Djärv

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).