emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] /srv/bzr/emacs/trunk r103835: Calendar fix for scroll-bar


From: Glenn Morris
Subject: [Emacs-diffs] /srv/bzr/emacs/trunk r103835: Calendar fix for scroll-bar scrolling (b#8305).
Date: Tue, 05 Apr 2011 19:05:45 -0700
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 103835
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Tue 2011-04-05 19:05:45 -0700
message:
  Calendar fix for scroll-bar scrolling (b#8305).
  
  * lisp/calendar/cal-move.el (calendar-scroll-toolkit-scroll): New function.
  * lisp/calendar/calendar.el (calendar-mode-map):
  Check for toolkit scroll bars.
modified:
  lisp/ChangeLog
  lisp/calendar/cal-move.el
  lisp/calendar/calendar.el
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2011-04-05 21:19:42 +0000
+++ b/lisp/ChangeLog    2011-04-06 02:05:45 +0000
@@ -1,3 +1,9 @@
+2011-04-06  Glenn Morris  <address@hidden>
+
+       * calendar/cal-move.el (calendar-scroll-toolkit-scroll): New function.
+       * calendar/calendar.el (calendar-mode-map):
+       Check for toolkit scroll bars.  (Bug#8305)
+
 2011-04-05  Chong Yidong  <address@hidden>
 
        * minibuffer.el (completion-in-region--postch)

=== modified file 'lisp/calendar/cal-move.el'
--- a/lisp/calendar/cal-move.el 2011-01-26 08:36:39 +0000
+++ b/lisp/calendar/cal-move.el 2011-04-06 02:05:45 +0000
@@ -204,6 +204,18 @@
 (define-obsolete-function-alias 'scroll-calendar-left-three-months
   'calendar-scroll-left-three-months "23.1")
 
+;; cf scroll-bar-toolkit-scroll
+;;;###cal-autoload
+(defun calendar-scroll-toolkit-scroll (event)
+  "Function to scroll the calendar after a toolkit scroll-bar click."
+  (interactive "e")
+  (let ((part (nth 4 (event-end event))))
+    ;; Not bothering with drag events (handle, end-scroll).
+    (cond ((memq part '(above-handle up top))
+           (calendar-scroll-right nil event))
+          ((memq part '(below-handle down bottom))
+           (calendar-scroll-left nil event)))))
+
 ;;;###cal-autoload
 (defun calendar-scroll-right-three-months (arg &optional event)
   "Scroll the displayed calendar window right by 3*ARG months.

=== modified file 'lisp/calendar/calendar.el'
--- a/lisp/calendar/calendar.el 2011-01-26 08:36:39 +0000
+++ b/lisp/calendar/calendar.el 2011-04-06 02:05:45 +0000
@@ -1648,14 +1648,17 @@
     (define-key map [down-mouse-2]
       (easy-menu-binding cal-menu-global-mouse-menu))
 
-    ;; Left-click moves us forward in time, right-click backwards.
     ;; cf scroll-bar.el.
-    (define-key map [vertical-scroll-bar mouse-1] 'calendar-scroll-left)
-    (define-key map [vertical-scroll-bar drag-mouse-1] 'calendar-scroll-left)
-    ;; down-mouse-2 stays as scroll-bar-drag.
-    (define-key map [vertical-scroll-bar mouse-3] 'calendar-scroll-right)
-    (define-key map [vertical-scroll-bar drag-mouse-3] 'calendar-scroll-right)
-
+    (if (and (boundp 'x-toolkit-scroll-bars) x-toolkit-scroll-bars)
+        (define-key map [vertical-scroll-bar mouse-1]
+          'calendar-scroll-toolkit-scroll)
+      ;; Left-click moves us forward in time, right-click backwards.
+      (define-key map [vertical-scroll-bar mouse-1] 'calendar-scroll-left)
+      (define-key map [vertical-scroll-bar drag-mouse-1] 'calendar-scroll-left)
+      ;; down-mouse-2 stays as scroll-bar-drag.
+      (define-key map [vertical-scroll-bar mouse-3] 'calendar-scroll-right)
+      (define-key map [vertical-scroll-bar drag-mouse-3]
+        'calendar-scroll-right))
     map)
   "Keymap for `calendar-mode'.")
 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]