comparison src/gui-msw.c @ 406:b8cc9ab3f761 r21-2-33

Import from CVS: tag r21-2-33
author cvs
date Mon, 13 Aug 2007 11:17:09 +0200
parents 2f8bb876ab1d
children 501cfd01ee6d
comparison
equal deleted inserted replaced
405:0e08f63c74d2 406:b8cc9ab3f761
20 20
21 /* Synched up with: Not in FSF. */ 21 /* Synched up with: Not in FSF. */
22 22
23 #include <config.h> 23 #include <config.h>
24 #include "lisp.h" 24 #include "lisp.h"
25 #include "redisplay.h"
25 #include "gui.h" 26 #include "gui.h"
26 #include "redisplay.h" 27 #include "glyphs.h"
27 #include "frame.h" 28 #include "frame.h"
29 #include "events.h"
28 #include "elhash.h" 30 #include "elhash.h"
29 #include "console-msw.h" 31 #include "console-msw.h"
30 #include "buffer.h" 32 #include "buffer.h"
31 33
32 /* 34 /*
37 */ 39 */
38 Lisp_Object 40 Lisp_Object
39 mswindows_handle_gui_wm_command (struct frame* f, HWND ctrl, LPARAM id) 41 mswindows_handle_gui_wm_command (struct frame* f, HWND ctrl, LPARAM id)
40 { 42 {
41 /* Try to map the command id through the proper hash table */ 43 /* Try to map the command id through the proper hash table */
42 Lisp_Object data, fn, arg, frame; 44 Lisp_Object callback, callback_ex, image_instance, frame, event;
45
46 XSETFRAME (frame, f);
43 47
44 /* #### make_int should assert that --kkm */ 48 /* #### make_int should assert that --kkm */
45 assert (XINT (make_int (id)) == id); 49 assert (XINT (make_int (id)) == id);
46 50
47 data = Fgethash (make_int (id), 51 image_instance = Fgethash (make_int (id),
48 FRAME_MSWINDOWS_WIDGET_HASH_TABLE (f), Qnil); 52 FRAME_MSWINDOWS_WIDGET_HASH_TABLE1 (f), Qnil);
49 53 callback = Fgethash (make_int (id),
50 if (NILP (data) || UNBOUNDP (data)) 54 FRAME_MSWINDOWS_WIDGET_HASH_TABLE2 (f), Qnil);
55 callback_ex = Fgethash (make_int (id),
56 FRAME_MSWINDOWS_WIDGET_HASH_TABLE3 (f), Qnil);
57
58 if (!NILP (callback_ex) && !UNBOUNDP (callback_ex))
59 {
60 event = Fmake_event (Qnil, Qnil);
61
62 XEVENT (event)->event_type = misc_user_event;
63 XEVENT (event)->channel = frame;
64 XEVENT (event)->timestamp = GetTickCount ();
65 XEVENT (event)->event.eval.function = Qeval;
66 XEVENT (event)->event.eval.object =
67 list4 (Qfuncall, callback_ex, image_instance, event);
68 }
69 else if (NILP (callback) || UNBOUNDP (callback))
51 return Qnil; 70 return Qnil;
71 else
72 {
73 Lisp_Object fn, arg;
52 74
53 /* Ok, this is our one. Enqueue it. */ 75 event = Fmake_event (Qnil, Qnil);
54 get_gui_callback (data, &fn, &arg); 76
55 XSETFRAME (frame, f); 77 get_gui_callback (callback, &fn, &arg);
56 mswindows_enqueue_misc_user_event (frame, fn, arg); 78 XEVENT (event)->event_type = misc_user_event;
79 XEVENT (event)->channel = frame;
80 XEVENT (event)->timestamp = GetTickCount ();
81 XEVENT (event)->event.eval.function = fn;
82 XEVENT (event)->event.eval.object = arg;
83 }
84
85 mswindows_enqueue_dispatch_event (event);
57 /* The result of this evaluation could cause other instances to change so 86 /* The result of this evaluation could cause other instances to change so
58 enqueue an update callback to check this. */ 87 enqueue an update callback to check this. We also have to make sure that
59 mswindows_enqueue_misc_user_event (frame, Qeval, 88 the function does not appear in the command history.
60 list2 (Qupdate_widget_instances, frame)); 89 #### I'm sure someone can tell me how to optimize this. */
61 90 mswindows_enqueue_misc_user_event
91 (frame, Qeval,
92 list3 (Qlet,
93 list2 (Qthis_command,
94 Qlast_command),
95 list2 (Qupdate_widget_instances, frame)));
62 return Qt; 96 return Qt;
63 } 97 }
64 98
65 DEFUN ("mswindows-shell-execute", Fmswindows_shell_execute, 2, 4, 0, /* 99 DEFUN ("mswindows-shell-execute", Fmswindows_shell_execute, 2, 4, 0, /*
66 Get Windows to perform OPERATION on DOCUMENT. 100 Get Windows to perform OPERATION on DOCUMENT.