unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: martin rudalics <rudalics@gmx.at>
To: 998@emacsbugs.donarmstrong.com
Cc: Davide Viti <zinosat@tiscali.it>
Subject: bug#998: after split-window-horizontally scroll works only on first	window
Date: Tue, 30 Sep 2008 10:58:16 +0200	[thread overview]
Message-ID: <48E1EA28.50100@gmx.at> (raw)
In-Reply-To: <20080929132643.GB14199@zinosat.homelinux.com>

[-- Attachment #1: Type: text/plain, Size: 98 bytes --]

 > it does fix the problem!

OK.  So I could install the attached patch.  Any objections?

martin

[-- Attachment #2: 998.diff --]
[-- Type: text/plain, Size: 3618 bytes --]

*** scroll-bar.el.~1.59.~	2008-05-06 09:57:49.000000000 +0200
--- scroll-bar.el	2008-09-30 08:56:36.312500000 +0200
***************
*** 295,300 ****
--- 295,311 ----
  
  \f
  ;;; Tookit scroll bars.
+ (defcustom scroll-bar-resample-mouse-position nil
+     "Non-nil means re-sample mouse position when scrolling.
+ When your mouse-wheel scrolls the wrong window, setting this to
+ non-nil might help.  The mouse cursor must be within the window
+ you want to scroll in order for this to take effect.
+ 
+ This option works for toolkit scrollbars only."
+     :type 'boolean
+     :group 'frames
+     :group 'mouse
+     :version "23.1")
  
  (defun scroll-bar-toolkit-scroll (event)
    (interactive "e")
***************
*** 302,341 ****
  	 (window (nth 0 end-position))
  	 (part (nth 4 end-position))
  	 before-scroll)
!     (cond ((eq part 'end-scroll))
! 	  (t
! 	   (with-current-buffer (window-buffer window)
! 	     (setq before-scroll point-before-scroll))
! 	   (save-selected-window
! 	     (select-window window)
! 	     (setq before-scroll (or before-scroll (point)))
! 	     (cond ((eq part 'above-handle)
! 		    (scroll-up '-))
! 		   ((eq part 'below-handle)
! 		    (scroll-up nil))
! 		   ((eq part 'ratio)
! 		    (let* ((portion-whole (nth 2 end-position))
! 			   (lines (scroll-bar-scale portion-whole
! 						    (1- (window-height)))))
! 		      (scroll-up (cond ((not (zerop lines)) lines)
! 				       ((< (car portion-whole) 0) -1)
! 				       (t 1)))))
! 		   ((eq part 'up)
! 		    (scroll-up -1))
! 		   ((eq part 'down)
! 		    (scroll-up 1))
! 		   ((eq part 'top)
! 		    (set-window-start window (point-min)))
! 		   ((eq part 'bottom)
! 		    (goto-char (point-max))
! 		    (recenter))
! 		   ((eq part 'handle)
! 		    (scroll-bar-drag-1 event))))
! 	   (sit-for 0)
! 	   (with-current-buffer (window-buffer window)
! 	     (setq point-before-scroll before-scroll))))))
! 
! 
  \f
  ;;;; Bindings.
  
--- 313,361 ----
  	 (window (nth 0 end-position))
  	 (part (nth 4 end-position))
  	 before-scroll)
!     (when scroll-bar-resample-mouse-position
!       ;; With some mouse drivers the window reported in EVENT might not
!       ;; be valid, see Bug#998.  Here we re-sample the mouse position in
!       ;; the hope to get a more suitable window.
!       (condition-case nil
! 	  (let* ((mouse-position (mouse-position))
! 		 (mouse-window
! 		  (window-at (cadr mouse-position)
! 			     (cddr mouse-position)
! 			     (car mouse-position))))
! 	    (when (window-live-p mouse-window)
! 	      (setq window mouse-window)))
! 	(error nil)))
! 
!     (unless (eq part 'end-scroll)
!       (with-selected-window window
! 	(setq before-scroll (or point-before-scroll (point)))
! 	(cond
! 	 ((eq part 'above-handle)
! 	  (scroll-up '-))
! 	 ((eq part 'below-handle)
! 	  (scroll-up nil))
! 	 ((eq part 'ratio)
! 	  (let* ((portion-whole (nth 2 end-position))
! 		 (lines (scroll-bar-scale portion-whole
! 					  (1- (window-height)))))
! 	    (scroll-up (cond ((not (zerop lines)) lines)
! 			     ((< (car portion-whole) 0) -1)
! 			     (t 1)))))
! 	 ((eq part 'up)
! 	  (scroll-up -1))
! 	 ((eq part 'down)
! 	  (scroll-up 1))
! 	 ((eq part 'top)
! 	  (set-window-start window (point-min)))
! 	 ((eq part 'bottom)
! 	  (goto-char (point-max))
! 	  (recenter))
! 	 ((eq part 'handle)
! 	  (scroll-bar-drag-1 event))))
!       (sit-for 0)
!       (with-current-buffer (window-buffer window)
! 	(setq point-before-scroll before-scroll)))))
  \f
  ;;;; Bindings.
  

  reply	other threads:[~2008-09-30  8:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-18 13:44 bug#998: after split-window-horizontally scroll works only on first window Davide Viti
     [not found] ` <48D29A54.2050605@gmx.at>
2008-09-19  6:50   ` Davide Viti
2008-09-19  7:01     ` martin rudalics
2008-09-19  7:35       ` Davide Viti
2008-09-19  8:42         ` martin rudalics
2008-09-19 11:23           ` Davide Viti
2008-09-19 11:36             ` martin rudalics
2008-09-24  9:35             ` martin rudalics
2008-09-29 13:26               ` Davide Viti
2008-09-30  8:58                 ` martin rudalics [this message]
2008-09-30 14:20                   ` Stefan Monnier
2008-09-30 14:33                     ` martin rudalics
2008-09-30 16:01                       ` Stefan Monnier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=48E1EA28.50100@gmx.at \
    --to=rudalics@gmx.at \
    --cc=998@emacsbugs.donarmstrong.com \
    --cc=zinosat@tiscali.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).