annotate src/w32xfns.c @ 32222:ae7e7e548bf3

(backward-word): Doc fix.
author Dave Love <fx@gnu.org>
date Fri, 06 Oct 2000 18:13:28 +0000
parents f390b90e3495
children 59adbaee3092
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4 This file is part of GNU Emacs.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6 GNU Emacs is free software; you can redistribute it and/or modify
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7 it under the terms of the GNU General Public License as published by
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8 the Free Software Foundation; either version 2, or (at your option)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9 any later version.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
10
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
11 GNU Emacs is distributed in the hope that it will be useful,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
14 GNU General Public License for more details.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
15
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
22 #include <signal.h>
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
23 #include <stdio.h>
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
24 #include "lisp.h"
31117
f390b90e3495 Include keyboard.h before frame.h.
Andrew Innes <andrewi@gnu.org>
parents: 26088
diff changeset
25 #include "keyboard.h"
15153
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
26 #include "frame.h"
23509
afcb561b535d Include charset.h and fontset.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22077
diff changeset
27 #include "charset.h"
afcb561b535d Include charset.h and fontset.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 22077
diff changeset
28 #include "fontset.h"
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
29 #include "blockinput.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
30 #include "w32term.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
31 #include "windowsx.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
32
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
33 #define myalloc(cb) GlobalAllocPtr (GPTR, cb)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
34 #define myfree(lp) GlobalFreePtr (lp)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
35
14352
a05133ebf2bf backout 1,.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14239
diff changeset
36 CRITICAL_SECTION critsect;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
37 extern HANDLE keyboard_handle;
15153
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
38 HANDLE input_available = NULL;
22077
ae5e3b23c7e2 (interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 19715
diff changeset
39 HANDLE interrupt_handle = NULL;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
40
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
41 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
42 init_crit ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
43 {
14352
a05133ebf2bf backout 1,.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14239
diff changeset
44 InitializeCriticalSection (&critsect);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
45
15153
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
46 /* 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
47 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
48 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
49
ae5e3b23c7e2 (interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 19715
diff changeset
50 /* 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
51 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
52 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
53 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
54 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
55 signal this event, so that it never remains signalled. */
ae5e3b23c7e2 (interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 19715
diff changeset
56 interrupt_handle = CreateEvent (NULL, TRUE, FALSE, NULL);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
57 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
58
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
59 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
60 delete_crit ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
61 {
14352
a05133ebf2bf backout 1,.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14239
diff changeset
62 DeleteCriticalSection (&critsect);
15153
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
63
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
64 if (input_available)
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
65 {
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
66 CloseHandle (input_available);
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
67 input_available = NULL;
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
68 }
22077
ae5e3b23c7e2 (interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 19715
diff changeset
69 if (interrupt_handle)
ae5e3b23c7e2 (interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 19715
diff changeset
70 {
ae5e3b23c7e2 (interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 19715
diff changeset
71 CloseHandle (interrupt_handle);
ae5e3b23c7e2 (interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 19715
diff changeset
72 interrupt_handle = NULL;
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
ae5e3b23c7e2 (interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 19715
diff changeset
76 void
ae5e3b23c7e2 (interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 19715
diff changeset
77 signal_quit ()
ae5e3b23c7e2 (interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 19715
diff changeset
78 {
ae5e3b23c7e2 (interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 19715
diff changeset
79 /* 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
80 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
81 PulseEvent (interrupt_handle);
15153
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
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
84 void
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
85 select_palette (FRAME_PTR f, HDC hdc)
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
86 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15153
diff changeset
87 if (!NILP (Vw32_enable_palette))
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15153
diff changeset
88 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
89 SelectPalette (hdc, one_w32_display_info.palette, FALSE);
15153
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
90 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15153
diff changeset
91 f->output_data.w32->old_palette = NULL;
15153
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
92
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
93 if (RealizePalette (hdc))
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
94 {
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
95 Lisp_Object frame, framelist;
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
96 FOR_EACH_FRAME (framelist, frame)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
97 {
15153
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
98 SET_FRAME_GARBAGED (XFRAME (frame));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
99 }
15153
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
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
103 void
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
104 deselect_palette (FRAME_PTR f, HDC hdc)
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
105 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15153
diff changeset
106 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
107 SelectPalette (hdc, f->output_data.w32->old_palette, FALSE);
15153
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
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
110 /* 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
111 all frames if palette's mapping changes. */
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
112 HDC
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
113 get_frame_dc (FRAME_PTR f)
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
114 {
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
115 HDC hdc;
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
116
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
117 enter_crit ();
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
118
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15153
diff changeset
119 hdc = GetDC (f->output_data.w32->window_desc);
15153
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
120 select_palette (f, hdc);
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
121
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
122 return hdc;
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
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
125 int
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
126 release_frame_dc (FRAME_PTR f, HDC hdc)
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
127 {
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
128 int ret;
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
129
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
130 deselect_palette (f, hdc);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15153
diff changeset
131 ret = ReleaseDC (f->output_data.w32->window_desc, hdc);
15153
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
132
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
133 leave_crit ();
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
134
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
135 return ret;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
136 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
137
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
138 typedef struct int_msg
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
139 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15153
diff changeset
140 W32Msg w32msg;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
141 struct int_msg *lpNext;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
142 } int_msg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
143
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
144 int_msg *lpHead = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
145 int_msg *lpTail = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
146 int nQueue = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
147
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
148 BOOL
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
149 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
150 W32Msg * lpmsg;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
151 BOOL bWait;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
152 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
153 BOOL bRet = FALSE;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
154
14352
a05133ebf2bf backout 1,.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14239
diff changeset
155 enter_crit ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
156
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
157 /* The while loop takes care of multiple sets */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
158
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
159 while (!nQueue && bWait)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
160 {
14352
a05133ebf2bf backout 1,.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14239
diff changeset
161 leave_crit ();
15153
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
162 WaitForSingleObject (input_available, INFINITE);
14352
a05133ebf2bf backout 1,.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14239
diff changeset
163 enter_crit ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
164 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
165
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
166 if (nQueue)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
167 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15153
diff changeset
168 bcopy (&(lpHead->w32msg), lpmsg, sizeof (W32Msg));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
169
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
170 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
171 int_msg * lpCur = lpHead;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
172
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
173 lpHead = lpHead->lpNext;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
174
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
175 myfree (lpCur);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
176 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
177
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
178 nQueue--;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
179
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
180 bRet = TRUE;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
181 }
15153
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
182
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
183 if (nQueue == 0)
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
184 ResetEvent (input_available);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
185
14352
a05133ebf2bf backout 1,.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14239
diff changeset
186 leave_crit ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
187
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
188 return (bRet);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
189 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
190
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
191 BOOL
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
192 post_msg (lpmsg)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15153
diff changeset
193 W32Msg * lpmsg;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
194 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
195 int_msg * lpNew = (int_msg *) myalloc (sizeof (int_msg));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
196
15153
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
197 if (!lpNew)
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
198 return (FALSE);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
199
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15153
diff changeset
200 bcopy (lpmsg, &(lpNew->w32msg), sizeof (W32Msg));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
201 lpNew->lpNext = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
202
14352
a05133ebf2bf backout 1,.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14239
diff changeset
203 enter_crit ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
204
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
205 if (nQueue++)
14352
a05133ebf2bf backout 1,.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14239
diff changeset
206 {
a05133ebf2bf backout 1,.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14239
diff changeset
207 lpTail->lpNext = lpNew;
a05133ebf2bf backout 1,.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14239
diff changeset
208 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
209 else
14352
a05133ebf2bf backout 1,.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14239
diff changeset
210 {
a05133ebf2bf backout 1,.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14239
diff changeset
211 lpHead = lpNew;
a05133ebf2bf backout 1,.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14239
diff changeset
212 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
213
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
214 lpTail = lpNew;
15153
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
215 SetEvent (input_available);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
216
14352
a05133ebf2bf backout 1,.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14239
diff changeset
217 leave_crit ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
218
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
219 return (TRUE);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
220 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
221
14460
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
222 BOOL
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15153
diff changeset
223 prepend_msg (W32Msg *lpmsg)
14460
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
224 {
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
225 int_msg * lpNew = (int_msg *) myalloc (sizeof (int_msg));
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
226
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
227 if (!lpNew)
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
228 return (FALSE);
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
229
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15153
diff changeset
230 bcopy (lpmsg, &(lpNew->w32msg), sizeof (W32Msg));
14460
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
231
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
232 enter_crit ();
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
233
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
234 nQueue++;
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
235 lpNew->lpNext = lpHead;
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
236 lpHead = lpNew;
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
237
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
238 leave_crit ();
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
239
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
240 return (TRUE);
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
241 }
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
242
24917
600578f35004 (drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents: 23509
diff changeset
243 /* Process all messages in the current thread's queue. */
600578f35004 (drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents: 23509
diff changeset
244 void
600578f35004 (drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents: 23509
diff changeset
245 drain_message_queue ()
600578f35004 (drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents: 23509
diff changeset
246 {
600578f35004 (drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents: 23509
diff changeset
247 MSG msg;
600578f35004 (drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents: 23509
diff changeset
248 while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
600578f35004 (drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents: 23509
diff changeset
249 {
600578f35004 (drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents: 23509
diff changeset
250 TranslateMessage (&msg);
600578f35004 (drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents: 23509
diff changeset
251 DispatchMessage (&msg);
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
600578f35004 (drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents: 23509
diff changeset
255
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
256 /*
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
257 * XParseGeometry parses strings of the form
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
258 * "=<width>x<height>{+-}<xoffset>{+-}<yoffset>", where
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
259 * width, height, xoffset, and yoffset are unsigned integers.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
260 * Example: "=80x24+300-49"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
261 * The equal sign is optional.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
262 * It returns a bitmask that indicates which of the four values
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
263 * were actually found in the string. For each value found,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
264 * the corresponding argument is updated; for each value
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
265 * not found, the corresponding argument is left unchanged.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
266 */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
267
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
268 static int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
269 read_integer (string, NextString)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
270 register char *string;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
271 char **NextString;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
272 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
273 register int Result = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
274 int Sign = 1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
275
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
276 if (*string == '+')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
277 string++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
278 else if (*string == '-')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
279 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
280 string++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
281 Sign = -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
282 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
283 for (; (*string >= '0') && (*string <= '9'); string++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
284 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
285 Result = (Result * 10) + (*string - '0');
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
286 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
287 *NextString = string;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
288 if (Sign >= 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
289 return (Result);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
290 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
291 return (-Result);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
292 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
293
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
294 int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
295 XParseGeometry (string, x, y, width, height)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
296 char *string;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
297 int *x, *y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
298 unsigned int *width, *height; /* RETURN */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
299 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
300 int mask = NoValue;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
301 register char *strind;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
302 unsigned int tempWidth, tempHeight;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
303 int tempX, tempY;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
304 char *nextCharacter;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
305
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
306 if ((string == NULL) || (*string == '\0')) return (mask);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
307 if (*string == '=')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
308 string++; /* ignore possible '=' at beg of geometry spec */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
309
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
310 strind = (char *)string;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
311 if (*strind != '+' && *strind != '-' && *strind != 'x')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
312 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
313 tempWidth = read_integer (strind, &nextCharacter);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
314 if (strind == nextCharacter)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
315 return (0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
316 strind = nextCharacter;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
317 mask |= WidthValue;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
318 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
319
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
320 if (*strind == 'x' || *strind == 'X')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
321 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
322 strind++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
323 tempHeight = read_integer (strind, &nextCharacter);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
324 if (strind == nextCharacter)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
325 return (0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
326 strind = nextCharacter;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
327 mask |= HeightValue;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
328 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
329
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
330 if ((*strind == '+') || (*strind == '-'))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
331 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
332 if (*strind == '-')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
333 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
334 strind++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
335 tempX = -read_integer (strind, &nextCharacter);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
336 if (strind == nextCharacter)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
337 return (0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
338 strind = nextCharacter;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
339 mask |= XNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
340
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
341 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
342 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
343 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
344 strind++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
345 tempX = read_integer (strind, &nextCharacter);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
346 if (strind == nextCharacter)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
347 return (0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
348 strind = nextCharacter;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
349 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
350 mask |= XValue;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
351 if ((*strind == '+') || (*strind == '-'))
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
352 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
353 if (*strind == '-')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
354 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
355 strind++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
356 tempY = -read_integer (strind, &nextCharacter);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
357 if (strind == nextCharacter)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
358 return (0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
359 strind = nextCharacter;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
360 mask |= YNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
361
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
362 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
363 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
364 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
365 strind++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
366 tempY = read_integer (strind, &nextCharacter);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
367 if (strind == nextCharacter)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
368 return (0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
369 strind = nextCharacter;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
370 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
371 mask |= YValue;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
372 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
373 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
374
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
375 /* If strind isn't at the end of the string the it's an invalid
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
376 geometry specification. */
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
377
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
378 if (*strind != '\0') return (0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
379
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
380 if (mask & XValue)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
381 *x = tempX;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
382 if (mask & YValue)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
383 *y = tempY;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
384 if (mask & WidthValue)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
385 *width = tempWidth;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
386 if (mask & HeightValue)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
387 *height = tempHeight;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
388 return (mask);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
389 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
390
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15153
diff changeset
391 /* x_sync is a no-op on W32. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
392 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
393 x_sync (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
394 void *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
395 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
396 }