Mercurial > emacs
annotate src/w32term.c @ 16884:36babc489b0c
Change all uses of win95, winnt, and win32
into Windows 95, Windows NT, and W32, respectively.
Expand "win" substring in variables referring to Microsoft Windows
constructs into "windows".
Canonicalize header comments to use same terminology.
author | Geoff Voelker <voelker@cs.washington.edu> |
---|---|
date | Mon, 20 Jan 1997 00:38:22 +0000 |
parents | 481b7874a1e9 |
children | be4c110cda51 |
rev | line source |
---|---|
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16588
diff
changeset
|
1 /* Implementation of GUI terminal on the Microsoft W32 API. |
13434 | 2 Copyright (C) 1989, 1993, 1994, 1995 Free Software Foundation, Inc. |
3 | |
4 This file is part of GNU Emacs. | |
5 | |
6 GNU Emacs is free software; you can redistribute it and/or modify | |
7 it under the terms of the GNU General Public License as published by | |
8 the Free Software Foundation; either version 2, or (at your option) | |
9 any later version. | |
10 | |
11 GNU Emacs is distributed in the hope that it will be useful, | |
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 GNU General Public License for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
15742 | 17 along with GNU Emacs; see the file COPYING. If not, write to the |
18 Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
19 Boston, MA 02111-1307, USA. */ | |
13434 | 20 |
21 /* Added by Kevin Gallo */ | |
22 | |
23 #include <signal.h> | |
24 #include <config.h> | |
25 #include <stdio.h> | |
26 #include "lisp.h" | |
27 #include "blockinput.h" | |
28 | |
29 #include <w32term.h> | |
30 | |
31 #include "systty.h" | |
32 #include "systime.h" | |
33 | |
34 #include <ctype.h> | |
35 #include <errno.h> | |
36 #include <setjmp.h> | |
37 #include <sys/stat.h> | |
38 | |
39 #include "frame.h" | |
40 #include "dispextern.h" | |
41 #include "termhooks.h" | |
42 #include "termopts.h" | |
43 #include "termchar.h" | |
44 #include "gnu.h" | |
45 #include "disptab.h" | |
46 #include "buffer.h" | |
47 #include "window.h" | |
48 #include "keyboard.h" | |
49 #include "intervals.h" | |
50 | |
51 extern void free_frame_menubar (); | |
52 | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
53 extern Lisp_Object Vwindow_system; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
54 |
13434 | 55 #define x_any_window_to_frame x_window_to_frame |
56 #define x_top_window_to_frame x_window_to_frame | |
57 | |
58 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
59 /* This is display since w32 does not support multiple ones. */ |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
60 struct w32_display_info one_w32_display_info; |
13434 | 61 |
62 /* This is a list of cons cells, each of the form (NAME . FONT-LIST-CACHE), | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
63 one for each element of w32_display_list and in the same order. |
13434 | 64 NAME is the name of the frame. |
65 FONT-LIST-CACHE records previous values returned by x-list-fonts. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
66 Lisp_Object w32_display_name_list; |
13434 | 67 |
68 /* Frame being updated by update_frame. This is declared in term.c. | |
69 This is set by update_begin and looked at by all the | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
70 w32 functions. It is zero while not inside an update. |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
71 In that case, the w32 functions assume that `selected_frame' |
13434 | 72 is the frame to apply to. */ |
73 extern struct frame *updating_frame; | |
74 | |
75 /* This is a frame waiting to be autoraised, within w32_read_socket. */ | |
76 struct frame *pending_autoraise_frame; | |
77 | |
78 /* During an update, maximum vpos for ins/del line operations to affect. */ | |
79 | |
80 static int flexlines; | |
81 | |
82 /* During an update, nonzero if chars output now should be highlighted. */ | |
83 | |
84 static int highlight; | |
85 | |
86 /* Nominal cursor position -- where to draw output. | |
87 During an update, these are different from the cursor-box position. */ | |
88 | |
89 static int curs_x; | |
90 static int curs_y; | |
91 | |
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16588
diff
changeset
|
92 DWORD dwWindowsThreadId = 0; |
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16588
diff
changeset
|
93 HANDLE hWindowsThread = NULL; |
13434 | 94 DWORD dwMainThreadId = 0; |
95 HANDLE hMainThread = NULL; | |
96 | |
97 /* Mouse movement. */ | |
98 | |
99 /* Where the mouse was last time we reported a mouse event. */ | |
100 static FRAME_PTR last_mouse_frame; | |
101 static RECT last_mouse_glyph; | |
102 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
103 Lisp_Object Vw32_num_mouse_buttons; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
104 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
105 Lisp_Object Vw32_swap_mouse_buttons; |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
106 |
13434 | 107 /* The scroll bar in which the last motion event occurred. |
108 | |
109 If the last motion event occurred in a scroll bar, we set this | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
110 so w32_mouse_position can know whether to report a scroll bar motion or |
13434 | 111 an ordinary motion. |
112 | |
113 If the last motion event didn't occur in a scroll bar, we set this | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
114 to Qnil, to tell w32_mouse_position to return an ordinary motion event. */ |
13434 | 115 Lisp_Object last_mouse_scroll_bar; |
116 int last_mouse_scroll_bar_pos; | |
117 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
118 /* This is a hack. We would really prefer that w32_mouse_position would |
13434 | 119 return the time associated with the position it returns, but there |
120 doesn't seem to be any way to wrest the timestamp from the server | |
121 along with the position query. So, we just keep track of the time | |
122 of the last movement we received, and return that in hopes that | |
123 it's somewhat accurate. */ | |
124 Time last_mouse_movement_time; | |
125 | |
126 /* Incremented by w32_read_socket whenever it really tries to read events. */ | |
127 #ifdef __STDC__ | |
128 static int volatile input_signal_count; | |
129 #else | |
130 static int input_signal_count; | |
131 #endif | |
132 | |
133 extern Lisp_Object Vcommand_line_args, Vsystem_name; | |
134 | |
135 extern Lisp_Object Qface, Qmouse_face; | |
136 | |
137 extern int errno; | |
138 | |
139 /* A mask of extra modifier bits to put into every keyboard char. */ | |
140 extern int extra_keyboard_modifiers; | |
141 | |
142 static Lisp_Object Qvendor_specific_keysyms; | |
143 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
144 void w32_delete_display (); |
13434 | 145 |
146 static void redraw_previous_char (); | |
147 static void redraw_following_char (); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
148 static unsigned int w32_get_modifiers (); |
13434 | 149 |
150 static int fast_find_position (); | |
151 static void note_mouse_highlight (); | |
152 static void clear_mouse_face (); | |
153 static void show_mouse_face (); | |
154 static void do_line_dance (); | |
155 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
156 static int w32_cursor_to (); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
157 static int w32_clear_end_of_line (); |
13434 | 158 |
159 #if 0 | |
160 /* This is a function useful for recording debugging information | |
161 about the sequence of occurrences in this file. */ | |
162 | |
163 struct record | |
164 { | |
165 char *locus; | |
166 int type; | |
167 }; | |
168 | |
169 struct record event_record[100]; | |
170 | |
171 int event_record_index; | |
172 | |
173 record_event (locus, type) | |
174 char *locus; | |
175 int type; | |
176 { | |
177 if (event_record_index == sizeof (event_record) / sizeof (struct record)) | |
178 event_record_index = 0; | |
179 | |
180 event_record[event_record_index].locus = locus; | |
181 event_record[event_record_index].type = type; | |
182 event_record_index++; | |
183 } | |
184 | |
185 #endif /* 0 */ | |
186 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
187 /* Return the struct w32_display_info. */ |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
188 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
189 struct w32_display_info * |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
190 w32_display_info_for_display () |
13434 | 191 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
192 return (&one_w32_display_info); |
13434 | 193 } |
194 | |
195 void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
196 w32_fill_rect (f, _hdc, pix, lprect) |
13434 | 197 FRAME_PTR f; |
198 HDC _hdc; | |
199 COLORREF pix; | |
200 RECT * lprect; | |
201 { | |
202 HDC hdc; | |
203 HBRUSH hb; | |
204 RECT rect; | |
205 | |
206 if (_hdc) | |
207 hdc = _hdc; | |
208 else | |
209 { | |
210 if (!f) return; | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
211 hdc = get_frame_dc (f); |
13434 | 212 } |
213 | |
214 hb = CreateSolidBrush (pix); | |
215 FillRect (hdc, lprect, hb); | |
216 DeleteObject (hb); | |
217 | |
218 if (!_hdc) | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
219 release_frame_dc (f, hdc); |
13434 | 220 } |
221 | |
222 void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
223 w32_clear_window (f) |
13434 | 224 FRAME_PTR f; |
225 { | |
226 RECT rect; | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
227 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
228 GetClientRect (FRAME_W32_WINDOW (f), &rect); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
229 w32_clear_rect (f, NULL, &rect); |
13434 | 230 } |
231 | |
232 | |
233 /* Starting and ending updates. | |
234 | |
235 These hooks are called by update_frame at the beginning and end | |
236 of a frame update. We record in `updating_frame' the identity | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
237 of the frame being updated, so that the w32_... functions do not |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
238 need to take a frame as argument. Most of the w32_... functions |
13434 | 239 should never be called except during an update, the only exceptions |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
240 being w32_cursor_to, w32_write_glyphs and w32_reassert_line_highlight. */ |
13434 | 241 |
242 static | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
243 w32_update_begin (f) |
13434 | 244 struct frame *f; |
245 { | |
246 if (f == 0) | |
247 abort (); | |
248 | |
249 flexlines = f->height; | |
250 highlight = 0; | |
251 | |
252 BLOCK_INPUT; | |
253 | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
254 /* Regenerate display palette before drawing if list of requested |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
255 colors has changed. */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
256 if (FRAME_W32_DISPLAY_INFO (f)->regen_palette) |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
257 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
258 w32_regenerate_palette (f); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
259 FRAME_W32_DISPLAY_INFO (f)->regen_palette = FALSE; |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
260 } |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
261 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
262 if (f == FRAME_W32_DISPLAY_INFO (f)->mouse_face_mouse_frame) |
13434 | 263 { |
264 /* Don't do highlighting for mouse motion during the update. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
265 FRAME_W32_DISPLAY_INFO (f)->mouse_face_defer = 1; |
13434 | 266 |
267 /* If the frame needs to be redrawn, | |
268 simply forget about any prior mouse highlighting. */ | |
269 if (FRAME_GARBAGED_P (f)) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
270 FRAME_W32_DISPLAY_INFO (f)->mouse_face_window = Qnil; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
271 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
272 if (!NILP (FRAME_W32_DISPLAY_INFO (f)->mouse_face_window)) |
13434 | 273 { |
274 int firstline, lastline, i; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
275 struct window *w = XWINDOW (FRAME_W32_DISPLAY_INFO (f)->mouse_face_window); |
13434 | 276 |
277 /* Find the first, and the last+1, lines affected by redisplay. */ | |
278 for (firstline = 0; firstline < f->height; firstline++) | |
279 if (FRAME_DESIRED_GLYPHS (f)->enable[firstline]) | |
280 break; | |
281 | |
282 lastline = f->height; | |
283 for (i = f->height - 1; i >= 0; i--) | |
284 { | |
285 if (FRAME_DESIRED_GLYPHS (f)->enable[i]) | |
286 break; | |
287 else | |
288 lastline = i; | |
289 } | |
290 | |
291 /* Can we tell that this update does not affect the window | |
292 where the mouse highlight is? If so, no need to turn off. | |
293 Likewise, don't do anything if the frame is garbaged; | |
294 in that case, the FRAME_CURRENT_GLYPHS that we would use | |
295 are all wrong, and we will redisplay that line anyway. */ | |
296 if (! (firstline > (XFASTINT (w->top) + window_internal_height (w)) | |
297 || lastline < XFASTINT (w->top))) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
298 clear_mouse_face (FRAME_W32_DISPLAY_INFO (f)); |
13434 | 299 } |
300 } | |
301 | |
302 UNBLOCK_INPUT; | |
303 } | |
304 | |
305 static | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
306 w32_update_end (f) |
13434 | 307 struct frame *f; |
308 { | |
309 BLOCK_INPUT; | |
310 | |
311 do_line_dance (); | |
312 x_display_cursor (f, 1); | |
313 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
314 if (f == FRAME_W32_DISPLAY_INFO (f)->mouse_face_mouse_frame) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
315 FRAME_W32_DISPLAY_INFO (f)->mouse_face_defer = 0; |
13434 | 316 |
317 UNBLOCK_INPUT; | |
318 } | |
319 | |
320 /* This is called after a redisplay on frame F. */ | |
321 | |
322 static | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
323 w32_frame_up_to_date (f) |
13434 | 324 FRAME_PTR f; |
325 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
326 if (FRAME_W32_DISPLAY_INFO (f)->mouse_face_deferred_gc |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
327 || f == FRAME_W32_DISPLAY_INFO (f)->mouse_face_mouse_frame) |
13434 | 328 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
329 note_mouse_highlight (FRAME_W32_DISPLAY_INFO (f)->mouse_face_mouse_frame, |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
330 FRAME_W32_DISPLAY_INFO (f)->mouse_face_mouse_x, |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
331 FRAME_W32_DISPLAY_INFO (f)->mouse_face_mouse_y); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
332 FRAME_W32_DISPLAY_INFO (f)->mouse_face_deferred_gc = 0; |
13434 | 333 } |
334 } | |
335 | |
336 /* External interface to control of standout mode. | |
337 Call this when about to modify line at position VPOS | |
338 and not change whether it is highlighted. */ | |
339 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
340 w32_reassert_line_highlight (new, vpos) |
13434 | 341 int new, vpos; |
342 { | |
343 highlight = new; | |
344 } | |
345 | |
346 /* Call this when about to modify line at position VPOS | |
347 and change whether it is highlighted. */ | |
348 | |
349 static | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
350 w32_change_line_highlight (new_highlight, vpos, first_unused_hpos) |
13434 | 351 int new_highlight, vpos, first_unused_hpos; |
352 { | |
353 highlight = new_highlight; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
354 w32_cursor_to (vpos, 0); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
355 w32_clear_end_of_line (updating_frame->width); |
13434 | 356 } |
357 | |
358 /* This is used when starting Emacs and when restarting after suspend. | |
359 When starting Emacs, no window is mapped. And nothing must be done | |
360 to Emacs's own window if it is suspended (though that rarely happens). */ | |
361 | |
362 static | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
363 w32_set_terminal_modes () |
13434 | 364 { |
365 } | |
366 | |
367 /* This is called when exiting or suspending Emacs. | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
368 Exiting will make the W32 windows go away, and suspending |
13434 | 369 requires no action. */ |
370 | |
371 static | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
372 w32_reset_terminal_modes () |
13434 | 373 { |
374 } | |
375 | |
376 /* Set the nominal cursor position of the frame. | |
377 This is where display update commands will take effect. | |
378 This does not affect the place where the cursor-box is displayed. */ | |
379 | |
380 static int | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
381 w32_cursor_to (row, col) |
13434 | 382 register int row, col; |
383 { | |
384 int orow = row; | |
385 | |
386 curs_x = col; | |
387 curs_y = row; | |
388 | |
389 if (updating_frame == 0) | |
390 { | |
391 BLOCK_INPUT; | |
392 x_display_cursor (selected_frame, 1); | |
393 UNBLOCK_INPUT; | |
394 } | |
395 } | |
396 | |
397 /* Display a sequence of N glyphs found at GP. | |
398 WINDOW is the window to output to. LEFT and TOP are starting coords. | |
399 HL is 1 if this text is highlighted, 2 if the cursor is on it, | |
400 3 if should appear in its mouse-face. | |
401 JUST_FOREGROUND if 1 means draw only the foreground; | |
402 don't alter the background. | |
403 | |
404 FONT is the default font to use (for glyphs whose font-code is 0). | |
405 | |
406 Since the display generation code is responsible for calling | |
407 compute_char_face and compute_glyph_face on everything it puts in | |
408 the display structure, we can assume that the face code on each | |
409 glyph is a valid index into FRAME_COMPUTED_FACES (f), and the one | |
410 to which we can actually apply intern_face. | |
411 Call this function with input blocked. */ | |
412 | |
413 static void | |
414 dumpglyphs (f, left, top, gp, n, hl, just_foreground) | |
415 struct frame *f; | |
416 int left, top; | |
417 register GLYPH *gp; /* Points to first GLYPH. */ | |
418 register int n; /* Number of glyphs to display. */ | |
419 int hl; | |
420 int just_foreground; | |
421 { | |
422 /* Holds characters to be displayed. */ | |
423 char *buf = (char *) alloca (f->width * sizeof (*buf)); | |
424 register char *cp; /* Steps through buf[]. */ | |
425 register int tlen = GLYPH_TABLE_LENGTH; | |
426 register Lisp_Object *tbase = GLYPH_TABLE_BASE; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
427 Window window = FRAME_W32_WINDOW (f); |
13434 | 428 int orig_left = left; |
429 HDC hdc; | |
430 | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
431 hdc = get_frame_dc (f); |
13434 | 432 |
433 while (n > 0) | |
434 { | |
435 /* Get the face-code of the next GLYPH. */ | |
436 int cf, len; | |
437 int g = *gp; | |
438 | |
439 GLYPH_FOLLOW_ALIASES (tbase, tlen, g); | |
440 cf = FAST_GLYPH_FACE (g); | |
441 | |
442 /* Find the run of consecutive glyphs with the same face-code. | |
443 Extract their character codes into BUF. */ | |
444 cp = buf; | |
445 while (n > 0) | |
446 { | |
447 g = *gp; | |
448 GLYPH_FOLLOW_ALIASES (tbase, tlen, g); | |
449 if (FAST_GLYPH_FACE (g) != cf) | |
450 break; | |
451 | |
452 *cp++ = FAST_GLYPH_CHAR (g); | |
453 --n; | |
454 ++gp; | |
455 } | |
456 | |
457 /* LEN gets the length of the run. */ | |
458 len = cp - buf; | |
459 | |
460 /* Now output this run of chars, with the font and pixel values | |
461 determined by the face code CF. */ | |
462 { | |
463 struct face *face = FRAME_DEFAULT_FACE (f); | |
464 XFontStruct *font = FACE_FONT (face); | |
465 int stippled = 0; | |
466 COLORREF fg; | |
467 COLORREF bg; | |
468 | |
469 /* HL = 3 means use a mouse face previously chosen. */ | |
470 if (hl == 3) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
471 cf = FRAME_W32_DISPLAY_INFO (f)->mouse_face_face_id; |
13434 | 472 |
473 /* First look at the face of the text itself. */ | |
474 if (cf != 0) | |
475 { | |
476 /* It's possible for the display table to specify | |
477 a face code that is out of range. Use 0 in that case. */ | |
478 if (cf < 0 || cf >= FRAME_N_COMPUTED_FACES (f) | |
479 || FRAME_COMPUTED_FACES (f) [cf] == 0) | |
480 cf = 0; | |
481 | |
482 if (cf == 1) | |
483 face = FRAME_MODE_LINE_FACE (f); | |
484 else | |
485 face = intern_face (f, FRAME_COMPUTED_FACES (f) [cf]); | |
486 font = FACE_FONT (face); | |
487 if (FACE_STIPPLE (face)) | |
488 stippled = 1; | |
489 } | |
490 | |
491 /* Then comes the distinction between modeline and normal text. */ | |
492 else if (hl == 0) | |
493 ; | |
494 else if (hl == 1) | |
495 { | |
496 face = FRAME_MODE_LINE_FACE (f); | |
497 font = FACE_FONT (face); | |
498 if (FACE_STIPPLE (face)) | |
499 stippled = 1; | |
500 } | |
501 | |
502 fg = face->foreground; | |
503 bg = face->background; | |
504 | |
505 /* Now override that if the cursor's on this character. */ | |
506 if (hl == 2) | |
507 { | |
508 /* The cursor overrides stippling. */ | |
509 stippled = 0; | |
510 | |
511 if ((!face->font | |
512 || face->font == (XFontStruct *) FACE_DEFAULT | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
513 || face->font == f->output_data.w32->font) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
514 && face->background == f->output_data.w32->background_pixel |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
515 && face->foreground == f->output_data.w32->foreground_pixel) |
13434 | 516 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
517 bg = f->output_data.w32->cursor_pixel; |
13434 | 518 fg = face->background; |
519 } | |
520 /* Cursor on non-default face: must merge. */ | |
521 else | |
522 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
523 bg = f->output_data.w32->cursor_pixel; |
13434 | 524 fg = face->background; |
525 /* If the glyph would be invisible, | |
526 try a different foreground. */ | |
527 if (fg == bg) | |
528 fg = face->foreground; | |
529 if (fg == bg) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
530 fg = f->output_data.w32->cursor_foreground_pixel; |
13434 | 531 if (fg == bg) |
532 fg = face->foreground; | |
533 /* Make sure the cursor is distinct from text in this face. */ | |
534 if (bg == face->background | |
535 && fg == face->foreground) | |
536 { | |
537 bg = face->foreground; | |
538 fg = face->background; | |
539 } | |
540 } | |
541 } | |
542 | |
543 if (font == (XFontStruct *) FACE_DEFAULT) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
544 font = f->output_data.w32->font; |
13434 | 545 |
546 SetBkMode (hdc, just_foreground ? TRANSPARENT : OPAQUE); | |
547 | |
548 SetTextColor (hdc, fg); | |
549 SetBkColor (hdc, bg); | |
550 | |
551 SelectObject (hdc, font->hfont); | |
552 | |
553 TextOut (hdc, left, top, buf, len); | |
554 | |
555 if (!just_foreground) | |
556 { | |
557 /* Clear the rest of the line's height. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
558 if (f->output_data.w32->line_height != FONT_HEIGHT (font)) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
559 w32_fill_area (f, hdc, bg, |
13434 | 560 left, |
561 top + FONT_HEIGHT (font), | |
562 FONT_WIDTH (font) * len, | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
563 f->output_data.w32->line_height - FONT_HEIGHT (font)); |
13434 | 564 } |
565 | |
566 { | |
567 int underline_position = 1; | |
568 | |
569 if (font->tm.tmDescent <= underline_position) | |
570 underline_position = font->tm.tmDescent - 1; | |
571 | |
572 if (face->underline) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
573 w32_fill_area (f, hdc, fg, |
13434 | 574 left, (top |
575 + FONT_BASE (font) | |
576 + underline_position), | |
577 len * FONT_WIDTH (font), 1); | |
578 } | |
579 | |
580 left += len * FONT_WIDTH (font); | |
581 } | |
582 } | |
583 | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
584 release_frame_dc (f, hdc); |
13434 | 585 } |
586 | |
587 | |
588 /* Output some text at the nominal frame cursor position. | |
589 Advance the cursor over the text. | |
590 Output LEN glyphs at START. | |
591 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
592 `highlight', set up by w32_reassert_line_highlight or w32_change_line_highlight, |
13434 | 593 controls the pixel values used for foreground and background. */ |
594 | |
595 static | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
596 w32_write_glyphs (start, len) |
13434 | 597 register GLYPH *start; |
598 int len; | |
599 { | |
600 register int temp_length; | |
601 struct frame *f; | |
602 | |
603 BLOCK_INPUT; | |
604 | |
605 do_line_dance (); | |
606 f = updating_frame; | |
607 if (f == 0) | |
608 { | |
609 f = selected_frame; | |
610 /* If not within an update, | |
611 output at the frame's visible cursor. */ | |
612 curs_x = f->cursor_x; | |
613 curs_y = f->cursor_y; | |
614 } | |
615 | |
616 dumpglyphs (f, | |
617 CHAR_TO_PIXEL_COL (f, curs_x), | |
618 CHAR_TO_PIXEL_ROW (f, curs_y), | |
619 start, len, highlight, 0); | |
620 | |
621 /* If we drew on top of the cursor, note that it is turned off. */ | |
622 if (curs_y == f->phys_cursor_y | |
623 && curs_x <= f->phys_cursor_x | |
624 && curs_x + len > f->phys_cursor_x) | |
625 f->phys_cursor_x = -1; | |
626 | |
627 if (updating_frame == 0) | |
628 { | |
629 f->cursor_x += len; | |
630 x_display_cursor (f, 1); | |
631 f->cursor_x -= len; | |
632 } | |
633 else | |
634 curs_x += len; | |
635 | |
636 UNBLOCK_INPUT; | |
637 } | |
638 | |
639 /* Clear to the end of the line. | |
640 Erase the current text line from the nominal cursor position (inclusive) | |
641 to column FIRST_UNUSED (exclusive). The idea is that everything | |
642 from FIRST_UNUSED onward is already erased. */ | |
643 | |
644 static | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
645 w32_clear_end_of_line (first_unused) |
13434 | 646 register int first_unused; |
647 { | |
648 struct frame *f = updating_frame; | |
649 | |
650 if (f == 0) | |
651 abort (); | |
652 | |
653 if (curs_y < 0 || curs_y >= f->height) | |
654 return 1; | |
655 if (first_unused <= 0) | |
656 return 1; | |
657 | |
658 if (first_unused >= f->width) | |
659 first_unused = f->width; | |
660 | |
661 BLOCK_INPUT; | |
662 | |
663 do_line_dance (); | |
664 | |
665 /* Notice if the cursor will be cleared by this operation. */ | |
666 if (curs_y == f->phys_cursor_y | |
667 && curs_x <= f->phys_cursor_x | |
668 && f->phys_cursor_x < first_unused) | |
669 f->phys_cursor_x = -1; | |
670 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
671 w32_clear_area (f, NULL, |
13434 | 672 CHAR_TO_PIXEL_COL (f, curs_x), |
673 CHAR_TO_PIXEL_ROW (f, curs_y), | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
674 FONT_WIDTH (f->output_data.w32->font) * (first_unused - curs_x), |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
675 f->output_data.w32->line_height); |
13434 | 676 |
677 UNBLOCK_INPUT; | |
678 } | |
679 | |
680 static | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
681 w32_clear_frame () |
13434 | 682 { |
683 struct frame *f = updating_frame; | |
684 | |
685 if (f == 0) | |
686 f = selected_frame; | |
687 | |
688 f->phys_cursor_x = -1; /* Cursor not visible. */ | |
689 curs_x = 0; /* Nominal cursor position is top left. */ | |
690 curs_y = 0; | |
691 | |
692 BLOCK_INPUT; | |
693 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
694 w32_clear_window (f); |
13434 | 695 |
696 /* We have to clear the scroll bars, too. If we have changed | |
697 colors or something like that, then they should be notified. */ | |
698 x_scroll_bar_clear (f); | |
699 | |
700 UNBLOCK_INPUT; | |
701 } | |
702 | |
703 /* Make audible bell. */ | |
704 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
705 w32_ring_bell () |
13434 | 706 { |
707 BLOCK_INPUT; | |
708 | |
709 if (visible_bell) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
710 FlashWindow (FRAME_W32_WINDOW (selected_frame), FALSE); |
13434 | 711 else |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
712 w32_sys_ring_bell (); |
13434 | 713 |
714 UNBLOCK_INPUT; | |
715 | |
716 return 1; | |
717 } | |
718 | |
719 /* Insert and delete character. | |
720 These are not supposed to be used because we are supposed to turn | |
721 off the feature of using them. */ | |
722 | |
723 static | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
724 w32_insert_glyphs (start, len) |
13434 | 725 register char *start; |
726 register int len; | |
727 { | |
728 abort (); | |
729 } | |
730 | |
731 static | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
732 w32_delete_glyphs (n) |
13434 | 733 register int n; |
734 { | |
735 abort (); | |
736 } | |
737 | |
738 /* Specify how many text lines, from the top of the window, | |
739 should be affected by insert-lines and delete-lines operations. | |
740 This, and those operations, are used only within an update | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
741 that is bounded by calls to w32_update_begin and w32_update_end. */ |
13434 | 742 |
743 static | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
744 w32_set_terminal_window (n) |
13434 | 745 register int n; |
746 { | |
747 if (updating_frame == 0) | |
748 abort (); | |
749 | |
750 if ((n <= 0) || (n > updating_frame->height)) | |
751 flexlines = updating_frame->height; | |
752 else | |
753 flexlines = n; | |
754 } | |
755 | |
756 /* These variables need not be per frame | |
757 because redisplay is done on a frame-by-frame basis | |
758 and the line dance for one frame is finished before | |
759 anything is done for another frame. */ | |
760 | |
761 /* Array of line numbers from cached insert/delete operations. | |
762 line_dance[i] is the old position of the line that we want | |
763 to move to line i, or -1 if we want a blank line there. */ | |
764 static int *line_dance; | |
765 | |
766 /* Allocated length of that array. */ | |
767 static int line_dance_len; | |
768 | |
769 /* Flag indicating whether we've done any work. */ | |
770 static int line_dance_in_progress; | |
771 | |
772 /* Perform an insert-lines or delete-lines operation, | |
773 inserting N lines or deleting -N lines at vertical position VPOS. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
774 w32_ins_del_lines (vpos, n) |
13434 | 775 int vpos, n; |
776 { | |
777 register int fence, i; | |
778 | |
779 if (vpos >= flexlines) | |
780 return 1; | |
781 | |
782 if (!line_dance_in_progress) | |
783 { | |
784 int ht = updating_frame->height; | |
785 if (ht > line_dance_len) | |
786 { | |
787 line_dance = (int *)xrealloc (line_dance, ht * sizeof (int)); | |
788 line_dance_len = ht; | |
789 } | |
790 for (i = 0; i < ht; ++i) line_dance[i] = i; | |
791 line_dance_in_progress = 1; | |
792 } | |
793 if (n >= 0) | |
794 { | |
795 if (n > flexlines - vpos) | |
796 n = flexlines - vpos; | |
797 fence = vpos + n; | |
798 for (i = flexlines; --i >= fence;) | |
799 line_dance[i] = line_dance[i-n]; | |
800 for (i = fence; --i >= vpos;) | |
801 line_dance[i] = -1; | |
802 } | |
803 else | |
804 { | |
805 n = -n; | |
806 if (n > flexlines - vpos) | |
807 n = flexlines - vpos; | |
808 fence = flexlines - n; | |
809 for (i = vpos; i < fence; ++i) | |
810 line_dance[i] = line_dance[i + n]; | |
811 for (i = fence; i < flexlines; ++i) | |
812 line_dance[i] = -1; | |
813 } | |
814 } | |
815 | |
816 /* Here's where we actually move the pixels around. | |
817 Must be called with input blocked. */ | |
818 static void | |
819 do_line_dance () | |
820 { | |
821 register int i, j, distance; | |
822 register struct frame *f; | |
823 int ht; | |
824 int intborder; | |
825 HDC hdc; | |
826 | |
827 /* Must check this flag first. If it's not set, then not only is the | |
828 array uninitialized, but we might not even have a frame. */ | |
829 if (!line_dance_in_progress) | |
830 return; | |
831 | |
832 f = updating_frame; | |
833 if (f == 0) | |
834 abort (); | |
835 | |
836 ht = f->height; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
837 intborder = f->output_data.w32->internal_border_width; |
13434 | 838 |
839 x_display_cursor (updating_frame, 0); | |
840 | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
841 hdc = get_frame_dc (f); |
13434 | 842 |
843 for (i = 0; i < ht; ++i) | |
844 if (line_dance[i] != -1 && (distance = line_dance[i]-i) > 0) | |
845 { | |
846 for (j = i; (j < ht && line_dance[j] != -1 | |
847 && line_dance[j]-j == distance); ++j); | |
848 /* Copy [i,j) upward from [i+distance, j+distance) */ | |
849 BitBlt (hdc, | |
850 intborder, CHAR_TO_PIXEL_ROW (f, i+distance), | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
851 f->width * FONT_WIDTH (f->output_data.w32->font), |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
852 (j-i) * f->output_data.w32->line_height, |
13434 | 853 hdc, |
854 intborder, CHAR_TO_PIXEL_ROW (f, i), | |
855 SRCCOPY); | |
856 i = j-1; | |
857 } | |
858 | |
859 for (i = ht; --i >=0; ) | |
860 if (line_dance[i] != -1 && (distance = line_dance[i]-i) < 0) | |
861 { | |
862 for (j = i; (--j >= 0 && line_dance[j] != -1 | |
863 && line_dance[j]-j == distance);); | |
864 /* Copy (j, i] downward from (j+distance, i+distance] */ | |
865 BitBlt (hdc, | |
866 intborder, CHAR_TO_PIXEL_ROW (f, j+1+distance), | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
867 f->width * FONT_WIDTH (f->output_data.w32->font), |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
868 (i-j) * f->output_data.w32->line_height, |
13434 | 869 hdc, |
870 intborder, CHAR_TO_PIXEL_ROW (f, j+1), | |
871 SRCCOPY); | |
872 i = j+1; | |
873 } | |
874 | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
875 release_frame_dc (f, hdc); |
13434 | 876 |
877 for (i = 0; i < ht; ++i) | |
878 if (line_dance[i] == -1) | |
879 { | |
880 for (j = i; j < ht && line_dance[j] == -1; ++j); | |
881 /* Clear [i,j) */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
882 w32_clear_area (f, NULL, |
13434 | 883 intborder, |
884 CHAR_TO_PIXEL_ROW (f, i), | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
885 f->width * FONT_WIDTH (f->output_data.w32->font), |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
886 (j-i) * f->output_data.w32->line_height); |
13434 | 887 i = j-1; |
888 } | |
889 line_dance_in_progress = 0; | |
890 } | |
891 | |
892 /* Support routines for exposure events. */ | |
893 static void clear_cursor (); | |
894 | |
895 /* Output into a rectangle of a window (for frame F) | |
896 the characters in f->phys_lines that overlap that rectangle. | |
897 TOP and LEFT are the position of the upper left corner of the rectangle. | |
898 ROWS and COLS are the size of the rectangle. | |
899 Call this function with input blocked. */ | |
900 | |
901 void | |
902 dumprectangle (f, left, top, cols, rows) | |
903 struct frame *f; | |
904 register int left, top, cols, rows; | |
905 { | |
906 register struct frame_glyphs *active_frame = FRAME_CURRENT_GLYPHS (f); | |
907 int cursor_cleared = 0; | |
908 int bottom, right; | |
909 register int y; | |
910 | |
911 if (FRAME_GARBAGED_P (f)) | |
912 return; | |
913 | |
914 /* Express rectangle as four edges, instead of position-and-size. */ | |
915 bottom = top + rows; | |
916 right = left + cols; | |
917 | |
918 /* Convert rectangle edges in pixels to edges in chars. | |
919 Round down for left and top, up for right and bottom. */ | |
920 top = PIXEL_TO_CHAR_ROW (f, top); | |
921 left = PIXEL_TO_CHAR_COL (f, left); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
922 bottom += (f->output_data.w32->line_height - 1); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
923 right += (FONT_WIDTH (f->output_data.w32->font) - 1); |
13434 | 924 bottom = PIXEL_TO_CHAR_ROW (f, bottom); |
925 right = PIXEL_TO_CHAR_COL (f, right); | |
926 | |
927 /* Clip the rectangle to what can be visible. */ | |
928 if (left < 0) | |
929 left = 0; | |
930 if (top < 0) | |
931 top = 0; | |
932 if (right > f->width) | |
933 right = f->width; | |
934 if (bottom > f->height) | |
935 bottom = f->height; | |
936 | |
937 /* Get size in chars of the rectangle. */ | |
938 cols = right - left; | |
939 rows = bottom - top; | |
940 | |
941 /* If rectangle has zero area, return. */ | |
942 if (rows <= 0) return; | |
943 if (cols <= 0) return; | |
944 | |
945 /* Turn off the cursor if it is in the rectangle. | |
946 We will turn it back on afterward. */ | |
947 if ((f->phys_cursor_x >= left) && (f->phys_cursor_x < right) | |
948 && (f->phys_cursor_y >= top) && (f->phys_cursor_y < bottom)) | |
949 { | |
950 clear_cursor (f); | |
951 cursor_cleared = 1; | |
952 } | |
953 | |
954 /* Display the text in the rectangle, one text line at a time. */ | |
955 | |
956 for (y = top; y < bottom; y++) | |
957 { | |
958 GLYPH *line = &active_frame->glyphs[y][left]; | |
959 | |
960 if (! active_frame->enable[y] || left > active_frame->used[y]) | |
961 continue; | |
962 | |
963 dumpglyphs (f, | |
964 CHAR_TO_PIXEL_COL (f, left), | |
965 CHAR_TO_PIXEL_ROW (f, y), | |
966 line, min (cols, active_frame->used[y] - left), | |
967 active_frame->highlight[y], 0); | |
968 } | |
969 | |
970 /* Turn the cursor on if we turned it off. */ | |
971 | |
972 if (cursor_cleared) | |
973 x_display_cursor (f, 1); | |
974 } | |
975 | |
976 static void | |
977 frame_highlight (f) | |
978 struct frame *f; | |
979 { | |
980 x_display_cursor (f, 1); | |
981 } | |
982 | |
983 static void | |
984 frame_unhighlight (f) | |
985 struct frame *f; | |
986 { | |
987 x_display_cursor (f, 1); | |
988 } | |
989 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
990 static void w32_frame_rehighlight (); |
13434 | 991 static void x_frame_rehighlight (); |
992 | |
993 /* The focus has changed. Update the frames as necessary to reflect | |
994 the new situation. Note that we can't change the selected frame | |
995 here, because the Lisp code we are interrupting might become confused. | |
996 Each event gets marked with the frame in which it occurred, so the | |
997 Lisp code can tell when the switch took place by examining the events. */ | |
998 | |
999 void | |
1000 x_new_focus_frame (dpyinfo, frame) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1001 struct w32_display_info *dpyinfo; |
13434 | 1002 struct frame *frame; |
1003 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1004 struct frame *old_focus = dpyinfo->w32_focus_frame; |
13434 | 1005 int events_enqueued = 0; |
1006 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1007 if (frame != dpyinfo->w32_focus_frame) |
13434 | 1008 { |
1009 /* Set this before calling other routines, so that they see | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1010 the correct value of w32_focus_frame. */ |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1011 dpyinfo->w32_focus_frame = frame; |
13434 | 1012 |
1013 if (old_focus && old_focus->auto_lower) | |
1014 x_lower_frame (old_focus); | |
1015 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1016 if (dpyinfo->w32_focus_frame && dpyinfo->w32_focus_frame->auto_raise) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1017 pending_autoraise_frame = dpyinfo->w32_focus_frame; |
13434 | 1018 else |
1019 pending_autoraise_frame = 0; | |
1020 } | |
1021 | |
1022 x_frame_rehighlight (dpyinfo); | |
1023 } | |
1024 | |
1025 /* Handle an event saying the mouse has moved out of an Emacs frame. */ | |
1026 | |
1027 void | |
1028 x_mouse_leave (dpyinfo) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1029 struct w32_display_info *dpyinfo; |
13434 | 1030 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1031 x_new_focus_frame (dpyinfo, dpyinfo->w32_focus_event_frame); |
13434 | 1032 } |
1033 | |
1034 /* The focus has changed, or we have redirected a frame's focus to | |
1035 another frame (this happens when a frame uses a surrogate | |
1036 minibuffer frame). Shift the highlight as appropriate. | |
1037 | |
1038 The FRAME argument doesn't necessarily have anything to do with which | |
1039 frame is being highlighted or unhighlighted; we only use it to find | |
1040 the appropriate display info. */ | |
1041 static void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1042 w32_frame_rehighlight (frame) |
13434 | 1043 struct frame *frame; |
1044 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1045 x_frame_rehighlight (FRAME_W32_DISPLAY_INFO (frame)); |
13434 | 1046 } |
1047 | |
1048 static void | |
1049 x_frame_rehighlight (dpyinfo) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1050 struct w32_display_info *dpyinfo; |
13434 | 1051 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1052 struct frame *old_highlight = dpyinfo->w32_highlight_frame; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1053 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1054 if (dpyinfo->w32_focus_frame) |
13434 | 1055 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1056 dpyinfo->w32_highlight_frame |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1057 = ((GC_FRAMEP (FRAME_FOCUS_FRAME (dpyinfo->w32_focus_frame))) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1058 ? XFRAME (FRAME_FOCUS_FRAME (dpyinfo->w32_focus_frame)) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1059 : dpyinfo->w32_focus_frame); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1060 if (! FRAME_LIVE_P (dpyinfo->w32_highlight_frame)) |
13434 | 1061 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1062 FRAME_FOCUS_FRAME (dpyinfo->w32_focus_frame) = Qnil; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1063 dpyinfo->w32_highlight_frame = dpyinfo->w32_focus_frame; |
13434 | 1064 } |
1065 } | |
1066 else | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1067 dpyinfo->w32_highlight_frame = 0; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1068 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1069 if (dpyinfo->w32_highlight_frame != old_highlight) |
13434 | 1070 { |
1071 if (old_highlight) | |
1072 frame_unhighlight (old_highlight); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1073 if (dpyinfo->w32_highlight_frame) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1074 frame_highlight (dpyinfo->w32_highlight_frame); |
13434 | 1075 } |
1076 } | |
1077 | |
1078 /* Keyboard processing - modifier keys, etc. */ | |
1079 | |
1080 /* Convert a keysym to its name. */ | |
1081 | |
1082 char * | |
1083 x_get_keysym_name (keysym) | |
1084 int keysym; | |
1085 { | |
1086 /* Make static so we can always return it */ | |
1087 static char value[100]; | |
1088 | |
1089 BLOCK_INPUT; | |
1090 GetKeyNameText(keysym, value, 100); | |
1091 UNBLOCK_INPUT; | |
1092 | |
1093 return value; | |
1094 } | |
1095 | |
1096 /* Mouse clicks and mouse movement. Rah. */ | |
1097 | |
1098 /* Given a pixel position (PIX_X, PIX_Y) on the frame F, return | |
1099 glyph co-ordinates in (*X, *Y). Set *BOUNDS to the rectangle | |
1100 that the glyph at X, Y occupies, if BOUNDS != 0. | |
1101 If NOCLIP is nonzero, do not force the value into range. */ | |
1102 | |
1103 void | |
1104 pixel_to_glyph_coords (f, pix_x, pix_y, x, y, bounds, noclip) | |
1105 FRAME_PTR f; | |
1106 register int pix_x, pix_y; | |
1107 register int *x, *y; | |
1108 RECT *bounds; | |
1109 int noclip; | |
1110 { | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1111 /* Support tty mode: if Vwindow_system is nil, behave correctly. */ |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1112 if (NILP (Vwindow_system)) |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1113 { |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1114 *x = pix_x; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1115 *y = pix_y; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1116 return; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1117 } |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1118 |
13434 | 1119 /* Arrange for the division in PIXEL_TO_CHAR_COL etc. to round down |
1120 even for negative values. */ | |
1121 if (pix_x < 0) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1122 pix_x -= FONT_WIDTH ((f)->output_data.w32->font) - 1; |
13434 | 1123 if (pix_y < 0) |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1124 pix_y -= (f)->output_data.w32->line_height - 1; |
13434 | 1125 |
1126 pix_x = PIXEL_TO_CHAR_COL (f, pix_x); | |
1127 pix_y = PIXEL_TO_CHAR_ROW (f, pix_y); | |
1128 | |
1129 if (bounds) | |
1130 { | |
1131 bounds->left = CHAR_TO_PIXEL_COL (f, pix_x); | |
1132 bounds->top = CHAR_TO_PIXEL_ROW (f, pix_y); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1133 bounds->right = bounds->left + FONT_WIDTH (f->output_data.w32->font) - 1; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1134 bounds->bottom = bounds->top + f->output_data.w32->line_height - 1; |
13434 | 1135 } |
1136 | |
1137 if (!noclip) | |
1138 { | |
1139 if (pix_x < 0) | |
1140 pix_x = 0; | |
1141 else if (pix_x > f->width) | |
1142 pix_x = f->width; | |
1143 | |
1144 if (pix_y < 0) | |
1145 pix_y = 0; | |
1146 else if (pix_y > f->height) | |
1147 pix_y = f->height; | |
1148 } | |
1149 | |
1150 *x = pix_x; | |
1151 *y = pix_y; | |
1152 } | |
1153 | |
1154 void | |
1155 glyph_to_pixel_coords (f, x, y, pix_x, pix_y) | |
1156 FRAME_PTR f; | |
1157 register int x, y; | |
1158 register int *pix_x, *pix_y; | |
1159 { | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1160 /* Support tty mode: if Vwindow_system is nil, behave correctly. */ |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1161 if (NILP (Vwindow_system)) |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1162 { |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1163 *pix_x = x; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1164 *pix_y = y; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1165 return; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1166 } |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1167 |
13434 | 1168 *pix_x = CHAR_TO_PIXEL_COL (f, x); |
1169 *pix_y = CHAR_TO_PIXEL_ROW (f, y); | |
1170 } | |
1171 | |
1172 BOOL | |
1173 parse_button (message, pbutton, pup) | |
1174 int message; | |
1175 int * pbutton; | |
1176 int * pup; | |
1177 { | |
1178 int button = 0; | |
1179 int up = 0; | |
1180 | |
1181 switch (message) | |
1182 { | |
1183 case WM_LBUTTONDOWN: | |
1184 button = 0; | |
1185 up = 0; | |
1186 break; | |
1187 case WM_LBUTTONUP: | |
1188 button = 0; | |
1189 up = 1; | |
1190 break; | |
1191 case WM_MBUTTONDOWN: | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1192 if (NILP (Vw32_swap_mouse_buttons)) |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1193 button = 1; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1194 else |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1195 button = 2; |
13434 | 1196 up = 0; |
1197 break; | |
1198 case WM_MBUTTONUP: | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1199 if (NILP (Vw32_swap_mouse_buttons)) |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1200 button = 1; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1201 else |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1202 button = 2; |
13434 | 1203 up = 1; |
1204 break; | |
1205 case WM_RBUTTONDOWN: | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1206 if (NILP (Vw32_swap_mouse_buttons)) |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1207 button = 2; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1208 else |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1209 button = 1; |
13434 | 1210 up = 0; |
1211 break; | |
1212 case WM_RBUTTONUP: | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1213 if (NILP (Vw32_swap_mouse_buttons)) |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1214 button = 2; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1215 else |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1216 button = 1; |
13434 | 1217 up = 1; |
1218 break; | |
1219 default: | |
1220 return (FALSE); | |
1221 } | |
1222 | |
1223 if (pup) *pup = up; | |
1224 if (pbutton) *pbutton = button; | |
1225 | |
1226 return (TRUE); | |
1227 } | |
1228 | |
1229 | |
1230 /* Prepare a mouse-event in *RESULT for placement in the input queue. | |
1231 | |
1232 If the event is a button press, then note that we have grabbed | |
1233 the mouse. */ | |
1234 | |
1235 static void | |
1236 construct_mouse_click (result, msg, f) | |
1237 struct input_event *result; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1238 W32Msg *msg; |
13434 | 1239 struct frame *f; |
1240 { | |
1241 int button; | |
1242 int up; | |
1243 | |
1244 parse_button (msg->msg.message, &button, &up); | |
1245 | |
1246 /* Make the event type no_event; we'll change that when we decide | |
1247 otherwise. */ | |
1248 result->kind = mouse_click; | |
1249 result->code = button; | |
1250 result->timestamp = msg->msg.time; | |
1251 result->modifiers = (msg->dwModifiers | |
1252 | (up | |
1253 ? up_modifier | |
1254 : down_modifier)); | |
1255 | |
1256 { | |
1257 int row, column; | |
1258 | |
1259 XSETINT (result->x, LOWORD (msg->msg.lParam)); | |
1260 XSETINT (result->y, HIWORD (msg->msg.lParam)); | |
1261 XSETFRAME (result->frame_or_window, f); | |
1262 } | |
1263 } | |
1264 | |
1265 | |
1266 /* Function to report a mouse movement to the mainstream Emacs code. | |
1267 The input handler calls this. | |
1268 | |
1269 We have received a mouse movement event, which is given in *event. | |
1270 If the mouse is over a different glyph than it was last time, tell | |
1271 the mainstream emacs code by setting mouse_moved. If not, ask for | |
1272 another motion event, so we can check again the next time it moves. */ | |
1273 | |
1274 static void | |
1275 note_mouse_movement (frame, msg) | |
1276 FRAME_PTR frame; | |
1277 MSG *msg; | |
1278 { | |
1279 last_mouse_movement_time = msg->time; | |
1280 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1281 if (msg->hwnd != FRAME_W32_WINDOW (frame)) |
13434 | 1282 { |
1283 frame->mouse_moved = 1; | |
1284 last_mouse_scroll_bar = Qnil; | |
1285 | |
1286 note_mouse_highlight (frame, -1, -1); | |
1287 } | |
1288 | |
1289 /* Has the mouse moved off the glyph it was on at the last sighting? */ | |
1290 else if (LOWORD (msg->lParam) < last_mouse_glyph.left | |
1291 || LOWORD (msg->lParam) > last_mouse_glyph.right | |
15229
a270351f6e0c
(note_mouse_movement): Upwards mouse movement recognition corrected.
Richard M. Stallman <rms@gnu.org>
parents:
15216
diff
changeset
|
1292 || HIWORD (msg->lParam) < last_mouse_glyph.top |
13434 | 1293 || HIWORD (msg->lParam) > last_mouse_glyph.bottom) |
1294 { | |
1295 frame->mouse_moved = 1; | |
1296 last_mouse_scroll_bar = Qnil; | |
1297 | |
1298 note_mouse_highlight (frame, LOWORD (msg->lParam), HIWORD (msg->lParam)); | |
1299 } | |
1300 } | |
1301 | |
1302 /* This is used for debugging, to turn off note_mouse_highlight. */ | |
1303 static int disable_mouse_highlight; | |
1304 | |
1305 /* Take proper action when the mouse has moved to position X, Y on frame F | |
1306 as regards highlighting characters that have mouse-face properties. | |
1307 Also dehighlighting chars where the mouse was before. | |
1308 X and Y can be negative or out of range. */ | |
1309 | |
1310 static void | |
1311 note_mouse_highlight (f, x, y) | |
1312 FRAME_PTR f; | |
1313 int x, y; | |
1314 { | |
1315 int row, column, portion; | |
1316 RECT new_glyph; | |
1317 Lisp_Object window; | |
1318 struct window *w; | |
1319 | |
1320 if (disable_mouse_highlight) | |
1321 return; | |
1322 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1323 FRAME_W32_DISPLAY_INFO (f)->mouse_face_mouse_x = x; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1324 FRAME_W32_DISPLAY_INFO (f)->mouse_face_mouse_y = y; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1325 FRAME_W32_DISPLAY_INFO (f)->mouse_face_mouse_frame = f; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1326 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1327 if (FRAME_W32_DISPLAY_INFO (f)->mouse_face_defer) |
13434 | 1328 return; |
1329 | |
1330 if (gc_in_progress) | |
1331 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1332 FRAME_W32_DISPLAY_INFO (f)->mouse_face_deferred_gc = 1; |
13434 | 1333 return; |
1334 } | |
1335 | |
1336 /* Find out which glyph the mouse is on. */ | |
1337 pixel_to_glyph_coords (f, x, y, &column, &row, | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1338 &new_glyph, FRAME_W32_DISPLAY_INFO (f)->grabbed); |
13434 | 1339 |
1340 /* Which window is that in? */ | |
1341 window = window_from_coordinates (f, column, row, &portion); | |
1342 w = XWINDOW (window); | |
1343 | |
1344 /* If we were displaying active text in another window, clear that. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1345 if (! EQ (window, FRAME_W32_DISPLAY_INFO (f)->mouse_face_window)) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1346 clear_mouse_face (FRAME_W32_DISPLAY_INFO (f)); |
13434 | 1347 |
1348 /* Are we in a window whose display is up to date? | |
1349 And verify the buffer's text has not changed. */ | |
1350 if (WINDOWP (window) && portion == 0 && row >= 0 && column >= 0 | |
1351 && row < FRAME_HEIGHT (f) && column < FRAME_WIDTH (f) | |
1352 && EQ (w->window_end_valid, w->buffer) | |
16209
40552cb9a45d
(note_mouse_highlight): Test last_overlay_modified field.
Richard M. Stallman <rms@gnu.org>
parents:
15742
diff
changeset
|
1353 && w->last_modified == BUF_MODIFF (XBUFFER (w->buffer)) |
40552cb9a45d
(note_mouse_highlight): Test last_overlay_modified field.
Richard M. Stallman <rms@gnu.org>
parents:
15742
diff
changeset
|
1354 && w->last_overlay_modified == BUF_OVERLAY_MODIFF (XBUFFER (w->buffer))) |
13434 | 1355 { |
1356 int *ptr = FRAME_CURRENT_GLYPHS (f)->charstarts[row]; | |
1357 int i, pos; | |
1358 | |
1359 /* Find which buffer position the mouse corresponds to. */ | |
1360 for (i = column; i >= 0; i--) | |
1361 if (ptr[i] > 0) | |
1362 break; | |
1363 pos = ptr[i]; | |
1364 /* Is it outside the displayed active region (if any)? */ | |
1365 if (pos <= 0) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1366 clear_mouse_face (FRAME_W32_DISPLAY_INFO (f)); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1367 else if (! (EQ (window, FRAME_W32_DISPLAY_INFO (f)->mouse_face_window) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1368 && row >= FRAME_W32_DISPLAY_INFO (f)->mouse_face_beg_row |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1369 && row <= FRAME_W32_DISPLAY_INFO (f)->mouse_face_end_row |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1370 && (row > FRAME_W32_DISPLAY_INFO (f)->mouse_face_beg_row |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1371 || column >= FRAME_W32_DISPLAY_INFO (f)->mouse_face_beg_col) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1372 && (row < FRAME_W32_DISPLAY_INFO (f)->mouse_face_end_row |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1373 || column < FRAME_W32_DISPLAY_INFO (f)->mouse_face_end_col |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1374 || FRAME_W32_DISPLAY_INFO (f)->mouse_face_past_end))) |
13434 | 1375 { |
1376 Lisp_Object mouse_face, overlay, position; | |
1377 Lisp_Object *overlay_vec; | |
1378 int len, noverlays, ignor1; | |
1379 struct buffer *obuf; | |
1380 int obegv, ozv; | |
1381 | |
1382 /* If we get an out-of-range value, return now; avoid an error. */ | |
1383 if (pos > BUF_Z (XBUFFER (w->buffer))) | |
1384 return; | |
1385 | |
1386 /* Make the window's buffer temporarily current for | |
1387 overlays_at and compute_char_face. */ | |
1388 obuf = current_buffer; | |
1389 current_buffer = XBUFFER (w->buffer); | |
1390 obegv = BEGV; | |
1391 ozv = ZV; | |
1392 BEGV = BEG; | |
1393 ZV = Z; | |
1394 | |
1395 /* Yes. Clear the display of the old active region, if any. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1396 clear_mouse_face (FRAME_W32_DISPLAY_INFO (f)); |
13434 | 1397 |
1398 /* Is this char mouse-active? */ | |
1399 XSETINT (position, pos); | |
1400 | |
1401 len = 10; | |
1402 overlay_vec = (Lisp_Object *) xmalloc (len * sizeof (Lisp_Object)); | |
1403 | |
1404 /* Put all the overlays we want in a vector in overlay_vec. | |
1405 Store the length in len. */ | |
1406 noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len, | |
1407 NULL, NULL); | |
1408 noverlays = sort_overlays (overlay_vec, noverlays, w); | |
1409 | |
1410 /* Find the highest priority overlay that has a mouse-face prop. */ | |
1411 overlay = Qnil; | |
1412 for (i = 0; i < noverlays; i++) | |
1413 { | |
1414 mouse_face = Foverlay_get (overlay_vec[i], Qmouse_face); | |
1415 if (!NILP (mouse_face)) | |
1416 { | |
1417 overlay = overlay_vec[i]; | |
1418 break; | |
1419 } | |
1420 } | |
1421 free (overlay_vec); | |
1422 /* If no overlay applies, get a text property. */ | |
1423 if (NILP (overlay)) | |
1424 mouse_face = Fget_text_property (position, Qmouse_face, w->buffer); | |
1425 | |
1426 /* Handle the overlay case. */ | |
1427 if (! NILP (overlay)) | |
1428 { | |
1429 /* Find the range of text around this char that | |
1430 should be active. */ | |
1431 Lisp_Object before, after; | |
1432 int ignore; | |
1433 | |
1434 before = Foverlay_start (overlay); | |
1435 after = Foverlay_end (overlay); | |
1436 /* Record this as the current active region. */ | |
1437 fast_find_position (window, before, | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1438 &FRAME_W32_DISPLAY_INFO (f)->mouse_face_beg_col, |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1439 &FRAME_W32_DISPLAY_INFO (f)->mouse_face_beg_row); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1440 FRAME_W32_DISPLAY_INFO (f)->mouse_face_past_end |
13434 | 1441 = !fast_find_position (window, after, |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1442 &FRAME_W32_DISPLAY_INFO (f)->mouse_face_end_col, |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1443 &FRAME_W32_DISPLAY_INFO (f)->mouse_face_end_row); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1444 FRAME_W32_DISPLAY_INFO (f)->mouse_face_window = window; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1445 FRAME_W32_DISPLAY_INFO (f)->mouse_face_face_id |
13434 | 1446 = compute_char_face (f, w, pos, 0, 0, |
1447 &ignore, pos + 1, 1); | |
1448 | |
1449 /* Display it as active. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1450 show_mouse_face (FRAME_W32_DISPLAY_INFO (f), 1); |
13434 | 1451 } |
1452 /* Handle the text property case. */ | |
1453 else if (! NILP (mouse_face)) | |
1454 { | |
1455 /* Find the range of text around this char that | |
1456 should be active. */ | |
1457 Lisp_Object before, after, beginning, end; | |
1458 int ignore; | |
1459 | |
1460 beginning = Fmarker_position (w->start); | |
1461 XSETINT (end, (BUF_Z (XBUFFER (w->buffer)) | |
1462 - XFASTINT (w->window_end_pos))); | |
1463 before | |
1464 = Fprevious_single_property_change (make_number (pos + 1), | |
1465 Qmouse_face, | |
1466 w->buffer, beginning); | |
1467 after | |
1468 = Fnext_single_property_change (position, Qmouse_face, | |
1469 w->buffer, end); | |
1470 /* Record this as the current active region. */ | |
1471 fast_find_position (window, before, | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1472 &FRAME_W32_DISPLAY_INFO (f)->mouse_face_beg_col, |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1473 &FRAME_W32_DISPLAY_INFO (f)->mouse_face_beg_row); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1474 FRAME_W32_DISPLAY_INFO (f)->mouse_face_past_end |
13434 | 1475 = !fast_find_position (window, after, |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1476 &FRAME_W32_DISPLAY_INFO (f)->mouse_face_end_col, |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1477 &FRAME_W32_DISPLAY_INFO (f)->mouse_face_end_row); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1478 FRAME_W32_DISPLAY_INFO (f)->mouse_face_window = window; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1479 FRAME_W32_DISPLAY_INFO (f)->mouse_face_face_id |
13434 | 1480 = compute_char_face (f, w, pos, 0, 0, |
1481 &ignore, pos + 1, 1); | |
1482 | |
1483 /* Display it as active. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1484 show_mouse_face (FRAME_W32_DISPLAY_INFO (f), 1); |
13434 | 1485 } |
1486 BEGV = obegv; | |
1487 ZV = ozv; | |
1488 current_buffer = obuf; | |
1489 } | |
1490 } | |
1491 } | |
1492 | |
1493 /* Find the row and column of position POS in window WINDOW. | |
1494 Store them in *COLUMNP and *ROWP. | |
1495 This assumes display in WINDOW is up to date. | |
1496 If POS is above start of WINDOW, return coords | |
1497 of start of first screen line. | |
1498 If POS is after end of WINDOW, return coords of end of last screen line. | |
1499 | |
1500 Value is 1 if POS is in range, 0 if it was off screen. */ | |
1501 | |
1502 static int | |
1503 fast_find_position (window, pos, columnp, rowp) | |
1504 Lisp_Object window; | |
1505 int pos; | |
1506 int *columnp, *rowp; | |
1507 { | |
1508 struct window *w = XWINDOW (window); | |
1509 FRAME_PTR f = XFRAME (WINDOW_FRAME (w)); | |
1510 int i; | |
1511 int row = 0; | |
16258
008dd73a2005
(fast_find_position, show_macro_face): Use new WINDOW_LEFT_MARGIN macro.
Richard M. Stallman <rms@gnu.org>
parents:
16209
diff
changeset
|
1512 int left = WINDOW_LEFT_MARGIN (w); |
13434 | 1513 int top = w->top; |
1514 int height = XFASTINT (w->height) - ! MINI_WINDOW_P (w); | |
1515 int width = window_internal_width (w); | |
1516 int *charstarts; | |
1517 int lastcol; | |
1518 int maybe_next_line = 0; | |
1519 | |
1520 /* Find the right row. */ | |
1521 for (i = 0; | |
1522 i < height; | |
1523 i++) | |
1524 { | |
1525 int linestart = FRAME_CURRENT_GLYPHS (f)->charstarts[top + i][left]; | |
1526 if (linestart > pos) | |
1527 break; | |
1528 /* If the position sought is the end of the buffer, | |
1529 don't include the blank lines at the bottom of the window. */ | |
1530 if (linestart == pos && pos == BUF_ZV (XBUFFER (w->buffer))) | |
1531 { | |
1532 maybe_next_line = 1; | |
1533 break; | |
1534 } | |
1535 if (linestart > 0) | |
1536 row = i; | |
1537 } | |
1538 | |
1539 /* Find the right column with in it. */ | |
1540 charstarts = FRAME_CURRENT_GLYPHS (f)->charstarts[top + row]; | |
1541 lastcol = left; | |
1542 for (i = 0; i < width; i++) | |
1543 { | |
1544 if (charstarts[left + i] == pos) | |
1545 { | |
1546 *rowp = row + top; | |
1547 *columnp = i + left; | |
1548 return 1; | |
1549 } | |
1550 else if (charstarts[left + i] > pos) | |
1551 break; | |
1552 else if (charstarts[left + i] > 0) | |
1553 lastcol = left + i; | |
1554 } | |
1555 | |
1556 /* If we're looking for the end of the buffer, | |
1557 and we didn't find it in the line we scanned, | |
1558 use the start of the following line. */ | |
1559 if (maybe_next_line) | |
1560 { | |
1561 row++; | |
1562 i = 0; | |
1563 } | |
1564 | |
1565 *rowp = row + top; | |
1566 *columnp = lastcol; | |
1567 return 0; | |
1568 } | |
1569 | |
1570 /* Display the active region described by mouse_face_* | |
1571 in its mouse-face if HL > 0, in its normal face if HL = 0. */ | |
1572 | |
1573 static void | |
1574 show_mouse_face (dpyinfo, hl) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1575 struct w32_display_info *dpyinfo; |
13434 | 1576 int hl; |
1577 { | |
1578 struct window *w = XWINDOW (dpyinfo->mouse_face_window); | |
1579 int width = window_internal_width (w); | |
1580 FRAME_PTR f = XFRAME (WINDOW_FRAME (w)); | |
1581 int i; | |
1582 int cursor_off = 0; | |
1583 int old_curs_x = curs_x; | |
1584 int old_curs_y = curs_y; | |
1585 | |
1586 /* Set these variables temporarily | |
1587 so that if we have to turn the cursor off and on again | |
1588 we will put it back at the same place. */ | |
1589 curs_x = f->phys_cursor_x; | |
1590 curs_y = f->phys_cursor_y; | |
1591 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1592 for (i = FRAME_W32_DISPLAY_INFO (f)->mouse_face_beg_row; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1593 i <= FRAME_W32_DISPLAY_INFO (f)->mouse_face_end_row; i++) |
13434 | 1594 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1595 int column = (i == FRAME_W32_DISPLAY_INFO (f)->mouse_face_beg_row |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1596 ? FRAME_W32_DISPLAY_INFO (f)->mouse_face_beg_col |
16258
008dd73a2005
(fast_find_position, show_macro_face): Use new WINDOW_LEFT_MARGIN macro.
Richard M. Stallman <rms@gnu.org>
parents:
16209
diff
changeset
|
1597 : WINDOW_LEFT_MARGIN (w)); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1598 int endcolumn = (i == FRAME_W32_DISPLAY_INFO (f)->mouse_face_end_row |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1599 ? FRAME_W32_DISPLAY_INFO (f)->mouse_face_end_col |
16258
008dd73a2005
(fast_find_position, show_macro_face): Use new WINDOW_LEFT_MARGIN macro.
Richard M. Stallman <rms@gnu.org>
parents:
16209
diff
changeset
|
1600 : WINDOW_LEFT_MARGIN (w) + width); |
13434 | 1601 endcolumn = min (endcolumn, FRAME_CURRENT_GLYPHS (f)->used[i]); |
1602 | |
1603 /* If the cursor's in the text we are about to rewrite, | |
1604 turn the cursor off. */ | |
1605 if (i == curs_y | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1606 && curs_x >= FRAME_W32_DISPLAY_INFO (f)->mouse_face_beg_col - 1 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1607 && curs_x <= FRAME_W32_DISPLAY_INFO (f)->mouse_face_end_col) |
13434 | 1608 { |
1609 x_display_cursor (f, 0); | |
1610 cursor_off = 1; | |
1611 } | |
1612 | |
1613 dumpglyphs (f, | |
1614 CHAR_TO_PIXEL_COL (f, column), | |
1615 CHAR_TO_PIXEL_ROW (f, i), | |
1616 FRAME_CURRENT_GLYPHS (f)->glyphs[i] + column, | |
1617 endcolumn - column, | |
1618 /* Highlight with mouse face if hl > 0. */ | |
1619 hl > 0 ? 3 : 0, 0); | |
1620 } | |
1621 | |
1622 /* If we turned the cursor off, turn it back on. */ | |
1623 if (cursor_off) | |
1624 x_display_cursor (f, 1); | |
1625 | |
1626 curs_x = old_curs_x; | |
1627 curs_y = old_curs_y; | |
1628 | |
1629 /* Change the mouse cursor according to the value of HL. */ | |
1630 if (hl > 0) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1631 SetCursor (f->output_data.w32->cross_cursor); |
13434 | 1632 else |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1633 SetCursor (f->output_data.w32->text_cursor); |
13434 | 1634 } |
1635 | |
1636 /* Clear out the mouse-highlighted active region. | |
1637 Redraw it unhighlighted first. */ | |
1638 | |
1639 static void | |
1640 clear_mouse_face (dpyinfo) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1641 struct w32_display_info *dpyinfo; |
13434 | 1642 { |
1643 if (! NILP (dpyinfo->mouse_face_window)) | |
1644 show_mouse_face (dpyinfo, 0); | |
1645 | |
1646 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; | |
1647 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; | |
1648 dpyinfo->mouse_face_window = Qnil; | |
1649 } | |
1650 | |
1651 struct scroll_bar *x_window_to_scroll_bar (); | |
1652 static void x_scroll_bar_report_motion (); | |
1653 | |
1654 /* Return the current position of the mouse. | |
1655 *fp should be a frame which indicates which display to ask about. | |
1656 | |
1657 If the mouse movement started in a scroll bar, set *fp, *bar_window, | |
1658 and *part to the frame, window, and scroll bar part that the mouse | |
1659 is over. Set *x and *y to the portion and whole of the mouse's | |
1660 position on the scroll bar. | |
1661 | |
1662 If the mouse movement started elsewhere, set *fp to the frame the | |
1663 mouse is on, *bar_window to nil, and *x and *y to the character cell | |
1664 the mouse is over. | |
1665 | |
1666 Set *time to the server timestamp for the time at which the mouse | |
1667 was at this position. | |
1668 | |
1669 Don't store anything if we don't have a valid set of values to report. | |
1670 | |
1671 This clears the mouse_moved flag, so we can wait for the next mouse | |
1672 movement. This also calls XQueryPointer, which will cause the | |
1673 server to give us another MotionNotify when the mouse moves | |
1674 again. */ | |
1675 | |
1676 static void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1677 w32_mouse_position (fp, insist, bar_window, part, x, y, time) |
13434 | 1678 FRAME_PTR *fp; |
1679 int insist; | |
1680 Lisp_Object *bar_window; | |
1681 enum scroll_bar_part *part; | |
1682 Lisp_Object *x, *y; | |
1683 unsigned long *time; | |
1684 { | |
1685 FRAME_PTR f1; | |
1686 | |
1687 BLOCK_INPUT; | |
1688 | |
1689 if (! NILP (last_mouse_scroll_bar)) | |
1690 x_scroll_bar_report_motion (fp, bar_window, part, x, y, time); | |
1691 else | |
1692 { | |
1693 POINT pt; | |
1694 | |
1695 Lisp_Object frame, tail; | |
1696 | |
1697 /* Clear the mouse-moved flag for every frame on this display. */ | |
1698 FOR_EACH_FRAME (tail, frame) | |
1699 XFRAME (frame)->mouse_moved = 0; | |
1700 | |
1701 last_mouse_scroll_bar = Qnil; | |
1702 | |
1703 GetCursorPos (&pt); | |
1704 | |
1705 /* Now we have a position on the root; find the innermost window | |
1706 containing the pointer. */ | |
1707 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1708 if (FRAME_W32_DISPLAY_INFO (*fp)->grabbed && last_mouse_frame |
13434 | 1709 && FRAME_LIVE_P (last_mouse_frame)) |
1710 { | |
1711 f1 = last_mouse_frame; | |
1712 } | |
1713 else | |
1714 { | |
1715 /* Is win one of our frames? */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1716 f1 = x_window_to_frame (FRAME_W32_DISPLAY_INFO (*fp), WindowFromPoint(pt)); |
13434 | 1717 } |
1718 | |
1719 /* If not, is it one of our scroll bars? */ | |
1720 if (! f1) | |
1721 { | |
1722 struct scroll_bar *bar = x_window_to_scroll_bar (WindowFromPoint(pt)); | |
1723 | |
1724 if (bar) | |
1725 { | |
1726 f1 = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); | |
1727 } | |
1728 } | |
1729 | |
1730 if (f1 == 0 && insist) | |
1731 f1 = selected_frame; | |
1732 | |
1733 if (f1) | |
1734 { | |
1735 int ignore1, ignore2; | |
1736 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1737 ScreenToClient (FRAME_W32_WINDOW (f1), &pt); |
13434 | 1738 |
1739 /* Ok, we found a frame. Store all the values. */ | |
1740 | |
1741 pixel_to_glyph_coords (f1, pt.x, pt.y, &ignore1, &ignore2, | |
1742 &last_mouse_glyph, | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1743 FRAME_W32_DISPLAY_INFO (f1)->grabbed |
13434 | 1744 || insist); |
1745 | |
1746 *bar_window = Qnil; | |
1747 *part = 0; | |
1748 *fp = f1; | |
1749 XSETINT (*x, pt.x); | |
1750 XSETINT (*y, pt.y); | |
1751 *time = last_mouse_movement_time; | |
1752 } | |
1753 } | |
1754 } | |
1755 | |
1756 UNBLOCK_INPUT; | |
1757 } | |
1758 | |
1759 /* Scroll bar support. */ | |
1760 | |
1761 /* Given an window ID, find the struct scroll_bar which manages it. | |
1762 This can be called in GC, so we have to make sure to strip off mark | |
1763 bits. */ | |
1764 struct scroll_bar * | |
1765 x_window_to_scroll_bar (window_id) | |
1766 Window window_id; | |
1767 { | |
1768 Lisp_Object tail, frame; | |
1769 | |
1770 for (tail = Vframe_list; | |
1771 XGCTYPE (tail) == Lisp_Cons; | |
1772 tail = XCONS (tail)->cdr) | |
1773 { | |
1774 Lisp_Object frame, bar, condemned; | |
1775 | |
1776 frame = XCONS (tail)->car; | |
1777 /* All elements of Vframe_list should be frames. */ | |
1778 if (! GC_FRAMEP (frame)) | |
1779 abort (); | |
1780 | |
1781 /* Scan this frame's scroll bar list for a scroll bar with the | |
1782 right window ID. */ | |
1783 condemned = FRAME_CONDEMNED_SCROLL_BARS (XFRAME (frame)); | |
1784 for (bar = FRAME_SCROLL_BARS (XFRAME (frame)); | |
1785 /* This trick allows us to search both the ordinary and | |
1786 condemned scroll bar lists with one loop. */ | |
1787 ! GC_NILP (bar) || (bar = condemned, | |
1788 condemned = Qnil, | |
1789 ! GC_NILP (bar)); | |
1790 bar = XSCROLL_BAR (bar)->next) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1791 if (SCROLL_BAR_W32_WINDOW (XSCROLL_BAR (bar)) == window_id) |
13434 | 1792 return XSCROLL_BAR (bar); |
1793 } | |
1794 | |
1795 return 0; | |
1796 } | |
1797 | |
1798 HWND | |
1799 my_create_scrollbar (f, bar) | |
1800 struct frame * f; | |
1801 struct scroll_bar * bar; | |
1802 { | |
1803 MSG msg; | |
1804 | |
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16588
diff
changeset
|
1805 PostThreadMessage (dwWindowsThreadId, WM_EMACS_CREATESCROLLBAR, (WPARAM) f, |
13434 | 1806 (LPARAM) bar); |
1807 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE); | |
1808 | |
1809 return ((HWND) msg.wParam); | |
1810 } | |
1811 | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1812 //#define ATTACH_THREADS |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1813 |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1814 void |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1815 my_show_window (HWND hwnd, int how) |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1816 { |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1817 #ifndef ATTACH_THREADS |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1818 SendMessage (hwnd, WM_EMACS_SHOWWINDOW, (WPARAM) how, 0); |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1819 #else |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1820 ShowWindow (hwnd , how); |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1821 #endif |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1822 } |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1823 |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1824 void |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1825 my_set_window_pos (HWND hwnd, HWND hwndAfter, |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1826 int x, int y, int cx, int cy, int flags) |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1827 { |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1828 #ifndef ATTACH_THREADS |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1829 W32WindowPos pos; |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1830 pos.hwndAfter = hwndAfter; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1831 pos.x = x; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1832 pos.y = y; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1833 pos.cx = cx; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1834 pos.cy = cy; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1835 pos.flags = flags; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1836 SendMessage (hwnd, WM_EMACS_SETWINDOWPOS, (WPARAM) &pos, 0); |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1837 #else |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1838 SetWindowPos (hwnd, hwndAfter, x, y, cx, cy, flags); |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1839 #endif |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1840 } |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1841 |
13434 | 1842 void |
1843 my_destroy_window (f, hwnd) | |
1844 struct frame * f; | |
1845 HWND hwnd; | |
1846 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1847 SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_DESTROYWINDOW, |
13434 | 1848 (WPARAM) hwnd, 0); |
1849 } | |
1850 | |
1851 /* Open a new window to serve as a scroll bar, and return the | |
1852 scroll bar vector for it. */ | |
1853 static struct scroll_bar * | |
1854 x_scroll_bar_create (window, top, left, width, height) | |
1855 struct window *window; | |
1856 int top, left, width, height; | |
1857 { | |
1858 FRAME_PTR f = XFRAME (WINDOW_FRAME (window)); | |
1859 struct scroll_bar *bar | |
1860 = XSCROLL_BAR (Fmake_vector (make_number (SCROLL_BAR_VEC_SIZE), Qnil)); | |
1861 HWND hwnd; | |
1862 | |
1863 BLOCK_INPUT; | |
1864 | |
1865 XSETWINDOW (bar->window, window); | |
1866 XSETINT (bar->top, top); | |
1867 XSETINT (bar->left, left); | |
1868 XSETINT (bar->width, width); | |
1869 XSETINT (bar->height, height); | |
1870 XSETINT (bar->start, 0); | |
1871 XSETINT (bar->end, 0); | |
1872 bar->dragging = Qnil; | |
1873 | |
1874 /* Requires geometry to be set before call to create the real window */ | |
1875 | |
1876 hwnd = my_create_scrollbar (f, bar); | |
1877 | |
1878 SetScrollRange (hwnd, SB_CTL, 0, height, FALSE); | |
1879 SetScrollPos (hwnd, SB_CTL, 0, TRUE); | |
1880 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1881 SET_SCROLL_BAR_W32_WINDOW (bar, hwnd); |
13434 | 1882 |
1883 /* Add bar to its frame's list of scroll bars. */ | |
1884 bar->next = FRAME_SCROLL_BARS (f); | |
1885 bar->prev = Qnil; | |
1886 XSETVECTOR (FRAME_SCROLL_BARS (f), bar); | |
1887 if (! NILP (bar->next)) | |
1888 XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar); | |
1889 | |
1890 UNBLOCK_INPUT; | |
1891 | |
1892 return bar; | |
1893 } | |
1894 | |
1895 /* Draw BAR's handle in the proper position. | |
1896 If the handle is already drawn from START to END, don't bother | |
1897 redrawing it, unless REBUILD is non-zero; in that case, always | |
1898 redraw it. (REBUILD is handy for drawing the handle after expose | |
1899 events.) | |
1900 | |
1901 Normally, we want to constrain the start and end of the handle to | |
1902 fit inside its rectangle, but if the user is dragging the scroll bar | |
1903 handle, we want to let them drag it down all the way, so that the | |
1904 bar's top is as far down as it goes; otherwise, there's no way to | |
1905 move to the very end of the buffer. */ | |
1906 static void | |
1907 x_scroll_bar_set_handle (bar, start, end, rebuild) | |
1908 struct scroll_bar *bar; | |
1909 int start, end; | |
1910 int rebuild; | |
1911 { | |
1912 int dragging = ! NILP (bar->dragging); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1913 Window w = SCROLL_BAR_W32_WINDOW (bar); |
13434 | 1914 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); |
1915 | |
1916 /* If the display is already accurate, do nothing. */ | |
1917 if (! rebuild | |
1918 && start == XINT (bar->start) | |
1919 && end == XINT (bar->end)) | |
1920 return; | |
1921 | |
1922 BLOCK_INPUT; | |
1923 | |
1924 /* Store the adjusted setting in the scroll bar. */ | |
1925 XSETINT (bar->start, start); | |
1926 XSETINT (bar->end, end); | |
1927 | |
15216
f639c5d732a3
(x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents:
15204
diff
changeset
|
1928 SetScrollPos (w, SB_CTL, start, TRUE); |
13434 | 1929 |
1930 UNBLOCK_INPUT; | |
1931 } | |
1932 | |
1933 /* Move a scroll bar around on the screen, to accommodate changing | |
1934 window configurations. */ | |
1935 static void | |
1936 x_scroll_bar_move (bar, top, left, width, height) | |
1937 struct scroll_bar *bar; | |
1938 int top, left, width, height; | |
1939 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1940 Window w = SCROLL_BAR_W32_WINDOW (bar); |
13434 | 1941 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); |
1942 | |
1943 BLOCK_INPUT; | |
1944 | |
1945 MoveWindow (w, left, top, width, height, TRUE); | |
1946 SetScrollRange (w, SB_CTL, 0, height, FALSE); | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1947 InvalidateRect (w, NULL, FALSE); |
15204
881e3b9247f8
(x_scroll_bar_move): Call my_show_window.
Richard M. Stallman <rms@gnu.org>
parents:
15151
diff
changeset
|
1948 my_show_window (w, SW_NORMAL); |
13434 | 1949 |
1950 XSETINT (bar->left, left); | |
1951 XSETINT (bar->top, top); | |
1952 XSETINT (bar->width, width); | |
1953 XSETINT (bar->height, height); | |
1954 | |
1955 UNBLOCK_INPUT; | |
1956 } | |
1957 | |
1958 /* Destroy the window for BAR, and set its Emacs window's scroll bar | |
1959 to nil. */ | |
1960 static void | |
1961 x_scroll_bar_remove (bar) | |
1962 struct scroll_bar *bar; | |
1963 { | |
1964 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); | |
1965 | |
1966 BLOCK_INPUT; | |
1967 | |
1968 /* Destroy the window. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1969 my_destroy_window (f, SCROLL_BAR_W32_WINDOW (bar)); |
13434 | 1970 |
1971 /* Disassociate this scroll bar from its window. */ | |
1972 XWINDOW (bar->window)->vertical_scroll_bar = Qnil; | |
1973 | |
1974 UNBLOCK_INPUT; | |
1975 } | |
1976 | |
1977 /* Set the handle of the vertical scroll bar for WINDOW to indicate | |
1978 that we are displaying PORTION characters out of a total of WHOLE | |
1979 characters, starting at POSITION. If WINDOW has no scroll bar, | |
1980 create one. */ | |
1981 static void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1982 w32_set_vertical_scroll_bar (window, portion, whole, position) |
13434 | 1983 struct window *window; |
1984 int portion, whole, position; | |
1985 { | |
1986 FRAME_PTR f = XFRAME (WINDOW_FRAME (window)); | |
1987 int top = XINT (window->top); | |
1988 int left = WINDOW_VERTICAL_SCROLL_BAR_COLUMN (window); | |
1989 int height = WINDOW_VERTICAL_SCROLL_BAR_HEIGHT (window); | |
1990 | |
1991 /* Where should this scroll bar be, pixelwise? */ | |
1992 int pixel_top = CHAR_TO_PIXEL_ROW (f, top); | |
1993 int pixel_left = CHAR_TO_PIXEL_COL (f, left); | |
1994 int pixel_width | |
1995 = (FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0 | |
1996 ? FRAME_SCROLL_BAR_PIXEL_WIDTH (f) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1997 : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.w32->font))); |
13434 | 1998 int pixel_height = VERTICAL_SCROLL_BAR_PIXEL_HEIGHT (f, height); |
1999 | |
2000 struct scroll_bar *bar; | |
2001 | |
2002 /* Does the scroll bar exist yet? */ | |
2003 if (NILP (window->vertical_scroll_bar)) | |
2004 bar = x_scroll_bar_create (window, | |
2005 pixel_top, pixel_left, | |
2006 pixel_width, pixel_height); | |
2007 else | |
2008 { | |
2009 /* It may just need to be moved and resized. */ | |
2010 bar = XSCROLL_BAR (window->vertical_scroll_bar); | |
2011 x_scroll_bar_move (bar, pixel_top, pixel_left, pixel_width, pixel_height); | |
2012 } | |
2013 | |
2014 /* Set the scroll bar's current state, unless we're currently being | |
2015 dragged. */ | |
2016 if (NILP (bar->dragging)) | |
2017 { | |
2018 int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (pixel_height); | |
2019 | |
2020 if (whole == 0) | |
2021 x_scroll_bar_set_handle (bar, 0, top_range, 0); | |
2022 else | |
2023 { | |
2024 int start = (int) (((double) position * top_range) / whole); | |
2025 int end = (int) (((double) (position + portion) * top_range) / whole); | |
2026 | |
2027 x_scroll_bar_set_handle (bar, start, end, 0); | |
2028 } | |
2029 } | |
2030 | |
2031 XSETVECTOR (window->vertical_scroll_bar, bar); | |
2032 } | |
2033 | |
2034 | |
2035 /* The following three hooks are used when we're doing a thorough | |
2036 redisplay of the frame. We don't explicitly know which scroll bars | |
2037 are going to be deleted, because keeping track of when windows go | |
2038 away is a real pain - "Can you say set-window-configuration, boys | |
2039 and girls?" Instead, we just assert at the beginning of redisplay | |
2040 that *all* scroll bars are to be removed, and then save a scroll bar | |
2041 from the fiery pit when we actually redisplay its window. */ | |
2042 | |
2043 /* Arrange for all scroll bars on FRAME to be removed at the next call | |
2044 to `*judge_scroll_bars_hook'. A scroll bar may be spared if | |
2045 `*redeem_scroll_bar_hook' is applied to its window before the judgement. */ | |
2046 static void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2047 w32_condemn_scroll_bars (frame) |
13434 | 2048 FRAME_PTR frame; |
2049 { | |
2050 /* The condemned list should be empty at this point; if it's not, | |
2051 then the rest of Emacs isn't using the condemn/redeem/judge | |
2052 protocol correctly. */ | |
2053 if (! NILP (FRAME_CONDEMNED_SCROLL_BARS (frame))) | |
2054 abort (); | |
2055 | |
2056 /* Move them all to the "condemned" list. */ | |
2057 FRAME_CONDEMNED_SCROLL_BARS (frame) = FRAME_SCROLL_BARS (frame); | |
2058 FRAME_SCROLL_BARS (frame) = Qnil; | |
2059 } | |
2060 | |
2061 /* Unmark WINDOW's scroll bar for deletion in this judgement cycle. | |
2062 Note that WINDOW isn't necessarily condemned at all. */ | |
2063 static void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2064 w32_redeem_scroll_bar (window) |
13434 | 2065 struct window *window; |
2066 { | |
2067 struct scroll_bar *bar; | |
2068 | |
2069 /* We can't redeem this window's scroll bar if it doesn't have one. */ | |
2070 if (NILP (window->vertical_scroll_bar)) | |
2071 abort (); | |
2072 | |
2073 bar = XSCROLL_BAR (window->vertical_scroll_bar); | |
2074 | |
2075 /* Unlink it from the condemned list. */ | |
2076 { | |
2077 FRAME_PTR f = XFRAME (WINDOW_FRAME (window)); | |
2078 | |
2079 if (NILP (bar->prev)) | |
2080 { | |
2081 /* If the prev pointer is nil, it must be the first in one of | |
2082 the lists. */ | |
2083 if (EQ (FRAME_SCROLL_BARS (f), window->vertical_scroll_bar)) | |
2084 /* It's not condemned. Everything's fine. */ | |
2085 return; | |
2086 else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f), | |
2087 window->vertical_scroll_bar)) | |
2088 FRAME_CONDEMNED_SCROLL_BARS (f) = bar->next; | |
2089 else | |
2090 /* If its prev pointer is nil, it must be at the front of | |
2091 one or the other! */ | |
2092 abort (); | |
2093 } | |
2094 else | |
2095 XSCROLL_BAR (bar->prev)->next = bar->next; | |
2096 | |
2097 if (! NILP (bar->next)) | |
2098 XSCROLL_BAR (bar->next)->prev = bar->prev; | |
2099 | |
2100 bar->next = FRAME_SCROLL_BARS (f); | |
2101 bar->prev = Qnil; | |
2102 XSETVECTOR (FRAME_SCROLL_BARS (f), bar); | |
2103 if (! NILP (bar->next)) | |
2104 XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar); | |
2105 } | |
2106 } | |
2107 | |
2108 /* Remove all scroll bars on FRAME that haven't been saved since the | |
2109 last call to `*condemn_scroll_bars_hook'. */ | |
2110 static void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2111 w32_judge_scroll_bars (f) |
13434 | 2112 FRAME_PTR f; |
2113 { | |
2114 Lisp_Object bar, next; | |
2115 | |
2116 bar = FRAME_CONDEMNED_SCROLL_BARS (f); | |
2117 | |
2118 /* Clear out the condemned list now so we won't try to process any | |
2119 more events on the hapless scroll bars. */ | |
2120 FRAME_CONDEMNED_SCROLL_BARS (f) = Qnil; | |
2121 | |
2122 for (; ! NILP (bar); bar = next) | |
2123 { | |
2124 struct scroll_bar *b = XSCROLL_BAR (bar); | |
2125 | |
2126 x_scroll_bar_remove (b); | |
2127 | |
2128 next = b->next; | |
2129 b->next = b->prev = Qnil; | |
2130 } | |
2131 | |
2132 /* Now there should be no references to the condemned scroll bars, | |
2133 and they should get garbage-collected. */ | |
2134 } | |
2135 | |
2136 /* Handle a mouse click on the scroll bar BAR. If *EMACS_EVENT's kind | |
2137 is set to something other than no_event, it is enqueued. | |
2138 | |
2139 This may be called from a signal handler, so we have to ignore GC | |
2140 mark bits. */ | |
15216
f639c5d732a3
(x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents:
15204
diff
changeset
|
2141 |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2142 static int |
13434 | 2143 x_scroll_bar_handle_click (bar, msg, emacs_event) |
2144 struct scroll_bar *bar; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2145 W32Msg *msg; |
13434 | 2146 struct input_event *emacs_event; |
2147 { | |
2148 if (! GC_WINDOWP (bar->window)) | |
2149 abort (); | |
2150 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2151 emacs_event->kind = w32_scroll_bar_click; |
13434 | 2152 emacs_event->code = 0; |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2153 /* not really meaningful to distinguish up/down */ |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2154 emacs_event->modifiers = msg->dwModifiers; |
13434 | 2155 emacs_event->frame_or_window = bar->window; |
2156 emacs_event->timestamp = msg->msg.time; | |
2157 | |
2158 { | |
2159 int internal_height | |
2160 = VERTICAL_SCROLL_BAR_INSIDE_HEIGHT (XINT (bar->height)); | |
2161 int top_range | |
2162 = VERTICAL_SCROLL_BAR_TOP_RANGE (XINT (bar->height)); | |
2163 int y = GetScrollPos ((HWND) msg->msg.lParam, SB_CTL); | |
2164 | |
2165 switch (LOWORD (msg->msg.wParam)) | |
15216
f639c5d732a3
(x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents:
15204
diff
changeset
|
2166 { |
f639c5d732a3
(x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents:
15204
diff
changeset
|
2167 case SB_THUMBTRACK: |
13434 | 2168 emacs_event->part = scroll_bar_handle; |
2169 if (VERTICAL_SCROLL_BAR_TOP_RANGE (XINT (bar->height)) <= 0xffff) | |
2170 y = HIWORD (msg->msg.wParam); | |
2171 break; | |
15216
f639c5d732a3
(x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents:
15204
diff
changeset
|
2172 case SB_LINEDOWN: |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2173 emacs_event->part = scroll_bar_down_arrow; |
13434 | 2174 break; |
15216
f639c5d732a3
(x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents:
15204
diff
changeset
|
2175 case SB_LINEUP: |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2176 emacs_event->part = scroll_bar_up_arrow; |
13434 | 2177 break; |
15216
f639c5d732a3
(x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents:
15204
diff
changeset
|
2178 case SB_PAGEUP: |
13434 | 2179 emacs_event->part = scroll_bar_above_handle; |
2180 break; | |
15216
f639c5d732a3
(x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents:
15204
diff
changeset
|
2181 case SB_PAGEDOWN: |
13434 | 2182 emacs_event->part = scroll_bar_below_handle; |
2183 break; | |
15216
f639c5d732a3
(x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents:
15204
diff
changeset
|
2184 case SB_TOP: |
13434 | 2185 emacs_event->part = scroll_bar_handle; |
2186 y = 0; | |
2187 break; | |
15216
f639c5d732a3
(x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents:
15204
diff
changeset
|
2188 case SB_BOTTOM: |
13434 | 2189 emacs_event->part = scroll_bar_handle; |
2190 y = top_range; | |
2191 break; | |
15216
f639c5d732a3
(x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents:
15204
diff
changeset
|
2192 case SB_THUMBPOSITION: |
13434 | 2193 emacs_event->part = scroll_bar_handle; |
2194 break; | |
15216
f639c5d732a3
(x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents:
15204
diff
changeset
|
2195 case SB_ENDSCROLL: |
f639c5d732a3
(x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents:
15204
diff
changeset
|
2196 default: |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2197 SetScrollPos (SCROLL_BAR_W32_WINDOW (bar), SB_CTL, y, TRUE); |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2198 return FALSE; |
15216
f639c5d732a3
(x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents:
15204
diff
changeset
|
2199 } |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2200 |
13434 | 2201 XSETINT (emacs_event->x, y); |
2202 XSETINT (emacs_event->y, top_range); | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2203 |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2204 return TRUE; |
13434 | 2205 } |
2206 } | |
2207 | |
2208 /* Return information to the user about the current position of the mouse | |
2209 on the scroll bar. */ | |
2210 static void | |
2211 x_scroll_bar_report_motion (fp, bar_window, part, x, y, time) | |
2212 FRAME_PTR *fp; | |
2213 Lisp_Object *bar_window; | |
2214 enum scroll_bar_part *part; | |
2215 Lisp_Object *x, *y; | |
2216 unsigned long *time; | |
2217 { | |
2218 struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2219 Window w = SCROLL_BAR_W32_WINDOW (bar); |
13434 | 2220 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); |
2221 int pos; | |
2222 | |
2223 BLOCK_INPUT; | |
2224 | |
2225 *fp = f; | |
2226 *bar_window = bar->window; | |
2227 | |
2228 pos = GetScrollPos (w, SB_CTL); | |
2229 | |
2230 switch (LOWORD (last_mouse_scroll_bar_pos)) | |
2231 { | |
2232 case SB_THUMBPOSITION: | |
2233 case SB_THUMBTRACK: | |
2234 *part = scroll_bar_handle; | |
2235 if (VERTICAL_SCROLL_BAR_TOP_RANGE (XINT (bar->height)) <= 0xffff) | |
2236 pos = HIWORD (last_mouse_scroll_bar_pos); | |
2237 break; | |
2238 case SB_LINEDOWN: | |
2239 *part = scroll_bar_handle; | |
2240 pos++; | |
2241 break; | |
2242 default: | |
2243 *part = scroll_bar_handle; | |
2244 break; | |
2245 } | |
2246 | |
2247 XSETINT(*x, pos); | |
2248 XSETINT(*y, VERTICAL_SCROLL_BAR_TOP_RANGE (XINT (bar->height))); | |
2249 | |
2250 f->mouse_moved = 0; | |
2251 last_mouse_scroll_bar = Qnil; | |
2252 | |
2253 *time = last_mouse_movement_time; | |
2254 | |
2255 UNBLOCK_INPUT; | |
2256 } | |
2257 | |
2258 /* The screen has been cleared so we may have changed foreground or | |
2259 background colors, and the scroll bars may need to be redrawn. | |
2260 Clear out the scroll bars, and ask for expose events, so we can | |
2261 redraw them. */ | |
2262 | |
2263 x_scroll_bar_clear (f) | |
2264 FRAME_PTR f; | |
2265 { | |
2266 Lisp_Object bar; | |
2267 | |
2268 for (bar = FRAME_SCROLL_BARS (f); VECTORP (bar); | |
2269 bar = XSCROLL_BAR (bar)->next) | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2270 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2271 HWND window = SCROLL_BAR_W32_WINDOW (XSCROLL_BAR (bar)); |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2272 HDC hdc = GetDC (window); |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2273 RECT rect; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2274 |
15204
881e3b9247f8
(x_scroll_bar_move): Call my_show_window.
Richard M. Stallman <rms@gnu.org>
parents:
15151
diff
changeset
|
2275 my_show_window (window, SW_HIDE); |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2276 GetClientRect (window, &rect); |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2277 select_palette (f, hdc); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2278 w32_clear_rect (f, hdc, &rect); |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2279 deselect_palette (f, hdc); |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2280 } |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2281 } |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2282 |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2283 show_scroll_bars (f, how) |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2284 FRAME_PTR f; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2285 int how; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2286 { |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2287 Lisp_Object bar; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2288 |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2289 for (bar = FRAME_SCROLL_BARS (f); VECTORP (bar); |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2290 bar = XSCROLL_BAR (bar)->next) |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2291 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2292 HWND window = SCROLL_BAR_W32_WINDOW (XSCROLL_BAR (bar)); |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2293 my_show_window (window, how); |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2294 } |
13434 | 2295 } |
2296 | |
2297 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2298 /* The main W32 event-reading loop - w32_read_socket. */ |
13434 | 2299 |
2300 /* Timestamp of enter window event. This is only used by w32_read_socket, | |
2301 but we have to put it out here, since static variables within functions | |
2302 sometimes don't work. */ | |
2303 static Time enter_timestamp; | |
2304 | |
2305 /* Record the last 100 characters stored | |
2306 to help debug the loss-of-chars-during-GC problem. */ | |
2307 int temp_index; | |
2308 short temp_buffer[100]; | |
2309 | |
14462
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2310 extern int key_event (KEY_EVENT_RECORD *, struct input_event *); |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2311 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2312 /* Map a W32 WM_CHAR message into a KEY_EVENT_RECORD so that |
14462
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2313 we can use the same routines to handle input in both console |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2314 and window modes. */ |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2315 |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2316 static void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2317 convert_to_key_event (W32Msg *msgp, KEY_EVENT_RECORD *eventp) |
14462
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2318 { |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2319 eventp->bKeyDown = TRUE; |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2320 eventp->wRepeatCount = 1; |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2321 eventp->wVirtualKeyCode = msgp->msg.wParam; |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2322 eventp->wVirtualScanCode = (msgp->msg.lParam & 0xFF0000) >> 16; |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2323 eventp->uChar.AsciiChar = 0; |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2324 eventp->dwControlKeyState = msgp->dwModifiers; |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2325 } |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2326 |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2327 /* Return nonzero if the virtual key is a dead key. */ |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2328 |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2329 static int |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2330 is_dead_key (int wparam) |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2331 { |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2332 unsigned int code = MapVirtualKey (wparam, 2); |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2333 |
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16588
diff
changeset
|
2334 /* Windows 95 returns 0x8000, NT returns 0x80000000. */ |
14462
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2335 if ((code & 0x8000) || (code & 0x80000000)) |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2336 return 1; |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2337 else |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2338 return 0; |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2339 } |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2340 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2341 /* Read events coming from the W32 shell. |
13434 | 2342 This routine is called by the SIGIO handler. |
2343 We return as soon as there are no more events to be read. | |
2344 | |
2345 Events representing keys are stored in buffer BUFP, | |
2346 which can hold up to NUMCHARS characters. | |
2347 We return the number of characters stored into the buffer, | |
2348 thus pretending to be `read'. | |
2349 | |
2350 EXPECTED is nonzero if the caller knows input is available. | |
2351 | |
2352 Some of these messages are reposted back to the message queue since the | |
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16588
diff
changeset
|
2353 system calls the windows proc directly in a context where we cannot return |
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16588
diff
changeset
|
2354 the data nor can we guarantee the state we are in. So if we dispatch them |
13434 | 2355 we will get into an infinite loop. To prevent this from ever happening we |
2356 will set a variable to indicate we are in the read_socket call and indicate | |
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16588
diff
changeset
|
2357 which message we are processing since the windows proc gets called |
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16588
diff
changeset
|
2358 recursively with different messages by the system. |
13434 | 2359 */ |
2360 | |
2361 int | |
16326
a85909645f7a
(w32_read_socket): Delete WAITP arg.
Richard M. Stallman <rms@gnu.org>
parents:
16258
diff
changeset
|
2362 w32_read_socket (sd, bufp, numchars, expected) |
13434 | 2363 register int sd; |
2364 register struct input_event *bufp; | |
2365 register int numchars; | |
2366 int expected; | |
2367 { | |
2368 int count = 0; | |
2369 int nbytes = 0; | |
2370 int items_pending; /* How many items are in the X queue. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2371 W32Msg msg; |
13434 | 2372 struct frame *f; |
2373 int event_found = 0; | |
2374 int prefix; | |
2375 Lisp_Object part; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2376 struct w32_display_info *dpyinfo = &one_w32_display_info; |
13434 | 2377 |
2378 if (interrupt_input_blocked) | |
2379 { | |
2380 interrupt_input_pending = 1; | |
2381 return -1; | |
2382 } | |
2383 | |
2384 interrupt_input_pending = 0; | |
2385 BLOCK_INPUT; | |
2386 | |
2387 /* So people can tell when we have read the available input. */ | |
2388 input_signal_count++; | |
2389 | |
2390 if (numchars <= 0) | |
2391 abort (); /* Don't think this happens. */ | |
2392 | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2393 while (get_next_msg (&msg, FALSE)) |
13434 | 2394 { |
2395 switch (msg.msg.message) | |
2396 { | |
2397 case WM_PAINT: | |
2398 { | |
2399 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | |
2400 | |
2401 if (f) | |
2402 { | |
2403 if (f->async_visible == 0) | |
2404 { | |
2405 f->async_visible = 1; | |
2406 f->async_iconified = 0; | |
2407 SET_FRAME_GARBAGED (f); | |
2408 } | |
2409 else | |
2410 { | |
15723
d2cee951f37e
(w32_read_socket): Need to erase background
Karl Heuer <kwzh@gnu.org>
parents:
15651
diff
changeset
|
2411 /* Erase background again for safety. */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2412 w32_clear_rect (f, NULL, &msg.rect); |
13434 | 2413 dumprectangle (f, |
2414 msg.rect.left, | |
2415 msg.rect.top, | |
2416 msg.rect.right-msg.rect.left+1, | |
2417 msg.rect.bottom-msg.rect.top+1); | |
2418 } | |
2419 } | |
2420 } | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2421 break; |
13434 | 2422 case WM_KEYDOWN: |
2423 case WM_SYSKEYDOWN: | |
2424 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | |
2425 | |
2426 if (f && !f->iconified) | |
2427 { | |
2428 if (temp_index == sizeof temp_buffer / sizeof (short)) | |
2429 temp_index = 0; | |
2430 temp_buffer[temp_index++] = msg.msg.wParam; | |
2431 bufp->kind = non_ascii_keystroke; | |
2432 bufp->code = msg.msg.wParam; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2433 bufp->modifiers = w32_kbd_mods_to_emacs (msg.dwModifiers); |
13434 | 2434 XSETFRAME (bufp->frame_or_window, f); |
2435 bufp->timestamp = msg.msg.time; | |
2436 bufp++; | |
2437 numchars--; | |
2438 count++; | |
2439 } | |
2440 break; | |
2441 case WM_SYSCHAR: | |
2442 case WM_CHAR: | |
2443 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | |
2444 | |
2445 if (f && !f->iconified) | |
2446 { | |
2447 if (numchars > 1) | |
2448 { | |
14462
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2449 int add; |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2450 KEY_EVENT_RECORD key, *keyp = &key; |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2451 |
13434 | 2452 if (temp_index == sizeof temp_buffer / sizeof (short)) |
2453 temp_index = 0; | |
14462
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2454 |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2455 convert_to_key_event (&msg, keyp); |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2456 add = key_event (keyp, bufp); |
15035
a538ad05bce1
(w32_read_socket): Initialize frame_or_window field.
Richard M. Stallman <rms@gnu.org>
parents:
14462
diff
changeset
|
2457 XSETFRAME (bufp->frame_or_window, f); |
14462
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2458 if (add == -1) |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2459 { |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2460 /* The key pressed generated two characters, most likely |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2461 an accent character and a key that could not be |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2462 combined with it. Prepend the message on the queue |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2463 again to process the second character (which is |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2464 being held internally in key_event), and process |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2465 the first character now. */ |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2466 prepend_msg (&msg); |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2467 add = 1; |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2468 } |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2469 |
15332
008f373921e4
(w32_read_socket): If the dead key was produced using
Richard M. Stallman <rms@gnu.org>
parents:
15289
diff
changeset
|
2470 /* Throw dead keys away. However, be sure not to |
008f373921e4
(w32_read_socket): If the dead key was produced using
Richard M. Stallman <rms@gnu.org>
parents:
15289
diff
changeset
|
2471 throw away the dead key if it was produced using |
008f373921e4
(w32_read_socket): If the dead key was produced using
Richard M. Stallman <rms@gnu.org>
parents:
15289
diff
changeset
|
2472 AltGr and there is a valid AltGr scan code for |
008f373921e4
(w32_read_socket): If the dead key was produced using
Richard M. Stallman <rms@gnu.org>
parents:
15289
diff
changeset
|
2473 this key. */ |
008f373921e4
(w32_read_socket): If the dead key was produced using
Richard M. Stallman <rms@gnu.org>
parents:
15289
diff
changeset
|
2474 if (is_dead_key (msg.msg.wParam) |
15651
b055a4ec9351
(w32_read_socket): Remove unused WM_ERASEBKGND code.
Karl Heuer <kwzh@gnu.org>
parents:
15616
diff
changeset
|
2475 && !((VkKeyScan ((char) bufp->code) & 0xff00) == 0x600)) |
14462
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2476 break; |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2477 |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2478 bufp += add; |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2479 numchars -= add; |
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
2480 count += add; |
13434 | 2481 } |
2482 else | |
2483 { | |
2484 abort (); | |
2485 } | |
2486 } | |
2487 break; | |
2488 case WM_MOUSEMOVE: | |
2489 if (dpyinfo->grabbed && last_mouse_frame | |
2490 && FRAME_LIVE_P (last_mouse_frame)) | |
2491 f = last_mouse_frame; | |
2492 else | |
2493 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | |
2494 | |
2495 if (f) | |
2496 note_mouse_movement (f, &msg.msg); | |
2497 else | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2498 clear_mouse_face (FRAME_W32_DISPLAY_INFO (f)); |
13434 | 2499 |
2500 break; | |
2501 case WM_LBUTTONDOWN: | |
2502 case WM_LBUTTONUP: | |
2503 case WM_MBUTTONDOWN: | |
2504 case WM_MBUTTONUP: | |
2505 case WM_RBUTTONDOWN: | |
2506 case WM_RBUTTONUP: | |
2507 { | |
2508 int button; | |
2509 int up; | |
2510 | |
2511 if (dpyinfo->grabbed && last_mouse_frame | |
2512 && FRAME_LIVE_P (last_mouse_frame)) | |
2513 f = last_mouse_frame; | |
2514 else | |
2515 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | |
2516 | |
2517 if (f) | |
2518 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2519 if ((!dpyinfo->w32_focus_frame || f == dpyinfo->w32_focus_frame) |
13434 | 2520 && (numchars >= 1)) |
2521 { | |
2522 construct_mouse_click (bufp, &msg, f); | |
2523 bufp++; | |
2524 count++; | |
2525 numchars--; | |
2526 } | |
2527 } | |
2528 | |
2529 parse_button (msg.msg.message, &button, &up); | |
2530 | |
2531 if (up) | |
2532 { | |
2533 dpyinfo->grabbed &= ~ (1 << button); | |
2534 } | |
2535 else | |
2536 { | |
2537 dpyinfo->grabbed |= (1 << button); | |
2538 last_mouse_frame = f; | |
2539 } | |
2540 } | |
2541 | |
2542 break; | |
2543 case WM_VSCROLL: | |
2544 { | |
2545 struct scroll_bar *bar = x_window_to_scroll_bar ((HWND)msg.msg.lParam); | |
2546 | |
2547 if (bar && numchars >= 1) | |
2548 { | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2549 if (x_scroll_bar_handle_click (bar, &msg, bufp)) |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2550 { |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2551 bufp++; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2552 count++; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2553 numchars--; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2554 } |
13434 | 2555 } |
2556 } | |
2557 | |
2558 break; | |
2559 case WM_MOVE: | |
2560 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | |
2561 | |
2562 if (f && !f->async_iconified) | |
2563 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2564 f->output_data.w32->left_pos = LOWORD (msg.msg.lParam); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2565 f->output_data.w32->top_pos = HIWORD (msg.msg.lParam); |
13434 | 2566 } |
2567 | |
2568 break; | |
2569 case WM_SIZE: | |
2570 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | |
2571 | |
2572 if (f && !f->async_iconified && msg.msg.wParam != SIZE_MINIMIZED) | |
2573 { | |
2574 RECT rect; | |
2575 int rows; | |
2576 int columns; | |
2577 int width; | |
2578 int height; | |
2579 | |
14351
fb2ce4ebc871
ubackout 1.3 and 1.4
Geoff Voelker <voelker@cs.washington.edu>
parents:
14248
diff
changeset
|
2580 GetClientRect(msg.msg.hwnd, &rect); |
13434 | 2581 |
2582 height = rect.bottom - rect.top + 1; | |
2583 width = rect.right - rect.left + 1; | |
2584 | |
2585 rows = PIXEL_TO_CHAR_HEIGHT (f, height); | |
2586 columns = PIXEL_TO_CHAR_WIDTH (f, width); | |
2587 | |
2588 /* Even if the number of character rows and columns has | |
2589 not changed, the font size may have changed, so we need | |
2590 to check the pixel dimensions as well. */ | |
2591 | |
2592 if (columns != f->width | |
2593 || rows != f->height | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2594 || width != f->output_data.w32->pixel_width |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2595 || height != f->output_data.w32->pixel_height) |
13434 | 2596 { |
2597 /* I had set this to 0, 0 - I am not sure why?? */ | |
2598 | |
2599 change_frame_size (f, rows, columns, 0, 1); | |
2600 SET_FRAME_GARBAGED (f); | |
2601 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2602 f->output_data.w32->pixel_width = width; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2603 f->output_data.w32->pixel_height = height; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2604 f->output_data.w32->win_gravity = NorthWestGravity; |
13434 | 2605 } |
2606 } | |
2607 | |
2608 break; | |
2609 case WM_SETFOCUS: | |
2610 case WM_KILLFOCUS: | |
2611 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | |
2612 | |
2613 if (msg.msg.message == WM_SETFOCUS) | |
2614 { | |
2615 x_new_focus_frame (dpyinfo, f); | |
2616 } | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2617 else if (f == dpyinfo->w32_focus_frame) |
13434 | 2618 x_new_focus_frame (dpyinfo, 0); |
2619 | |
2620 break; | |
2621 case WM_SYSCOMMAND: | |
15242
56c035c36875
(w32_read_socket): Mask out lower 4 bits of wParam
Geoff Voelker <voelker@cs.washington.edu>
parents:
15229
diff
changeset
|
2622 switch (msg.msg.wParam & 0xfff0) /* Lower 4 bits used by Windows. */ |
13434 | 2623 { |
2624 case SC_CLOSE: | |
2625 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | |
2626 | |
2627 if (f) | |
2628 { | |
2629 if (numchars == 0) | |
2630 abort (); | |
2631 | |
2632 bufp->kind = delete_window_event; | |
2633 XSETFRAME (bufp->frame_or_window, f); | |
2634 bufp++; | |
2635 count++; | |
2636 numchars--; | |
2637 } | |
2638 | |
2639 break; | |
2640 case SC_MINIMIZE: | |
2641 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | |
2642 | |
2643 if (f) | |
2644 { | |
2645 f->async_visible = 1; | |
2646 f->async_iconified = 1; | |
2647 | |
2648 bufp->kind = iconify_event; | |
2649 XSETFRAME (bufp->frame_or_window, f); | |
2650 bufp++; | |
2651 count++; | |
2652 numchars--; | |
2653 } | |
2654 | |
2655 break; | |
2656 case SC_MAXIMIZE: | |
2657 case SC_RESTORE: | |
2658 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | |
2659 | |
2660 if (f) | |
2661 { | |
2662 f->async_visible = 1; | |
2663 f->async_iconified = 0; | |
2664 | |
2665 /* wait_reading_process_input will notice this and update | |
2666 the frame's display structures. */ | |
2667 SET_FRAME_GARBAGED (f); | |
2668 | |
2669 if (f->iconified) | |
2670 { | |
2671 bufp->kind = deiconify_event; | |
2672 XSETFRAME (bufp->frame_or_window, f); | |
2673 bufp++; | |
2674 count++; | |
2675 numchars--; | |
2676 } | |
2677 else | |
2678 /* Force a redisplay sooner or later | |
2679 to update the frame titles | |
2680 in case this is the second frame. */ | |
2681 record_asynch_buffer_change (); | |
2682 } | |
2683 | |
2684 break; | |
2685 } | |
2686 | |
2687 break; | |
2688 case WM_CLOSE: | |
2689 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | |
2690 | |
2691 if (f) | |
2692 { | |
2693 if (numchars == 0) | |
2694 abort (); | |
2695 | |
2696 bufp->kind = delete_window_event; | |
2697 XSETFRAME (bufp->frame_or_window, f); | |
2698 bufp++; | |
2699 count++; | |
2700 numchars--; | |
2701 } | |
2702 | |
2703 break; | |
2704 case WM_COMMAND: | |
2705 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | |
2706 | |
2707 if (f) | |
2708 { | |
2709 if (msg.msg.lParam == 0) | |
2710 { | |
2711 /* Came from window menu */ | |
2712 | |
2713 extern Lisp_Object get_frame_menubar_event (); | |
2714 Lisp_Object event = get_frame_menubar_event (f, msg.msg.wParam); | |
2715 struct input_event buf; | |
2716 Lisp_Object frame; | |
2717 | |
2718 XSETFRAME (frame, f); | |
2719 buf.kind = menu_bar_event; | |
2720 | |
2721 /* Store initial menu bar event */ | |
2722 | |
2723 if (!NILP (event)) | |
2724 { | |
2725 buf.frame_or_window = Fcons (frame, Fcons (Qmenu_bar, Qnil)); | |
2726 kbd_buffer_store_event (&buf); | |
2727 } | |
2728 | |
2729 /* Enqueue the events */ | |
2730 | |
2731 while (!NILP (event)) | |
2732 { | |
2733 buf.frame_or_window = Fcons (frame, XCONS (event)->car); | |
2734 kbd_buffer_store_event (&buf); | |
2735 event = XCONS (event)->cdr; | |
2736 } | |
2737 } | |
2738 else | |
2739 { | |
2740 /* Came from popup menu */ | |
2741 } | |
2742 } | |
2743 break; | |
2744 } | |
2745 } | |
2746 | |
2747 /* If the focus was just given to an autoraising frame, | |
2748 raise it now. */ | |
2749 /* ??? This ought to be able to handle more than one such frame. */ | |
2750 if (pending_autoraise_frame) | |
2751 { | |
2752 x_raise_frame (pending_autoraise_frame); | |
2753 pending_autoraise_frame = 0; | |
2754 } | |
2755 | |
2756 UNBLOCK_INPUT; | |
2757 return count; | |
2758 } | |
2759 | |
2760 /* Drawing the cursor. */ | |
2761 | |
2762 | |
2763 /* Draw a hollow box cursor. Don't change the inside of the box. */ | |
2764 | |
2765 static void | |
2766 x_draw_box (f) | |
2767 struct frame *f; | |
2768 { | |
2769 RECT rect; | |
2770 HBRUSH hb; | |
2771 HDC hdc; | |
2772 | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2773 hdc = get_frame_dc (f); |
13434 | 2774 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2775 hb = CreateSolidBrush (f->output_data.w32->cursor_pixel); |
13434 | 2776 |
2777 rect.left = CHAR_TO_PIXEL_COL (f, curs_x); | |
2778 rect.top = CHAR_TO_PIXEL_ROW (f, curs_y); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2779 rect.right = rect.left + FONT_WIDTH (f->output_data.w32->font); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2780 rect.bottom = rect.top + f->output_data.w32->line_height; |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2781 |
13434 | 2782 FrameRect (hdc, &rect, hb); |
2783 DeleteObject (hb); | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2784 |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2785 release_frame_dc (f, hdc); |
13434 | 2786 } |
2787 | |
2788 /* Clear the cursor of frame F to background color, | |
2789 and mark the cursor as not shown. | |
2790 This is used when the text where the cursor is | |
2791 is about to be rewritten. */ | |
2792 | |
2793 static void | |
2794 clear_cursor (f) | |
2795 struct frame *f; | |
2796 { | |
2797 if (! FRAME_VISIBLE_P (f) | |
2798 || f->phys_cursor_x < 0) | |
2799 return; | |
2800 | |
2801 x_display_cursor (f, 0); | |
2802 f->phys_cursor_x = -1; | |
2803 } | |
2804 | |
2805 /* Redraw the glyph at ROW, COLUMN on frame F, in the style | |
2806 HIGHLIGHT. HIGHLIGHT is as defined for dumpglyphs. Return the | |
2807 glyph drawn. */ | |
2808 | |
2809 static void | |
2810 x_draw_single_glyph (f, row, column, glyph, highlight) | |
2811 struct frame *f; | |
2812 int row, column; | |
2813 GLYPH glyph; | |
2814 int highlight; | |
2815 { | |
2816 dumpglyphs (f, | |
2817 CHAR_TO_PIXEL_COL (f, column), | |
2818 CHAR_TO_PIXEL_ROW (f, row), | |
2819 &glyph, 1, highlight, 0); | |
2820 } | |
2821 | |
2822 static void | |
2823 x_display_bar_cursor (f, on) | |
2824 struct frame *f; | |
2825 int on; | |
2826 { | |
2827 struct frame_glyphs *current_glyphs = FRAME_CURRENT_GLYPHS (f); | |
2828 | |
2829 /* This is pointless on invisible frames, and dangerous on garbaged | |
2830 frames; in the latter case, the frame may be in the midst of | |
2831 changing its size, and curs_x and curs_y may be off the frame. */ | |
2832 if (! FRAME_VISIBLE_P (f) || FRAME_GARBAGED_P (f)) | |
2833 return; | |
2834 | |
2835 if (! on && f->phys_cursor_x < 0) | |
2836 return; | |
2837 | |
2838 /* If we're not updating, then we want to use the current frame's | |
2839 cursor position, not our local idea of where the cursor ought to be. */ | |
2840 if (f != updating_frame) | |
2841 { | |
2842 curs_x = FRAME_CURSOR_X (f); | |
2843 curs_y = FRAME_CURSOR_Y (f); | |
2844 } | |
2845 | |
2846 /* If there is anything wrong with the current cursor state, remove it. */ | |
2847 if (f->phys_cursor_x >= 0 | |
2848 && (!on | |
2849 || f->phys_cursor_x != curs_x | |
2850 || f->phys_cursor_y != curs_y | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2851 || f->output_data.w32->current_cursor != bar_cursor)) |
13434 | 2852 { |
2853 /* Erase the cursor by redrawing the character underneath it. */ | |
2854 x_draw_single_glyph (f, f->phys_cursor_y, f->phys_cursor_x, | |
2855 f->phys_cursor_glyph, | |
2856 current_glyphs->highlight[f->phys_cursor_y]); | |
2857 f->phys_cursor_x = -1; | |
2858 } | |
2859 | |
2860 /* If we now need a cursor in the new place or in the new form, do it so. */ | |
2861 if (on | |
2862 && (f->phys_cursor_x < 0 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2863 || (f->output_data.w32->current_cursor != bar_cursor))) |
13434 | 2864 { |
2865 f->phys_cursor_glyph | |
2866 = ((current_glyphs->enable[curs_y] | |
2867 && curs_x < current_glyphs->used[curs_y]) | |
2868 ? current_glyphs->glyphs[curs_y][curs_x] | |
2869 : SPACEGLYPH); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2870 w32_fill_area (f, NULL, f->output_data.w32->cursor_pixel, |
13434 | 2871 CHAR_TO_PIXEL_COL (f, curs_x), |
2872 CHAR_TO_PIXEL_ROW (f, curs_y), | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2873 max (f->output_data.w32->cursor_width, 1), |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2874 f->output_data.w32->line_height); |
13434 | 2875 |
2876 f->phys_cursor_x = curs_x; | |
2877 f->phys_cursor_y = curs_y; | |
2878 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2879 f->output_data.w32->current_cursor = bar_cursor; |
13434 | 2880 } |
2881 } | |
2882 | |
2883 | |
2884 /* Turn the displayed cursor of frame F on or off according to ON. | |
2885 If ON is nonzero, where to put the cursor is specified | |
2886 by F->cursor_x and F->cursor_y. */ | |
2887 | |
2888 static void | |
2889 x_display_box_cursor (f, on) | |
2890 struct frame *f; | |
2891 int on; | |
2892 { | |
2893 struct frame_glyphs *current_glyphs = FRAME_CURRENT_GLYPHS (f); | |
2894 | |
2895 /* This is pointless on invisible frames, and dangerous on garbaged | |
2896 frames; in the latter case, the frame may be in the midst of | |
2897 changing its size, and curs_x and curs_y may be off the frame. */ | |
2898 if (! FRAME_VISIBLE_P (f) || FRAME_GARBAGED_P (f)) | |
2899 return; | |
2900 | |
2901 /* If cursor is off and we want it off, return quickly. */ | |
2902 if (!on && f->phys_cursor_x < 0) | |
2903 return; | |
2904 | |
2905 /* If we're not updating, then we want to use the current frame's | |
2906 cursor position, not our local idea of where the cursor ought to be. */ | |
2907 if (f != updating_frame) | |
2908 { | |
2909 curs_x = FRAME_CURSOR_X (f); | |
2910 curs_y = FRAME_CURSOR_Y (f); | |
2911 } | |
2912 | |
2913 /* If cursor is currently being shown and we don't want it to be | |
2914 or it is in the wrong place, | |
2915 or we want a hollow box and it's not so, (pout!) | |
2916 erase it. */ | |
2917 if (f->phys_cursor_x >= 0 | |
2918 && (!on | |
2919 || f->phys_cursor_x != curs_x | |
2920 || f->phys_cursor_y != curs_y | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2921 || (f->output_data.w32->current_cursor != hollow_box_cursor |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2922 && (f != FRAME_W32_DISPLAY_INFO (f)->w32_highlight_frame)))) |
13434 | 2923 { |
2924 int mouse_face_here = 0; | |
2925 struct frame_glyphs *active_glyphs = FRAME_CURRENT_GLYPHS (f); | |
2926 | |
2927 /* If the cursor is in the mouse face area, redisplay that when | |
2928 we clear the cursor. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2929 if (f == FRAME_W32_DISPLAY_INFO (f)->mouse_face_mouse_frame |
13434 | 2930 && |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2931 (f->phys_cursor_y > FRAME_W32_DISPLAY_INFO (f)->mouse_face_beg_row |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2932 || (f->phys_cursor_y == FRAME_W32_DISPLAY_INFO (f)->mouse_face_beg_row |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2933 && f->phys_cursor_x >= FRAME_W32_DISPLAY_INFO (f)->mouse_face_beg_col)) |
13434 | 2934 && |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2935 (f->phys_cursor_y < FRAME_W32_DISPLAY_INFO (f)->mouse_face_end_row |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2936 || (f->phys_cursor_y == FRAME_W32_DISPLAY_INFO (f)->mouse_face_end_row |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2937 && f->phys_cursor_x < FRAME_W32_DISPLAY_INFO (f)->mouse_face_end_col)) |
13434 | 2938 /* Don't redraw the cursor's spot in mouse face |
2939 if it is at the end of a line (on a newline). | |
2940 The cursor appears there, but mouse highlighting does not. */ | |
2941 && active_glyphs->used[f->phys_cursor_y] > f->phys_cursor_x) | |
2942 mouse_face_here = 1; | |
2943 | |
2944 /* If the font is not as tall as a whole line, | |
2945 we must explicitly clear the line's whole height. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2946 if (FONT_HEIGHT (f->output_data.w32->font) != f->output_data.w32->line_height) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2947 w32_clear_area (f, NULL, |
13434 | 2948 CHAR_TO_PIXEL_COL (f, f->phys_cursor_x), |
2949 CHAR_TO_PIXEL_ROW (f, f->phys_cursor_y), | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2950 FONT_WIDTH (f->output_data.w32->font), |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2951 f->output_data.w32->line_height); |
13434 | 2952 /* Erase the cursor by redrawing the character underneath it. */ |
2953 x_draw_single_glyph (f, f->phys_cursor_y, f->phys_cursor_x, | |
2954 f->phys_cursor_glyph, | |
2955 (mouse_face_here | |
2956 ? 3 | |
2957 : current_glyphs->highlight[f->phys_cursor_y])); | |
2958 f->phys_cursor_x = -1; | |
2959 } | |
2960 | |
2961 /* If we want to show a cursor, | |
2962 or we want a box cursor and it's not so, | |
2963 write it in the right place. */ | |
2964 if (on | |
2965 && (f->phys_cursor_x < 0 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2966 || (f->output_data.w32->current_cursor != filled_box_cursor |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2967 && f == FRAME_W32_DISPLAY_INFO (f)->w32_highlight_frame))) |
13434 | 2968 { |
2969 f->phys_cursor_glyph | |
2970 = ((current_glyphs->enable[curs_y] | |
2971 && curs_x < current_glyphs->used[curs_y]) | |
2972 ? current_glyphs->glyphs[curs_y][curs_x] | |
2973 : SPACEGLYPH); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2974 if (f != FRAME_W32_DISPLAY_INFO (f)->w32_highlight_frame) |
13434 | 2975 { |
2976 x_draw_box (f); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2977 f->output_data.w32->current_cursor = hollow_box_cursor; |
13434 | 2978 } |
2979 else | |
2980 { | |
2981 x_draw_single_glyph (f, curs_y, curs_x, | |
2982 f->phys_cursor_glyph, 2); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2983 f->output_data.w32->current_cursor = filled_box_cursor; |
13434 | 2984 } |
2985 | |
2986 f->phys_cursor_x = curs_x; | |
2987 f->phys_cursor_y = curs_y; | |
2988 } | |
2989 } | |
2990 | |
2991 x_display_cursor (f, on) | |
2992 struct frame *f; | |
2993 int on; | |
2994 { | |
2995 BLOCK_INPUT; | |
2996 | |
2997 if (FRAME_DESIRED_CURSOR (f) == filled_box_cursor) | |
2998 x_display_box_cursor (f, on); | |
2999 else if (FRAME_DESIRED_CURSOR (f) == bar_cursor) | |
3000 x_display_bar_cursor (f, on); | |
3001 else | |
3002 /* Those are the only two we have implemented! */ | |
3003 abort (); | |
3004 | |
3005 UNBLOCK_INPUT; | |
3006 } | |
3007 | |
3008 /* Changing the font of the frame. */ | |
3009 | |
3010 /* Give frame F the font named FONTNAME as its default font, and | |
3011 return the full name of that font. FONTNAME may be a wildcard | |
3012 pattern; in that case, we choose some font that fits the pattern. | |
3013 The return value shows which font we chose. */ | |
3014 | |
3015 Lisp_Object | |
3016 x_new_font (f, fontname) | |
3017 struct frame *f; | |
3018 register char *fontname; | |
3019 { | |
3020 int already_loaded; | |
3021 int n_matching_fonts; | |
3022 XFontStruct *font_info; | |
3023 char new_font_name[101]; | |
3024 | |
3025 /* Get a font which matches this name */ | |
3026 { | |
3027 LOGFONT lf; | |
3028 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3029 if (!x_to_w32_font(fontname, &lf) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3030 || !w32_to_x_font(&lf, new_font_name, 100)) |
13434 | 3031 { |
3032 return Qnil; | |
3033 } | |
3034 } | |
3035 | |
3036 /* See if we've already loaded a matching font. */ | |
3037 already_loaded = -1; | |
3038 | |
3039 { | |
3040 int i; | |
3041 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3042 for (i = 0; i < FRAME_W32_DISPLAY_INFO (f)->n_fonts; i++) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3043 if (!strcmp (FRAME_W32_DISPLAY_INFO (f)->font_table[i].name, new_font_name)) |
13434 | 3044 { |
3045 already_loaded = i; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3046 fontname = FRAME_W32_DISPLAY_INFO (f)->font_table[i].name; |
13434 | 3047 break; |
3048 } | |
3049 } | |
3050 | |
3051 /* If we have, just return it from the table. */ | |
3052 if (already_loaded >= 0) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3053 f->output_data.w32->font = FRAME_W32_DISPLAY_INFO (f)->font_table[already_loaded].font; |
13434 | 3054 /* Otherwise, load the font and add it to the table. */ |
3055 else | |
3056 { | |
3057 XFontStruct *font; | |
3058 int n_fonts; | |
3059 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3060 font = w32_load_font(FRAME_W32_DISPLAY_INFO (f), fontname); |
13434 | 3061 |
3062 if (! font) | |
3063 { | |
3064 return Qnil; | |
3065 } | |
3066 | |
3067 /* Do we need to create the table? */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3068 if (FRAME_W32_DISPLAY_INFO (f)->font_table_size == 0) |
13434 | 3069 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3070 FRAME_W32_DISPLAY_INFO (f)->font_table_size = 16; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3071 FRAME_W32_DISPLAY_INFO (f)->font_table |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3072 = (struct font_info *) xmalloc (FRAME_W32_DISPLAY_INFO (f)->font_table_size |
13434 | 3073 * sizeof (struct font_info)); |
3074 } | |
3075 /* Do we need to grow the table? */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3076 else if (FRAME_W32_DISPLAY_INFO (f)->n_fonts |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3077 >= FRAME_W32_DISPLAY_INFO (f)->font_table_size) |
13434 | 3078 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3079 FRAME_W32_DISPLAY_INFO (f)->font_table_size *= 2; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3080 FRAME_W32_DISPLAY_INFO (f)->font_table |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3081 = (struct font_info *) xrealloc (FRAME_W32_DISPLAY_INFO (f)->font_table, |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3082 (FRAME_W32_DISPLAY_INFO (f)->font_table_size |
13434 | 3083 * sizeof (struct font_info))); |
3084 } | |
3085 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3086 n_fonts = FRAME_W32_DISPLAY_INFO (f)->n_fonts; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3087 FRAME_W32_DISPLAY_INFO (f)->font_table[n_fonts].name = (char *) xmalloc (strlen (fontname) + 1); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3088 bcopy (fontname, FRAME_W32_DISPLAY_INFO (f)->font_table[n_fonts].name, strlen (fontname) + 1); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3089 f->output_data.w32->font = FRAME_W32_DISPLAY_INFO (f)->font_table[n_fonts].font = font; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3090 FRAME_W32_DISPLAY_INFO (f)->n_fonts++; |
13434 | 3091 } |
3092 | |
3093 /* Compute the scroll bar width in character columns. */ | |
3094 if (f->scroll_bar_pixel_width > 0) | |
3095 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3096 int wid = FONT_WIDTH (f->output_data.w32->font); |
13434 | 3097 f->scroll_bar_cols = (f->scroll_bar_pixel_width + wid-1) / wid; |
3098 } | |
3099 else | |
3100 f->scroll_bar_cols = 2; | |
3101 | |
3102 /* Now make the frame display the given font. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3103 if (FRAME_W32_WINDOW (f) != 0) |
13434 | 3104 { |
3105 frame_update_line_height (f); | |
3106 x_set_window_size (f, 0, f->width, f->height); | |
3107 } | |
3108 else | |
3109 /* If we are setting a new frame's font for the first time, | |
3110 there are no faces yet, so this font's height is the line height. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3111 f->output_data.w32->line_height = FONT_HEIGHT (f->output_data.w32->font); |
13434 | 3112 |
3113 { | |
3114 Lisp_Object lispy_name; | |
3115 | |
3116 lispy_name = build_string (fontname); | |
3117 | |
3118 return lispy_name; | |
3119 } | |
3120 } | |
3121 | |
3122 x_calc_absolute_position (f) | |
3123 struct frame *f; | |
3124 { | |
3125 Window win, child; | |
3126 POINT pt; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3127 int flags = f->output_data.w32->size_hint_flags; |
13434 | 3128 |
3129 pt.x = pt.y = 0; | |
3130 | |
3131 /* Find the position of the outside upper-left corner of | |
3132 the inner window, with respect to the outer window. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3133 if (f->output_data.w32->parent_desc != FRAME_W32_DISPLAY_INFO (f)->root_window) |
13434 | 3134 { |
3135 BLOCK_INPUT; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3136 MapWindowPoints (FRAME_W32_WINDOW (f), |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3137 f->output_data.w32->parent_desc, |
13434 | 3138 &pt, 1); |
3139 UNBLOCK_INPUT; | |
3140 } | |
3141 | |
3142 { | |
3143 RECT rt; | |
3144 rt.left = rt.right = rt.top = rt.bottom = 0; | |
3145 | |
3146 BLOCK_INPUT; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3147 AdjustWindowRect(&rt, f->output_data.w32->dwStyle, |
14351
fb2ce4ebc871
ubackout 1.3 and 1.4
Geoff Voelker <voelker@cs.washington.edu>
parents:
14248
diff
changeset
|
3148 FRAME_EXTERNAL_MENU_BAR (f)); |
13434 | 3149 UNBLOCK_INPUT; |
3150 | |
3151 pt.x += (rt.right - rt.left); | |
3152 pt.y += (rt.bottom - rt.top); | |
3153 } | |
3154 | |
3155 /* Treat negative positions as relative to the leftmost bottommost | |
3156 position that fits on the screen. */ | |
3157 if (flags & XNegative) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3158 f->output_data.w32->left_pos = (FRAME_W32_DISPLAY_INFO (f)->width |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3159 - 2 * f->output_data.w32->border_width - pt.x |
13434 | 3160 - PIXEL_WIDTH (f) |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3161 + f->output_data.w32->left_pos); |
13434 | 3162 |
3163 if (flags & YNegative) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3164 f->output_data.w32->top_pos = (FRAME_W32_DISPLAY_INFO (f)->height |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3165 - 2 * f->output_data.w32->border_width - pt.y |
13434 | 3166 - PIXEL_HEIGHT (f) |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3167 + f->output_data.w32->top_pos); |
13434 | 3168 /* The left_pos and top_pos |
3169 are now relative to the top and left screen edges, | |
3170 so the flags should correspond. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3171 f->output_data.w32->size_hint_flags &= ~ (XNegative | YNegative); |
13434 | 3172 } |
3173 | |
3174 /* CHANGE_GRAVITY is 1 when calling from Fset_frame_position, | |
3175 to really change the position, and 0 when calling from | |
3176 x_make_frame_visible (in that case, XOFF and YOFF are the current | |
3177 position values). It is -1 when calling from x_set_frame_parameters, | |
3178 which means, do adjust for borders but don't change the gravity. */ | |
3179 | |
3180 x_set_offset (f, xoff, yoff, change_gravity) | |
3181 struct frame *f; | |
3182 register int xoff, yoff; | |
3183 int change_gravity; | |
3184 { | |
3185 int modified_top, modified_left; | |
3186 | |
3187 if (change_gravity > 0) | |
3188 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3189 f->output_data.w32->top_pos = yoff; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3190 f->output_data.w32->left_pos = xoff; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3191 f->output_data.w32->size_hint_flags &= ~ (XNegative | YNegative); |
13434 | 3192 if (xoff < 0) |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3193 f->output_data.w32->size_hint_flags |= XNegative; |
13434 | 3194 if (yoff < 0) |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3195 f->output_data.w32->size_hint_flags |= YNegative; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3196 f->output_data.w32->win_gravity = NorthWestGravity; |
13434 | 3197 } |
3198 x_calc_absolute_position (f); | |
3199 | |
3200 BLOCK_INPUT; | |
3201 x_wm_set_size_hint (f, (long) 0, 0); | |
3202 | |
3203 /* It is a mystery why we need to add the border_width here | |
3204 when the frame is already visible, but experiment says we do. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3205 modified_left = f->output_data.w32->left_pos; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3206 modified_top = f->output_data.w32->top_pos; |
13434 | 3207 if (change_gravity != 0) |
3208 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3209 modified_left += f->output_data.w32->border_width; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3210 modified_top += f->output_data.w32->border_width; |
13434 | 3211 } |
3212 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3213 my_set_window_pos (FRAME_W32_WINDOW (f), |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3214 NULL, |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3215 modified_left, modified_top, |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3216 0,0, |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3217 SWP_NOZORDER | SWP_NOSIZE); |
13434 | 3218 UNBLOCK_INPUT; |
3219 } | |
3220 | |
3221 /* Call this to change the size of frame F's x-window. | |
3222 If CHANGE_GRAVITY is 1, we change to top-left-corner window gravity | |
3223 for this size change and subsequent size changes. | |
3224 Otherwise we leave the window gravity unchanged. */ | |
3225 | |
3226 x_set_window_size (f, change_gravity, cols, rows) | |
3227 struct frame *f; | |
3228 int change_gravity; | |
3229 int cols, rows; | |
3230 { | |
3231 int pixelwidth, pixelheight; | |
3232 | |
3233 BLOCK_INPUT; | |
3234 | |
3235 check_frame_size (f, &rows, &cols); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3236 f->output_data.w32->vertical_scroll_bar_extra |
13434 | 3237 = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f) |
3238 ? 0 | |
3239 : FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0 | |
3240 ? FRAME_SCROLL_BAR_PIXEL_WIDTH (f) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3241 : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.w32->font))); |
13434 | 3242 pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols); |
3243 pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows); | |
3244 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3245 f->output_data.w32->win_gravity = NorthWestGravity; |
13434 | 3246 x_wm_set_size_hint (f, (long) 0, 0); |
3247 | |
3248 { | |
3249 RECT rect; | |
3250 | |
3251 rect.left = rect.top = 0; | |
3252 rect.right = pixelwidth; | |
3253 rect.bottom = pixelheight; | |
3254 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3255 AdjustWindowRect(&rect, f->output_data.w32->dwStyle, |
14351
fb2ce4ebc871
ubackout 1.3 and 1.4
Geoff Voelker <voelker@cs.washington.edu>
parents:
14248
diff
changeset
|
3256 FRAME_EXTERNAL_MENU_BAR (f)); |
13434 | 3257 |
3258 /* All windows have an extra pixel */ | |
3259 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3260 my_set_window_pos (FRAME_W32_WINDOW (f), |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3261 NULL, |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3262 0, 0, |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3263 rect.right - rect.left + 1, |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3264 rect.bottom - rect.top + 1, |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3265 SWP_NOZORDER | SWP_NOMOVE); |
13434 | 3266 } |
3267 | |
3268 /* Now, strictly speaking, we can't be sure that this is accurate, | |
3269 but the window manager will get around to dealing with the size | |
3270 change request eventually, and we'll hear how it went when the | |
3271 ConfigureNotify event gets here. | |
3272 | |
3273 We could just not bother storing any of this information here, | |
3274 and let the ConfigureNotify event set everything up, but that | |
3275 might be kind of confusing to the lisp code, since size changes | |
3276 wouldn't be reported in the frame parameters until some random | |
3277 point in the future when the ConfigureNotify event arrives. */ | |
3278 change_frame_size (f, rows, cols, 0, 0); | |
3279 PIXEL_WIDTH (f) = pixelwidth; | |
3280 PIXEL_HEIGHT (f) = pixelheight; | |
3281 | |
3282 /* If cursor was outside the new size, mark it as off. */ | |
3283 if (f->phys_cursor_y >= rows | |
3284 || f->phys_cursor_x >= cols) | |
3285 { | |
3286 f->phys_cursor_x = -1; | |
3287 f->phys_cursor_y = -1; | |
3288 } | |
3289 | |
3290 /* We've set {FRAME,PIXEL}_{WIDTH,HEIGHT} to the values we hope to | |
3291 receive in the ConfigureNotify event; if we get what we asked | |
3292 for, then the event won't cause the screen to become garbaged, so | |
3293 we have to make sure to do it here. */ | |
3294 SET_FRAME_GARBAGED (f); | |
3295 | |
3296 UNBLOCK_INPUT; | |
3297 } | |
3298 | |
3299 /* Mouse warping. */ | |
3300 | |
3301 void | |
15616
a73836346910
(x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents:
15435
diff
changeset
|
3302 x_set_mouse_pixel_position (f, pix_x, pix_y) |
a73836346910
(x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents:
15435
diff
changeset
|
3303 struct frame *f; |
a73836346910
(x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents:
15435
diff
changeset
|
3304 int pix_x, pix_y; |
a73836346910
(x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents:
15435
diff
changeset
|
3305 { |
a73836346910
(x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents:
15435
diff
changeset
|
3306 BLOCK_INPUT; |
a73836346910
(x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents:
15435
diff
changeset
|
3307 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3308 pix_x += f->output_data.w32->left_pos; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3309 pix_y += f->output_data.w32->top_pos; |
15616
a73836346910
(x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents:
15435
diff
changeset
|
3310 |
a73836346910
(x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents:
15435
diff
changeset
|
3311 SetCursorPos (pix_x, pix_y); |
a73836346910
(x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents:
15435
diff
changeset
|
3312 |
a73836346910
(x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents:
15435
diff
changeset
|
3313 UNBLOCK_INPUT; |
a73836346910
(x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents:
15435
diff
changeset
|
3314 } |
a73836346910
(x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents:
15435
diff
changeset
|
3315 |
a73836346910
(x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents:
15435
diff
changeset
|
3316 void |
13434 | 3317 x_set_mouse_position (f, x, y) |
3318 struct frame *f; | |
3319 int x, y; | |
3320 { | |
3321 int pix_x, pix_y; | |
3322 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3323 pix_x = CHAR_TO_PIXEL_COL (f, x) + FONT_WIDTH (f->output_data.w32->font) / 2; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3324 pix_y = CHAR_TO_PIXEL_ROW (f, y) + f->output_data.w32->line_height / 2; |
13434 | 3325 |
3326 if (pix_x < 0) pix_x = 0; | |
3327 if (pix_x > PIXEL_WIDTH (f)) pix_x = PIXEL_WIDTH (f); | |
3328 | |
3329 if (pix_y < 0) pix_y = 0; | |
3330 if (pix_y > PIXEL_HEIGHT (f)) pix_y = PIXEL_HEIGHT (f); | |
3331 | |
15616
a73836346910
(x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents:
15435
diff
changeset
|
3332 x_set_mouse_pixel_position (f, pix_x, pix_y); |
13434 | 3333 } |
3334 | |
3335 /* focus shifting, raising and lowering. */ | |
3336 | |
3337 x_focus_on_frame (f) | |
3338 struct frame *f; | |
3339 { | |
3340 } | |
3341 | |
3342 x_unfocus_frame (f) | |
3343 struct frame *f; | |
3344 { | |
3345 } | |
3346 | |
3347 /* Raise frame F. */ | |
3348 | |
3349 x_raise_frame (f) | |
3350 struct frame *f; | |
3351 { | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3352 // if (f->async_visible) |
13434 | 3353 { |
3354 BLOCK_INPUT; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3355 my_set_window_pos (FRAME_W32_WINDOW (f), |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3356 HWND_TOP, |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3357 0, 0, 0, 0, |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3358 SWP_NOSIZE | SWP_NOMOVE); |
13434 | 3359 UNBLOCK_INPUT; |
3360 } | |
3361 } | |
3362 | |
3363 /* Lower frame F. */ | |
3364 | |
3365 x_lower_frame (f) | |
3366 struct frame *f; | |
3367 { | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3368 // if (f->async_visible) |
13434 | 3369 { |
3370 BLOCK_INPUT; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3371 my_set_window_pos (FRAME_W32_WINDOW (f), |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3372 HWND_BOTTOM, |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3373 0, 0, 0, 0, |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3374 SWP_NOSIZE | SWP_NOMOVE); |
13434 | 3375 UNBLOCK_INPUT; |
3376 } | |
3377 } | |
3378 | |
3379 static void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3380 w32_frame_raise_lower (f, raise) |
13434 | 3381 FRAME_PTR f; |
3382 int raise; | |
3383 { | |
3384 if (raise) | |
3385 x_raise_frame (f); | |
3386 else | |
3387 x_lower_frame (f); | |
3388 } | |
3389 | |
3390 /* Change of visibility. */ | |
3391 | |
3392 /* This tries to wait until the frame is really visible. | |
3393 However, if the window manager asks the user where to position | |
3394 the frame, this will return before the user finishes doing that. | |
3395 The frame will not actually be visible at that time, | |
3396 but it will become visible later when the window manager | |
3397 finishes with it. */ | |
3398 | |
3399 x_make_frame_visible (f) | |
3400 struct frame *f; | |
3401 { | |
3402 BLOCK_INPUT; | |
3403 | |
3404 if (! FRAME_VISIBLE_P (f)) | |
3405 { | |
3406 /* We test FRAME_GARBAGED_P here to make sure we don't | |
3407 call x_set_offset a second time | |
3408 if we get to x_make_frame_visible a second time | |
3409 before the window gets really visible. */ | |
3410 if (! FRAME_ICONIFIED_P (f) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3411 && ! f->output_data.w32->asked_for_visible) |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3412 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3413 x_set_offset (f, f->output_data.w32->left_pos, f->output_data.w32->top_pos, 0); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3414 // SetForegroundWindow (FRAME_W32_WINDOW (f)); |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3415 } |
13434 | 3416 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3417 f->output_data.w32->asked_for_visible = 1; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3418 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3419 my_show_window (FRAME_W32_WINDOW (f), SW_SHOWNORMAL); |
13434 | 3420 } |
3421 | |
3422 /* Synchronize to ensure Emacs knows the frame is visible | |
3423 before we do anything else. We do this loop with input not blocked | |
3424 so that incoming events are handled. */ | |
3425 { | |
3426 Lisp_Object frame; | |
3427 int count = input_signal_count; | |
3428 | |
3429 /* This must come after we set COUNT. */ | |
3430 UNBLOCK_INPUT; | |
3431 | |
3432 XSETFRAME (frame, f); | |
3433 | |
3434 while (1) | |
3435 { | |
3436 /* Once we have handled input events, | |
3437 we should have received the MapNotify if one is coming. | |
3438 So if we have not got it yet, stop looping. | |
3439 Some window managers make their own decisions | |
3440 about visibility. */ | |
3441 if (input_signal_count != count) | |
3442 break; | |
3443 /* Machines that do polling rather than SIGIO have been observed | |
3444 to go into a busy-wait here. So we'll fake an alarm signal | |
3445 to let the handler know that there's something to be read. | |
3446 We used to raise a real alarm, but it seems that the handler | |
3447 isn't always enabled here. This is probably a bug. */ | |
3448 if (input_polling_used ()) | |
3449 { | |
3450 /* It could be confusing if a real alarm arrives while processing | |
3451 the fake one. Turn it off and let the handler reset it. */ | |
3452 alarm (0); | |
3453 input_poll_signal (); | |
3454 } | |
3455 /* Once we have handled input events, | |
3456 we should have received the MapNotify if one is coming. | |
3457 So if we have not got it yet, stop looping. | |
3458 Some window managers make their own decisions | |
3459 about visibility. */ | |
3460 if (input_signal_count != count) | |
3461 break; | |
3462 } | |
3463 FRAME_SAMPLE_VISIBILITY (f); | |
3464 } | |
3465 } | |
3466 | |
3467 /* Change from mapped state to withdrawn state. */ | |
3468 | |
3469 /* Make the frame visible (mapped and not iconified). */ | |
3470 | |
3471 x_make_frame_invisible (f) | |
3472 struct frame *f; | |
3473 { | |
3474 Window window; | |
3475 | |
3476 /* Don't keep the highlight on an invisible frame. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3477 if (FRAME_W32_DISPLAY_INFO (f)->w32_highlight_frame == f) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3478 FRAME_W32_DISPLAY_INFO (f)->w32_highlight_frame = 0; |
13434 | 3479 |
3480 BLOCK_INPUT; | |
3481 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3482 my_show_window (FRAME_W32_WINDOW (f), SW_HIDE); |
13434 | 3483 |
3484 /* We can't distinguish this from iconification | |
3485 just by the event that we get from the server. | |
3486 So we can't win using the usual strategy of letting | |
3487 FRAME_SAMPLE_VISIBILITY set this. So do it by hand, | |
3488 and synchronize with the server to make sure we agree. */ | |
3489 f->visible = 0; | |
3490 FRAME_ICONIFIED_P (f) = 0; | |
3491 f->async_visible = 0; | |
3492 f->async_iconified = 0; | |
3493 | |
3494 UNBLOCK_INPUT; | |
3495 } | |
3496 | |
3497 /* Change window state from mapped to iconified. */ | |
3498 | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3499 void |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3500 x_iconify_frame (f) |
13434 | 3501 struct frame *f; |
3502 { | |
3503 int result; | |
3504 | |
3505 /* Don't keep the highlight on an invisible frame. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3506 if (FRAME_W32_DISPLAY_INFO (f)->w32_highlight_frame == f) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3507 FRAME_W32_DISPLAY_INFO (f)->w32_highlight_frame = 0; |
13434 | 3508 |
3509 if (f->async_iconified) | |
3510 return; | |
3511 | |
3512 BLOCK_INPUT; | |
3513 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3514 my_show_window (FRAME_W32_WINDOW (f), SW_SHOWMINIMIZED); |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3515 /* The frame doesn't seem to be lowered automatically. */ |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3516 x_lower_frame (f); |
13434 | 3517 |
3518 f->async_iconified = 1; | |
3519 | |
3520 UNBLOCK_INPUT; | |
3521 } | |
3522 | |
3523 /* Destroy the window of frame F. */ | |
3524 | |
3525 x_destroy_window (f) | |
3526 struct frame *f; | |
3527 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3528 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
13434 | 3529 |
3530 BLOCK_INPUT; | |
3531 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3532 my_destroy_window (f, FRAME_W32_WINDOW (f)); |
13434 | 3533 free_frame_menubar (f); |
3534 free_frame_faces (f); | |
3535 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3536 xfree (f->output_data.w32); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3537 f->output_data.w32 = 0; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3538 if (f == dpyinfo->w32_focus_frame) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3539 dpyinfo->w32_focus_frame = 0; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3540 if (f == dpyinfo->w32_focus_event_frame) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3541 dpyinfo->w32_focus_event_frame = 0; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3542 if (f == dpyinfo->w32_highlight_frame) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3543 dpyinfo->w32_highlight_frame = 0; |
13434 | 3544 |
3545 dpyinfo->reference_count--; | |
3546 | |
3547 if (f == dpyinfo->mouse_face_mouse_frame) | |
3548 { | |
3549 dpyinfo->mouse_face_beg_row | |
3550 = dpyinfo->mouse_face_beg_col = -1; | |
3551 dpyinfo->mouse_face_end_row | |
3552 = dpyinfo->mouse_face_end_col = -1; | |
3553 dpyinfo->mouse_face_window = Qnil; | |
3554 } | |
3555 | |
3556 UNBLOCK_INPUT; | |
3557 } | |
3558 | |
3559 /* Setting window manager hints. */ | |
3560 | |
3561 /* Set the normal size hints for the window manager, for frame F. | |
3562 FLAGS is the flags word to use--or 0 meaning preserve the flags | |
3563 that the window now has. | |
3564 If USER_POSITION is nonzero, we set the USPosition | |
3565 flag (this is useful when FLAGS is 0). */ | |
3566 | |
3567 x_wm_set_size_hint (f, flags, user_position) | |
3568 struct frame *f; | |
3569 long flags; | |
3570 int user_position; | |
3571 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3572 Window window = FRAME_W32_WINDOW (f); |
13434 | 3573 |
3574 flexlines = f->height; | |
3575 | |
14351
fb2ce4ebc871
ubackout 1.3 and 1.4
Geoff Voelker <voelker@cs.washington.edu>
parents:
14248
diff
changeset
|
3576 enter_crit (); |
13434 | 3577 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3578 SetWindowLong (window, WND_X_UNITS_INDEX, FONT_WIDTH (f->output_data.w32->font)); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3579 SetWindowLong (window, WND_Y_UNITS_INDEX, f->output_data.w32->line_height); |
13434 | 3580 |
14351
fb2ce4ebc871
ubackout 1.3 and 1.4
Geoff Voelker <voelker@cs.washington.edu>
parents:
14248
diff
changeset
|
3581 leave_crit (); |
13434 | 3582 } |
3583 | |
3584 /* Window manager things */ | |
3585 x_wm_set_icon_position (f, icon_x, icon_y) | |
3586 struct frame *f; | |
3587 int icon_x, icon_y; | |
3588 { | |
3589 #if 0 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3590 Window window = FRAME_W32_WINDOW (f); |
13434 | 3591 |
3592 f->display.x->wm_hints.flags |= IconPositionHint; | |
3593 f->display.x->wm_hints.icon_x = icon_x; | |
3594 f->display.x->wm_hints.icon_y = icon_y; | |
3595 | |
3596 XSetWMHints (FRAME_X_DISPLAY (f), window, &f->display.x->wm_hints); | |
3597 #endif | |
3598 } | |
3599 | |
3600 | |
3601 /* Initialization. */ | |
3602 | |
3603 #ifdef USE_X_TOOLKIT | |
3604 static XrmOptionDescRec emacs_options[] = { | |
3605 {"-geometry", ".geometry", XrmoptionSepArg, NULL}, | |
3606 {"-iconic", ".iconic", XrmoptionNoArg, (XtPointer) "yes"}, | |
3607 | |
3608 {"-internal-border-width", "*EmacsScreen.internalBorderWidth", | |
3609 XrmoptionSepArg, NULL}, | |
3610 {"-ib", "*EmacsScreen.internalBorderWidth", XrmoptionSepArg, NULL}, | |
3611 | |
3612 {"-T", "*EmacsShell.title", XrmoptionSepArg, (XtPointer) NULL}, | |
3613 {"-wn", "*EmacsShell.title", XrmoptionSepArg, (XtPointer) NULL}, | |
3614 {"-title", "*EmacsShell.title", XrmoptionSepArg, (XtPointer) NULL}, | |
3615 {"-iconname", "*EmacsShell.iconName", XrmoptionSepArg, (XtPointer) NULL}, | |
3616 {"-in", "*EmacsShell.iconName", XrmoptionSepArg, (XtPointer) NULL}, | |
3617 {"-mc", "*pointerColor", XrmoptionSepArg, (XtPointer) NULL}, | |
3618 {"-cr", "*cursorColor", XrmoptionSepArg, (XtPointer) NULL} | |
3619 }; | |
3620 #endif /* USE_X_TOOLKIT */ | |
3621 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3622 static int w32_initialized = 0; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3623 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3624 struct w32_display_info * |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3625 w32_term_init (display_name, xrm_option, resource_name) |
13434 | 3626 Lisp_Object display_name; |
3627 char *xrm_option; | |
3628 char *resource_name; | |
3629 { | |
3630 Lisp_Object frame; | |
3631 char *defaultvalue; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3632 struct w32_display_info *dpyinfo; |
13434 | 3633 HDC hdc; |
14351
fb2ce4ebc871
ubackout 1.3 and 1.4
Geoff Voelker <voelker@cs.washington.edu>
parents:
14248
diff
changeset
|
3634 |
13434 | 3635 BLOCK_INPUT; |
3636 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3637 if (!w32_initialized) |
13434 | 3638 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3639 w32_initialize (); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3640 w32_initialized = 1; |
13434 | 3641 } |
3642 | |
3643 { | |
3644 int argc = 0; | |
3645 char *argv[3]; | |
3646 | |
3647 argv[0] = ""; | |
3648 argc = 1; | |
3649 if (xrm_option) | |
3650 { | |
3651 argv[argc++] = "-xrm"; | |
3652 argv[argc++] = xrm_option; | |
3653 } | |
3654 } | |
3655 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3656 dpyinfo = &one_w32_display_info; |
13434 | 3657 |
3658 /* Put this display on the chain. */ | |
3659 dpyinfo->next = NULL; | |
3660 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3661 /* Put it on w32_display_name_list as well, to keep them parallel. */ |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3662 w32_display_name_list = Fcons (Fcons (display_name, Qnil), |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3663 w32_display_name_list); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3664 dpyinfo->name_list_element = XCONS (w32_display_name_list)->car; |
14351
fb2ce4ebc871
ubackout 1.3 and 1.4
Geoff Voelker <voelker@cs.washington.edu>
parents:
14248
diff
changeset
|
3665 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3666 dpyinfo->w32_id_name |
13434 | 3667 = (char *) xmalloc (XSTRING (Vinvocation_name)->size |
3668 + XSTRING (Vsystem_name)->size | |
3669 + 2); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3670 sprintf (dpyinfo->w32_id_name, "%s@%s", |
13434 | 3671 XSTRING (Vinvocation_name)->data, XSTRING (Vsystem_name)->data); |
3672 | |
3673 #if 0 | |
3674 xrdb = x_load_resources (dpyinfo->display, xrm_option, | |
3675 resource_name, EMACS_CLASS); | |
3676 | |
3677 /* Put the rdb where we can find it in a way that works on | |
3678 all versions. */ | |
3679 dpyinfo->xrdb = xrdb; | |
3680 #endif | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3681 hdc = GetDC (GetDesktopWindow ()); |
13434 | 3682 |
3683 dpyinfo->height = GetDeviceCaps (hdc, VERTRES); | |
3684 dpyinfo->width = GetDeviceCaps (hdc, HORZRES); | |
3685 dpyinfo->root_window = GetDesktopWindow (); | |
3686 dpyinfo->n_planes = GetDeviceCaps (hdc, PLANES); | |
3687 dpyinfo->n_cbits = GetDeviceCaps (hdc, BITSPIXEL); | |
3688 dpyinfo->height_in = GetDeviceCaps (hdc, LOGPIXELSX); | |
3689 dpyinfo->width_in = GetDeviceCaps (hdc, LOGPIXELSY); | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3690 dpyinfo->has_palette = GetDeviceCaps (hdc, RASTERCAPS) & RC_PALETTE; |
13434 | 3691 dpyinfo->grabbed = 0; |
3692 dpyinfo->reference_count = 0; | |
3693 dpyinfo->n_fonts = 0; | |
3694 dpyinfo->font_table_size = 0; | |
3695 dpyinfo->bitmaps = 0; | |
3696 dpyinfo->bitmaps_size = 0; | |
3697 dpyinfo->bitmaps_last = 0; | |
3698 dpyinfo->mouse_face_mouse_frame = 0; | |
3699 dpyinfo->mouse_face_deferred_gc = 0; | |
3700 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; | |
3701 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; | |
3702 dpyinfo->mouse_face_face_id = 0; | |
3703 dpyinfo->mouse_face_window = Qnil; | |
3704 dpyinfo->mouse_face_mouse_x = dpyinfo->mouse_face_mouse_y = 0; | |
3705 dpyinfo->mouse_face_defer = 0; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3706 dpyinfo->w32_focus_frame = 0; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3707 dpyinfo->w32_focus_event_frame = 0; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3708 dpyinfo->w32_highlight_frame = 0; |
13434 | 3709 |
3710 ReleaseDC (GetDesktopWindow (), hdc); | |
3711 | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3712 /* Determine if there is a middle mouse button, to allow parse_button |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3713 to decide whether right mouse events should be mouse-2 or |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3714 mouse-3. */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3715 XSETINT (Vw32_num_mouse_buttons, GetSystemMetrics (SM_CMOUSEBUTTONS)); |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3716 |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3717 /* initialise palette with white and black */ |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3718 { |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3719 COLORREF color; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3720 defined_color (0, "white", &color, 1); |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3721 defined_color (0, "black", &color, 1); |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3722 } |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3723 |
13434 | 3724 #ifndef F_SETOWN_BUG |
3725 #ifdef F_SETOWN | |
3726 #ifdef F_SETOWN_SOCK_NEG | |
3727 /* stdin is a socket here */ | |
3728 fcntl (connection, F_SETOWN, -getpid ()); | |
3729 #else /* ! defined (F_SETOWN_SOCK_NEG) */ | |
3730 fcntl (connection, F_SETOWN, getpid ()); | |
3731 #endif /* ! defined (F_SETOWN_SOCK_NEG) */ | |
3732 #endif /* ! defined (F_SETOWN) */ | |
3733 #endif /* F_SETOWN_BUG */ | |
3734 | |
3735 #ifdef SIGIO | |
3736 if (interrupt_input) | |
3737 init_sigio (connection); | |
3738 #endif /* ! defined (SIGIO) */ | |
3739 | |
3740 UNBLOCK_INPUT; | |
3741 | |
3742 return dpyinfo; | |
3743 } | |
3744 | |
3745 /* Get rid of display DPYINFO, assuming all frames are already gone. */ | |
3746 | |
3747 void | |
3748 x_delete_display (dpyinfo) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3749 struct w32_display_info *dpyinfo; |
13434 | 3750 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3751 /* Discard this display from w32_display_name_list and w32_display_list. |
13434 | 3752 We can't use Fdelq because that can quit. */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3753 if (! NILP (w32_display_name_list) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3754 && EQ (XCONS (w32_display_name_list)->car, dpyinfo->name_list_element)) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3755 w32_display_name_list = XCONS (w32_display_name_list)->cdr; |
13434 | 3756 else |
3757 { | |
3758 Lisp_Object tail; | |
3759 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3760 tail = w32_display_name_list; |
13434 | 3761 while (CONSP (tail) && CONSP (XCONS (tail)->cdr)) |
3762 { | |
3763 if (EQ (XCONS (XCONS (tail)->cdr)->car, | |
3764 dpyinfo->name_list_element)) | |
3765 { | |
3766 XCONS (tail)->cdr = XCONS (XCONS (tail)->cdr)->cdr; | |
3767 break; | |
3768 } | |
3769 tail = XCONS (tail)->cdr; | |
3770 } | |
3771 } | |
3772 | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3773 /* free palette table */ |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3774 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3775 struct w32_palette_entry * plist; |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3776 |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3777 plist = dpyinfo->color_list; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3778 while (plist) |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3779 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3780 struct w32_palette_entry * pentry = plist; |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3781 plist = plist->next; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3782 xfree(pentry); |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3783 } |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3784 dpyinfo->color_list = NULL; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3785 if (dpyinfo->palette) |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3786 DeleteObject(dpyinfo->palette); |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3787 } |
13434 | 3788 xfree (dpyinfo->font_table); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3789 xfree (dpyinfo->w32_id_name); |
13434 | 3790 } |
3791 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3792 /* Set up use of W32. */ |
13434 | 3793 |
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16588
diff
changeset
|
3794 DWORD windows_msg_worker (); |
13434 | 3795 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3796 w32_initialize () |
13434 | 3797 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3798 clear_frame_hook = w32_clear_frame; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3799 clear_end_of_line_hook = w32_clear_end_of_line; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3800 ins_del_lines_hook = w32_ins_del_lines; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3801 change_line_highlight_hook = w32_change_line_highlight; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3802 insert_glyphs_hook = w32_insert_glyphs; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3803 write_glyphs_hook = w32_write_glyphs; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3804 delete_glyphs_hook = w32_delete_glyphs; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3805 ring_bell_hook = w32_ring_bell; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3806 reset_terminal_modes_hook = w32_reset_terminal_modes; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3807 set_terminal_modes_hook = w32_set_terminal_modes; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3808 update_begin_hook = w32_update_begin; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3809 update_end_hook = w32_update_end; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3810 set_terminal_window_hook = w32_set_terminal_window; |
13434 | 3811 read_socket_hook = w32_read_socket; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3812 frame_up_to_date_hook = w32_frame_up_to_date; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3813 cursor_to_hook = w32_cursor_to; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3814 reassert_line_highlight_hook = w32_reassert_line_highlight; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3815 mouse_position_hook = w32_mouse_position; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3816 frame_rehighlight_hook = w32_frame_rehighlight; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3817 frame_raise_lower_hook = w32_frame_raise_lower; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3818 set_vertical_scroll_bar_hook = w32_set_vertical_scroll_bar; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3819 condemn_scroll_bars_hook = w32_condemn_scroll_bars; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3820 redeem_scroll_bar_hook = w32_redeem_scroll_bar; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3821 judge_scroll_bars_hook = w32_judge_scroll_bars; |
13434 | 3822 |
3823 scroll_region_ok = 1; /* we'll scroll partial frames */ | |
3824 char_ins_del_ok = 0; /* just as fast to write the line */ | |
3825 line_ins_del_ok = 1; /* we'll just blt 'em */ | |
3826 fast_clear_end_of_line = 1; /* X does this well */ | |
3827 memory_below_frame = 0; /* we don't remember what scrolls | |
3828 off the bottom */ | |
3829 baud_rate = 19200; | |
3830 | |
3831 /* Try to use interrupt input; if we can't, then start polling. */ | |
3832 Fset_input_mode (Qt, Qnil, Qt, Qnil); | |
3833 | |
3834 /* Create the window thread - it will terminate itself or when the app terminates */ | |
3835 | |
3836 init_crit (); | |
3837 | |
3838 dwMainThreadId = GetCurrentThreadId (); | |
3839 DuplicateHandle (GetCurrentProcess (), GetCurrentThread (), | |
3840 GetCurrentProcess (), &hMainThread, 0, TRUE, DUPLICATE_SAME_ACCESS); | |
3841 | |
3842 /* Wait for thread to start */ | |
3843 | |
3844 { | |
3845 MSG msg; | |
3846 | |
3847 PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE); | |
3848 | |
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16588
diff
changeset
|
3849 hWindowsThread = CreateThread (NULL, 0, |
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16588
diff
changeset
|
3850 (LPTHREAD_START_ROUTINE) windows_msg_worker, |
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16588
diff
changeset
|
3851 0, 0, &dwWindowsThreadId); |
13434 | 3852 |
3853 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE); | |
3854 } | |
3855 | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3856 /* It is desirable that mainThread should have the same notion of |
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16588
diff
changeset
|
3857 focus window and active window as windowsThread. Unfortunately, the |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3858 following call to AttachThreadInput, which should do precisely what |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3859 we need, causes major problems when Emacs is linked as a console |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3860 program. Unfortunately, we have good reasons for doing that, so |
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16588
diff
changeset
|
3861 instead we need to send messages to windowsThread to make some API |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3862 calls for us (ones that affect, or depend on, the active/focus |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3863 window state. */ |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3864 #ifdef ATTACH_THREADS |
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16588
diff
changeset
|
3865 AttachThreadInput (dwMainThreadId, dwWindowsThreadId, TRUE); |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3866 #endif |
13434 | 3867 } |
3868 | |
3869 void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3870 syms_of_w32term () |
13434 | 3871 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3872 staticpro (&w32_display_name_list); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3873 w32_display_name_list = Qnil; |
13434 | 3874 |
3875 staticpro (&last_mouse_scroll_bar); | |
3876 last_mouse_scroll_bar = Qnil; | |
3877 | |
3878 staticpro (&Qvendor_specific_keysyms); | |
3879 Qvendor_specific_keysyms = intern ("vendor-specific-keysyms"); | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3880 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3881 DEFVAR_INT ("w32-num-mouse-buttons", |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3882 &Vw32_num_mouse_buttons, |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3883 "Number of physical mouse buttons."); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3884 Vw32_num_mouse_buttons = Qnil; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3885 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3886 DEFVAR_LISP ("w32-swap-mouse-buttons", |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3887 &Vw32_swap_mouse_buttons, |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3888 "Swap the mapping of middle and right mouse buttons.\n\ |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3889 When nil, middle button is mouse-2 and right button is mouse-3."); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3890 Vw32_swap_mouse_buttons = Qnil; |
13434 | 3891 } |