208 |
(start-col (car (posn-col-row start-posn))) |
(start-col (car (posn-col-row start-posn))) |
209 |
(old-selected-window (selected-window)) |
(old-selected-window (selected-window)) |
210 |
event end row mouse-delta scroll-delta |
event end row mouse-delta scroll-delta |
211 |
have-scrolled point-event-p old-binding |
have-scrolled |
212 |
window-last-row |
window-last-row |
213 |
col mouse-col-delta window-last-col |
col mouse-col-delta window-last-col |
214 |
(scroll-col-delta 0) |
(scroll-col-delta 0) |
261 |
(mouse-drag-safe-scroll scroll-delta scroll-col-delta) |
(mouse-drag-safe-scroll scroll-delta scroll-col-delta) |
262 |
(mouse-drag-repeatedly-safe-scroll scroll-delta scroll-col-delta))))) ;xxx |
(mouse-drag-repeatedly-safe-scroll scroll-delta scroll-col-delta))))) ;xxx |
263 |
;; If it was a click and not a drag, prepare to pass the event on. |
;; If it was a click and not a drag, prepare to pass the event on. |
264 |
;; Note: We must determine the pass-through event before restoring |
;; Is there a more correct way to reconstruct the event? |
|
;; the window, but invoke it after. Sigh. |
|
265 |
(if (and (not have-scrolled) |
(if (and (not have-scrolled) |
266 |
(mouse-drag-events-are-point-events-p start-posn end)) |
(mouse-drag-events-are-point-events-p start-posn end)) |
267 |
(setq point-event-p t |
(push (cons (event-basic-type start-event) (cdr start-event)) |
268 |
old-binding (key-binding |
unread-command-events)) |
|
(vector (event-basic-type start-event))))) |
|
269 |
;; Now restore the old window. |
;; Now restore the old window. |
270 |
(select-window old-selected-window) |
(select-window old-selected-window))) |
|
;; For clicks, call the old function. |
|
|
(if point-event-p |
|
|
(call-interactively old-binding)))) |
|
271 |
|
|
272 |
(defun mouse-drag-drag (start-event) |
(defun mouse-drag-drag (start-event) |
273 |
"\"Drag\" the page according to a mouse drag. |
"\"Drag\" the page according to a mouse drag. |
292 |
(start-col (car (posn-col-row start-posn))) |
(start-col (car (posn-col-row start-posn))) |
293 |
(old-selected-window (selected-window)) |
(old-selected-window (selected-window)) |
294 |
event end row mouse-delta scroll-delta |
event end row mouse-delta scroll-delta |
295 |
have-scrolled point-event-p old-binding |
have-scrolled |
296 |
window-last-row |
window-last-row |
297 |
col mouse-col-delta window-last-col |
col mouse-col-delta window-last-col |
298 |
(scroll-col-delta 0) |
(scroll-col-delta 0) |
330 |
(setq have-scrolled t) |
(setq have-scrolled t) |
331 |
(mouse-drag-safe-scroll scroll-delta scroll-col-delta))))))) |
(mouse-drag-safe-scroll scroll-delta scroll-col-delta))))))) |
332 |
;; If it was a click and not a drag, prepare to pass the event on. |
;; If it was a click and not a drag, prepare to pass the event on. |
333 |
;; Note: We must determine the pass-through event before restoring |
;; Is there a more correct way to reconstruct the event? |
|
;; the window, but invoke it after. Sigh. |
|
334 |
(if (and (not have-scrolled) |
(if (and (not have-scrolled) |
335 |
(mouse-drag-events-are-point-events-p start-posn end)) |
(mouse-drag-events-are-point-events-p start-posn end)) |
336 |
(setq point-event-p t |
(push (cons (event-basic-type start-event) (cdr start-event)) |
337 |
old-binding (key-binding |
unread-command-events)) |
|
(vector (event-basic-type start-event))))) |
|
338 |
;; Now restore the old window. |
;; Now restore the old window. |
339 |
(select-window old-selected-window) |
(select-window old-selected-window))) |
340 |
;; For clicks, call the old function. |
|
|
(if point-event-p |
|
|
(call-interactively old-binding)))) |
|
341 |
|
|
342 |
(provide 'mouse-drag) |
(provide 'mouse-drag) |
343 |
|
|