comparison src/events.c @ 215:1f0dabaa0855 r20-4b6

Import from CVS: tag r20-4b6
author cvs
date Mon, 13 Aug 2007 10:07:35 +0200
parents 78f53ef88e17
children d44af0c54775
comparison
equal deleted inserted replaced
214:c5d88c05e1e9 215:1f0dabaa0855
185 print_event_1 ("#<magic-event ", obj, printcharfun); 185 print_event_1 ("#<magic-event ", obj, printcharfun);
186 break; 186 break;
187 case pointer_motion_event: 187 case pointer_motion_event:
188 { 188 {
189 char buf[64]; 189 char buf[64];
190 sprintf (buf, "#<motion-event %d, %d", 190 Lisp_Object Vx, Vy;
191 XEVENT (obj)->event.motion.x, XEVENT (obj)->event.motion.y); 191 Vx = Fevent_x_pixel (obj);
192 assert (INTP (Vx));
193 Vy = Fevent_y_pixel (obj);
194 assert (INTP (Vy));
195 sprintf (buf, "#<motion-event %d, %d", XINT (Vx), XINT (Vy));
192 write_c_string (buf, printcharfun); 196 write_c_string (buf, printcharfun);
193 break; 197 break;
194 } 198 }
195 case process_event: 199 case process_event:
196 write_c_string ("#<process-event ", printcharfun); 200 write_c_string ("#<process-event ", printcharfun);
404 PLIST is a property list, the properties being compatible to those 408 PLIST is a property list, the properties being compatible to those
405 returned by `event-properties'. The following properties are 409 returned by `event-properties'. The following properties are
406 allowed: 410 allowed:
407 411
408 channel -- The event channel, a frame or a console. For 412 channel -- The event channel, a frame or a console. For
409 button-press, button-release and motion events, this 413 button-press, button-release, motion and dnd-drop
410 must be a frame. For key-press events, it must be a 414 events, this must be a frame. For key-press
411 console. If channel is unspecified, it will be set to 415 events, it must be a console. If channel is
412 the selected frame or selected console, as appropriate. 416 unspecified, it will be set to the selected frame
417 or selected console, as appropriate.
413 key -- The event key, a symbol or character. Allowed only for 418 key -- The event key, a symbol or character. Allowed only for
414 keypress events. 419 keypress events.
415 button -- The event button, integer 1, 2 or 3. Allowed only for 420 button -- The event button, integer 1, 2 or 3. Allowed for
416 button-press and button-release events. 421 button-press, button-release and dnd-drag events.
417 modifiers -- The event modifiers, a list of modifier symbols. Allowed 422 modifiers -- The event modifiers, a list of modifier symbols. Allowed
418 for key-press, button-press, button-release and motion 423 for key-press, button-press, button-release, motion and
419 events. 424 dnd-drop events.
420 x -- The event X coordinate, an integer. This is relative 425 x -- The event X coordinate, an integer. This is relative
421 to the left of CHANNEL's root window. Allowed for 426 to the left of CHANNEL's root window. Allowed for
422 motion, button-press and button-release events. 427 motion, button-press, button-release and dnd-drop events.
423 y -- The event Y coordinate, an integer. This is relative 428 y -- The event Y coordinate, an integer. This is relative
424 to the top of CHANNEL's root window. Allowed for 429 to the top of CHANNEL's root window. Allowed for
425 motion, button-press and button-release events. 430 motion, button-press, button-release and dnd-drop events.
426 dnd-data -- The event DND data, a list of (INTEGER DATA). Allowed 431 dnd-data -- The event DND data, a list of (INTEGER DATA). Allowed
427 for dnd-drop events, if support for DND has been 432 for dnd-drop events, if support for DND has been
428 compiled into XEmacs. 433 compiled into XEmacs.
429 timestamp -- The event timestamp, a non-negative integer. Allowed for 434 timestamp -- The event timestamp, a non-negative integer. Allowed for
430 all types of events. 435 all types of events. If unspecified, it will be set to 0
436 by default.
431 437
432 For event type `empty', PLIST must be nil. 438 For event type `empty', PLIST must be nil.
433 `button-release', or `motion'. If TYPE is left out, it defaults to 439 `button-release', or `motion'. If TYPE is left out, it defaults to
434 `empty'. 440 `empty'.
435 PLIST is a list of properties, as returned by `event-properties'. Not 441 PLIST is a list of properties, as returned by `event-properties'. Not
606 } 612 }
607 #ifdef HAVE_OFFIX_DND 613 #ifdef HAVE_OFFIX_DND
608 else if (EQ (keyword, Qdnd_data)) 614 else if (EQ (keyword, Qdnd_data))
609 { 615 {
610 Lisp_Object dnd_tail; 616 Lisp_Object dnd_tail;
611 /* Value is a list of (INT DATA). Data is a list. */ 617 /* Value is either nil, or a list of (TYPE DATA). TYPE is
612 CHECK_CONS (value); 618 an integer. DATA is a list. */
613 /* Oliver, change this to accept symbols, when the time is 619 if (!NILP (value))
614 ripe! */ 620 {
615 CHECK_NATNUM (XCAR (value)); 621 CHECK_CONS (value);
616 CHECK_CONS (XCDR (value)); 622 /* To be changed to CHECK_SYMBOL. */
617 if (!NILP (XCDR (XCDR (value)))) 623 CHECK_NATNUM (XCAR (value));
618 wrong_type_argument (Qlistp, XCDR (value)); 624 CHECK_CONS (XCDR (value));
619 /* Check the list validity. */ 625 if (XINT (Flength (value)) != 2)
620 EXTERNAL_LIST_LOOP (dnd_tail, XCAR (XCDR (value))) 626 signal_simple_error ("`dnd-data' should be a two-element list",
621 ; 627 XINT (Flength (value)));
622 /* And now, copy it all. */ 628 /* Check validity of DATA. */
623 e->event.dnd_drop.data = Fcopy_tree (value, Qnil); 629 EXTERNAL_LIST_LOOP (dnd_tail, XCAR (XCDR (value)))
630 {
631 /* Every element must be a string. */
632 CHECK_STRING (XCAR (dnd_tail));
633 }
634 /* And now, copy it all. */
635 e->event.dnd_drop.data = Fcopy_tree (value, Qnil);
636 }
624 } 637 }
625 #endif /* HAVE_OFFIX_DND */ 638 #endif /* HAVE_OFFIX_DND */
626 else 639 else
627 signal_simple_error ("Invalid property", keyword); 640 signal_simple_error ("Invalid property", keyword);
628 } /* while */ 641 } /* while */
689 ? "button-release" : "dnd-drop" 702 ? "button-release" : "dnd-drop"
690 #else 703 #else
691 "button-release" 704 "button-release"
692 #endif 705 #endif
693 ); 706 );
694 #ifdef HAVE_OFFIX_DND 707 break;
695 if ((e->event_type == dnd_drop_event) &&
696 NILP (e->event.dnd_drop.data))
697 error ("Unspecified data for dnd-drop event");
698 break;
699 #endif
700 default: 708 default:
701 break; 709 break;
702 } 710 }
703 711
704 UNGCPRO; 712 UNGCPRO;
1603 *x -= w->pixel_left; 1611 *x -= w->pixel_left;
1604 *y -= w->pixel_top; 1612 *y -= w->pixel_top;
1605 } 1613 }
1606 else 1614 else
1607 { 1615 {
1608 *y -= FRAME_REAL_TOP_TOOLBAR_HEIGHT (f); 1616 *y -= FRAME_REAL_TOP_TOOLBAR_HEIGHT (f) -
1609 *x -= FRAME_REAL_LEFT_TOOLBAR_WIDTH (f); 1617 FRAME_REAL_TOP_TOOLBAR_BORDER_WIDTH (f);
1618 *x -= FRAME_REAL_LEFT_TOOLBAR_WIDTH (f) -
1619 FRAME_REAL_LEFT_TOOLBAR_BORDER_WIDTH (f);
1610 } 1620 }
1611 1621
1612 return 1; 1622 return 1;
1613 } 1623 }
1614 1624