Mercurial > hg > xemacs-beta
comparison src/event-msw.c @ 964:8d610ea37af8
[xemacs-hg @ 2002-08-16 08:15:18 by michaels]
2002-08-13 David Bush <David.Bush@intel.com>
* device-msw.c: Correct initialization list for devmode_description
Add dumpable flag to msprinter-settings for USE_KKCC
* dialog-msw.c: Add dumpable flag to mswindows-dialog-id for USE_KKCC
* event-msw.c (mswindows_enqueue_misc_user_event): With USE_KKCC
use mutator macros to set event parameters
* event-msw.c (mswindows_enqueue_magic_event): With USE_KKCC
use mutator macros to set event parameters
* event-msw.c (mswindows_enqueue_process_event): With USE_KKCC
use mutator macros to set event parameters
* event-msw.c (mswindows_enqueue_mouse_button_event): Reorder
event setup so event type is set first to support USE_KKCC.
For USE_KKCC use mutator macros to set event parameters
* event-msw.c (mswindows_enqueue_keypress_event): With USE_KKCC
use mutator macros to set event parameters
* event-msw.c (mswindows_dequeue_dispatch_event): With USE_KKCC
use accessor to get and mutator macros to set event parameters
* event-msw.c (mswindows_cancel_dispatch_event): With USE_KKCC
use accessor macros to get event parameters
* event-msw.c (mswindows_wm_timer_callback): With USE_KKCC
use mutator macros to set event parameters
* event-msw.c (mswindows_dde_callback): With USE_KKCC
use mutator macros to set event parameters
* event-msw.c (mswindows_wnd_proc): With USE_KKCC
use mutator macros to set event parameters
* event-msw.c (emacs_mswindows_remove_timeout): With USE_KKCC
use mutator macros to set event parameters
* event-msw.c (emacs_mswindows_format_magic_event): With USE_KKCC
use accessor macro to access magic event type
* event-msw.c (emacs_mswindows_compare_magic_event): With USE_KKCC
use accessor macro to access magic event type
* event-msw.c (emacs_mswindows_hash_magic_event): With USE_KKCC
use accessor macro to access magic event type
* event-msw.c (emacs_mswindows_handle_magic_event): With USE_KKCC
use accessor macro to access magic event type and event data
* event-msw.c (emacs_mswindows_quit_p): With USE_KKCC use event
accessor and mutator macros to get/set event parameters
* gui-msw.c (mswindows_handle_gui_wm_command): For USE_KKCC
use mutator macros to set event parameters. Make the event
data type match the event type.
* menubar-msw.c (mswindows_popup_menu): With USE_KKCC use
accessor macros to extract button position
author | michaels |
---|---|
date | Fri, 16 Aug 2002 08:15:42 +0000 |
parents | 3b122a8e1d51 |
children | 9b80efded6a5 |
comparison
equal
deleted
inserted
replaced
963:6b31140c1456 | 964:8d610ea37af8 |
---|---|
947 void | 947 void |
948 mswindows_enqueue_misc_user_event (Lisp_Object channel, Lisp_Object function, | 948 mswindows_enqueue_misc_user_event (Lisp_Object channel, Lisp_Object function, |
949 Lisp_Object object) | 949 Lisp_Object object) |
950 { | 950 { |
951 Lisp_Object event = Fmake_event (Qnil, Qnil); | 951 Lisp_Object event = Fmake_event (Qnil, Qnil); |
952 | |
953 #ifdef USE_KKCC | |
954 | |
955 XSET_EVENT_TYPE (event, misc_user_event); | |
956 XSET_EVENT_CHANNEL (event, channel); | |
957 XSET_EVENT_TIMESTAMP (event, GetTickCount()); | |
958 XSET_MISC_USER_DATA_FUNCTION (XEVENT_DATA (event), function); | |
959 XSET_MISC_USER_DATA_OBJECT (XEVENT_DATA (event), object); | |
960 #else /* not USE_KKCC */ | |
952 Lisp_Event *e = XEVENT (event); | 961 Lisp_Event *e = XEVENT (event); |
953 | 962 |
954 e->event_type = misc_user_event; | 963 e->event_type = misc_user_event; |
955 e->channel = channel; | 964 e->channel = channel; |
956 e->timestamp = GetTickCount (); | 965 e->timestamp = GetTickCount (); |
957 e->event.misc.function = function; | 966 e->event.misc.function = function; |
958 e->event.misc.object = object; | 967 e->event.misc.object = object; |
968 #endif /* not USE_KKCC */ | |
959 | 969 |
960 mswindows_enqueue_dispatch_event (event); | 970 mswindows_enqueue_dispatch_event (event); |
961 } | 971 } |
962 | 972 |
963 void | 973 void |
964 mswindows_enqueue_magic_event (HWND hwnd, UINT msg) | 974 mswindows_enqueue_magic_event (HWND hwnd, UINT msg) |
965 { | 975 { |
966 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); | 976 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); |
977 | |
978 #ifdef USE_KKCC | |
979 XSET_EVENT_CHANNEL (emacs_event, (hwnd ? mswindows_find_frame (hwnd) : Qnil)); | |
980 XSET_EVENT_TIMESTAMP (emacs_event, GetMessageTime ()); | |
981 XSET_EVENT_TYPE (emacs_event, magic_event); | |
982 XSET_MAGIC_DATA_MSWINDOWS_EVENT (XEVENT_DATA(emacs_event), msg); | |
983 #else /* not USE_KKCC */ | |
967 Lisp_Event *event = XEVENT (emacs_event); | 984 Lisp_Event *event = XEVENT (emacs_event); |
968 | 985 |
969 event->channel = hwnd ? mswindows_find_frame (hwnd) : Qnil; | 986 event->channel = hwnd ? mswindows_find_frame (hwnd) : Qnil; |
970 event->timestamp = GetMessageTime(); | 987 event->timestamp = GetMessageTime(); |
971 event->event_type = magic_event; | 988 event->event_type = magic_event; |
972 EVENT_MSWINDOWS_MAGIC_TYPE (event) = msg; | 989 EVENT_MSWINDOWS_MAGIC_TYPE (event) = msg; |
990 #endif /* not USE_KKCC */ | |
973 | 991 |
974 mswindows_enqueue_dispatch_event (emacs_event); | 992 mswindows_enqueue_dispatch_event (emacs_event); |
975 } | 993 } |
976 | 994 |
977 static void | 995 static void |
980 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); | 998 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); |
981 Lisp_Event *event = XEVENT (emacs_event); | 999 Lisp_Event *event = XEVENT (emacs_event); |
982 Lisp_Object process = wrap_process (p); | 1000 Lisp_Object process = wrap_process (p); |
983 | 1001 |
984 | 1002 |
1003 #ifdef USE_KKCC | |
1004 XSET_EVENT_TYPE (emacs_event, process_event); | |
1005 XSET_EVENT_TIMESTAMP (emacs_event, GetTickCount()); | |
1006 XSET_PROCESS_DATA_PROCESS (XEVENT_DATA (emacs_event), process); | |
1007 #else /* not USE_KKCC */ | |
985 event->event_type = process_event; | 1008 event->event_type = process_event; |
986 event->timestamp = GetTickCount (); | 1009 event->timestamp = GetTickCount (); |
987 event->event.process.process = process; | 1010 event->event.process.process = process; |
1011 #endif /* not USE_KKCC */ | |
988 | 1012 |
989 mswindows_enqueue_dispatch_event (emacs_event); | 1013 mswindows_enqueue_dispatch_event (emacs_event); |
990 } | 1014 } |
991 | 1015 |
992 static void | 1016 static void |
1002 | 1026 |
1003 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); | 1027 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); |
1004 Lisp_Event *event = XEVENT (emacs_event); | 1028 Lisp_Event *event = XEVENT (emacs_event); |
1005 | 1029 |
1006 mswindows_handle_sticky_modifiers (0, 0, downp, 0); | 1030 mswindows_handle_sticky_modifiers (0, 0, downp, 0); |
1031 | |
1032 if (downp) | |
1033 { | |
1034 #ifdef USE_KKCC | |
1035 XSET_EVENT_TYPE (emacs_event, button_press_event); | |
1036 #else /* not USE_KKCC */ | |
1037 event->event_type = button_press_event; | |
1038 #endif /* not USE_KKCC */ | |
1039 } | |
1040 else | |
1041 { | |
1042 #ifdef USE_KKCC | |
1043 XSET_EVENT_TYPE (emacs_event, button_release_event); | |
1044 #else /* not USE_KKCC */ | |
1045 event->event_type = button_release_event; | |
1046 #endif /* not USE_KKCC */ | |
1047 } | |
1048 | |
1049 #ifdef USE_KKCC | |
1050 XSET_EVENT_CHANNEL (emacs_event, mswindows_find_frame (hwnd)); | |
1051 XSET_EVENT_TIMESTAMP (emacs_event, when); | |
1052 XSET_BUTTON_DATA_BUTTON (XEVENT_DATA (emacs_event), | |
1053 (msg==WM_LBUTTONDOWN || msg==WM_LBUTTONUP) ? 1 : | |
1054 ((msg==WM_RBUTTONDOWN || msg==WM_RBUTTONUP) ? 3 : 2)); | |
1055 XSET_BUTTON_DATA_X (XEVENT_DATA (emacs_event), where.x); | |
1056 XSET_BUTTON_DATA_Y (XEVENT_DATA (emacs_event), where.y); | |
1057 XSET_BUTTON_DATA_MODIFIERS (XEVENT_DATA (emacs_event), | |
1058 mswindows_modifier_state (NULL, mods, 0)); | |
1059 #else /* not USE_KKCC */ | |
1007 event->channel = mswindows_find_frame (hwnd); | 1060 event->channel = mswindows_find_frame (hwnd); |
1008 event->timestamp = when; | 1061 event->timestamp = when; |
1009 event->event.button.button = | 1062 event->event.button.button = |
1010 (msg==WM_LBUTTONDOWN || msg==WM_LBUTTONUP) ? 1 : | 1063 (msg==WM_LBUTTONDOWN || msg==WM_LBUTTONUP) ? 1 : |
1011 ((msg==WM_RBUTTONDOWN || msg==WM_RBUTTONUP) ? 3 : 2); | 1064 ((msg==WM_RBUTTONDOWN || msg==WM_RBUTTONUP) ? 3 : 2); |
1012 event->event.button.x = where.x; | 1065 event->event.button.x = where.x; |
1013 event->event.button.y = where.y; | 1066 event->event.button.y = where.y; |
1014 event->event.button.modifiers = mswindows_modifier_state (NULL, mods, 0); | 1067 event->event.button.modifiers = mswindows_modifier_state (NULL, mods, 0); |
1068 #endif /* not USE_KKCC */ | |
1015 | 1069 |
1016 if (downp) | 1070 if (downp) |
1017 { | 1071 { |
1018 event->event_type = button_press_event; | |
1019 SetCapture (hwnd); | 1072 SetCapture (hwnd); |
1020 /* we need this to make sure the main window regains the focus | 1073 /* we need this to make sure the main window regains the focus |
1021 from control subwindows */ | 1074 from control subwindows */ |
1022 if (GetFocus() != hwnd) | 1075 if (GetFocus() != hwnd) |
1023 { | 1076 { |
1025 mswindows_enqueue_magic_event (hwnd, WM_SETFOCUS); | 1078 mswindows_enqueue_magic_event (hwnd, WM_SETFOCUS); |
1026 } | 1079 } |
1027 } | 1080 } |
1028 else | 1081 else |
1029 { | 1082 { |
1030 event->event_type = button_release_event; | |
1031 ReleaseCapture (); | 1083 ReleaseCapture (); |
1032 } | 1084 } |
1033 | 1085 |
1034 mswindows_enqueue_dispatch_event (emacs_event); | 1086 mswindows_enqueue_dispatch_event (emacs_event); |
1035 } | 1087 } |
1036 | 1088 |
1037 static Lisp_Object | 1089 static Lisp_Object |
1038 mswindows_enqueue_keypress_event (HWND hwnd, Lisp_Object keysym, int mods) | 1090 mswindows_enqueue_keypress_event (HWND hwnd, Lisp_Object keysym, int mods) |
1039 { | 1091 { |
1040 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); | 1092 Lisp_Object emacs_event = Fmake_event (Qnil, Qnil); |
1093 | |
1094 #ifdef USE_KKCC | |
1095 XSET_EVENT_CHANNEL (emacs_event, mswindows_find_console(hwnd)); | |
1096 XSET_EVENT_TIMESTAMP (emacs_event, GetMessageTime()); | |
1097 XSET_EVENT_TYPE (emacs_event, key_press_event); | |
1098 XSET_KEY_DATA_KEYSYM (XEVENT_DATA (emacs_event), keysym); | |
1099 XSET_KEY_DATA_MODIFIERS (XEVENT_DATA (emacs_event), mods); | |
1100 #else /* not USE_KKCC */ | |
1041 Lisp_Event *event = XEVENT(emacs_event); | 1101 Lisp_Event *event = XEVENT(emacs_event); |
1042 | 1102 |
1043 event->channel = mswindows_find_console(hwnd); | 1103 event->channel = mswindows_find_console(hwnd); |
1044 event->timestamp = GetMessageTime(); | 1104 event->timestamp = GetMessageTime(); |
1045 event->event_type = key_press_event; | 1105 event->event_type = key_press_event; |
1046 event->event.key.keysym = keysym; | 1106 event->event.key.keysym = keysym; |
1047 event->event.key.modifiers = mods; | 1107 event->event.key.modifiers = mods; |
1108 #endif /* not USE_KKCC */ | |
1048 mswindows_enqueue_dispatch_event (emacs_event); | 1109 mswindows_enqueue_dispatch_event (emacs_event); |
1049 return emacs_event; | 1110 return emacs_event; |
1050 } | 1111 } |
1051 | 1112 |
1052 /* | 1113 /* |
1068 &mswindows_u_dispatch_event_queue, | 1129 &mswindows_u_dispatch_event_queue, |
1069 NILP(mswindows_u_dispatch_event_queue) ? | 1130 NILP(mswindows_u_dispatch_event_queue) ? |
1070 &mswindows_s_dispatch_event_queue_tail : | 1131 &mswindows_s_dispatch_event_queue_tail : |
1071 &mswindows_u_dispatch_event_queue_tail); | 1132 &mswindows_u_dispatch_event_queue_tail); |
1072 | 1133 |
1134 #ifdef USE_KKCC | |
1135 if (XEVENT_TYPE (event) == key_press_event | |
1136 && (XKEY_DATA_MODIFIERS (XEVENT_DATA(event)) & FAKE_MOD_QUIT)) | |
1137 XSET_KEY_DATA_MODIFIERS (XEVENT_DATA (event), | |
1138 XKEY_DATA_MODIFIERS (XEVENT_DATA (event)) & | |
1139 ~(FAKE_MOD_QUIT | FAKE_MOD_QUIT_CRITICAL)); | |
1140 #else /* not USE_KKCC */ | |
1073 sevt = XEVENT (event); | 1141 sevt = XEVENT (event); |
1074 if (sevt->event_type == key_press_event | 1142 if (sevt->event_type == key_press_event |
1075 && (sevt->event.key.modifiers & FAKE_MOD_QUIT)) | 1143 && (sevt->event.key.modifiers & FAKE_MOD_QUIT)) |
1076 sevt->event.key.modifiers &= | 1144 sevt->event.key.modifiers &= |
1077 ~(FAKE_MOD_QUIT | FAKE_MOD_QUIT_CRITICAL); | 1145 ~(FAKE_MOD_QUIT | FAKE_MOD_QUIT_CRITICAL); |
1146 #endif /* not USE_KKCC */ | |
1078 | 1147 |
1079 return event; | 1148 return event; |
1080 } | 1149 } |
1081 | 1150 |
1082 /* | 1151 /* |
1103 || match->event_type == key_press_event); | 1172 || match->event_type == key_press_event); |
1104 | 1173 |
1105 EVENT_CHAIN_LOOP (event, *head) | 1174 EVENT_CHAIN_LOOP (event, *head) |
1106 { | 1175 { |
1107 Lisp_Event *e = XEVENT (event); | 1176 Lisp_Event *e = XEVENT (event); |
1177 #ifdef USE_KKCC | |
1178 if ((EVENT_TYPE (e) == EVENT_TYPE (match)) && | |
1179 ((EVENT_TYPE (e) == timeout_event) ? | |
1180 (XTIMEOUT_DATA_INTERVAL_ID (EVENT_DATA (e)) == | |
1181 XTIMEOUT_DATA_INTERVAL_ID (EVENT_DATA (match))) : | |
1182 ((XKEY_DATA_MODIFIERS (EVENT_DATA (e)) & | |
1183 XKEY_DATA_MODIFIERS (EVENT_DATA (match))) != 0))) | |
1184 #else /* not USE_KKCC */ | |
1108 if ((e->event_type == match->event_type) && | 1185 if ((e->event_type == match->event_type) && |
1109 ((e->event_type == timeout_event) ? | 1186 ((e->event_type == timeout_event) ? |
1110 (e->event.timeout.interval_id == match->event.timeout.interval_id) : | 1187 (e->event.timeout.interval_id == match->event.timeout.interval_id) : |
1111 /* Must be key_press_event */ | 1188 /* Must be key_press_event */ |
1112 ((e->event.key.modifiers & match->event.key.modifiers) != 0))) | 1189 ((e->event.key.modifiers & match->event.key.modifiers) != 0))) |
1190 #endif /* not USE_KKCC */ | |
1113 { | 1191 { |
1114 if (NILP (previous_event)) | 1192 if (NILP (previous_event)) |
1115 dequeue_event (head, tail); | 1193 dequeue_event (head, tail); |
1116 else | 1194 else |
1117 { | 1195 { |
1726 Lisp_Event *event = XEVENT (emacs_event); | 1804 Lisp_Event *event = XEVENT (emacs_event); |
1727 | 1805 |
1728 if (KillTimer (NULL, id_timer)) | 1806 if (KillTimer (NULL, id_timer)) |
1729 --mswindows_pending_timers_count; | 1807 --mswindows_pending_timers_count; |
1730 | 1808 |
1809 #ifdef USE_KKCC | |
1810 XSET_EVENT_CHANNEL (emacs_event, Qnil); | |
1811 XSET_EVENT_TIMESTAMP (emacs_event, dwtime); | |
1812 XSET_EVENT_TYPE (emacs_event, timeout_event); | |
1813 XSET_TIMEOUT_DATA_INTERVAL_ID (XEVENT_DATA(emacs_event), id_timer); | |
1814 XSET_TIMEOUT_DATA_FUNCTION (XEVENT_DATA(emacs_event), Qnil); | |
1815 XSET_TIMEOUT_DATA_OBJECT (XEVENT_DATA(emacs_event), Qnil); | |
1816 #else /* not USE_KKCC */ | |
1731 event->channel = Qnil; | 1817 event->channel = Qnil; |
1732 event->timestamp = dwtime; | 1818 event->timestamp = dwtime; |
1733 event->event_type = timeout_event; | 1819 event->event_type = timeout_event; |
1734 event->event.timeout.interval_id = id_timer; | 1820 event->event.timeout.interval_id = id_timer; |
1735 event->event.timeout.function = Qnil; | 1821 event->event.timeout.function = Qnil; |
1736 event->event.timeout.object = Qnil; | 1822 event->event.timeout.object = Qnil; |
1823 #endif /* not USE_KKCC */ | |
1737 | 1824 |
1738 mswindows_enqueue_dispatch_event (emacs_event); | 1825 mswindows_enqueue_dispatch_event (emacs_event); |
1739 } | 1826 } |
1740 | 1827 |
1741 /* | 1828 /* |
2173 if (FRAME_TYPE_P (XFRAME (frame), mswindows)) | 2260 if (FRAME_TYPE_P (XFRAME (frame), mswindows)) |
2174 event->channel = frame; | 2261 event->channel = frame; |
2175 }; | 2262 }; |
2176 assert (!NILP (event->channel)); | 2263 assert (!NILP (event->channel)); |
2177 | 2264 |
2265 #ifdef USE_KKCC | |
2266 SET_EVENT_TIMESTAMP (event, GetTickCount()); | |
2267 SET_EVENT_TYPE (event, misc_user_event); | |
2268 XSET_MISC_USER_DATA_BUTTON (EVENT_DATA (event), 1); | |
2269 XSET_MISC_USER_DATA_MODIFIERS (EVENT_DATA (event), 0); | |
2270 XSET_MISC_USER_DATA_X (EVENT_DATA (event), -1); | |
2271 XSET_MISC_USER_DATA_Y (EVENT_DATA (event), -1); | |
2272 XSET_MISC_USER_DATA_FUNCTION (EVENT_DATA (event), | |
2273 Qdragdrop_drop_dispatch); | |
2274 XSET_MISC_USER_DATA_OBJECT (EVENT_DATA (event), | |
2275 Fcons (Qdragdrop_URL, | |
2276 Fcons (l_dndlist, Qnil))); | |
2277 #else /* not USE_KKCC */ | |
2178 event->timestamp = GetTickCount(); | 2278 event->timestamp = GetTickCount(); |
2179 event->event_type = misc_user_event; | 2279 event->event_type = misc_user_event; |
2180 event->event.misc.button = 1; | 2280 event->event.misc.button = 1; |
2181 event->event.misc.modifiers = 0; | 2281 event->event.misc.modifiers = 0; |
2182 event->event.misc.x = -1; | 2282 event->event.misc.x = -1; |
2183 event->event.misc.y = -1; | 2283 event->event.misc.y = -1; |
2184 event->event.misc.function = Qdragdrop_drop_dispatch; | 2284 event->event.misc.function = Qdragdrop_drop_dispatch; |
2185 event->event.misc.object = Fcons (Qdragdrop_URL, | 2285 event->event.misc.object = Fcons (Qdragdrop_URL, |
2186 Fcons (l_dndlist, Qnil)); | 2286 Fcons (l_dndlist, Qnil)); |
2287 #endif /* not USE_KKCC */ | |
2187 mswindows_enqueue_dispatch_event (emacs_event); | 2288 mswindows_enqueue_dispatch_event (emacs_event); |
2188 UNGCPRO; | 2289 UNGCPRO; |
2189 return (HDDEDATA) DDE_FACK; | 2290 return (HDDEDATA) DDE_FACK; |
2190 } | 2291 } |
2191 DdeFreeDataHandle (hdata); | 2292 DdeFreeDataHandle (hdata); |
3216 } | 3317 } |
3217 | 3318 |
3218 emacs_event = Fmake_event (Qnil, Qnil); | 3319 emacs_event = Fmake_event (Qnil, Qnil); |
3219 event = XEVENT(emacs_event); | 3320 event = XEVENT(emacs_event); |
3220 | 3321 |
3322 #ifdef USE_KKCC | |
3323 XSET_EVENT_CHANNEL (emacs_event, mswindows_find_frame(hwnd)); | |
3324 XSET_EVENT_TIMESTAMP (emacs_event, GetMessageTime()); | |
3325 XSET_EVENT_TYPE (emacs_event, pointer_motion_event); | |
3326 XSET_MOTION_DATA_X (XEVENT_DATA (emacs_event),MAKEPOINTS (lParam).x); | |
3327 XSET_MOTION_DATA_Y (XEVENT_DATA (emacs_event),MAKEPOINTS (lParam).y); | |
3328 XSET_MOTION_DATA_MODIFIERS (XEVENT_DATA(emacs_event), | |
3329 mswindows_modifier_state (NULL, wParam, 0)); | |
3330 #else /* not USE_KKCC */ | |
3221 event->channel = mswindows_find_frame (hwnd); | 3331 event->channel = mswindows_find_frame (hwnd); |
3222 event->timestamp = GetMessageTime (); | 3332 event->timestamp = GetMessageTime (); |
3223 event->event_type = pointer_motion_event; | 3333 event->event_type = pointer_motion_event; |
3224 event->event.motion.x = MAKEPOINTS (lParam).x; | 3334 event->event.motion.x = MAKEPOINTS (lParam).x; |
3225 event->event.motion.y = MAKEPOINTS (lParam).y; | 3335 event->event.motion.y = MAKEPOINTS (lParam).y; |
3226 event->event.motion.modifiers = | 3336 event->event.motion.modifiers = |
3227 mswindows_modifier_state (NULL, wParam, 0); | 3337 mswindows_modifier_state (NULL, wParam, 0); |
3338 #endif /* not USE_KKCC */ | |
3228 | 3339 |
3229 mswindows_enqueue_dispatch_event (emacs_event); | 3340 mswindows_enqueue_dispatch_event (emacs_event); |
3230 } | 3341 } |
3231 break; | 3342 break; |
3232 | 3343 |
3743 GCPRO3 (emacs_event, l_dndlist, l_item); | 3854 GCPRO3 (emacs_event, l_dndlist, l_item); |
3744 | 3855 |
3745 if (!DragQueryPoint ((HDROP) wParam, &point)) | 3856 if (!DragQueryPoint ((HDROP) wParam, &point)) |
3746 point.x = point.y = -1; /* outside client area */ | 3857 point.x = point.y = -1; /* outside client area */ |
3747 | 3858 |
3859 #ifdef USE_KKCC | |
3860 XSET_EVENT_TYPE (emacs_event, misc_user_event); | |
3861 XSET_EVENT_CHANNEL (emacs_event, mswindows_find_frame(hwnd)); | |
3862 XSET_EVENT_TIMESTAMP (emacs_event, GetMessageTime()); | |
3863 XSET_MISC_USER_DATA_BUTTON (XEVENT_DATA (emacs_event), 1); | |
3864 XSET_MISC_USER_DATA_MODIFIERS (XEVENT_DATA (emacs_event), | |
3865 mswindows_modifier_state (NULL, (DWORD) -1, 0)); | |
3866 XSET_MISC_USER_DATA_X (XEVENT_DATA (emacs_event), point.x); | |
3867 XSET_MISC_USER_DATA_Y (XEVENT_DATA (emacs_event), point.y); | |
3868 XSET_MISC_USER_DATA_FUNCTION (XEVENT_DATA (emacs_event), | |
3869 Qdragdrop_drop_dispatch); | |
3870 #else /* not USE_KKCC */ | |
3748 event->event_type = misc_user_event; | 3871 event->event_type = misc_user_event; |
3749 event->channel = mswindows_find_frame (hwnd); | 3872 event->channel = mswindows_find_frame (hwnd); |
3750 event->timestamp = GetMessageTime(); | 3873 event->timestamp = GetMessageTime(); |
3751 event->event.misc.button = 1; /* #### Should try harder */ | 3874 event->event.misc.button = 1; /* #### Should try harder */ |
3752 event->event.misc.modifiers = mswindows_modifier_state (NULL, | 3875 event->event.misc.modifiers = mswindows_modifier_state (NULL, |
3753 (DWORD) -1, 0); | 3876 (DWORD) -1, 0); |
3754 event->event.misc.x = point.x; | 3877 event->event.misc.x = point.x; |
3755 event->event.misc.y = point.y; | 3878 event->event.misc.y = point.y; |
3756 event->event.misc.function = Qdragdrop_drop_dispatch; | 3879 event->event.misc.function = Qdragdrop_drop_dispatch; |
3880 #endif /* not USE_KKCC */ | |
3757 | 3881 |
3758 filecount = qxeDragQueryFile ((HDROP) wParam, 0xffffffff, NULL, 0); | 3882 filecount = qxeDragQueryFile ((HDROP) wParam, 0xffffffff, NULL, 0); |
3759 for (i = 0; i < filecount; i++) | 3883 for (i = 0; i < filecount; i++) |
3760 { | 3884 { |
3761 Ibyte *fname; | 3885 Ibyte *fname; |
3927 } | 4051 } |
3928 } | 4052 } |
3929 | 4053 |
3930 DragFinish ((HDROP) wParam); | 4054 DragFinish ((HDROP) wParam); |
3931 | 4055 |
4056 #ifdef USE_KKCC | |
4057 XSET_MISC_USER_DATA_OBJECT (EVENT_DATA (event), | |
4058 Fcons (Qdragdrop_URL, l_dndlist)); | |
4059 #else /* not USE_KKCC */ | |
3932 event->event.misc.object = Fcons (Qdragdrop_URL, l_dndlist); | 4060 event->event.misc.object = Fcons (Qdragdrop_URL, l_dndlist); |
4061 #endif /* not USE_KKCC */ | |
3933 mswindows_enqueue_dispatch_event (emacs_event); | 4062 mswindows_enqueue_dispatch_event (emacs_event); |
3934 UNGCPRO; | 4063 UNGCPRO; |
3935 } | 4064 } |
3936 break; | 4065 break; |
3937 #endif /* HAVE_DRAGNDROP */ | 4066 #endif /* HAVE_DRAGNDROP */ |
4381 if (KillTimer (NULL, id)) | 4510 if (KillTimer (NULL, id)) |
4382 --mswindows_pending_timers_count; | 4511 --mswindows_pending_timers_count; |
4383 | 4512 |
4384 /* If there is a dispatch event generated by this | 4513 /* If there is a dispatch event generated by this |
4385 timeout in the queue, we have to remove it too. */ | 4514 timeout in the queue, we have to remove it too. */ |
4515 #ifdef USE_KKCC | |
4516 SET_EVENT_TYPE(&match_against, timeout_event); | |
4517 XSET_TIMEOUT_DATA_INTERVAL_ID (EVENT_DATA (&match_against), id); | |
4518 #else /* not USE_KKCC */ | |
4386 match_against.event_type = timeout_event; | 4519 match_against.event_type = timeout_event; |
4387 match_against.event.timeout.interval_id = id; | 4520 match_against.event.timeout.interval_id = id; |
4521 #endif /* not USE_KKCC */ | |
4388 emacs_event = mswindows_cancel_dispatch_event (&match_against); | 4522 emacs_event = mswindows_cancel_dispatch_event (&match_against); |
4389 if (!NILP (emacs_event)) | 4523 if (!NILP (emacs_event)) |
4390 Fdeallocate_event(emacs_event); | 4524 Fdeallocate_event(emacs_event); |
4391 } | 4525 } |
4392 | 4526 |
4427 emacs_mswindows_format_magic_event (Lisp_Event *emacs_event, | 4561 emacs_mswindows_format_magic_event (Lisp_Event *emacs_event, |
4428 Lisp_Object pstream) | 4562 Lisp_Object pstream) |
4429 { | 4563 { |
4430 #define FROB(msg) case msg: write_c_string (pstream, "type=" #msg); break | 4564 #define FROB(msg) case msg: write_c_string (pstream, "type=" #msg); break |
4431 | 4565 |
4566 #ifdef USE_KKCC | |
4567 switch (XMAGIC_DATA_MSWINDOWS_EVENT (EVENT_DATA(emacs_event))) | |
4568 #else /* not USE_KKCC */ | |
4432 switch (EVENT_MSWINDOWS_MAGIC_TYPE (emacs_event)) | 4569 switch (EVENT_MSWINDOWS_MAGIC_TYPE (emacs_event)) |
4570 #endif /* not USE_KKCC */ | |
4433 { | 4571 { |
4434 FROB (XM_BUMPQUEUE); | 4572 FROB (XM_BUMPQUEUE); |
4435 FROB (WM_PAINT); | 4573 FROB (WM_PAINT); |
4436 FROB (WM_SETFOCUS); | 4574 FROB (WM_SETFOCUS); |
4437 FROB (WM_KILLFOCUS); | 4575 FROB (WM_KILLFOCUS); |
4450 } | 4588 } |
4451 | 4589 |
4452 static int | 4590 static int |
4453 emacs_mswindows_compare_magic_event (Lisp_Event *e1, Lisp_Event *e2) | 4591 emacs_mswindows_compare_magic_event (Lisp_Event *e1, Lisp_Event *e2) |
4454 { | 4592 { |
4593 #ifdef USE_KKCC | |
4594 return (XMAGIC_DATA_MSWINDOWS_EVENT (EVENT_DATA (e1)) == | |
4595 XMAGIC_DATA_MSWINDOWS_EVENT (EVENT_DATA (e2))); | |
4596 #else /* not USE_KKCC */ | |
4455 return (e1->event.magic.underlying_mswindows_event == | 4597 return (e1->event.magic.underlying_mswindows_event == |
4456 e2->event.magic.underlying_mswindows_event); | 4598 e2->event.magic.underlying_mswindows_event); |
4599 #endif /* not USE_KKCC */ | |
4457 } | 4600 } |
4458 | 4601 |
4459 static Hashcode | 4602 static Hashcode |
4460 emacs_mswindows_hash_magic_event (Lisp_Event *e) | 4603 emacs_mswindows_hash_magic_event (Lisp_Event *e) |
4461 { | 4604 { |
4605 #ifdef USE_KKCC | |
4606 return (XMAGIC_DATA_MSWINDOWS_EVENT (EVENT_DATA (e))); | |
4607 #else /* not USE_KKCC */ | |
4462 return e->event.magic.underlying_mswindows_event; | 4608 return e->event.magic.underlying_mswindows_event; |
4609 #endif /* not USE_KKCC */ | |
4463 } | 4610 } |
4464 | 4611 |
4465 /* | 4612 /* |
4466 * Handle a magic event off the dispatch queue. | 4613 * Handle a magic event off the dispatch queue. |
4467 */ | 4614 */ |
4468 static void | 4615 static void |
4469 emacs_mswindows_handle_magic_event (Lisp_Event *emacs_event) | 4616 emacs_mswindows_handle_magic_event (Lisp_Event *emacs_event) |
4470 { | 4617 { |
4618 #ifdef USE_KKCC | |
4619 switch (XMAGIC_DATA_MSWINDOWS_EVENT (EVENT_DATA(emacs_event))) | |
4620 #else /* not USE_KKCC */ | |
4471 switch (EVENT_MSWINDOWS_MAGIC_TYPE (emacs_event)) | 4621 switch (EVENT_MSWINDOWS_MAGIC_TYPE (emacs_event)) |
4622 #endif /* not USE_KKCC */ | |
4472 { | 4623 { |
4473 case XM_BUMPQUEUE: | 4624 case XM_BUMPQUEUE: |
4474 break; | 4625 break; |
4475 | 4626 |
4476 case WM_PAINT: | 4627 case WM_PAINT: |
4484 case WM_SETFOCUS: | 4635 case WM_SETFOCUS: |
4485 case WM_KILLFOCUS: | 4636 case WM_KILLFOCUS: |
4486 { | 4637 { |
4487 Lisp_Object frame = EVENT_CHANNEL (emacs_event); | 4638 Lisp_Object frame = EVENT_CHANNEL (emacs_event); |
4488 struct frame *f = XFRAME (frame); | 4639 struct frame *f = XFRAME (frame); |
4640 #ifdef USE_KKCC | |
4641 int in_p = (XMAGIC_DATA_MSWINDOWS_EVENT (EVENT_DATA(emacs_event)) | |
4642 == WM_SETFOCUS); | |
4643 #else /* not USE_KKCC */ | |
4489 int in_p = (EVENT_MSWINDOWS_MAGIC_TYPE (emacs_event) == WM_SETFOCUS); | 4644 int in_p = (EVENT_MSWINDOWS_MAGIC_TYPE (emacs_event) == WM_SETFOCUS); |
4645 #endif /* not USE_KKCC */ | |
4490 Lisp_Object conser; | 4646 Lisp_Object conser; |
4491 struct gcpro gcpro1; | 4647 struct gcpro gcpro1; |
4492 | 4648 |
4493 /* On focus change, clear all memory of sticky modifiers | 4649 /* On focus change, clear all memory of sticky modifiers |
4494 to avoid non-intuitive behavior. */ | 4650 to avoid non-intuitive behavior. */ |
4507 | 4663 |
4508 case XM_MAPFRAME: | 4664 case XM_MAPFRAME: |
4509 case XM_UNMAPFRAME: | 4665 case XM_UNMAPFRAME: |
4510 { | 4666 { |
4511 Lisp_Object frame = EVENT_CHANNEL (emacs_event); | 4667 Lisp_Object frame = EVENT_CHANNEL (emacs_event); |
4668 #ifdef USE_KKCC | |
4669 va_run_hook_with_args (XMAGIC_DATA_MSWINDOWS_EVENT (EVENT_DATA(emacs_event)) | |
4670 #else /* not USE_KKCC */ | |
4512 va_run_hook_with_args (EVENT_MSWINDOWS_MAGIC_TYPE (emacs_event) | 4671 va_run_hook_with_args (EVENT_MSWINDOWS_MAGIC_TYPE (emacs_event) |
4672 #endif /* not USE_KKCC */ | |
4513 == XM_MAPFRAME ? | 4673 == XM_MAPFRAME ? |
4514 Qmap_frame_hook : Qunmap_frame_hook, | 4674 Qmap_frame_hook : Qunmap_frame_hook, |
4515 1, frame); | 4675 1, frame); |
4516 } | 4676 } |
4517 break; | 4677 break; |
4678 /* Yes there's a hidden one... Throw it away */ | 4838 /* Yes there's a hidden one... Throw it away */ |
4679 Lisp_Event match_against; | 4839 Lisp_Event match_against; |
4680 Lisp_Object emacs_event; | 4840 Lisp_Object emacs_event; |
4681 int critical_p = 0; | 4841 int critical_p = 0; |
4682 | 4842 |
4843 #ifdef USE_KKCC | |
4844 SET_EVENT_TYPE (&match_against, key_press_event); | |
4845 XSET_KEY_DATA_MODIFIERS (EVENT_DATA (&match_against), FAKE_MOD_QUIT); | |
4846 #else /* not USE_KKCC */ | |
4683 match_against.event_type = key_press_event; | 4847 match_against.event_type = key_press_event; |
4684 match_against.event.key.modifiers = FAKE_MOD_QUIT; | 4848 match_against.event.key.modifiers = FAKE_MOD_QUIT; |
4849 #endif /* not USE_KKCC */ | |
4685 | 4850 |
4686 while (mswindows_quit_chars_count > 0) | 4851 while (mswindows_quit_chars_count > 0) |
4687 { | 4852 { |
4688 emacs_event = mswindows_cancel_dispatch_event (&match_against); | 4853 emacs_event = mswindows_cancel_dispatch_event (&match_against); |
4689 assert (!NILP (emacs_event)); | 4854 assert (!NILP (emacs_event)); |
4690 | 4855 |
4856 #ifdef USE_KKCC | |
4857 if (XKEY_DATA_MODIFIERS (XEVENT_DATA(emacs_event)) & | |
4858 #else /* not USE_KKCC */ | |
4691 if (XEVENT (emacs_event)->event.key.modifiers & | 4859 if (XEVENT (emacs_event)->event.key.modifiers & |
4860 #endif /* not USE_KKCC */ | |
4692 FAKE_MOD_QUIT_CRITICAL) | 4861 FAKE_MOD_QUIT_CRITICAL) |
4693 critical_p = 1; | 4862 critical_p = 1; |
4694 | 4863 |
4695 Fdeallocate_event (emacs_event); | 4864 Fdeallocate_event (emacs_event); |
4696 mswindows_quit_chars_count--; | 4865 mswindows_quit_chars_count--; |