summaryrefslogtreecommitdiff
path: root/lisp/calendar
diff options
context:
space:
mode:
authorGlenn Morris <rgm@gnu.org>2011-04-05 19:05:45 -0700
committerGlenn Morris <rgm@gnu.org>2011-04-05 19:05:45 -0700
commit3f0f17000d1e4f5adca285ab28c67c1de86589f3 (patch)
tree8e376e0c652b2afdad40f082b94a30d03d227a8a /lisp/calendar
parentf872186f77caf422f7196141cc7984bc61fa8d54 (diff)
downloademacs-3f0f17000d1e4f5adca285ab28c67c1de86589f3.tar.gz
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.
Diffstat (limited to 'lisp/calendar')
-rw-r--r--lisp/calendar/cal-move.el12
-rw-r--r--lisp/calendar/calendar.el17
2 files changed, 22 insertions, 7 deletions
diff --git a/lisp/calendar/cal-move.el b/lisp/calendar/cal-move.el
index c13a9a0a73a..72b34beda6b 100644
--- a/lisp/calendar/cal-move.el
+++ b/lisp/calendar/cal-move.el
@@ -204,6 +204,18 @@ EVENT is an event like `last-nonmenu-event'."
(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.
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index a4e53670530..99b0c21c94c 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -1648,14 +1648,17 @@ line."
(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'.")