annotate src/event-msw.h @ 219:262b8bb4a523 r20-4b8

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