Mercurial > emacs
annotate src/w32xfns.c @ 27570:33c77685f4a2
(frames-on-display-list, framep-on-display): New functions.
(display-mouse-p, display-popup-menus-p, display-graphic-p)
(display-selections-p, display-screens, display-pixel-width)
(display-pixel-height, display-mm-width, display-mm-height)
(display-backing-store, display-save-under, display-planes)
(display-color-cells, display-visual-class): New functions.
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Wed, 02 Feb 2000 11:35:43 +0000 |
parents | b7aa6ac26872 |
children | f390b90e3495 |
rev | line source |
---|---|
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16588
diff
changeset
|
1 /* Functions taken directly from X sources for use with the Microsoft W32 API. |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
24917
diff
changeset
|
2 Copyright (C) 1989, 1992, 1993, 1994, 1995, 1999 Free Software Foundation. |
13434 | 3 |
4 This file is part of GNU Emacs. | |
5 | |
6 GNU Emacs is free software; you can redistribute it and/or modify | |
7 it under the terms of the GNU General Public License as published by | |
8 the Free Software Foundation; either version 2, or (at your option) | |
9 any later version. | |
10 | |
11 GNU Emacs is distributed in the hope that it will be useful, | |
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 GNU General Public License for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
17 along with GNU Emacs; see the file COPYING. If not, write to | |
14186
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
13866
diff
changeset
|
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
13866
diff
changeset
|
19 Boston, MA 02111-1307, USA. */ |
13434 | 20 |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
24917
diff
changeset
|
21 #include <config.h> |
13434 | 22 #include <signal.h> |
23 #include <stdio.h> | |
24 #include "lisp.h" | |
15153
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
25 #include "frame.h" |
23509
afcb561b535d
Include charset.h and fontset.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22077
diff
changeset
|
26 #include "charset.h" |
afcb561b535d
Include charset.h and fontset.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22077
diff
changeset
|
27 #include "fontset.h" |
13434 | 28 #include "blockinput.h" |
29 #include "w32term.h" | |
30 #include "windowsx.h" | |
31 | |
32 #define myalloc(cb) GlobalAllocPtr (GPTR, cb) | |
33 #define myfree(lp) GlobalFreePtr (lp) | |
34 | |
14352 | 35 CRITICAL_SECTION critsect; |
13434 | 36 extern HANDLE keyboard_handle; |
15153
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
37 HANDLE input_available = NULL; |
22077
ae5e3b23c7e2
(interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19715
diff
changeset
|
38 HANDLE interrupt_handle = NULL; |
13434 | 39 |
40 void | |
41 init_crit () | |
42 { | |
14352 | 43 InitializeCriticalSection (&critsect); |
13434 | 44 |
15153
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
45 /* For safety, input_available should only be reset by get_next_msg |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
46 when the input queue is empty, so make it a manual reset event. */ |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
47 keyboard_handle = input_available = CreateEvent (NULL, TRUE, FALSE, NULL); |
22077
ae5e3b23c7e2
(interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19715
diff
changeset
|
48 |
ae5e3b23c7e2
(interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19715
diff
changeset
|
49 /* interrupt_handle is signalled when quit (C-g) is detected, so that |
ae5e3b23c7e2
(interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19715
diff
changeset
|
50 blocking system calls can be interrupted. We make it a manual |
ae5e3b23c7e2
(interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19715
diff
changeset
|
51 reset event, so that if we should ever have multiple threads |
ae5e3b23c7e2
(interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19715
diff
changeset
|
52 performing system calls, they will all be interrupted (I'm guessing |
ae5e3b23c7e2
(interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19715
diff
changeset
|
53 that would the right response). Note that we use PulseEvent to |
ae5e3b23c7e2
(interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19715
diff
changeset
|
54 signal this event, so that it never remains signalled. */ |
ae5e3b23c7e2
(interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19715
diff
changeset
|
55 interrupt_handle = CreateEvent (NULL, TRUE, FALSE, NULL); |
13434 | 56 } |
57 | |
58 void | |
59 delete_crit () | |
60 { | |
14352 | 61 DeleteCriticalSection (&critsect); |
15153
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
62 |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
63 if (input_available) |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
64 { |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
65 CloseHandle (input_available); |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
66 input_available = NULL; |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
67 } |
22077
ae5e3b23c7e2
(interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19715
diff
changeset
|
68 if (interrupt_handle) |
ae5e3b23c7e2
(interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19715
diff
changeset
|
69 { |
ae5e3b23c7e2
(interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19715
diff
changeset
|
70 CloseHandle (interrupt_handle); |
ae5e3b23c7e2
(interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19715
diff
changeset
|
71 interrupt_handle = NULL; |
ae5e3b23c7e2
(interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19715
diff
changeset
|
72 } |
ae5e3b23c7e2
(interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19715
diff
changeset
|
73 } |
ae5e3b23c7e2
(interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19715
diff
changeset
|
74 |
ae5e3b23c7e2
(interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19715
diff
changeset
|
75 void |
ae5e3b23c7e2
(interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19715
diff
changeset
|
76 signal_quit () |
ae5e3b23c7e2
(interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19715
diff
changeset
|
77 { |
ae5e3b23c7e2
(interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19715
diff
changeset
|
78 /* Make sure this event never remains signalled; if the main thread |
ae5e3b23c7e2
(interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19715
diff
changeset
|
79 isn't in a blocking call, then this should do nothing. */ |
ae5e3b23c7e2
(interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
19715
diff
changeset
|
80 PulseEvent (interrupt_handle); |
15153
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
81 } |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
82 |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
83 void |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
84 select_palette (FRAME_PTR f, HDC hdc) |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
85 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15153
diff
changeset
|
86 if (!NILP (Vw32_enable_palette)) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15153
diff
changeset
|
87 f->output_data.w32->old_palette = |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15153
diff
changeset
|
88 SelectPalette (hdc, one_w32_display_info.palette, FALSE); |
15153
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
89 else |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15153
diff
changeset
|
90 f->output_data.w32->old_palette = NULL; |
15153
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
91 |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
92 if (RealizePalette (hdc)) |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
93 { |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
94 Lisp_Object frame, framelist; |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
95 FOR_EACH_FRAME (framelist, frame) |
13434 | 96 { |
15153
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
97 SET_FRAME_GARBAGED (XFRAME (frame)); |
13434 | 98 } |
15153
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
99 } |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
100 } |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
101 |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
102 void |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
103 deselect_palette (FRAME_PTR f, HDC hdc) |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
104 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15153
diff
changeset
|
105 if (f->output_data.w32->old_palette) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15153
diff
changeset
|
106 SelectPalette (hdc, f->output_data.w32->old_palette, FALSE); |
15153
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
107 } |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
108 |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
109 /* Get a DC for frame and select palette for drawing; force an update of |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
110 all frames if palette's mapping changes. */ |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
111 HDC |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
112 get_frame_dc (FRAME_PTR f) |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
113 { |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
114 HDC hdc; |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
115 |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
116 enter_crit (); |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
117 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15153
diff
changeset
|
118 hdc = GetDC (f->output_data.w32->window_desc); |
15153
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
119 select_palette (f, hdc); |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
120 |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
121 return hdc; |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
122 } |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
123 |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
124 int |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
125 release_frame_dc (FRAME_PTR f, HDC hdc) |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
126 { |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
127 int ret; |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
128 |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
129 deselect_palette (f, hdc); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15153
diff
changeset
|
130 ret = ReleaseDC (f->output_data.w32->window_desc, hdc); |
15153
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
131 |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
132 leave_crit (); |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
133 |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
134 return ret; |
13434 | 135 } |
136 | |
137 typedef struct int_msg | |
138 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15153
diff
changeset
|
139 W32Msg w32msg; |
13434 | 140 struct int_msg *lpNext; |
141 } int_msg; | |
142 | |
143 int_msg *lpHead = NULL; | |
144 int_msg *lpTail = NULL; | |
145 int nQueue = 0; | |
146 | |
147 BOOL | |
148 get_next_msg (lpmsg, bWait) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15153
diff
changeset
|
149 W32Msg * lpmsg; |
13434 | 150 BOOL bWait; |
151 { | |
152 BOOL bRet = FALSE; | |
153 | |
14352 | 154 enter_crit (); |
13434 | 155 |
156 /* The while loop takes care of multiple sets */ | |
157 | |
158 while (!nQueue && bWait) | |
159 { | |
14352 | 160 leave_crit (); |
15153
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
161 WaitForSingleObject (input_available, INFINITE); |
14352 | 162 enter_crit (); |
13434 | 163 } |
164 | |
165 if (nQueue) | |
166 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15153
diff
changeset
|
167 bcopy (&(lpHead->w32msg), lpmsg, sizeof (W32Msg)); |
13434 | 168 |
169 { | |
170 int_msg * lpCur = lpHead; | |
171 | |
172 lpHead = lpHead->lpNext; | |
173 | |
174 myfree (lpCur); | |
175 } | |
176 | |
177 nQueue--; | |
178 | |
179 bRet = TRUE; | |
180 } | |
15153
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
181 |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
182 if (nQueue == 0) |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
183 ResetEvent (input_available); |
13434 | 184 |
14352 | 185 leave_crit (); |
13434 | 186 |
187 return (bRet); | |
188 } | |
189 | |
190 BOOL | |
191 post_msg (lpmsg) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15153
diff
changeset
|
192 W32Msg * lpmsg; |
13434 | 193 { |
194 int_msg * lpNew = (int_msg *) myalloc (sizeof (int_msg)); | |
195 | |
15153
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
196 if (!lpNew) |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
197 return (FALSE); |
13434 | 198 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15153
diff
changeset
|
199 bcopy (lpmsg, &(lpNew->w32msg), sizeof (W32Msg)); |
13434 | 200 lpNew->lpNext = NULL; |
201 | |
14352 | 202 enter_crit (); |
13434 | 203 |
204 if (nQueue++) | |
14352 | 205 { |
206 lpTail->lpNext = lpNew; | |
207 } | |
13434 | 208 else |
14352 | 209 { |
210 lpHead = lpNew; | |
211 } | |
13434 | 212 |
213 lpTail = lpNew; | |
15153
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
214 SetEvent (input_available); |
13434 | 215 |
14352 | 216 leave_crit (); |
13434 | 217 |
218 return (TRUE); | |
219 } | |
220 | |
14460
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
221 BOOL |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15153
diff
changeset
|
222 prepend_msg (W32Msg *lpmsg) |
14460
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
223 { |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
224 int_msg * lpNew = (int_msg *) myalloc (sizeof (int_msg)); |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
225 |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
226 if (!lpNew) |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
227 return (FALSE); |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
228 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15153
diff
changeset
|
229 bcopy (lpmsg, &(lpNew->w32msg), sizeof (W32Msg)); |
14460
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
230 |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
231 enter_crit (); |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
232 |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
233 nQueue++; |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
234 lpNew->lpNext = lpHead; |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
235 lpHead = lpNew; |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
236 |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
237 leave_crit (); |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
238 |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
239 return (TRUE); |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
240 } |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
241 |
24917
600578f35004
(drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents:
23509
diff
changeset
|
242 /* Process all messages in the current thread's queue. */ |
600578f35004
(drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents:
23509
diff
changeset
|
243 void |
600578f35004
(drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents:
23509
diff
changeset
|
244 drain_message_queue () |
600578f35004
(drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents:
23509
diff
changeset
|
245 { |
600578f35004
(drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents:
23509
diff
changeset
|
246 MSG msg; |
600578f35004
(drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents:
23509
diff
changeset
|
247 while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE)) |
600578f35004
(drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents:
23509
diff
changeset
|
248 { |
600578f35004
(drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents:
23509
diff
changeset
|
249 TranslateMessage (&msg); |
600578f35004
(drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents:
23509
diff
changeset
|
250 DispatchMessage (&msg); |
600578f35004
(drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents:
23509
diff
changeset
|
251 } |
600578f35004
(drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents:
23509
diff
changeset
|
252 } |
600578f35004
(drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents:
23509
diff
changeset
|
253 |
600578f35004
(drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents:
23509
diff
changeset
|
254 |
13434 | 255 /* |
256 * XParseGeometry parses strings of the form | |
257 * "=<width>x<height>{+-}<xoffset>{+-}<yoffset>", where | |
258 * width, height, xoffset, and yoffset are unsigned integers. | |
259 * Example: "=80x24+300-49" | |
260 * The equal sign is optional. | |
261 * It returns a bitmask that indicates which of the four values | |
262 * were actually found in the string. For each value found, | |
263 * the corresponding argument is updated; for each value | |
264 * not found, the corresponding argument is left unchanged. | |
265 */ | |
266 | |
267 static int | |
268 read_integer (string, NextString) | |
269 register char *string; | |
270 char **NextString; | |
271 { | |
272 register int Result = 0; | |
273 int Sign = 1; | |
274 | |
275 if (*string == '+') | |
276 string++; | |
277 else if (*string == '-') | |
278 { | |
279 string++; | |
280 Sign = -1; | |
281 } | |
282 for (; (*string >= '0') && (*string <= '9'); string++) | |
283 { | |
284 Result = (Result * 10) + (*string - '0'); | |
285 } | |
286 *NextString = string; | |
287 if (Sign >= 0) | |
288 return (Result); | |
289 else | |
290 return (-Result); | |
291 } | |
292 | |
293 int | |
294 XParseGeometry (string, x, y, width, height) | |
295 char *string; | |
296 int *x, *y; | |
297 unsigned int *width, *height; /* RETURN */ | |
298 { | |
299 int mask = NoValue; | |
300 register char *strind; | |
301 unsigned int tempWidth, tempHeight; | |
302 int tempX, tempY; | |
303 char *nextCharacter; | |
304 | |
305 if ((string == NULL) || (*string == '\0')) return (mask); | |
306 if (*string == '=') | |
307 string++; /* ignore possible '=' at beg of geometry spec */ | |
308 | |
309 strind = (char *)string; | |
310 if (*strind != '+' && *strind != '-' && *strind != 'x') | |
311 { | |
312 tempWidth = read_integer (strind, &nextCharacter); | |
313 if (strind == nextCharacter) | |
314 return (0); | |
315 strind = nextCharacter; | |
316 mask |= WidthValue; | |
317 } | |
318 | |
319 if (*strind == 'x' || *strind == 'X') | |
320 { | |
321 strind++; | |
322 tempHeight = read_integer (strind, &nextCharacter); | |
323 if (strind == nextCharacter) | |
324 return (0); | |
325 strind = nextCharacter; | |
326 mask |= HeightValue; | |
327 } | |
328 | |
329 if ((*strind == '+') || (*strind == '-')) | |
330 { | |
331 if (*strind == '-') | |
332 { | |
333 strind++; | |
334 tempX = -read_integer (strind, &nextCharacter); | |
335 if (strind == nextCharacter) | |
336 return (0); | |
337 strind = nextCharacter; | |
338 mask |= XNegative; | |
339 | |
340 } | |
341 else | |
342 { | |
343 strind++; | |
344 tempX = read_integer (strind, &nextCharacter); | |
345 if (strind == nextCharacter) | |
346 return (0); | |
347 strind = nextCharacter; | |
348 } | |
349 mask |= XValue; | |
350 if ((*strind == '+') || (*strind == '-')) | |
351 { | |
352 if (*strind == '-') | |
353 { | |
354 strind++; | |
355 tempY = -read_integer (strind, &nextCharacter); | |
356 if (strind == nextCharacter) | |
357 return (0); | |
358 strind = nextCharacter; | |
359 mask |= YNegative; | |
360 | |
361 } | |
362 else | |
363 { | |
364 strind++; | |
365 tempY = read_integer (strind, &nextCharacter); | |
366 if (strind == nextCharacter) | |
367 return (0); | |
368 strind = nextCharacter; | |
369 } | |
370 mask |= YValue; | |
371 } | |
372 } | |
373 | |
374 /* If strind isn't at the end of the string the it's an invalid | |
375 geometry specification. */ | |
376 | |
377 if (*strind != '\0') return (0); | |
378 | |
379 if (mask & XValue) | |
380 *x = tempX; | |
381 if (mask & YValue) | |
382 *y = tempY; | |
383 if (mask & WidthValue) | |
384 *width = tempWidth; | |
385 if (mask & HeightValue) | |
386 *height = tempHeight; | |
387 return (mask); | |
388 } | |
389 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15153
diff
changeset
|
390 /* x_sync is a no-op on W32. */ |
13434 | 391 void |
392 x_sync (f) | |
393 void *f; | |
394 { | |
395 } |