Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
b846d039
Commit
b846d039
authored
Jul 02, 1993
by
Jim Blandy
Browse files
* mouse.el (mouse-drag-region): Correctly handle drags which enter
other frames.
parent
d7b4e137
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
24 deletions
+40
-24
lisp/mouse.el
lisp/mouse.el
+40
-24
No files found.
lisp/mouse.el
View file @
b846d039
...
...
@@ -161,6 +161,7 @@ This must be bound to a button-down mouse event."
(
let*
((
start-posn
(
event-start
start-event
))
(
start-point
(
posn-point
start-posn
))
(
start-window
(
posn-window
start-posn
))
(
start-frame
(
window-frame
start-window
))
(
bounds
(
window-edges
start-window
))
(
top
(
nth
1
bounds
))
(
bottom
(
if
(
window-minibuffer-p
start-window
)
...
...
@@ -176,30 +177,45 @@ This must be bound to a button-down mouse event."
(
let
(
event
end
end-point
)
(
track-mouse
(
while
(
progn
(
setq
event
(
read-event
)
end
(
event-end
event
)
end-point
(
posn-point
end
))
(
mouse-movement-p
event
))
;; Is the mouse anywhere reasonable on the frame?
(
if
(
windowp
(
posn-window
end
))
;; If the mouse is outside the current window, scroll it.
(
if
(
or
(
not
(
eq
(
posn-window
end
)
start-window
))
(
not
(
integer-or-marker-p
end-point
)))
;; Which direction should we scroll the window?
(
let
((
mouse-row
(
+
(
nth
1
(
window-edges
(
posn-window
end
)))
(
cdr
(
posn-col-row
end
)))))
(
cond
((
<
mouse-row
top
)
(
mouse-scroll-subr
(
-
mouse-row
top
)
mouse-drag-overlay
start-point
))
((
and
(
not
(
eobp
))
(
>=
mouse-row
bottom
))
(
mouse-scroll-subr
(
1+
(
-
mouse-row
bottom
))
mouse-drag-overlay
start-point
))))
(
goto-char
end-point
)
(
move-overlay
mouse-drag-overlay
start-point
(
point
))))))
(
setq
event
(
read-event
))
(
or
(
mouse-movement-p
event
)
(
eq
(
car-safe
event
)
'switch-frame
)))
(
if
(
eq
(
car-safe
event
)
'switch-frame
)
nil
(
setq
end
(
event-end
event
)
end-point
(
posn-point
end
))
(
cond
;; Ignore switch-frame events.
((
eq
(
car-safe
event
)
'switch-frame
))
;; Are we moving within the original window?
((
and
(
eq
(
posn-window
end
)
start-window
)
(
integer-or-marker-p
end-point
))
(
goto-char
end-point
)
(
move-overlay
mouse-drag-overlay
start-point
(
point
)))
;; Are we moving on a different window on the same frame?
((
and
(
windowp
(
posn-window
end
))
(
eq
(
window-frame
(
posn-window
end
))
start-frame
))
(
let
((
mouse-row
(
+
(
nth
1
(
window-edges
(
posn-window
end
)))
(
cdr
(
posn-col-row
end
)))))
(
cond
((
<
mouse-row
top
)
(
mouse-scroll-subr
(
-
mouse-row
top
)
mouse-drag-overlay
start-point
))
((
and
(
not
(
eobp
))
(
>=
mouse-row
bottom
))
(
mouse-scroll-subr
(
1+
(
-
mouse-row
bottom
))
mouse-drag-overlay
start-point
)))))
;; Otherwise, we have no idea where the mouse is.
(
t
)))))
(
if
(
and
(
eq
(
get
(
event-basic-type
event
)
'event-kind
)
'mouse-click
)
(
eq
(
posn-window
(
event-end
event
))
start-window
)
(
numberp
(
posn-point
(
event-end
event
))))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment