annotate src/event-msw.h @ 213:78f53ef88e17 r20-4b5

Import from CVS: tag r20-4b5
author cvs
date Mon, 13 Aug 2007 10:06:47 +0200
parents
children 262b8bb4a523
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
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
52 /* Random globals shared between main and message-processing thread */
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
53 extern DWORD mswindows_main_thread_id;
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
54 extern DWORD mswindows_win_thread_id;
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
55 extern CRITICAL_SECTION mswindows_dispatch_crit;
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
56
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
57
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
58 /*
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
59 * Communication between main and windows thread
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
60 */
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
61 #define WM_XEMACS_BASE (WM_APP + 0)
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
62 #define WM_XEMACS_ACK (WM_XEMACS_BASE + 0x00)
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
63 #define WM_XEMACS_CREATEWINDOW (WM_XEMACS_BASE + 0x01)
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
64 #define WM_XEMACS_SETTIMER (WM_XEMACS_BASE + 0x02)
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
65 #define WM_XEMACS_KILLTIMER (WM_XEMACS_BASE + 0x03)
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
66 #define WM_XEMACS_END (WM_XEMACS_BASE + 0x10)
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
67
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
68 typedef struct mswindows_request_type
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
69 {
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
70 void *thing1;
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
71 void *thing2;
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
72 } mswindows_request_type;
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
73
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
74 LPARAM mswindows_make_request(UINT message, WPARAM wParam, mswindows_request_type *request);
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
75 void mswindows_handle_request(MSG *msg);
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
76
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
77
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
78 /*
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
79 * Event generating stuff
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
80 */
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
81
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
82 /* The number of things we can wait on */
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
83 #define MAX_WAITABLE 256
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
84
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
85 typedef enum mswindows_waitable_type
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
86 {
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
87 mswindows_waitable_type_none,
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
88 mswindows_waitable_type_dispatch,
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
89 mswindows_waitable_type_timeout,
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
90 mswindows_waitable_type_process,
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
91 mswindows_waitable_type_socket
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
92 } mswindows_waitable_type;
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
93
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
94 typedef struct mswindows_timeout_data
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
95 {
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
96 int milliseconds;
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
97 int id;
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
98 } mswindows_timeout_data;
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
99
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
100 typedef struct mswindows_waitable_info_type
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
101 {
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
102 mswindows_waitable_type type;
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
103 union
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
104 {
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
105 mswindows_timeout_data timeout;
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
106 } data;
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
107 } mswindows_waitable_info_type;
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
108
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
109 mswindows_waitable_info_type *mswindows_add_waitable(mswindows_waitable_info_type *info);
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
110 void mswindows_remove_waitable(mswindows_waitable_info_type *info);
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
111
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
112 /*
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
113 * Some random function declarations in mswindows-proc.c
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
114 */
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
115 DWORD mswindows_win_thread();
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
116 extern void mswindows_enqeue_dispatch_event (Lisp_Object event);
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
117
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
118
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
119 /*
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
120 * Inside mswindows magic events
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
121 */
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
122 #define EVENT_MSWINDOWS_MAGIC_EVENT(e) \
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
123 ((e)->event.magic.underlying_mswindows_event)
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
124 #define EVENT_MSWINDOWS_MAGIC_TYPE(e) \
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
125 (EVENT_MSWINDOWS_MAGIC_EVENT(e).message)
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
126 #define EVENT_MSWINDOWS_MAGIC_DATA(e) \
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
127 (*((RECT *) (&(EVENT_MSWINDOWS_MAGIC_EVENT(e).data))))
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
128
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
129
78f53ef88e17 Import from CVS: tag r20-4b5
cvs
parents:
diff changeset
130 #endif /* _XEMACS_EVENT_MSW_H_ */