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