213
|
1 /* mswindows-specific defines for event-handling.
|
|
2 Copyright (C) 1997 Jonathan Harris.
|
|
3
|
|
4 This file is part of XEmacs.
|
|
5
|
|
6 XEmacs is free software; you can redistribute it and/or modify it
|
|
7 under the terms of the GNU General Public License as published by the
|
|
8 Free Software Foundation; either version 2, or (at your option) any
|
|
9 later version.
|
|
10
|
|
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 for more details.
|
|
15
|
|
16 You should have received a copy of the GNU General Public License
|
|
17 along with XEmacs; see the file COPYING. If not, write to
|
|
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
19 Boston, MA 02111-1307, USA. */
|
|
20
|
|
21 /* Synched up with: Not in FSF. */
|
|
22
|
|
23 /* Authorship:
|
|
24
|
|
25 Jonathan Harris, November 1997 for 20.4.
|
|
26 */
|
|
27
|
|
28 #ifndef _XEMACS_EVENT_MSW_H_
|
|
29 #define _XEMACS_EVENT_MSW_H_
|
|
30
|
|
31 #include <windows.h>
|
|
32
|
|
33 /*
|
|
34 * XXX FIXME: The following X modifier defs in events-mod.h clash with win32
|
|
35 * hotkey defs in winuser.h. For the moment lose the win32 versions.
|
|
36 * Maybe we should rename all of MOD_* to something that doesn't clash.
|
|
37 */
|
|
38 #ifdef MOD_CONTROL
|
|
39 # undef MOD_CONTROL
|
|
40 #endif
|
|
41 #ifdef MOD_ALT
|
|
42 # undef MOD_ALT
|
|
43 #endif
|
|
44 #ifdef MOD_SHIFT
|
|
45 # undef MOD_SHIFT
|
|
46 #endif
|
|
47 #include "events-mod.h"
|
|
48
|
|
49 /* The name of the main window class */
|
|
50 #define XEMACS_CLASS "XEmacs"
|
|
51
|
219
|
52 /* Granularity of timeouts in milliseconds & max number of active timeouts */
|
|
53 #define MSW_TIMEOUT_GRANULARITY 25
|
|
54 #define MSW_TIMEOUT_MAX 32
|
|
55
|
213
|
56 /* Random globals shared between main and message-processing thread */
|
|
57 extern DWORD mswindows_main_thread_id;
|
|
58 extern DWORD mswindows_win_thread_id;
|
|
59 extern CRITICAL_SECTION mswindows_dispatch_crit;
|
|
60
|
|
61
|
|
62 /*
|
|
63 * Communication between main and windows thread
|
|
64 */
|
|
65 #define WM_XEMACS_BASE (WM_APP + 0)
|
|
66 #define WM_XEMACS_ACK (WM_XEMACS_BASE + 0x00)
|
|
67 #define WM_XEMACS_CREATEWINDOW (WM_XEMACS_BASE + 0x01)
|
219
|
68 #define WM_XEMACS_DESTROYWINDOW (WM_XEMACS_BASE + 0x02)
|
|
69 #define WM_XEMACS_SETTIMER (WM_XEMACS_BASE + 0x03)
|
|
70 #define WM_XEMACS_KILLTIMER (WM_XEMACS_BASE + 0x04)
|
213
|
71 #define WM_XEMACS_END (WM_XEMACS_BASE + 0x10)
|
|
72
|
|
73 typedef struct mswindows_request_type
|
|
74 {
|
|
75 void *thing1;
|
|
76 void *thing2;
|
|
77 } mswindows_request_type;
|
|
78
|
|
79 LPARAM mswindows_make_request(UINT message, WPARAM wParam, mswindows_request_type *request);
|
|
80 void mswindows_handle_request(MSG *msg);
|
|
81
|
|
82
|
|
83 /*
|
|
84 * Event generating stuff
|
|
85 */
|
|
86
|
|
87 /* The number of things we can wait on */
|
|
88 #define MAX_WAITABLE 256
|
|
89
|
|
90 typedef enum mswindows_waitable_type
|
|
91 {
|
|
92 mswindows_waitable_type_none,
|
|
93 mswindows_waitable_type_dispatch,
|
|
94 mswindows_waitable_type_timeout,
|
|
95 mswindows_waitable_type_process,
|
|
96 mswindows_waitable_type_socket
|
|
97 } mswindows_waitable_type;
|
|
98
|
|
99 typedef struct mswindows_timeout_data
|
|
100 {
|
|
101 int milliseconds;
|
|
102 int id;
|
|
103 } mswindows_timeout_data;
|
|
104
|
|
105 typedef struct mswindows_waitable_info_type
|
|
106 {
|
|
107 mswindows_waitable_type type;
|
|
108 union
|
|
109 {
|
|
110 mswindows_timeout_data timeout;
|
|
111 } data;
|
|
112 } mswindows_waitable_info_type;
|
|
113
|
|
114 mswindows_waitable_info_type *mswindows_add_waitable(mswindows_waitable_info_type *info);
|
|
115 void mswindows_remove_waitable(mswindows_waitable_info_type *info);
|
|
116
|
|
117 /*
|
219
|
118 * Some random function declarations in msw-proc.c
|
213
|
119 */
|
|
120 DWORD mswindows_win_thread();
|
|
121 extern void mswindows_enqeue_dispatch_event (Lisp_Object event);
|
219
|
122 Lisp_Object mswindows_cancel_dispatch_event (Lisp_Object event);
|
213
|
123
|
|
124
|
|
125 /*
|
|
126 * Inside mswindows magic events
|
|
127 */
|
|
128 #define EVENT_MSWINDOWS_MAGIC_EVENT(e) \
|
|
129 ((e)->event.magic.underlying_mswindows_event)
|
|
130 #define EVENT_MSWINDOWS_MAGIC_TYPE(e) \
|
|
131 (EVENT_MSWINDOWS_MAGIC_EVENT(e).message)
|
|
132 #define EVENT_MSWINDOWS_MAGIC_DATA(e) \
|
|
133 (*((RECT *) (&(EVENT_MSWINDOWS_MAGIC_EVENT(e).data))))
|
|
134
|
|
135
|
|
136 #endif /* _XEMACS_EVENT_MSW_H_ */
|