Mercurial > emacs
annotate src/w32xfns.c @ 19860:c17fd465ea95 libc-970911 libc-970912 libc-970913 libc-970914 libc-970915 libc-970916 libc-970917 libc-970918 libc-970919 libc-970920 libc-970921 libc-970922 libc-970923 libc-970924 libc-970925 libc-970926 libc-970927 libc-970928 libc-970929 libc-970930 libc-971001 libc-971018 libc-971019 libc-971020 libc-971021 libc-971022 libc-971023 libc-971024 libc-971025 libc-971026 libc-971027 libc-971028 libc-971029 libc-971030 libc-971031 libc-971101 libc-971102 libc-971103 libc-971104 libc-971105 libc-971106 libc-971107 libc-971108 libc-971109 libc-971110 libc-971111 libc-971112 libc-971113 libc-971114 libc-971115 libc-971116 libc-971117 libc-971118 libc-971120 libc-971121 libc-971122 libc-971123 libc-971124 libc-971125 libc-971126 libc-971127 libc-971128 libc-971129 libc-971130 libc-971201 libc-971203 libc-971204 libc-971205 libc-971206 libc-971207 libc-971208 libc-971209 libc-971210 libc-971211 libc-971212 libc-971213 libc-971214 libc-971217 libc-971218 libc-971219 libc-971220 libc-971221 libc-971222 libc-971223 libc-971224 libc-971225 libc-971226 libc-971227 libc-971228 libc-971229 libc-971230 libc-971231 libc-980103 libc-980104 libc-980105 libc-980106 libc-980107 libc-980108 libc-980109 libc-980110 libc-980111 libc-980112 libc-980114 libc-980115 libc-980116 libc-980117 libc-980118 libc-980119 libc-980120 libc-980121 libc-980122 libc-980123 libc-980124 libc-980125 libc-980126 libc-980127 libc-980128
typos.
author | Jeff Law <law@redhat.com> |
---|---|
date | Wed, 10 Sep 1997 21:16:20 +0000 |
parents | 639881f2750d |
children | ae5e3b23c7e2 |
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. |
13434 | 2 Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation. |
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 |
21 #include <signal.h> | |
22 #include <config.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" |
13434 | 26 #include "blockinput.h" |
27 #include "w32term.h" | |
28 #include "windowsx.h" | |
29 | |
30 #define myalloc(cb) GlobalAllocPtr (GPTR, cb) | |
31 #define myfree(lp) GlobalFreePtr (lp) | |
32 | |
14352 | 33 CRITICAL_SECTION critsect; |
13434 | 34 extern HANDLE keyboard_handle; |
15153
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
35 HANDLE input_available = NULL; |
13434 | 36 |
37 void | |
38 init_crit () | |
39 { | |
14352 | 40 InitializeCriticalSection (&critsect); |
13434 | 41 |
15153
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
42 /* 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
|
43 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
|
44 keyboard_handle = input_available = CreateEvent (NULL, TRUE, FALSE, NULL); |
13434 | 45 } |
46 | |
47 void | |
48 delete_crit () | |
49 { | |
14352 | 50 DeleteCriticalSection (&critsect); |
15153
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
51 |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
52 if (input_available) |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
53 { |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
54 CloseHandle (input_available); |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
55 input_available = NULL; |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
56 } |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
57 } |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
58 |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
59 void |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
60 select_palette (FRAME_PTR f, HDC hdc) |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
61 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15153
diff
changeset
|
62 if (!NILP (Vw32_enable_palette)) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15153
diff
changeset
|
63 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
|
64 SelectPalette (hdc, one_w32_display_info.palette, FALSE); |
15153
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
65 else |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15153
diff
changeset
|
66 f->output_data.w32->old_palette = NULL; |
15153
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
67 |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
68 if (RealizePalette (hdc)) |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
69 { |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
70 Lisp_Object frame, framelist; |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
71 FOR_EACH_FRAME (framelist, frame) |
13434 | 72 { |
15153
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
73 SET_FRAME_GARBAGED (XFRAME (frame)); |
13434 | 74 } |
15153
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
75 } |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
76 } |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
77 |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
78 void |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
79 deselect_palette (FRAME_PTR f, HDC hdc) |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
80 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15153
diff
changeset
|
81 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
|
82 SelectPalette (hdc, f->output_data.w32->old_palette, FALSE); |
15153
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
83 } |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
84 |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
85 /* 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
|
86 all frames if palette's mapping changes. */ |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
87 HDC |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
88 get_frame_dc (FRAME_PTR f) |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
89 { |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
90 HDC hdc; |
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 enter_crit (); |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
93 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15153
diff
changeset
|
94 hdc = GetDC (f->output_data.w32->window_desc); |
15153
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
95 select_palette (f, hdc); |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
96 |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
97 return hdc; |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
98 } |
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 int |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
101 release_frame_dc (FRAME_PTR f, HDC hdc) |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
102 { |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
103 int ret; |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
104 |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
105 deselect_palette (f, hdc); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15153
diff
changeset
|
106 ret = ReleaseDC (f->output_data.w32->window_desc, hdc); |
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 leave_crit (); |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
109 |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
110 return ret; |
13434 | 111 } |
112 | |
113 typedef struct int_msg | |
114 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15153
diff
changeset
|
115 W32Msg w32msg; |
13434 | 116 struct int_msg *lpNext; |
117 } int_msg; | |
118 | |
119 int_msg *lpHead = NULL; | |
120 int_msg *lpTail = NULL; | |
121 int nQueue = 0; | |
122 | |
123 BOOL | |
124 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
|
125 W32Msg * lpmsg; |
13434 | 126 BOOL bWait; |
127 { | |
128 BOOL bRet = FALSE; | |
129 | |
14352 | 130 enter_crit (); |
13434 | 131 |
132 /* The while loop takes care of multiple sets */ | |
133 | |
134 while (!nQueue && bWait) | |
135 { | |
14352 | 136 leave_crit (); |
15153
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
137 WaitForSingleObject (input_available, INFINITE); |
14352 | 138 enter_crit (); |
13434 | 139 } |
140 | |
141 if (nQueue) | |
142 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15153
diff
changeset
|
143 bcopy (&(lpHead->w32msg), lpmsg, sizeof (W32Msg)); |
13434 | 144 |
145 { | |
146 int_msg * lpCur = lpHead; | |
147 | |
148 lpHead = lpHead->lpNext; | |
149 | |
150 myfree (lpCur); | |
151 } | |
152 | |
153 nQueue--; | |
154 | |
155 bRet = TRUE; | |
156 } | |
15153
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
157 |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
158 if (nQueue == 0) |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
159 ResetEvent (input_available); |
13434 | 160 |
14352 | 161 leave_crit (); |
13434 | 162 |
163 return (bRet); | |
164 } | |
165 | |
166 BOOL | |
167 post_msg (lpmsg) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15153
diff
changeset
|
168 W32Msg * lpmsg; |
13434 | 169 { |
170 int_msg * lpNew = (int_msg *) myalloc (sizeof (int_msg)); | |
171 | |
15153
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
172 if (!lpNew) |
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
173 return (FALSE); |
13434 | 174 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15153
diff
changeset
|
175 bcopy (lpmsg, &(lpNew->w32msg), sizeof (W32Msg)); |
13434 | 176 lpNew->lpNext = NULL; |
177 | |
14352 | 178 enter_crit (); |
13434 | 179 |
180 if (nQueue++) | |
14352 | 181 { |
182 lpTail->lpNext = lpNew; | |
183 } | |
13434 | 184 else |
14352 | 185 { |
186 lpHead = lpNew; | |
187 } | |
13434 | 188 |
189 lpTail = lpNew; | |
15153
c1494aa589e8
Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14460
diff
changeset
|
190 SetEvent (input_available); |
13434 | 191 |
14352 | 192 leave_crit (); |
13434 | 193 |
194 return (TRUE); | |
195 } | |
196 | |
14460
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
197 BOOL |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15153
diff
changeset
|
198 prepend_msg (W32Msg *lpmsg) |
14460
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
199 { |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
200 int_msg * lpNew = (int_msg *) myalloc (sizeof (int_msg)); |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
201 |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
202 if (!lpNew) |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
203 return (FALSE); |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
204 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15153
diff
changeset
|
205 bcopy (lpmsg, &(lpNew->w32msg), sizeof (W32Msg)); |
14460
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
206 |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
207 enter_crit (); |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
208 |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
209 nQueue++; |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
210 lpNew->lpNext = lpHead; |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
211 lpHead = lpNew; |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
212 |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
213 leave_crit (); |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
214 |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
215 return (TRUE); |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
216 } |
61fc696a0c6a
(prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14352
diff
changeset
|
217 |
13434 | 218 /* |
219 * XParseGeometry parses strings of the form | |
220 * "=<width>x<height>{+-}<xoffset>{+-}<yoffset>", where | |
221 * width, height, xoffset, and yoffset are unsigned integers. | |
222 * Example: "=80x24+300-49" | |
223 * The equal sign is optional. | |
224 * It returns a bitmask that indicates which of the four values | |
225 * were actually found in the string. For each value found, | |
226 * the corresponding argument is updated; for each value | |
227 * not found, the corresponding argument is left unchanged. | |
228 */ | |
229 | |
230 static int | |
231 read_integer (string, NextString) | |
232 register char *string; | |
233 char **NextString; | |
234 { | |
235 register int Result = 0; | |
236 int Sign = 1; | |
237 | |
238 if (*string == '+') | |
239 string++; | |
240 else if (*string == '-') | |
241 { | |
242 string++; | |
243 Sign = -1; | |
244 } | |
245 for (; (*string >= '0') && (*string <= '9'); string++) | |
246 { | |
247 Result = (Result * 10) + (*string - '0'); | |
248 } | |
249 *NextString = string; | |
250 if (Sign >= 0) | |
251 return (Result); | |
252 else | |
253 return (-Result); | |
254 } | |
255 | |
256 int | |
257 XParseGeometry (string, x, y, width, height) | |
258 char *string; | |
259 int *x, *y; | |
260 unsigned int *width, *height; /* RETURN */ | |
261 { | |
262 int mask = NoValue; | |
263 register char *strind; | |
264 unsigned int tempWidth, tempHeight; | |
265 int tempX, tempY; | |
266 char *nextCharacter; | |
267 | |
268 if ((string == NULL) || (*string == '\0')) return (mask); | |
269 if (*string == '=') | |
270 string++; /* ignore possible '=' at beg of geometry spec */ | |
271 | |
272 strind = (char *)string; | |
273 if (*strind != '+' && *strind != '-' && *strind != 'x') | |
274 { | |
275 tempWidth = read_integer (strind, &nextCharacter); | |
276 if (strind == nextCharacter) | |
277 return (0); | |
278 strind = nextCharacter; | |
279 mask |= WidthValue; | |
280 } | |
281 | |
282 if (*strind == 'x' || *strind == 'X') | |
283 { | |
284 strind++; | |
285 tempHeight = read_integer (strind, &nextCharacter); | |
286 if (strind == nextCharacter) | |
287 return (0); | |
288 strind = nextCharacter; | |
289 mask |= HeightValue; | |
290 } | |
291 | |
292 if ((*strind == '+') || (*strind == '-')) | |
293 { | |
294 if (*strind == '-') | |
295 { | |
296 strind++; | |
297 tempX = -read_integer (strind, &nextCharacter); | |
298 if (strind == nextCharacter) | |
299 return (0); | |
300 strind = nextCharacter; | |
301 mask |= XNegative; | |
302 | |
303 } | |
304 else | |
305 { | |
306 strind++; | |
307 tempX = read_integer (strind, &nextCharacter); | |
308 if (strind == nextCharacter) | |
309 return (0); | |
310 strind = nextCharacter; | |
311 } | |
312 mask |= XValue; | |
313 if ((*strind == '+') || (*strind == '-')) | |
314 { | |
315 if (*strind == '-') | |
316 { | |
317 strind++; | |
318 tempY = -read_integer (strind, &nextCharacter); | |
319 if (strind == nextCharacter) | |
320 return (0); | |
321 strind = nextCharacter; | |
322 mask |= YNegative; | |
323 | |
324 } | |
325 else | |
326 { | |
327 strind++; | |
328 tempY = read_integer (strind, &nextCharacter); | |
329 if (strind == nextCharacter) | |
330 return (0); | |
331 strind = nextCharacter; | |
332 } | |
333 mask |= YValue; | |
334 } | |
335 } | |
336 | |
337 /* If strind isn't at the end of the string the it's an invalid | |
338 geometry specification. */ | |
339 | |
340 if (*strind != '\0') return (0); | |
341 | |
342 if (mask & XValue) | |
343 *x = tempX; | |
344 if (mask & YValue) | |
345 *y = tempY; | |
346 if (mask & WidthValue) | |
347 *width = tempWidth; | |
348 if (mask & HeightValue) | |
349 *height = tempHeight; | |
350 return (mask); | |
351 } | |
352 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15153
diff
changeset
|
353 /* x_sync is a no-op on W32. */ |
13434 | 354 void |
355 x_sync (f) | |
356 void *f; | |
357 { | |
358 } | |
359 |