Mercurial > hg > xemacs-beta
comparison src/gui-msw.c @ 442:abe6d1db359e r21-2-36
Import from CVS: tag r21-2-36
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:35:02 +0200 |
parents | 8de8e3f6228a |
children | 943eaba38521 |
comparison
equal
deleted
inserted
replaced
441:72a7cfa4a488 | 442:abe6d1db359e |
---|---|
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 "console-msw.h" | |
26 #include "redisplay.h" | |
25 #include "gui.h" | 27 #include "gui.h" |
26 #include "redisplay.h" | 28 #include "glyphs.h" |
27 #include "frame.h" | 29 #include "frame.h" |
28 #include "elhash.h" | 30 #include "elhash.h" |
29 #include "console-msw.h" | 31 #include "events.h" |
30 #include "buffer.h" | 32 #include "buffer.h" |
31 | 33 |
32 /* | 34 /* |
33 * Return value is Qt if we have dispatched the command, | 35 * Return value is Qt if we have dispatched the command, |
34 * or Qnil if id has not been mapped to a callback. | 36 * or Qnil if id has not been mapped to a callback. |
35 * Window procedure may try other targets to route the | 37 * Window procedure may try other targets to route the |
36 * command if we return nil | 38 * command if we return nil |
37 */ | 39 */ |
38 Lisp_Object | 40 Lisp_Object |
39 mswindows_handle_gui_wm_command (struct frame* f, HWND ctrl, DWORD 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 /* It is possible for a widget action to cause it to get out of sync |
50 if (NILP (data) || UNBOUNDP (data)) | 54 with its instantiator. Thus it is necessary to signal this |
55 possibility. */ | |
56 if (IMAGE_INSTANCEP (image_instance)) | |
57 XIMAGE_INSTANCE_WIDGET_ACTION_OCCURRED (image_instance) = 1; | |
58 callback = Fgethash (make_int (id), | |
59 FRAME_MSWINDOWS_WIDGET_HASH_TABLE2 (f), Qnil); | |
60 callback_ex = Fgethash (make_int (id), | |
61 FRAME_MSWINDOWS_WIDGET_HASH_TABLE3 (f), Qnil); | |
62 | |
63 if (!NILP (callback_ex) && !UNBOUNDP (callback_ex)) | |
64 { | |
65 event = Fmake_event (Qnil, Qnil); | |
66 | |
67 XEVENT (event)->event_type = misc_user_event; | |
68 XEVENT (event)->channel = frame; | |
69 XEVENT (event)->timestamp = GetTickCount (); | |
70 XEVENT (event)->event.eval.function = Qeval; | |
71 XEVENT (event)->event.eval.object = | |
72 list4 (Qfuncall, callback_ex, image_instance, event); | |
73 } | |
74 else if (NILP (callback) || UNBOUNDP (callback)) | |
51 return Qnil; | 75 return Qnil; |
76 else | |
77 { | |
78 Lisp_Object fn, arg; | |
52 | 79 |
53 MARK_SUBWINDOWS_STATE_CHANGED; | 80 event = Fmake_event (Qnil, Qnil); |
54 /* Ok, this is our one. Enqueue it. */ | |
55 get_gui_callback (data, &fn, &arg); | |
56 XSETFRAME (frame, f); | |
57 mswindows_enqueue_misc_user_event (frame, fn, arg); | |
58 | 81 |
82 get_gui_callback (callback, &fn, &arg); | |
83 XEVENT (event)->event_type = misc_user_event; | |
84 XEVENT (event)->channel = frame; | |
85 XEVENT (event)->timestamp = GetTickCount (); | |
86 XEVENT (event)->event.eval.function = fn; | |
87 XEVENT (event)->event.eval.object = arg; | |
88 } | |
89 | |
90 mswindows_enqueue_dispatch_event (event); | |
91 /* The result of this evaluation could cause other instances to change so | |
92 enqueue an update callback to check this. */ | |
93 enqueue_magic_eval_event (update_widget_instances, frame); | |
59 return Qt; | 94 return Qt; |
60 } | |
61 | |
62 DEFUN ("mswindows-shell-execute", Fmswindows_shell_execute, 2, 4, 0, /* | |
63 Get Windows to perform OPERATION on DOCUMENT. | |
64 This is a wrapper around the ShellExecute system function, which | |
65 invokes the application registered to handle OPERATION for DOCUMENT. | |
66 OPERATION is typically \"open\", \"print\" or \"explore\" (but can be | |
67 nil for the default action), and DOCUMENT is typically the name of a | |
68 document file or URL, but can also be a program executable to run or | |
69 a directory to open in the Windows Explorer. | |
70 | |
71 If DOCUMENT is a program executable, PARAMETERS can be a string | |
72 containing command line parameters, but otherwise should be nil. | |
73 | |
74 SHOW-FLAG can be used to control whether the invoked application is hidden | |
75 or minimized. If SHOW-FLAG is nil, the application is displayed normally, | |
76 otherwise it is an integer representing a ShowWindow flag: | |
77 | |
78 0 - start hidden | |
79 1 - start normally | |
80 3 - start maximized | |
81 6 - start minimized | |
82 */ | |
83 (operation, document, parameters, show_flag)) | |
84 { | |
85 Lisp_Object current_dir; | |
86 | |
87 CHECK_STRING (document); | |
88 | |
89 /* Encode filename and current directory. */ | |
90 current_dir = current_buffer->directory; | |
91 if ((int) ShellExecute (NULL, | |
92 (STRINGP (operation) ? | |
93 XSTRING (operation)->data : NULL), | |
94 XSTRING (document)->data, | |
95 (STRINGP (parameters) ? | |
96 XSTRING (parameters)->data : NULL), | |
97 XSTRING (current_dir)->data, | |
98 (INTP (show_flag) ? | |
99 XINT (show_flag) : SW_SHOWDEFAULT)) | |
100 > 32) | |
101 return Qt; | |
102 | |
103 error ("ShellExecute failed"); | |
104 return Qnil; | |
105 } | 95 } |
106 | 96 |
107 void | 97 void |
108 syms_of_gui_mswindows (void) | 98 syms_of_gui_mswindows (void) |
109 { | 99 { |
110 DEFSUBR (Fmswindows_shell_execute); | |
111 } | 100 } |