diff options
| author | Richard M. Stallman | 1998-05-01 04:51:51 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1998-05-01 04:51:51 +0000 |
| commit | a24dc617a836a57458a72073ea6097154fd7d348 (patch) | |
| tree | 4dcb030461a3681ed246a24989da902ecf431ce7 | |
| parent | 1e9582d459d99b4137d2dfd41b7c7b47ecaf5cac (diff) | |
| download | emacs-a24dc617a836a57458a72073ea6097154fd7d348.tar.gz emacs-a24dc617a836a57458a72073ea6097154fd7d348.zip | |
(Qdrag_n_drop, drag_n_drop_syms, lispy_drag_n_drop_names): New variables.
(make_lispy_event): Handle drag_n_drop events.
(syms_of_keyboard): Initialize new symbols.
| -rw-r--r-- | src/keyboard.c | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/src/keyboard.c b/src/keyboard.c index 5c2319ec054..dd7c7bf922a 100644 --- a/src/keyboard.c +++ b/src/keyboard.c | |||
| @@ -451,6 +451,7 @@ Lisp_Object Qmouse_click; | |||
| 451 | #ifdef WINDOWSNT | 451 | #ifdef WINDOWSNT |
| 452 | Lisp_Object Qmouse_wheel; | 452 | Lisp_Object Qmouse_wheel; |
| 453 | #endif | 453 | #endif |
| 454 | Lisp_Object Qdrag_n_drop; | ||
| 454 | /* Lisp_Object Qmouse_movement; - also an event header */ | 455 | /* Lisp_Object Qmouse_movement; - also an event header */ |
| 455 | 456 | ||
| 456 | /* Properties of event headers. */ | 457 | /* Properties of event headers. */ |
| @@ -3291,6 +3292,7 @@ static Lisp_Object mouse_syms; | |||
| 3291 | #ifdef WINDOWSNT | 3292 | #ifdef WINDOWSNT |
| 3292 | static Lisp_Object mouse_wheel_syms; | 3293 | static Lisp_Object mouse_wheel_syms; |
| 3293 | #endif | 3294 | #endif |
| 3295 | static Lisp_Object drag_n_drop_syms; | ||
| 3294 | 3296 | ||
| 3295 | /* This is a list of keysym codes for special "accent" characters. | 3297 | /* This is a list of keysym codes for special "accent" characters. |
| 3296 | It parallels lispy_accent_keys. */ | 3298 | It parallels lispy_accent_keys. */ |
| @@ -3722,8 +3724,16 @@ static char *lispy_mouse_wheel_names[] = | |||
| 3722 | { | 3724 | { |
| 3723 | "mouse-wheel" | 3725 | "mouse-wheel" |
| 3724 | }; | 3726 | }; |
| 3727 | |||
| 3725 | #endif /* WINDOWSNT */ | 3728 | #endif /* WINDOWSNT */ |
| 3726 | 3729 | ||
| 3730 | /* drag-n-drop events are generated when a set of selected files are | ||
| 3731 | dragged from another application and dropped onto an Emacs window. */ | ||
| 3732 | static char *lispy_drag_n_drop_names[] = | ||
| 3733 | { | ||
| 3734 | "drag-n-drop" | ||
| 3735 | }; | ||
| 3736 | |||
| 3727 | /* Scroll bar parts. */ | 3737 | /* Scroll bar parts. */ |
| 3728 | Lisp_Object Qabove_handle, Qhandle, Qbelow_handle; | 3738 | Lisp_Object Qabove_handle, Qhandle, Qbelow_handle; |
| 3729 | Lisp_Object Qup, Qdown; | 3739 | Lisp_Object Qup, Qdown; |
| @@ -4216,6 +4226,78 @@ make_lispy_event (event) | |||
| 4216 | } | 4226 | } |
| 4217 | } | 4227 | } |
| 4218 | #endif /* WINDOWSNT */ | 4228 | #endif /* WINDOWSNT */ |
| 4229 | |||
| 4230 | case drag_n_drop: | ||
| 4231 | { | ||
| 4232 | int part; | ||
| 4233 | FRAME_PTR f; | ||
| 4234 | Lisp_Object window; | ||
| 4235 | Lisp_Object posn; | ||
| 4236 | Lisp_Object head, position; | ||
| 4237 | Lisp_Object files; | ||
| 4238 | int row, column; | ||
| 4239 | |||
| 4240 | /* The frame_or_window field should be a cons of the frame in | ||
| 4241 | which the event occurred and a list of the filenames | ||
| 4242 | dropped. */ | ||
| 4243 | if (! CONSP (event->frame_or_window)) | ||
| 4244 | abort (); | ||
| 4245 | |||
| 4246 | f = XFRAME (XCONS (event->frame_or_window)->car); | ||
| 4247 | files = XCONS (event->frame_or_window)->cdr; | ||
| 4248 | |||
| 4249 | /* Ignore mouse events that were made on frames that | ||
| 4250 | have been deleted. */ | ||
| 4251 | if (! FRAME_LIVE_P (f)) | ||
| 4252 | return Qnil; | ||
| 4253 | pixel_to_glyph_coords (f, XINT (event->x), XINT (event->y), | ||
| 4254 | &column, &row, NULL, 1); | ||
| 4255 | window = window_from_coordinates (f, column, row, &part); | ||
| 4256 | |||
| 4257 | if (!WINDOWP (window)) | ||
| 4258 | { | ||
| 4259 | window = XCONS (event->frame_or_window)->car; | ||
| 4260 | posn = Qnil; | ||
| 4261 | } | ||
| 4262 | else | ||
| 4263 | { | ||
| 4264 | int pixcolumn, pixrow; | ||
| 4265 | column -= XINT (XWINDOW (window)->left); | ||
| 4266 | row -= XINT (XWINDOW (window)->top); | ||
| 4267 | glyph_to_pixel_coords (f, column, row, &pixcolumn, &pixrow); | ||
| 4268 | XSETINT (event->x, pixcolumn); | ||
| 4269 | XSETINT (event->y, pixrow); | ||
| 4270 | |||
| 4271 | if (part == 1) | ||
| 4272 | posn = Qmode_line; | ||
| 4273 | else if (part == 2) | ||
| 4274 | posn = Qvertical_line; | ||
| 4275 | else | ||
| 4276 | XSETINT (posn, | ||
| 4277 | buffer_posn_from_coords (XWINDOW (window), | ||
| 4278 | column, row)); | ||
| 4279 | } | ||
| 4280 | |||
| 4281 | { | ||
| 4282 | Lisp_Object head, position; | ||
| 4283 | |||
| 4284 | position | ||
| 4285 | = Fcons (window, | ||
| 4286 | Fcons (posn, | ||
| 4287 | Fcons (Fcons (event->x, event->y), | ||
| 4288 | Fcons (make_number (event->timestamp), | ||
| 4289 | Qnil)))); | ||
| 4290 | |||
| 4291 | head = modify_event_symbol (0, event->modifiers, | ||
| 4292 | Qdrag_n_drop, Qnil, | ||
| 4293 | lispy_drag_n_drop_names, | ||
| 4294 | &drag_n_drop_syms, 1); | ||
| 4295 | return Fcons (head, | ||
| 4296 | Fcons (position, | ||
| 4297 | Fcons (files, | ||
| 4298 | Qnil))); | ||
| 4299 | } | ||
| 4300 | } | ||
| 4219 | #endif /* HAVE_MOUSE */ | 4301 | #endif /* HAVE_MOUSE */ |
| 4220 | 4302 | ||
| 4221 | #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) | 4303 | #if defined (USE_X_TOOLKIT) || defined (HAVE_NTGUI) |
| @@ -8553,6 +8635,8 @@ syms_of_keyboard () | |||
| 8553 | Qmouse_wheel = intern ("mouse-wheel"); | 8635 | Qmouse_wheel = intern ("mouse-wheel"); |
| 8554 | staticpro (&Qmouse_wheel); | 8636 | staticpro (&Qmouse_wheel); |
| 8555 | #endif | 8637 | #endif |
| 8638 | Qdrag_n_drop = intern ("drag-n-drop"); | ||
| 8639 | staticpro (&Qdrag_n_drop); | ||
| 8556 | 8640 | ||
| 8557 | Qmenu_enable = intern ("menu-enable"); | 8641 | Qmenu_enable = intern ("menu-enable"); |
| 8558 | staticpro (&Qmenu_enable); | 8642 | staticpro (&Qmenu_enable); |
| @@ -8666,6 +8750,9 @@ syms_of_keyboard () | |||
| 8666 | #ifdef WINDOWSNT | 8750 | #ifdef WINDOWSNT |
| 8667 | mouse_wheel_syms = Qnil; | 8751 | mouse_wheel_syms = Qnil; |
| 8668 | staticpro (&mouse_wheel_syms); | 8752 | staticpro (&mouse_wheel_syms); |
| 8753 | |||
| 8754 | drag_n_drop_syms = Qnil; | ||
| 8755 | staticpro (&drag_n_drop_syms); | ||
| 8669 | #endif | 8756 | #endif |
| 8670 | 8757 | ||
| 8671 | unread_switch_frame = Qnil; | 8758 | unread_switch_frame = Qnil; |