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