comparison src/menubar-msw.c @ 286:57709be46d1b r21-0b41

Import from CVS: tag r21-0b41
author cvs
date Mon, 13 Aug 2007 10:35:03 +0200
parents c42ec1d1cded
children e11d67e05968
comparison
equal deleted inserted replaced
285:9a3756523c1b 286:57709be46d1b
613 */ 613 */
614 Lisp_Object 614 Lisp_Object
615 mswindows_handle_wm_command (struct frame* f, WORD id) 615 mswindows_handle_wm_command (struct frame* f, WORD id)
616 { 616 {
617 /* Try to map the command id through the proper hash table */ 617 /* Try to map the command id through the proper hash table */
618 Lisp_Object command, funcsym, frame; 618 Lisp_Object data, fn, arg, frame;
619 struct gcpro gcpro1; 619 struct gcpro gcpro1;
620 620
621 command = Fgethash (make_int (id), current_hashtable, Qunbound); 621 data = Fgethash (make_int (id), current_hashtable, Qunbound);
622 if (UNBOUNDP (command)) 622 if (UNBOUNDP (data))
623 { 623 {
624 menu_cleanup (f); 624 menu_cleanup (f);
625 return Qnil; 625 return Qnil;
626 } 626 }
627 627
628 /* Need to gcpro because the hashtable may get destroyed 628 /* Need to gcpro because the hashtable may get destroyed by
629 by menu_cleanup(), and will not gcpro the command 629 menu_cleanup(), and will not gcpro the data any more */
630 any more */ 630 GCPRO1 (data);
631 GCPRO1 (command);
632 menu_cleanup (f); 631 menu_cleanup (f);
633 632
634 /* Ok, this is our one. Enqueue it. */ 633 /* Ok, this is our one. Enqueue it. */
635 if (SYMBOLP (command)) 634 get_callback (data, &fn, &arg);
636 funcsym = Qcall_interactively;
637 else if (CONSP (command))
638 funcsym = Qeval;
639 else
640 signal_simple_error ("Callback must be either evallable form or a symbol",
641 command);
642 635
643 XSETFRAME (frame, f); 636 XSETFRAME (frame, f);
644 enqueue_misc_user_event (frame, funcsym, command); 637 enqueue_misc_user_event (frame, fn, arg);
645 638
646 /* Needs good bump also, for WM_COMMAND may have been dispatched from 639 /* Needs good bump also, for WM_COMMAND may have been dispatched from
647 mswindows_need_event, which will block again despite new command 640 mswindows_need_event, which will block again despite new command
648 event has arrived */ 641 event has arrived */
649 mswindows_bump_queue (); 642 mswindows_bump_queue ();
650 643
651 UNGCPRO; /* command */ 644 UNGCPRO; /* data */
652 return Qt; 645 return Qt;
653 } 646 }
654 647
655 648
656 /*------------------------------------------------------------------------*/ 649 /*------------------------------------------------------------------------*/