comparison src/keyboard.c @ 21888:6ce89105f98f

(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.
author Richard M. Stallman <rms@gnu.org>
date Fri, 01 May 1998 04:51:51 +0000
parents bb86eac5ce79
children ec5ce3eb24f3
comparison
equal deleted inserted replaced
21887:1c9f20274f76 21888:6ce89105f98f
449 Lisp_Object Qfunction_key; 449 Lisp_Object Qfunction_key;
450 Lisp_Object Qmouse_click; 450 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. */
457 Lisp_Object Qevent_kind; 458 Lisp_Object Qevent_kind;
458 Lisp_Object Qevent_symbol_elements; 459 Lisp_Object Qevent_symbol_elements;
3289 static Lisp_Object func_key_syms; 3290 static Lisp_Object func_key_syms;
3290 static Lisp_Object mouse_syms; 3291 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. */
3297 3299
3298 static int lispy_accent_codes[] = 3300 static int lispy_accent_codes[] =
3720 generates a mouse-2 event. */ 3722 generates a mouse-2 event. */
3721 static char *lispy_mouse_wheel_names[] = 3723 static char *lispy_mouse_wheel_names[] =
3722 { 3724 {
3723 "mouse-wheel" 3725 "mouse-wheel"
3724 }; 3726 };
3727
3725 #endif /* WINDOWSNT */ 3728 #endif /* WINDOWSNT */
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 };
3726 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;
3730 3740
4214 Fcons (make_number (event->code), 4224 Fcons (make_number (event->code),
4215 Qnil))); 4225 Qnil)));
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)
4222 case menu_bar_event: 4304 case menu_bar_event:
4223 /* The event value is in the cdr of the frame_or_window slot. */ 4305 /* The event value is in the cdr of the frame_or_window slot. */
8551 staticpro (&Qmouse_click); 8633 staticpro (&Qmouse_click);
8552 #ifdef WINDOWSNT 8634 #ifdef WINDOWSNT
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);
8559 Qmenu_alias = intern ("menu-alias"); 8643 Qmenu_alias = intern ("menu-alias");
8560 staticpro (&Qmenu_alias); 8644 staticpro (&Qmenu_alias);
8664 staticpro (&mouse_syms); 8748 staticpro (&mouse_syms);
8665 8749
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;
8672 staticpro (&unread_switch_frame); 8759 staticpro (&unread_switch_frame);
8673 8760