annotate src/w32xfns.c @ 99492:ee792794d888

(isearch-search-fun): Compare the length of the current search string with the length of the string from the previous search state to detect the situation when the user adds or removes characters in the search string. Use word-search-forward-lax and word-search-backward-lax in this case, and otherwise word-search-forward and word-search-backward.
author Juri Linkov <juri@jurta.org>
date Tue, 11 Nov 2008 19:43:09 +0000
parents a99299e4d2de
children e038c1a8307c
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.
75227
e90d04cd455a Update copyright for years from Emacs 21 to present (mainly adding
Glenn Morris <rgm@gnu.org>
parents: 68651
diff changeset
2 Copyright (C) 1989, 1992, 1993, 1994, 1995, 1999, 2001, 2002, 2003,
79759
fc2bcd2a8aad Add 2008 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 78260
diff changeset
3 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5 This file is part of GNU Emacs.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6
94963
8971ddf55736 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 91327
diff changeset
7 GNU Emacs is free software: you can redistribute it and/or modify
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8 it under the terms of the GNU General Public License as published by
94963
8971ddf55736 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 91327
diff changeset
9 the Free Software Foundation, either version 3 of the License, or
8971ddf55736 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 91327
diff changeset
10 (at your option) any later version.
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
11
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
12 GNU Emacs is distributed in the hope that it will be useful,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
15 GNU General Public License for more details.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
16
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
94963
8971ddf55736 Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 91327
diff changeset
18 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
19
26088
b7aa6ac26872 Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents: 24917
diff changeset
20 #include <config.h>
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
21 #include <signal.h>
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
22 #include <stdio.h>
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
23 #include "lisp.h"
31117
f390b90e3495 Include keyboard.h before frame.h.
Andrew Innes <andrewi@gnu.org>
parents: 26088
diff changeset
24 #include "keyboard.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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
28 #include "blockinput.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
29 #include "w32term.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
30 #include "windowsx.h"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
31
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
32 #define myalloc(cb) GlobalAllocPtr (GPTR, cb)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
33 #define myfree(lp) GlobalFreePtr (lp)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
34
14352
a05133ebf2bf backout 1,.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14239
diff changeset
35 CRITICAL_SECTION critsect;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
39
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
40 void
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
41 init_crit ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
42 {
14352
a05133ebf2bf backout 1,.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14239
diff changeset
43 InitializeCriticalSection (&critsect);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
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
96361
a99299e4d2de American English spelling fix.
Glenn Morris <rgm@gnu.org>
parents: 94963
diff changeset
49 /* interrupt_handle is signaled when quit (C-g) is detected, so that
22077
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
96361
a99299e4d2de American English spelling fix.
Glenn Morris <rgm@gnu.org>
parents: 94963
diff changeset
54 signal this event, so that it never remains signaled. */
22077
ae5e3b23c7e2 (interrupt_handle): New variable.
Richard M. Stallman <rms@gnu.org>
parents: 19715
diff changeset
55 interrupt_handle = CreateEvent (NULL, TRUE, FALSE, NULL);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
56 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
57
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
58 void
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
59 delete_crit ()
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
60 {
14352
a05133ebf2bf backout 1,.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14239
diff changeset
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 {
96361
a99299e4d2de American English spelling fix.
Glenn Morris <rgm@gnu.org>
parents: 94963
diff changeset
78 /* Make sure this event never remains signaled; if the main thread
22077
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 {
34783
9c0d7d896682 (select_palette): Avoid calling SelectPalette if
Andrew Innes <andrewi@gnu.org>
parents: 34094
diff changeset
86 struct w32_display_info *display_info = FRAME_W32_DISPLAY_INFO (f);
9c0d7d896682 (select_palette): Avoid calling SelectPalette if
Andrew Innes <andrewi@gnu.org>
parents: 34094
diff changeset
87
9c0d7d896682 (select_palette): Avoid calling SelectPalette if
Andrew Innes <andrewi@gnu.org>
parents: 34094
diff changeset
88 if (!display_info->has_palette)
9c0d7d896682 (select_palette): Avoid calling SelectPalette if
Andrew Innes <andrewi@gnu.org>
parents: 34094
diff changeset
89 return;
9c0d7d896682 (select_palette): Avoid calling SelectPalette if
Andrew Innes <andrewi@gnu.org>
parents: 34094
diff changeset
90
9c0d7d896682 (select_palette): Avoid calling SelectPalette if
Andrew Innes <andrewi@gnu.org>
parents: 34094
diff changeset
91 if (display_info->palette == 0)
35943
7a9bc23b91e7 (select_palette): Do nothing if palette hasn't yet
Andrew Innes <andrewi@gnu.org>
parents: 34999
diff changeset
92 return;
34783
9c0d7d896682 (select_palette): Avoid calling SelectPalette if
Andrew Innes <andrewi@gnu.org>
parents: 34094
diff changeset
93
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15153
diff changeset
94 if (!NILP (Vw32_enable_palette))
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15153
diff changeset
95 f->output_data.w32->old_palette =
34783
9c0d7d896682 (select_palette): Avoid calling SelectPalette if
Andrew Innes <andrewi@gnu.org>
parents: 34094
diff changeset
96 SelectPalette (hdc, display_info->palette, FALSE);
15153
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
97 else
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15153
diff changeset
98 f->output_data.w32->old_palette = NULL;
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 if (RealizePalette (hdc))
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 Lisp_Object frame, framelist;
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
103 FOR_EACH_FRAME (framelist, frame)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
104 {
15153
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
105 SET_FRAME_GARBAGED (XFRAME (frame));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
106 }
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
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
110 void
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
111 deselect_palette (FRAME_PTR f, HDC hdc)
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
112 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15153
diff changeset
113 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
114 SelectPalette (hdc, f->output_data.w32->old_palette, FALSE);
15153
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
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
117 /* 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
118 all frames if palette's mapping changes. */
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
119 HDC
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
120 get_frame_dc (FRAME_PTR f)
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 HDC hdc;
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
123
34999
549bbda5364a (get_frame_dc): Abort if called on a non-w32 frame.
Andrew Innes <andrewi@gnu.org>
parents: 34783
diff changeset
124 if (f->output_method != output_w32)
549bbda5364a (get_frame_dc): Abort if called on a non-w32 frame.
Andrew Innes <andrewi@gnu.org>
parents: 34783
diff changeset
125 abort ();
549bbda5364a (get_frame_dc): Abort if called on a non-w32 frame.
Andrew Innes <andrewi@gnu.org>
parents: 34783
diff changeset
126
15153
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
127 enter_crit ();
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
128
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15153
diff changeset
129 hdc = GetDC (f->output_data.w32->window_desc);
34094
59adbaee3092 (get_frame_dc): Avoid changing the palette on an invalid frame.
Jason Rumney <jasonr@gnu.org>
parents: 31117
diff changeset
130
59adbaee3092 (get_frame_dc): Avoid changing the palette on an invalid frame.
Jason Rumney <jasonr@gnu.org>
parents: 31117
diff changeset
131 /* If this gets called during startup before the frame is valid,
59adbaee3092 (get_frame_dc): Avoid changing the palette on an invalid frame.
Jason Rumney <jasonr@gnu.org>
parents: 31117
diff changeset
132 there is a chance of corrupting random data or crashing. */
59adbaee3092 (get_frame_dc): Avoid changing the palette on an invalid frame.
Jason Rumney <jasonr@gnu.org>
parents: 31117
diff changeset
133 if (hdc)
59adbaee3092 (get_frame_dc): Avoid changing the palette on an invalid frame.
Jason Rumney <jasonr@gnu.org>
parents: 31117
diff changeset
134 select_palette (f, hdc);
15153
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
135
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
136 return hdc;
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
137 }
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
138
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
139 int
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
140 release_frame_dc (FRAME_PTR f, HDC hdc)
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
141 {
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
142 int ret;
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
143
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
144 deselect_palette (f, hdc);
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15153
diff changeset
145 ret = ReleaseDC (f->output_data.w32->window_desc, hdc);
15153
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
146
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
147 leave_crit ();
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
148
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
149 return ret;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
150 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
151
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
152 typedef struct int_msg
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
153 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15153
diff changeset
154 W32Msg w32msg;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
155 struct int_msg *lpNext;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
156 } int_msg;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
157
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
158 int_msg *lpHead = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
159 int_msg *lpTail = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
160 int nQueue = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
161
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
162 BOOL
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
163 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
164 W32Msg * lpmsg;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
165 BOOL bWait;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
166 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
167 BOOL bRet = FALSE;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
168
14352
a05133ebf2bf backout 1,.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14239
diff changeset
169 enter_crit ();
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
170
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
171 /* The while loop takes care of multiple sets */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
172
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
173 while (!nQueue && bWait)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
174 {
14352
a05133ebf2bf backout 1,.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14239
diff changeset
175 leave_crit ();
15153
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
176 WaitForSingleObject (input_available, INFINITE);
14352
a05133ebf2bf backout 1,.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14239
diff changeset
177 enter_crit ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
178 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
179
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
180 if (nQueue)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
181 {
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15153
diff changeset
182 bcopy (&(lpHead->w32msg), lpmsg, sizeof (W32Msg));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
183
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
184 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
185 int_msg * lpCur = lpHead;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
186
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
187 lpHead = lpHead->lpNext;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
188
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
189 myfree (lpCur);
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
192 nQueue--;
91031
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
193 /* Consolidate WM_PAINT messages to optimise redrawing. */
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
194 if (lpmsg->msg.message == WM_PAINT && nQueue)
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
195 {
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
196 int_msg * lpCur = lpHead;
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
197 int_msg * lpPrev = NULL;
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
198 int_msg * lpNext = NULL;
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
199
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
200 while (lpCur && nQueue)
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
201 {
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
202 lpNext = lpCur->lpNext;
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
203 if (lpCur->w32msg.msg.message == WM_PAINT)
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
204 {
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
205 /* Remove this message from the queue. */
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
206 if (lpPrev)
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
207 lpPrev->lpNext = lpNext;
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
208 else
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
209 lpHead = lpNext;
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
210
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
211 if (lpCur == lpTail)
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
212 lpTail = lpPrev;
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
213
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
214 /* Adjust clip rectangle to cover both. */
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
215 if (!UnionRect (&(lpmsg->rect), &(lpmsg->rect),
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
216 &(lpCur->w32msg.rect)))
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
217 {
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
218 SetRectEmpty(&(lpmsg->rect));
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
219 }
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
220
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
221 myfree (lpCur);
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
222
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
223 nQueue--;
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
224
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
225 lpCur = lpNext;
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
226 }
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
227 else
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
228 {
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
229 lpPrev = lpCur;
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
230 lpCur = lpNext;
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
231 }
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
232 }
524f82fbf3ef (get_next_msg): Consolidate WM_PAINT messages.
Jason Rumney <jasonr@gnu.org>
parents: 90996
diff changeset
233 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
234
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
235 bRet = TRUE;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
236 }
15153
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
237
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
238 if (nQueue == 0)
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
239 ResetEvent (input_available);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
240
14352
a05133ebf2bf backout 1,.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14239
diff changeset
241 leave_crit ();
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
242
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
243 return (bRet);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
244 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
245
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
246 BOOL
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
247 post_msg (lpmsg)
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15153
diff changeset
248 W32Msg * lpmsg;
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
249 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
250 int_msg * lpNew = (int_msg *) myalloc (sizeof (int_msg));
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
251
15153
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
252 if (!lpNew)
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
253 return (FALSE);
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
254
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15153
diff changeset
255 bcopy (lpmsg, &(lpNew->w32msg), sizeof (W32Msg));
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
256 lpNew->lpNext = NULL;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
257
14352
a05133ebf2bf backout 1,.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14239
diff changeset
258 enter_crit ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
259
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
260 if (nQueue++)
14352
a05133ebf2bf backout 1,.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14239
diff changeset
261 {
a05133ebf2bf backout 1,.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14239
diff changeset
262 lpTail->lpNext = lpNew;
a05133ebf2bf backout 1,.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14239
diff changeset
263 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
264 else
14352
a05133ebf2bf backout 1,.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14239
diff changeset
265 {
a05133ebf2bf backout 1,.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14239
diff changeset
266 lpHead = lpNew;
a05133ebf2bf backout 1,.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14239
diff changeset
267 }
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
268
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
269 lpTail = lpNew;
15153
c1494aa589e8 Include frame.h.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14460
diff changeset
270 SetEvent (input_available);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
271
14352
a05133ebf2bf backout 1,.4
Geoff Voelker <voelker@cs.washington.edu>
parents: 14239
diff changeset
272 leave_crit ();
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
273
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
274 return (TRUE);
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
14460
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
277 BOOL
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15153
diff changeset
278 prepend_msg (W32Msg *lpmsg)
14460
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
279 {
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
280 int_msg * lpNew = (int_msg *) myalloc (sizeof (int_msg));
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
281
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
282 if (!lpNew)
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
283 return (FALSE);
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
284
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15153
diff changeset
285 bcopy (lpmsg, &(lpNew->w32msg), sizeof (W32Msg));
14460
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
286
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
287 enter_crit ();
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
288
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
289 nQueue++;
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
290 lpNew->lpNext = lpHead;
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
291 lpHead = lpNew;
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
292
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
293 leave_crit ();
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
294
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
295 return (TRUE);
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
296 }
61fc696a0c6a (prepend_msg): New function.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14352
diff changeset
297
24917
600578f35004 (drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents: 23509
diff changeset
298 /* Process all messages in the current thread's queue. */
600578f35004 (drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents: 23509
diff changeset
299 void
600578f35004 (drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents: 23509
diff changeset
300 drain_message_queue ()
600578f35004 (drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents: 23509
diff changeset
301 {
600578f35004 (drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents: 23509
diff changeset
302 MSG msg;
600578f35004 (drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents: 23509
diff changeset
303 while (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
600578f35004 (drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents: 23509
diff changeset
304 {
600578f35004 (drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents: 23509
diff changeset
305 TranslateMessage (&msg);
600578f35004 (drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents: 23509
diff changeset
306 DispatchMessage (&msg);
600578f35004 (drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents: 23509
diff changeset
307 }
600578f35004 (drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents: 23509
diff changeset
308 }
600578f35004 (drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents: 23509
diff changeset
309
600578f35004 (drain_message_queue): New function.
Andrew Innes <andrewi@gnu.org>
parents: 23509
diff changeset
310
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
311 /*
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
312 * XParseGeometry parses strings of the form
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
313 * "=<width>x<height>{+-}<xoffset>{+-}<yoffset>", where
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
314 * width, height, xoffset, and yoffset are unsigned integers.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
315 * Example: "=80x24+300-49"
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
316 * The equal sign is optional.
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
317 * It returns a bitmask that indicates which of the four values
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
318 * were actually found in the string. For each value found,
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
319 * the corresponding argument is updated; for each value
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
320 * not found, the corresponding argument is left unchanged.
13434
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
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
323 static int
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
324 read_integer (string, NextString)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
325 register char *string;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
326 char **NextString;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
327 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
328 register int Result = 0;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
329 int Sign = 1;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
330
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
331 if (*string == '+')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
332 string++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
333 else if (*string == '-')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
334 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
335 string++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
336 Sign = -1;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
337 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
338 for (; (*string >= '0') && (*string <= '9'); string++)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
339 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
340 Result = (Result * 10) + (*string - '0');
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 *NextString = string;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
343 if (Sign >= 0)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
344 return (Result);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
345 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
346 return (-Result);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
347 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
348
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
349 int
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
350 XParseGeometry (string, x, y, width, height)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
351 char *string;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
352 int *x, *y;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
353 unsigned int *width, *height; /* RETURN */
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 int mask = NoValue;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
356 register char *strind;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
357 unsigned int tempWidth, tempHeight;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
358 int tempX, tempY;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
359 char *nextCharacter;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
360
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
361 if ((string == NULL) || (*string == '\0')) return (mask);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
362 if (*string == '=')
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
363 string++; /* ignore possible '=' at beg of geometry spec */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
364
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
365 strind = (char *)string;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
366 if (*strind != '+' && *strind != '-' && *strind != 'x')
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
367 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
368 tempWidth = read_integer (strind, &nextCharacter);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
369 if (strind == nextCharacter)
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
370 return (0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
371 strind = nextCharacter;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
372 mask |= WidthValue;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
373 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
374
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
375 if (*strind == 'x' || *strind == 'X')
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
376 {
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
377 strind++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
378 tempHeight = read_integer (strind, &nextCharacter);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
379 if (strind == nextCharacter)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
380 return (0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
381 strind = nextCharacter;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
382 mask |= HeightValue;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
383 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
384
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
385 if ((*strind == '+') || (*strind == '-'))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
386 {
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
387 if (*strind == '-')
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
388 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
389 strind++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
390 tempX = -read_integer (strind, &nextCharacter);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
391 if (strind == nextCharacter)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
392 return (0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
393 strind = nextCharacter;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
394 mask |= XNegative;
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 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
397 else
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
398 {
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
399 strind++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
400 tempX = read_integer (strind, &nextCharacter);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
401 if (strind == nextCharacter)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
402 return (0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
403 strind = nextCharacter;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
404 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
405 mask |= XValue;
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
406 if ((*strind == '+') || (*strind == '-'))
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
407 {
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
408 if (*strind == '-')
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
409 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
410 strind++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
411 tempY = -read_integer (strind, &nextCharacter);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
412 if (strind == nextCharacter)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
413 return (0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
414 strind = nextCharacter;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
415 mask |= YNegative;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
416
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
417 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
418 else
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
419 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
420 strind++;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
421 tempY = read_integer (strind, &nextCharacter);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
422 if (strind == nextCharacter)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
423 return (0);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
424 strind = nextCharacter;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
425 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
426 mask |= YValue;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
427 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
428 }
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
429
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
430 /* 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
431 geometry specification. */
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
432
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
433 if (*strind != '\0') return (0);
49600
23a1cea22d13 Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents: 35943
diff changeset
434
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
435 if (mask & XValue)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
436 *x = tempX;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
437 if (mask & YValue)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
438 *y = tempY;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
439 if (mask & WidthValue)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
440 *width = tempWidth;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
441 if (mask & HeightValue)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
442 *height = tempHeight;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
443 return (mask);
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
444 }
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
445
16588
481b7874a1e9 Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents: 15153
diff changeset
446 /* x_sync is a no-op on W32. */
13434
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
447 void
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
448 x_sync (f)
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
449 void *f;
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
450 {
53ba95a88cf2 Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
451 }
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
452
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
453 /* arch-tag: 4fab3695-4ad3-4cc6-a2b1-fd2c67dc46be
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 49600
diff changeset
454 (do not change this comment) */