Mercurial > emacs
annotate src/w32term.c @ 24847:a976dbfb1f55
(Fuser_full_name): Doc fix.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Tue, 15 Jun 1999 05:30:07 +0000 |
parents | 487fdbc8de0f |
children | de94a8394d25 |
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. |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
2 Copyright (C) 1989, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc. |
13434 | 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 #include <signal.h> | |
22 #include <config.h> | |
23 #include <stdio.h> | |
24 #include "lisp.h" | |
18507
be4c110cda51
Include charset.h.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16884
diff
changeset
|
25 #include "charset.h" |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
26 #include "fontset.h" |
13434 | 27 #include "blockinput.h" |
28 | |
24674 | 29 #include "w32heap.h" |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
30 #include "w32term.h" |
21885 | 31 #include <shellapi.h> |
13434 | 32 |
33 #include "systty.h" | |
34 #include "systime.h" | |
35 | |
36 #include <ctype.h> | |
37 #include <errno.h> | |
38 #include <setjmp.h> | |
39 #include <sys/stat.h> | |
40 | |
41 #include "frame.h" | |
42 #include "dispextern.h" | |
43 #include "termhooks.h" | |
44 #include "termopts.h" | |
45 #include "termchar.h" | |
46 #include "gnu.h" | |
47 #include "disptab.h" | |
48 #include "buffer.h" | |
49 #include "window.h" | |
50 #include "keyboard.h" | |
51 #include "intervals.h" | |
21614
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
52 #include "coding.h" |
13434 | 53 |
21456 | 54 #undef min |
55 #undef max | |
56 #define min(x, y) (((x) < (y)) ? (x) : (y)) | |
57 #define max(x, y) (((x) > (y)) ? (x) : (y)) | |
58 | |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
59 #define CP_DEFAULT 1004 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
60 |
21875
16414f4d07e7
(msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21831
diff
changeset
|
61 extern unsigned int msh_mousewheel; |
16414f4d07e7
(msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21831
diff
changeset
|
62 |
13434 | 63 extern void free_frame_menubar (); |
64 | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
65 extern Lisp_Object Vwindow_system; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
66 |
13434 | 67 #define x_any_window_to_frame x_window_to_frame |
68 #define x_top_window_to_frame x_window_to_frame | |
69 | |
70 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
71 /* 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
|
72 struct w32_display_info one_w32_display_info; |
13434 | 73 |
74 /* 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
|
75 one for each element of w32_display_list and in the same order. |
13434 | 76 NAME is the name of the frame. |
77 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
|
78 Lisp_Object w32_display_name_list; |
13434 | 79 |
80 /* Frame being updated by update_frame. This is declared in term.c. | |
81 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
|
82 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
|
83 In that case, the w32 functions assume that `selected_frame' |
13434 | 84 is the frame to apply to. */ |
85 extern struct frame *updating_frame; | |
86 | |
87 /* This is a frame waiting to be autoraised, within w32_read_socket. */ | |
88 struct frame *pending_autoraise_frame; | |
89 | |
90 /* During an update, maximum vpos for ins/del line operations to affect. */ | |
91 | |
92 static int flexlines; | |
93 | |
94 /* During an update, nonzero if chars output now should be highlighted. */ | |
95 | |
96 static int highlight; | |
97 | |
98 /* Nominal cursor position -- where to draw output. | |
99 During an update, these are different from the cursor-box position. */ | |
100 | |
101 static int curs_x; | |
102 static int curs_y; | |
103 | |
23639
516fc58a7b7b
(w32_enable_unicode_output): Rename from
Geoff Voelker <voelker@cs.washington.edu>
parents:
23638
diff
changeset
|
104 /* Flag to enable Unicode output in case users wish to use programs |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
105 like Twinbridge on '95 rather than installed system level support |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
106 for Far East languages. */ |
23639
516fc58a7b7b
(w32_enable_unicode_output): Rename from
Geoff Voelker <voelker@cs.washington.edu>
parents:
23638
diff
changeset
|
107 int w32_enable_unicode_output; |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
108 |
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16588
diff
changeset
|
109 DWORD dwWindowsThreadId = 0; |
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16588
diff
changeset
|
110 HANDLE hWindowsThread = NULL; |
13434 | 111 DWORD dwMainThreadId = 0; |
112 HANDLE hMainThread = NULL; | |
113 | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
114 #ifndef SIF_ALL |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
115 /* These definitions are new with Windows 95. */ |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
116 #define SIF_RANGE 0x0001 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
117 #define SIF_PAGE 0x0002 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
118 #define SIF_POS 0x0004 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
119 #define SIF_DISABLENOSCROLL 0x0008 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
120 #define SIF_TRACKPOS 0x0010 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
121 #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
|
122 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
123 typedef struct tagSCROLLINFO |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
124 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
125 UINT cbSize; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
126 UINT fMask; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
127 int nMin; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
128 int nMax; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
129 UINT nPage; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
130 int nPos; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
131 int nTrackPos; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
132 } SCROLLINFO, FAR *LPSCROLLINFO; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
133 typedef SCROLLINFO CONST FAR *LPCSCROLLINFO; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
134 #endif /* SIF_ALL */ |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
135 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
136 /* 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
|
137 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
|
138 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
|
139 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
140 int vertical_scroll_bar_min_handle; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
141 int vertical_scroll_bar_top_border; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
142 int vertical_scroll_bar_bottom_border; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
143 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
144 int last_scroll_bar_drag_pos; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
145 |
13434 | 146 /* Mouse movement. */ |
147 | |
148 /* Where the mouse was last time we reported a mouse event. */ | |
149 static FRAME_PTR last_mouse_frame; | |
150 static RECT last_mouse_glyph; | |
151 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
152 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
|
153 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
154 Lisp_Object Vw32_swap_mouse_buttons; |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
155 |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
156 /* 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
|
157 Lisp_Object Vw32_grab_focus_on_raise; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
158 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
159 /* 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
|
160 Lisp_Object Vw32_capslock_is_shiftlock; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
161 |
21614
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
162 /* 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
|
163 Lisp_Object Vw32_recognize_altgr; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
164 |
13434 | 165 /* The scroll bar in which the last motion event occurred. |
166 | |
167 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
|
168 so w32_mouse_position can know whether to report a scroll bar motion or |
13434 | 169 an ordinary motion. |
170 | |
171 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
|
172 to Qnil, to tell w32_mouse_position to return an ordinary motion event. */ |
13434 | 173 Lisp_Object last_mouse_scroll_bar; |
174 int last_mouse_scroll_bar_pos; | |
175 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
176 /* This is a hack. We would really prefer that w32_mouse_position would |
13434 | 177 return the time associated with the position it returns, but there |
178 doesn't seem to be any way to wrest the timestamp from the server | |
179 along with the position query. So, we just keep track of the time | |
180 of the last movement we received, and return that in hopes that | |
181 it's somewhat accurate. */ | |
182 Time last_mouse_movement_time; | |
183 | |
24131
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
184 /* Associative list linking character set strings to Windows codepages. */ |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
185 Lisp_Object Vw32_charset_to_codepage_alist; |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
186 |
13434 | 187 /* Incremented by w32_read_socket whenever it really tries to read events. */ |
188 #ifdef __STDC__ | |
189 static int volatile input_signal_count; | |
190 #else | |
191 static int input_signal_count; | |
192 #endif | |
193 | |
194 extern Lisp_Object Vcommand_line_args, Vsystem_name; | |
195 | |
196 extern Lisp_Object Qface, Qmouse_face; | |
197 | |
198 extern int errno; | |
199 | |
200 /* A mask of extra modifier bits to put into every keyboard char. */ | |
201 extern int extra_keyboard_modifiers; | |
202 | |
203 static Lisp_Object Qvendor_specific_keysyms; | |
204 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
205 void w32_delete_display (); |
13434 | 206 |
207 static void redraw_previous_char (); | |
208 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
|
209 static unsigned int w32_get_modifiers (); |
13434 | 210 |
211 static int fast_find_position (); | |
212 static void note_mouse_highlight (); | |
213 static void clear_mouse_face (); | |
214 static void show_mouse_face (); | |
215 static void do_line_dance (); | |
216 | |
21831
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
217 /* Forward declarations for term hooks. Consistency with the rest of Emacs |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
218 requires the use of K&R functions prototypes. However, MSVC does not |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
219 pick up the function prototypes correctly with K&R function definitions, |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
220 and so we declare them first to give a little help to MSVC. */ |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
221 static void w32_clear_frame (); |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
222 static void w32_clear_end_of_line (int); |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
223 static void w32_ins_del_lines (int, int); |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
224 static void w32_change_line_highlight (int, int, int); |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
225 static void w32_insert_glyphs (GLYPH *, int); |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
226 static void w32_write_glyphs (GLYPH *, int); |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
227 static void w32_delete_glyphs (int); |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
228 static void w32_ring_bell (); |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
229 static void w32_reset_terminal_modes (); |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
230 static void w32_set_terminal_modes (); |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
231 static void w32_update_begin (FRAME_PTR); |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
232 static void w32_update_end (FRAME_PTR); |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
233 static void w32_set_terminal_window (int); |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
234 extern int w32_read_socket (int, struct input_event *, int, int); |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
235 static void w32_frame_up_to_date (FRAME_PTR); |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
236 static void w32_cursor_to (int, int); |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
237 static void w32_reassert_line_highlight (int, int); |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
238 static void w32_mouse_position (FRAME_PTR *, int, Lisp_Object *, |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
239 enum scroll_bar_part *, Lisp_Object *, |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
240 Lisp_Object *, unsigned long *); |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
241 static void w32_frame_rehighlight (FRAME_PTR); |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
242 static void w32_frame_raise_lower (FRAME_PTR, int); |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
243 static void w32_set_vertical_scroll_bar (struct window *, int, int, int); |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
244 static void w32_condemn_scroll_bars (FRAME_PTR); |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
245 static void w32_redeem_scroll_bar (struct window *); |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
246 static void w32_judge_scroll_bars (FRAME_PTR); |
13434 | 247 |
248 #if 0 | |
249 /* This is a function useful for recording debugging information | |
250 about the sequence of occurrences in this file. */ | |
251 | |
252 struct record | |
253 { | |
254 char *locus; | |
255 int type; | |
256 }; | |
257 | |
258 struct record event_record[100]; | |
259 | |
260 int event_record_index; | |
261 | |
262 record_event (locus, type) | |
263 char *locus; | |
264 int type; | |
265 { | |
266 if (event_record_index == sizeof (event_record) / sizeof (struct record)) | |
267 event_record_index = 0; | |
268 | |
269 event_record[event_record_index].locus = locus; | |
270 event_record[event_record_index].type = type; | |
271 event_record_index++; | |
272 } | |
273 | |
274 #endif /* 0 */ | |
275 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
276 /* 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
|
277 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
278 struct w32_display_info * |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
279 w32_display_info_for_display () |
13434 | 280 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
281 return (&one_w32_display_info); |
13434 | 282 } |
283 | |
284 void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
285 w32_fill_rect (f, _hdc, pix, lprect) |
13434 | 286 FRAME_PTR f; |
287 HDC _hdc; | |
288 COLORREF pix; | |
289 RECT * lprect; | |
290 { | |
291 HDC hdc; | |
292 HBRUSH hb; | |
293 RECT rect; | |
294 | |
295 if (_hdc) | |
296 hdc = _hdc; | |
297 else | |
298 { | |
299 if (!f) return; | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
300 hdc = get_frame_dc (f); |
13434 | 301 } |
302 | |
303 hb = CreateSolidBrush (pix); | |
304 FillRect (hdc, lprect, hb); | |
305 DeleteObject (hb); | |
306 | |
307 if (!_hdc) | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
308 release_frame_dc (f, hdc); |
13434 | 309 } |
310 | |
311 void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
312 w32_clear_window (f) |
13434 | 313 FRAME_PTR f; |
314 { | |
315 RECT rect; | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
316 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
317 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
|
318 w32_clear_rect (f, NULL, &rect); |
13434 | 319 } |
320 | |
321 | |
322 /* Starting and ending updates. | |
323 | |
324 These hooks are called by update_frame at the beginning and end | |
325 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
|
326 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
|
327 need to take a frame as argument. Most of the w32_... functions |
13434 | 328 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
|
329 being w32_cursor_to, w32_write_glyphs and w32_reassert_line_highlight. */ |
13434 | 330 |
21831
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
331 static void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
332 w32_update_begin (f) |
13434 | 333 struct frame *f; |
334 { | |
335 if (f == 0) | |
336 abort (); | |
337 | |
338 flexlines = f->height; | |
339 highlight = 0; | |
340 | |
341 BLOCK_INPUT; | |
342 | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
343 /* Regenerate display palette before drawing if list of requested |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
344 colors has changed. */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
345 if (FRAME_W32_DISPLAY_INFO (f)->regen_palette) |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
346 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
347 w32_regenerate_palette (f); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
348 FRAME_W32_DISPLAY_INFO (f)->regen_palette = FALSE; |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
349 } |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
350 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
351 if (f == FRAME_W32_DISPLAY_INFO (f)->mouse_face_mouse_frame) |
13434 | 352 { |
353 /* 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
|
354 FRAME_W32_DISPLAY_INFO (f)->mouse_face_defer = 1; |
13434 | 355 |
356 /* If the frame needs to be redrawn, | |
357 simply forget about any prior mouse highlighting. */ | |
358 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
|
359 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
|
360 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
361 if (!NILP (FRAME_W32_DISPLAY_INFO (f)->mouse_face_window)) |
13434 | 362 { |
363 int firstline, lastline, i; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
364 struct window *w = XWINDOW (FRAME_W32_DISPLAY_INFO (f)->mouse_face_window); |
13434 | 365 |
366 /* Find the first, and the last+1, lines affected by redisplay. */ | |
367 for (firstline = 0; firstline < f->height; firstline++) | |
368 if (FRAME_DESIRED_GLYPHS (f)->enable[firstline]) | |
369 break; | |
370 | |
371 lastline = f->height; | |
372 for (i = f->height - 1; i >= 0; i--) | |
373 { | |
374 if (FRAME_DESIRED_GLYPHS (f)->enable[i]) | |
375 break; | |
376 else | |
377 lastline = i; | |
378 } | |
379 | |
380 /* Can we tell that this update does not affect the window | |
381 where the mouse highlight is? If so, no need to turn off. | |
382 Likewise, don't do anything if the frame is garbaged; | |
383 in that case, the FRAME_CURRENT_GLYPHS that we would use | |
384 are all wrong, and we will redisplay that line anyway. */ | |
385 if (! (firstline > (XFASTINT (w->top) + window_internal_height (w)) | |
386 || lastline < XFASTINT (w->top))) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
387 clear_mouse_face (FRAME_W32_DISPLAY_INFO (f)); |
13434 | 388 } |
389 } | |
390 | |
391 UNBLOCK_INPUT; | |
392 } | |
393 | |
21831
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
394 static void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
395 w32_update_end (f) |
13434 | 396 struct frame *f; |
397 { | |
398 BLOCK_INPUT; | |
399 | |
400 do_line_dance (); | |
401 x_display_cursor (f, 1); | |
402 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
403 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
|
404 FRAME_W32_DISPLAY_INFO (f)->mouse_face_defer = 0; |
13434 | 405 |
406 UNBLOCK_INPUT; | |
407 } | |
408 | |
409 /* This is called after a redisplay on frame F. */ | |
410 | |
21831
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
411 static void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
412 w32_frame_up_to_date (f) |
13434 | 413 FRAME_PTR f; |
414 { | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
415 BLOCK_INPUT; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
416 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
|
417 || f == FRAME_W32_DISPLAY_INFO (f)->mouse_face_mouse_frame) |
13434 | 418 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
419 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
|
420 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
|
421 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
|
422 FRAME_W32_DISPLAY_INFO (f)->mouse_face_deferred_gc = 0; |
13434 | 423 } |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
424 UNBLOCK_INPUT; |
13434 | 425 } |
426 | |
427 /* External interface to control of standout mode. | |
428 Call this when about to modify line at position VPOS | |
429 and not change whether it is highlighted. */ | |
430 | |
21831
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
431 static void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
432 w32_reassert_line_highlight (new, vpos) |
13434 | 433 int new, vpos; |
434 { | |
435 highlight = new; | |
436 } | |
437 | |
438 /* Call this when about to modify line at position VPOS | |
439 and change whether it is highlighted. */ | |
440 | |
21831
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
441 static void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
442 w32_change_line_highlight (new_highlight, vpos, first_unused_hpos) |
13434 | 443 int new_highlight, vpos, first_unused_hpos; |
444 { | |
445 highlight = new_highlight; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
446 w32_cursor_to (vpos, 0); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
447 w32_clear_end_of_line (updating_frame->width); |
13434 | 448 } |
449 | |
450 /* This is used when starting Emacs and when restarting after suspend. | |
451 When starting Emacs, no window is mapped. And nothing must be done | |
452 to Emacs's own window if it is suspended (though that rarely happens). */ | |
453 | |
21831
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
454 static void |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
455 w32_set_terminal_modes (void) |
13434 | 456 { |
457 } | |
458 | |
459 /* 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
|
460 Exiting will make the W32 windows go away, and suspending |
13434 | 461 requires no action. */ |
462 | |
21831
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
463 static void |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
464 w32_reset_terminal_modes (void) |
13434 | 465 { |
466 } | |
467 | |
468 /* Set the nominal cursor position of the frame. | |
469 This is where display update commands will take effect. | |
470 This does not affect the place where the cursor-box is displayed. */ | |
471 | |
21831
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
472 static void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
473 w32_cursor_to (row, col) |
13434 | 474 register int row, col; |
475 { | |
476 int orow = row; | |
477 | |
478 curs_x = col; | |
479 curs_y = row; | |
480 | |
481 if (updating_frame == 0) | |
482 { | |
483 BLOCK_INPUT; | |
484 x_display_cursor (selected_frame, 1); | |
485 UNBLOCK_INPUT; | |
486 } | |
487 } | |
488 | |
24131
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
489 /* Get the Windows codepage corresponding to the specified font. The |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
490 charset info in the font name is used to look up |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
491 w32-charset-to-codepage-alist. */ |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
492 int |
24131
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
493 w32_codepage_for_font (char *fontname) |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
494 { |
24131
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
495 Lisp_Object codepage; |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
496 char charset_str[20], *charset, *end; |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
497 |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
498 /* Extract charset part of font string. */ |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
499 if (sscanf (fontname, |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
500 "-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%*[^-]-%19s", |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
501 charset_str) == EOF) |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
502 return CP_DEFAULT; |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
503 |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
504 /* Remove leading "*-". */ |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
505 if (strncmp ("*-", charset_str, 2) == 0) |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
506 charset = charset_str + 2; |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
507 else |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
508 charset = charset_str; |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
509 |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
510 /* Stop match at wildcard (including preceding '-'). */ |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
511 if (end = strchr (charset, '*')) |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
512 { |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
513 if (end > charset && *(end-1) == '-') |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
514 end--; |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
515 *end = '\0'; |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
516 } |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
517 |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
518 codepage = Fcdr (Fassoc (build_string(charset), |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
519 Vw32_charset_to_codepage_alist)); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
520 |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
521 if (INTEGERP (codepage)) |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
522 return XINT (codepage); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
523 else |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
524 return CP_DEFAULT; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
525 } |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
526 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
527 BOOL |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
528 w32_use_unicode_for_codepage (codepage) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
529 { |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
530 /* If the current codepage is supported, use Unicode for output. */ |
23639
516fc58a7b7b
(w32_enable_unicode_output): Rename from
Geoff Voelker <voelker@cs.washington.edu>
parents:
23638
diff
changeset
|
531 return (w32_enable_unicode_output |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
532 && codepage != CP_DEFAULT && IsValidCodePage (codepage)); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
533 } |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
534 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
535 /* Dealing with bits of wchar_t as if they were an XChar2B. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
536 #define BUILD_WCHAR_T(byte1, byte2) \ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
537 ((wchar_t)(((byte1 & 0x00ff) << 8) | (byte2 & 0x00ff))) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
538 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
539 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
540 #define BYTE1(ch) \ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
541 ((ch & 0xff00) >> 8) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
542 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
543 #define BYTE2(ch) \ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
544 (ch & 0x00ff) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
545 |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
546 #define W32_TEXTOUT(start_offset,nchars) \ |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
547 { \ |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
548 int charset_dim = CHARSET_DIMENSION(charset); \ |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
549 if (font->bdf) \ |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
550 w32_BDF_TextOut (font->bdf, hdc, left + xoffset, \ |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
551 top + yoffset, \ |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
552 x_1byte_buffer + start_offset, \ |
24480
f9d3288b66c3
(W32_TEXTOUT): Do not multiply nchars by
Geoff Voelker <voelker@cs.washington.edu>
parents:
24265
diff
changeset
|
553 charset_dim, nchars, 0); \ |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
554 else if (print_via_unicode) \ |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
555 ExtTextOutW (hdc, left + xoffset, top + yoffset, \ |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
556 fuOptions, clip_region, \ |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
557 x_2byte_buffer + start_offset, nchars, NULL); \ |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
558 else \ |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
559 ExtTextOut (hdc, left + xoffset, top + yoffset, \ |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
560 fuOptions, clip_region, \ |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
561 x_1byte_buffer + start_offset, \ |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
562 nchars * charset_dim, NULL); \ |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
563 start_offset += nchars * (print_via_unicode ? 1 : charset_dim ); \ |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
564 xoffset += nchars * glyph_width; \ |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
565 } |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
566 |
13434 | 567 /* Display a sequence of N glyphs found at GP. |
568 WINDOW is the window to output to. LEFT and TOP are starting coords. | |
569 HL is 1 if this text is highlighted, 2 if the cursor is on it, | |
570 3 if should appear in its mouse-face. | |
571 JUST_FOREGROUND if 1 means draw only the foreground; | |
572 don't alter the background. | |
573 | |
574 FONT is the default font to use (for glyphs whose font-code is 0). | |
575 | |
576 Since the display generation code is responsible for calling | |
577 compute_char_face and compute_glyph_face on everything it puts in | |
578 the display structure, we can assume that the face code on each | |
579 glyph is a valid index into FRAME_COMPUTED_FACES (f), and the one | |
580 to which we can actually apply intern_face. | |
581 Call this function with input blocked. */ | |
582 | |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
583 static int |
21614
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
584 dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp) |
13434 | 585 struct frame *f; |
586 int left, top; | |
587 register GLYPH *gp; /* Points to first GLYPH. */ | |
588 register int n; /* Number of glyphs to display. */ | |
589 int hl; | |
590 int just_foreground; | |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
591 struct cmpchar_info *cmpcharp; |
13434 | 592 { |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
593 wchar_t *x_2byte_buffer |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
594 = (wchar_t *) alloca (FRAME_WINDOW_WIDTH (f) * sizeof (*x_2byte_buffer)); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
595 register wchar_t *cp; /* Steps through x_2byte_buffer[]. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
596 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
597 /* Allocate double the window width, as this buffer may contain MBCS |
23806
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
598 characters under w32. Unsigned to let GetCharABCWidths work. */ |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
599 unsigned char *x_1byte_buffer |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
600 = (unsigned char *) alloca (2 * FRAME_WINDOW_WIDTH (f) |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
601 * sizeof (*x_1byte_buffer)); |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
602 register unsigned char *bp; /* Steps through x_1byte_buffer[]. */ |
13434 | 603 register int tlen = GLYPH_TABLE_LENGTH; |
604 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
|
605 Window window = FRAME_W32_WINDOW (f); |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
606 HDC hdc = get_frame_dc (f); |
13434 | 607 int orig_left = left; |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
608 int gidx = 0; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
609 int i; |
13434 | 610 |
611 while (n > 0) | |
612 { | |
613 /* Get the face-code of the next GLYPH. */ | |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
614 int cf, len, n_chars; |
21614
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
615 GLYPH g = *gp; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
616 int ch, charset; |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
617 Lisp_Object first_ch; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
618 /* HIGHEST and LOWEST are used while drawing a composite |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
619 character. The meanings are described later. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
620 int highest, lowest; |
13434 | 621 |
622 GLYPH_FOLLOW_ALIASES (tbase, tlen, g); | |
21614
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
623 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
|
624 ch = FAST_GLYPH_CHAR (g); |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
625 if (unibyte_display_via_language_environment |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
626 && SINGLE_BYTE_CHAR_P (ch) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
627 && ch >= 160) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
628 ch = unibyte_char_to_multibyte (ch); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
629 if (gidx == 0) XSETFASTINT (first_ch, ch); |
21614
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
630 charset = CHAR_CHARSET (ch); |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
631 if (charset == CHARSET_COMPOSITION) |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
632 { |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
633 /* We must draw components of the composite character on the |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
634 same column. */ |
21614
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
635 cmpcharp = cmpchar_table[COMPOSITE_CHAR_ID (ch)]; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
636 |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
637 /* Set the face in the slot for work. */ |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
638 cmpcharp->face_work = cf; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
639 |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
640 /* We don't need the return value ... */ |
21614
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
641 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
|
642 hl, just_foreground, cmpcharp); |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
643 /* ... because the width of just drawn text can be |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
644 calculated as follows. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
645 left += FONT_WIDTH (FRAME_FONT (f)) * cmpcharp->width; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
646 |
21614
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
647 ++gp, --n; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
648 while (gp && (*gp & GLYPH_MASK_PADDING)) ++gp, --n; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
649 cmpcharp = NULL; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
650 continue; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
651 } |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
652 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
653 /* Find the run of consecutive glyphs which can be drawn with |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
654 the same DC (i.e. the same charset and the same face-code). |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
655 Extract their character codes into X_2BYTE_BUFFER. |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
656 If CMPCHARP is not NULL, face-code is not checked because we |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
657 use only the face specified in `cmpcharp->face_work'. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
658 cp = x_2byte_buffer; |
13434 | 659 while (n > 0) |
660 { | |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
661 int this_charset, c1, c2; |
21614
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
662 |
13434 | 663 g = *gp; |
664 GLYPH_FOLLOW_ALIASES (tbase, tlen, g); | |
21614
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
665 ch = FAST_GLYPH_CHAR (g); |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
666 if (unibyte_display_via_language_environment |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
667 && SINGLE_BYTE_CHAR_P (ch) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
668 && ch >= 160) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
669 ch = unibyte_char_to_multibyte (ch); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
670 SPLIT_CHAR (ch, this_charset, c1, c2); |
21614
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
671 if (this_charset != charset |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
672 || (cmpcharp == NULL && FAST_GLYPH_FACE (g) != cf)) |
13434 | 673 break; |
674 | |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
675 if (c2 > 0) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
676 *cp = BUILD_WCHAR_T (c1, c2); |
21614
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
677 else |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
678 *cp = BUILD_WCHAR_T (0, c1); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
679 ++cp; |
21614
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
680 ++gp, --n; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
681 while (gp && (*gp & GLYPH_MASK_PADDING)) |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
682 ++gp, --n; |
13434 | 683 } |
684 | |
685 /* LEN gets the length of the run. */ | |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
686 len = cp - x_2byte_buffer; |
13434 | 687 /* Now output this run of chars, with the font and pixel values |
688 determined by the face code CF. */ | |
689 { | |
690 struct face *face = FRAME_DEFAULT_FACE (f); | |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
691 XFontStruct *font = NULL; |
24131
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
692 int fontset; |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
693 struct font_info *fontp; |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
694 int font_id; |
13434 | 695 COLORREF fg; |
696 COLORREF bg; | |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
697 int stippled = 0; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
698 int line_height = FRAME_LINE_HEIGHT (f); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
699 /* Pixel width of each glyph in this run. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
700 int glyph_width |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
701 = (FONT_WIDTH (FRAME_FONT (f)) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
702 * (cmpcharp ? cmpcharp->width : CHARSET_WIDTH (charset))); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
703 /* Overall pixel width of this run. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
704 int run_width |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
705 = (FONT_WIDTH (FRAME_FONT (f)) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
706 * (cmpcharp ? cmpcharp->width : len * CHARSET_WIDTH (charset))); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
707 /* A flag to tell if we have already filled background. We |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
708 fill background in advance in the following cases: |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
709 1) A face has stipple. |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
710 2) A height of font is shorter than LINE_HEIGHT. |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
711 3) Drawing a composite character. |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
712 4) Font has non-zero _MULE_BASELINE_OFFSET property. |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
713 5) Font is a bdf font. |
24687
8d4b8adc3c98
(dumpglyphs): Always fill background for italic fonts.
Andrew Innes <andrewi@gnu.org>
parents:
24674
diff
changeset
|
714 6) Font is italic (italic fonts falsely report their height). |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
715 After filling background, we draw glyphs by XDrawString16. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
716 int background_filled; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
717 /* Baseline position of a character, offset from TOP. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
718 int baseline; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
719 /* The property value of `_MULE_RELATIVE_COMPOSE' and |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
720 `_MULE_DEFAULT_ASCENT'. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
721 int relative_compose = 0, default_ascent = 0; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
722 /* 1 if we find no font or a font of inappropriate size. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
723 int require_clipping; |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
724 RECT clip_rectangle; |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
725 LPRECT clip_region = NULL; |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
726 UINT fuOptions = 0; |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
727 |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
728 int codepage = CP_DEFAULT; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
729 BOOL print_via_unicode = FALSE; |
13434 | 730 |
731 /* HL = 3 means use a mouse face previously chosen. */ | |
732 if (hl == 3) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
733 cf = FRAME_W32_DISPLAY_INFO (f)->mouse_face_face_id; |
13434 | 734 |
735 /* First look at the face of the text itself. */ | |
736 if (cf != 0) | |
737 { | |
738 /* It's possible for the display table to specify | |
739 a face code that is out of range. Use 0 in that case. */ | |
740 if (cf < 0 || cf >= FRAME_N_COMPUTED_FACES (f) | |
741 || FRAME_COMPUTED_FACES (f) [cf] == 0) | |
742 cf = 0; | |
743 | |
744 if (cf == 1) | |
745 face = FRAME_MODE_LINE_FACE (f); | |
746 else | |
747 face = intern_face (f, FRAME_COMPUTED_FACES (f) [cf]); | |
748 if (FACE_STIPPLE (face)) | |
749 stippled = 1; | |
750 } | |
751 | |
752 /* Then comes the distinction between modeline and normal text. */ | |
753 else if (hl == 0) | |
754 ; | |
755 else if (hl == 1) | |
756 { | |
757 face = FRAME_MODE_LINE_FACE (f); | |
758 if (FACE_STIPPLE (face)) | |
759 stippled = 1; | |
760 } | |
761 | |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
762 /* Setting appropriate font and codepage for this charset. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
763 if (charset != CHARSET_ASCII) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
764 { |
24131
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
765 fontset = FACE_FONTSET (face); |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
766 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
767 if ((fontset < 0 && (fontset = FRAME_FONTSET (f)) < 0) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
768 || !(fontp = FS_LOAD_FONT (f, FRAME_W32_FONT_TABLE (f), |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
769 charset, NULL, fontset))) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
770 goto font_not_found; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
771 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
772 font = (XFontStruct *) (fontp->font); |
24131
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
773 codepage = w32_codepage_for_font (fontp->name); |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
774 |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
775 if ( font && !font->bdf ) |
24480
f9d3288b66c3
(W32_TEXTOUT): Do not multiply nchars by
Geoff Voelker <voelker@cs.washington.edu>
parents:
24265
diff
changeset
|
776 print_via_unicode = w32_use_unicode_for_codepage (codepage); |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
777 |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
778 baseline = FONT_BASE (font) + fontp->baseline_offset; |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
779 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
780 if (cmpcharp && cmpcharp->cmp_rule == NULL) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
781 { |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
782 relative_compose = fontp->relative_compose; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
783 default_ascent = fontp->default_ascent; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
784 } |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
785 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
786 /* We have to change code points in the following cases. */ |
24131
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
787 if (fontp->font_encoder) |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
788 { |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
789 /* This font requires CCL program to calculate code |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
790 point of characters. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
791 struct ccl_program *ccl = fontp->font_encoder; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
792 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
793 if (CHARSET_DIMENSION (charset) == 1) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
794 for (cp = x_2byte_buffer; cp < x_2byte_buffer + len; cp++) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
795 { |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
796 ccl->reg[0] = charset; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
797 ccl->reg[1] = BYTE2 (*cp); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
798 ccl_driver (ccl, NULL, NULL, 0, 0, NULL); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
799 /* We assume that MSBs are appropriately |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
800 set/reset by CCL program. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
801 #if 0 /* this probably works under NT, but not under 95. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
802 if (font->tm.tmLastChar < 256) /* 1-byte font */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
803 *cp = BUILD_WCHAR_T (0, ccl->reg[1]); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
804 else |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
805 *cp = BUILD_WCHAR_T (ccl->reg[1], ccl->reg[2]); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
806 #else /* Assume single dimensional charsets stay so. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
807 *cp = BUILD_WCHAR_T (0, ccl->reg[1]); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
808 #endif |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
809 } |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
810 else |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
811 for (cp = x_2byte_buffer; cp < x_2byte_buffer + len; cp++) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
812 { |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
813 ccl->reg[0] = charset; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
814 ccl->reg[1] = BYTE1 (*cp) , ccl->reg[2] = BYTE2 (*cp); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
815 ccl_driver (ccl, NULL, NULL, 0, 0, NULL); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
816 /* We assume that MSBs are appropriately |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
817 set/reset by CCL program. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
818 #if 0 /* this probably works under NT, but not under 95. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
819 if (font->tm.tmLastChar < 256) /* 1-byte font */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
820 *cp = BUILD_WCHAR_T (0, ccl->reg[1]); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
821 else |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
822 *cp = BUILD_WCHAR_T (ccl->reg[1],ccl->reg[2]); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
823 #else /* Assume multidimensional charsets stay so. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
824 *cp = BUILD_WCHAR_T (ccl->reg[1],ccl->reg[2]); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
825 #endif |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
826 } |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
827 } |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
828 else if (fontp->encoding[charset]) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
829 { |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
830 int enc = fontp->encoding[charset]; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
831 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
832 if ((enc == 1 || enc == 2) && CHARSET_DIMENSION (charset) == 2) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
833 for (cp = x_2byte_buffer; cp < x_2byte_buffer + len; cp++) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
834 *cp = BUILD_WCHAR_T (BYTE1 (*cp) | 0x80, BYTE2 (*cp)); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
835 if (enc == 1 || enc == 3) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
836 for (cp = x_2byte_buffer; cp < x_2byte_buffer + len; cp++) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
837 *cp = BUILD_WCHAR_T (BYTE1 (*cp), BYTE2 (*cp) | 0x80); |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
838 /* Special encoding for SJIS Kanji. */ |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
839 if (enc == 4) |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
840 { |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
841 if (CHARSET_DIMENSION (charset) == 2) |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
842 { |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
843 int sjis1, sjis2; |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
844 for (cp = x_2byte_buffer; |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
845 cp < x_2byte_buffer + len; cp++) |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
846 { |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
847 ENCODE_SJIS (BYTE1 (*cp), BYTE2 (*cp), |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
848 sjis1, sjis2); |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
849 *cp = BUILD_WCHAR_T (sjis1, sjis2); |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
850 } |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
851 } |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
852 else |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
853 for (cp = x_2byte_buffer; |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
854 cp < x_2byte_buffer + len; cp++) |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
855 *cp = BUILD_WCHAR_T (BYTE1 (*cp), |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
856 BYTE2 (*cp) | 0x80); |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
857 } |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
858 } |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
859 } |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
860 else |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
861 { |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
862 font_not_found: |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
863 if (charset == CHARSET_ASCII || charset == charset_latin_iso8859_1) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
864 { |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
865 font = FACE_FONT (face); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
866 if (!font || font == (XFontStruct *) FACE_DEFAULT) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
867 font = FRAME_FONT (f); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
868 baseline = FONT_BASE (FRAME_FONT (f)); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
869 if (charset == charset_latin_iso8859_1) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
870 { |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
871 if (!font->bdf && font->tm.tmLastChar < 0x80) |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
872 /* This font can't display Latin1 characters. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
873 font = NULL; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
874 else |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
875 { |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
876 for (cp = x_2byte_buffer; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
877 cp < x_2byte_buffer + len; cp++) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
878 *cp = BUILD_WCHAR_T (BYTE1 (*cp), |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
879 BYTE2 (*cp) | 0x80); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
880 } |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
881 } |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
882 } |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
883 } |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
884 |
13434 | 885 fg = face->foreground; |
886 bg = face->background; | |
887 | |
888 /* Now override that if the cursor's on this character. */ | |
889 if (hl == 2) | |
890 { | |
891 /* The cursor overrides stippling. */ | |
892 stippled = 0; | |
893 | |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
894 if (font == FRAME_FONT (f) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
895 && face->background == FRAME_BACKGROUND_PIXEL (f) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
896 && face->foreground == FRAME_FOREGROUND_PIXEL (f) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
897 && !cmpcharp) |
13434 | 898 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
899 bg = f->output_data.w32->cursor_pixel; |
13434 | 900 fg = face->background; |
901 } | |
902 /* Cursor on non-default face: must merge. */ | |
903 else | |
904 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
905 bg = f->output_data.w32->cursor_pixel; |
13434 | 906 fg = face->background; |
907 /* If the glyph would be invisible, | |
908 try a different foreground. */ | |
909 if (fg == bg) | |
910 fg = face->foreground; | |
911 if (fg == bg) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
912 fg = f->output_data.w32->cursor_foreground_pixel; |
13434 | 913 if (fg == bg) |
914 fg = face->foreground; | |
915 /* Make sure the cursor is distinct from text in this face. */ | |
916 if (bg == face->background | |
917 && fg == face->foreground) | |
918 { | |
919 bg = face->foreground; | |
920 fg = face->background; | |
921 } | |
922 } | |
923 } | |
924 | |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
925 if (font) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
926 require_clipping = (!NILP (Vclip_large_size_font) |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
927 && ((font->bdf |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
928 ? (font->bdf->ury > baseline |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
929 || font->bdf->lly > line_height - baseline) |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
930 : (font->tm.tmAscent > baseline |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
931 || font->tm.tmDescent > line_height - baseline)) |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
932 || (!cmpcharp && FONT_MAX_WIDTH (font) > glyph_width))); |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
933 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
934 if (font && (just_foreground || (cmpcharp && gidx > 0))) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
935 background_filled = 1; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
936 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
937 /* Stippling not supported under w32. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
938 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
939 else if (!font |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
940 || font->bdf |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
941 || FONT_HEIGHT (font) < line_height |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
942 || FONT_WIDTH (font) < glyph_width |
23806
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
943 || FONT_MAX_WIDTH (font) != FONT_WIDTH (font) |
24687
8d4b8adc3c98
(dumpglyphs): Always fill background for italic fonts.
Andrew Innes <andrewi@gnu.org>
parents:
24674
diff
changeset
|
944 || font->tm.tmItalic |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
945 || cmpcharp) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
946 { |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
947 /* Fill in the background for the current run. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
948 w32_fill_area (f, hdc, bg, |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
949 left, |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
950 top, |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
951 run_width, |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
952 line_height); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
953 background_filled = 1; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
954 if (cmpcharp) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
955 /* To assure not to fill background while drawing |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
956 remaining components. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
957 just_foreground = 1; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
958 } |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
959 else |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
960 background_filled = 0; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
961 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
962 SetBkMode (hdc, background_filled ? TRANSPARENT : OPAQUE); |
13434 | 963 SetTextColor (hdc, fg); |
964 SetBkColor (hdc, bg); | |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
965 SetTextAlign (hdc, TA_BASELINE | TA_LEFT); |
13434 | 966 |
24674 | 967 /* On NT, where conversion to Unicode has to happen sometime |
968 when using the normal ExtTextOut facility, we might as well | |
969 take advantage of x_2byte_buffer which is already allocated, | |
970 to avoid the allocation overhead for implicit conversion. */ | |
971 | |
972 if (!print_via_unicode | |
973 && codepage == CP_DEFAULT | |
974 && w32_enable_unicode_output | |
975 && os_subtype == OS_NT | |
976 && font && !font->bdf) | |
977 { | |
978 print_via_unicode = TRUE; | |
979 } | |
980 | |
981 /* Note that we can special-case the conversion to Unicode when | |
982 the charset is CHARSET_ASCII (an important case) or Latin-1, | |
983 because x_2byte_buffer in fact already contains the unicode | |
984 characters. So avoid setting up x_1byte_buffer in that case. */ | |
985 if (!print_via_unicode | |
986 || (charset != CHARSET_ASCII && charset != charset_latin_iso8859_1)) | |
987 { | |
988 /* Convert x_2byte_buffer into a buffer of single byte | |
989 characters - possibly containing MBCS runs. */ | |
990 bp = x_1byte_buffer; | |
991 for (i = 0; i < len; i++) | |
992 { | |
993 if (BYTE1 (*(x_2byte_buffer + i))) | |
994 *bp++ = BYTE1 (*(x_2byte_buffer + i)); | |
995 *bp++ = BYTE2 (*(x_2byte_buffer + i)); | |
996 } | |
997 n_chars = bp - x_1byte_buffer; | |
998 } | |
999 else | |
1000 n_chars = len; | |
1001 | |
1002 if (print_via_unicode | |
1003 && charset != CHARSET_ASCII && charset != charset_latin_iso8859_1) | |
1004 { | |
1005 i = MultiByteToWideChar | |
1006 (codepage, 0, x_1byte_buffer, n_chars, | |
1007 x_2byte_buffer, FRAME_WINDOW_WIDTH (f)); | |
1008 | |
1009 /* Make sure we don't display nothing if conversion fails. */ | |
1010 if (i == 0) | |
1011 print_via_unicode = FALSE; | |
1012 else | |
1013 n_chars = i; | |
1014 } | |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1015 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1016 if (font) |
13434 | 1017 { |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1018 if (font->hfont) |
24733
8f526771b25b
(dumpglyphs): Use correct colours for drawing rectangles in place of
Andrew Innes <andrewi@gnu.org>
parents:
24687
diff
changeset
|
1019 SelectObject (hdc, font->hfont); |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1020 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1021 if (!cmpcharp) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1022 { |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1023 int xoffset = 0, yoffset = baseline; |
23806
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1024 if (require_clipping || FONT_WIDTH (font) != glyph_width |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1025 || FONT_MAX_WIDTH (font) != FONT_WIDTH (font)) |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1026 { |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1027 /* The incrementing of i in this loop is done |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1028 inside the W32_CHAROUT macro. */ |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1029 for (i = 0; i < n_chars; ) |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1030 { |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1031 if (require_clipping) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1032 { |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1033 /* Set up a clipping rectangle for ExtTextOut */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1034 fuOptions |= ETO_CLIPPED; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1035 clip_rectangle.left = left + i * glyph_width; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1036 clip_rectangle.right |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1037 = left + (i + 1) * glyph_width; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1038 clip_rectangle.top = top; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1039 clip_rectangle.bottom = top + line_height; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1040 clip_region = &clip_rectangle; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1041 } |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1042 W32_TEXTOUT (i, 1); |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1043 } |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1044 } |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1045 else |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1046 { |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1047 i = 0; |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1048 W32_TEXTOUT (i, n_chars); |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1049 } |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1050 } |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1051 else |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1052 { |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1053 /* Handle composite characters. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1054 RECT clip_rectangle; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1055 LPRECT clip_region = NULL; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1056 UINT fuOptions = 0; |
23806
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1057 ABC char_placement; |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1058 int char_width = 0; |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1059 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1060 if (require_clipping) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1061 { |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1062 /* Set up a clipping rectangle for ExtTextOut */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1063 fuOptions |= ETO_CLIPPED; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1064 clip_rectangle.left = left; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1065 clip_rectangle.right = left + glyph_width; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1066 clip_rectangle.top = top; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1067 clip_rectangle.bottom = top + line_height; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1068 clip_region = &clip_rectangle; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1069 } |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1070 if ((cmpcharp->cmp_rule || relative_compose) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1071 && gidx == 0) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1072 { |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1073 /* This is the first character. Initialize variables. |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1074 HIGHEST is the highest position of glyphs ever |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1075 written, LOWEST the lowest position. */ |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1076 int xoffset = 0; |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1077 int yoffset = baseline; |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1078 int start = 0; |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1079 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1080 if (default_ascent |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1081 && CHAR_TABLE_P (Vuse_default_ascent) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1082 && !NILP (Faref (Vuse_default_ascent, first_ch))) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1083 { |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1084 highest = default_ascent; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1085 lowest = 0; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1086 } |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1087 /* TODO: per char metrics for Truetype and BDF |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1088 fonts. */ |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1089 { |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1090 highest = FONT_BASE (font) + 1; |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1091 lowest = - (FONT_HEIGHT (font) - FONT_BASE (font)); |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1092 } |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1093 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1094 if (cmpcharp->cmp_rule) |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1095 xoffset = (int)(cmpcharp->col_offset[0] |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1096 * FONT_WIDTH (FRAME_FONT (f))); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1097 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1098 i = 1; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1099 |
23806
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1100 /* Truetype fonts often contain underhangs to |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1101 handle composition characters. This works |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1102 against our attempts to position the characters |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1103 manually, so we need to compensate for this. |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1104 */ |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1105 if (print_via_unicode ? |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1106 GetCharABCWidthsW (hdc, *x_2byte_buffer, |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1107 *x_2byte_buffer, |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1108 &char_placement) |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1109 : GetCharABCWidths (hdc, *x_1byte_buffer, |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1110 *x_1byte_buffer, |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1111 &char_placement)) |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1112 { |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1113 char_width = char_placement.abcA |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1114 + char_placement.abcB + char_placement.abcC; |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1115 xoffset += FONT_WIDTH (font) - char_width; |
23806
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1116 } |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1117 /* Don't let characters go beyond the glyph |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1118 boundary whatever their over/underhangs. */ |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1119 if (xoffset > glyph_width - char_width) |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1120 xoffset = glyph_width - char_width; |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1121 |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1122 if (xoffset < 0) |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1123 xoffset = 0; |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1124 |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1125 /* Draw the first character at the normal |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1126 position. */ |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1127 W32_TEXTOUT (start, 1); |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1128 gidx++; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1129 } |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1130 else |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1131 i = 0; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1132 |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1133 for (; i < n_chars; gidx++) |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1134 { |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1135 int xoffset = 0, yoffset = FONT_BASE (font); |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1136 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1137 if (relative_compose) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1138 { |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1139 /* No per char metrics on w32. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1140 if (NILP (Vignore_relative_composition) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1141 || NILP (Faref (Vignore_relative_composition, |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1142 make_number (cmpcharp->glyph[gidx])))) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1143 { |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1144 if (- (FONT_HEIGHT (font) - FONT_BASE (font)) |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1145 >= relative_compose) |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1146 { |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1147 /* Draw above the current glyphs. */ |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1148 yoffset = highest + FONT_HEIGHT (font); |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1149 highest += FONT_HEIGHT (font); |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1150 } |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1151 else if (FONT_BASE (font) <= 0) |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1152 { |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1153 /* Draw beneath the current glyphs. */ |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1154 yoffset = lowest; |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1155 lowest -= FONT_HEIGHT (font); |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1156 } |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1157 } |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1158 else |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1159 { |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1160 /* Draw the glyph at normal position. If |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1161 it sticks out of HIGHEST or LOWEST, |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1162 update them appropriately. */ |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1163 if (FONT_BASE (font) > highest) |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1164 highest = FONT_BASE (font); |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1165 else if (- (FONT_HEIGHT (font) - FONT_BASE (font)) |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1166 < lowest) |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1167 lowest = - (FONT_HEIGHT (font) - |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1168 FONT_BASE (font)); |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1169 } |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1170 } |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1171 else if (cmpcharp->cmp_rule) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1172 { |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1173 int gref = (cmpcharp->cmp_rule[gidx] - 0xA0) / 9; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1174 int nref = (cmpcharp->cmp_rule[gidx] - 0xA0) % 9; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1175 int bottom, top; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1176 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1177 /* Re-encode GREF and NREF so that they specify |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1178 only Y-axis information: |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1179 0:top, 1:base, 2:bottom, 3:center */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1180 gref = gref / 3 + (gref == 4) * 2; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1181 nref = nref / 3 + (nref == 4) * 2; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1182 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1183 /* No per char metrics on w32. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1184 bottom = ((gref == 0 ? highest : gref == 1 ? 0 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1185 : gref == 2 ? lowest |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1186 : (highest + lowest) / 2) |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1187 - (nref == 0 ? FONT_HEIGHT (font) |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1188 : nref == 1 ? (FONT_HEIGHT (font) - |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1189 FONT_BASE (font)) |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1190 : nref == 2 ? 0 |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1191 : (FONT_HEIGHT (font) / 2))); |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1192 top = bottom + FONT_HEIGHT (font); |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1193 |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1194 if (top > highest) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1195 highest = top; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1196 if (bottom < lowest) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1197 lowest = bottom; |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1198 yoffset = bottom + FONT_HEIGHT (font); |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1199 xoffset = (int)(cmpcharp->col_offset[gidx] |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1200 * FONT_WIDTH (FRAME_FONT(f))); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1201 } |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1202 |
23806
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1203 /* Truetype fonts often contain underhangs to |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1204 handle composition characters. This works |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1205 against our attempts to position the characters |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1206 manually, so we need to compensate for this. |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1207 */ |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1208 if (print_via_unicode ? |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1209 GetCharABCWidthsW (hdc, *(x_2byte_buffer + i), |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1210 *(x_2byte_buffer + i), |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1211 &char_placement) |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1212 : GetCharABCWidths (hdc, *(x_1byte_buffer + i), |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1213 *(x_1byte_buffer + i), |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1214 &char_placement)) |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1215 { |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1216 char_width = char_placement.abcA |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1217 + char_placement.abcB + char_placement.abcC; |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1218 xoffset += FONT_WIDTH (font) - char_width; |
23806
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1219 } |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1220 /* Don't let characters go beyond the glyph |
b59294a6167e
(dumpglyphs): Use unsigned char arrays.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23677
diff
changeset
|
1221 boundary whatever their over/underhangs. */ |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1222 if (xoffset > glyph_width - char_width) |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1223 xoffset = glyph_width - char_width; |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1224 |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1225 if (xoffset < 0) |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1226 xoffset = 0; |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1227 |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1228 W32_TEXTOUT (i, 1); |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1229 } |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1230 } |
13434 | 1231 } |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1232 if (!font) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1233 { |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1234 /* Show rectangles to indicate that we found no font. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1235 int limit = cmpcharp ? 1 : len; |
24733
8f526771b25b
(dumpglyphs): Use correct colours for drawing rectangles in place of
Andrew Innes <andrewi@gnu.org>
parents:
24687
diff
changeset
|
1236 HBRUSH hb, oldhb; |
8f526771b25b
(dumpglyphs): Use correct colours for drawing rectangles in place of
Andrew Innes <andrewi@gnu.org>
parents:
24687
diff
changeset
|
1237 HPEN hp, oldhp; |
8f526771b25b
(dumpglyphs): Use correct colours for drawing rectangles in place of
Andrew Innes <andrewi@gnu.org>
parents:
24687
diff
changeset
|
1238 hb = CreateSolidBrush (bg); |
8f526771b25b
(dumpglyphs): Use correct colours for drawing rectangles in place of
Andrew Innes <andrewi@gnu.org>
parents:
24687
diff
changeset
|
1239 hp = CreatePen (PS_SOLID, 0, fg); |
8f526771b25b
(dumpglyphs): Use correct colours for drawing rectangles in place of
Andrew Innes <andrewi@gnu.org>
parents:
24687
diff
changeset
|
1240 oldhb = SelectObject(hdc, hb); |
8f526771b25b
(dumpglyphs): Use correct colours for drawing rectangles in place of
Andrew Innes <andrewi@gnu.org>
parents:
24687
diff
changeset
|
1241 oldhp = SelectObject(hdc, hp); |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1242 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1243 for (i = 0; i < limit; i++) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1244 Rectangle (hdc, left + glyph_width * i, top, |
24733
8f526771b25b
(dumpglyphs): Use correct colours for drawing rectangles in place of
Andrew Innes <andrewi@gnu.org>
parents:
24687
diff
changeset
|
1245 left + glyph_width * (i + 1), |
8f526771b25b
(dumpglyphs): Use correct colours for drawing rectangles in place of
Andrew Innes <andrewi@gnu.org>
parents:
24687
diff
changeset
|
1246 top + line_height); |
8f526771b25b
(dumpglyphs): Use correct colours for drawing rectangles in place of
Andrew Innes <andrewi@gnu.org>
parents:
24687
diff
changeset
|
1247 |
8f526771b25b
(dumpglyphs): Use correct colours for drawing rectangles in place of
Andrew Innes <andrewi@gnu.org>
parents:
24687
diff
changeset
|
1248 SelectObject(hdc, oldhb); |
8f526771b25b
(dumpglyphs): Use correct colours for drawing rectangles in place of
Andrew Innes <andrewi@gnu.org>
parents:
24687
diff
changeset
|
1249 SelectObject(hdc, oldhp); |
8f526771b25b
(dumpglyphs): Use correct colours for drawing rectangles in place of
Andrew Innes <andrewi@gnu.org>
parents:
24687
diff
changeset
|
1250 DeleteObject (hb); |
8f526771b25b
(dumpglyphs): Use correct colours for drawing rectangles in place of
Andrew Innes <andrewi@gnu.org>
parents:
24687
diff
changeset
|
1251 DeleteObject (hp); |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1252 } |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1253 else if (require_clipping && !NILP (Vhighlight_wrong_size_font)) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1254 { |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1255 /* Indicate that we found a font of inappropriate size. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1256 int limit = cmpcharp ? 1 : len; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1257 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1258 for (i = 0; i < limit; i++) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1259 { |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1260 w32_fill_area (f, hdc, fg, left + glyph_width * i, |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1261 top + line_height - 1, glyph_width, 1); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1262 w32_fill_area (f, hdc, fg, left + glyph_width * i, |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1263 top + line_height - 3, 1, 2); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1264 } |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1265 } |
24733
8f526771b25b
(dumpglyphs): Use correct colours for drawing rectangles in place of
Andrew Innes <andrewi@gnu.org>
parents:
24687
diff
changeset
|
1266 |
13434 | 1267 { |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1268 /* Setting underline position based on the metric of the |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1269 current font results in shaky underline if it strides |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1270 over different fonts. So, we set the position based only |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1271 on the default font of this frame. */ |
13434 | 1272 int underline_position = 1; |
1273 | |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1274 if (FONT_HEIGHT (FRAME_FONT (f)) - FONT_BASE(FRAME_FONT (f)) |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1275 <= underline_position) |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1276 underline_position = (FONT_HEIGHT (FRAME_FONT (f)) - |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
1277 FONT_BASE(FRAME_FONT (f))) - 1; |
13434 | 1278 |
1279 if (face->underline) | |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1280 w32_fill_area (f, hdc, fg, left, |
23638
e6fb9ffee4f4
(dumpglyphs): Use FRAME_FONT for w32_fill_area.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23510
diff
changeset
|
1281 top + FONT_BASE (FRAME_FONT (f)) |
e6fb9ffee4f4
(dumpglyphs): Use FRAME_FONT for w32_fill_area.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23510
diff
changeset
|
1282 + underline_position, |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1283 run_width, 1); |
13434 | 1284 } |
1285 | |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1286 if (!cmpcharp) |
24733
8f526771b25b
(dumpglyphs): Use correct colours for drawing rectangles in place of
Andrew Innes <andrewi@gnu.org>
parents:
24687
diff
changeset
|
1287 left += run_width; |
13434 | 1288 } |
1289 } | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1290 release_frame_dc (f, hdc); |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1291 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
1292 return (left - orig_left); |
13434 | 1293 } |
1294 | |
1295 | |
1296 /* Output some text at the nominal frame cursor position. | |
1297 Advance the cursor over the text. | |
1298 Output LEN glyphs at START. | |
1299 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1300 `highlight', set up by w32_reassert_line_highlight or w32_change_line_highlight, |
13434 | 1301 controls the pixel values used for foreground and background. */ |
1302 | |
21831
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
1303 static void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1304 w32_write_glyphs (start, len) |
13434 | 1305 register GLYPH *start; |
1306 int len; | |
1307 { | |
1308 register int temp_length; | |
1309 struct frame *f; | |
1310 | |
1311 BLOCK_INPUT; | |
1312 | |
1313 do_line_dance (); | |
1314 f = updating_frame; | |
1315 if (f == 0) | |
1316 { | |
1317 f = selected_frame; | |
1318 /* If not within an update, | |
1319 output at the frame's visible cursor. */ | |
1320 curs_x = f->cursor_x; | |
1321 curs_y = f->cursor_y; | |
1322 } | |
1323 | |
1324 dumpglyphs (f, | |
1325 CHAR_TO_PIXEL_COL (f, curs_x), | |
1326 CHAR_TO_PIXEL_ROW (f, curs_y), | |
21614
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
1327 start, len, highlight, 0, NULL); |
13434 | 1328 |
1329 /* If we drew on top of the cursor, note that it is turned off. */ | |
1330 if (curs_y == f->phys_cursor_y | |
1331 && curs_x <= f->phys_cursor_x | |
1332 && curs_x + len > f->phys_cursor_x) | |
24674 | 1333 f->phys_cursor_on = 0; |
13434 | 1334 |
1335 if (updating_frame == 0) | |
1336 { | |
1337 f->cursor_x += len; | |
1338 x_display_cursor (f, 1); | |
1339 f->cursor_x -= len; | |
1340 } | |
1341 else | |
1342 curs_x += len; | |
1343 | |
1344 UNBLOCK_INPUT; | |
1345 } | |
1346 | |
1347 /* Clear to the end of the line. | |
1348 Erase the current text line from the nominal cursor position (inclusive) | |
1349 to column FIRST_UNUSED (exclusive). The idea is that everything | |
1350 from FIRST_UNUSED onward is already erased. */ | |
1351 | |
21831
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
1352 static void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1353 w32_clear_end_of_line (first_unused) |
13434 | 1354 register int first_unused; |
1355 { | |
1356 struct frame *f = updating_frame; | |
1357 | |
1358 if (f == 0) | |
1359 abort (); | |
1360 | |
1361 if (curs_y < 0 || curs_y >= f->height) | |
21831
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
1362 return; |
13434 | 1363 if (first_unused <= 0) |
21831
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
1364 return; |
13434 | 1365 |
1366 if (first_unused >= f->width) | |
1367 first_unused = f->width; | |
1368 | |
18877
d3e5a5f5fe02
(w32_clear_end_of_line): Include scroll bar width.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18507
diff
changeset
|
1369 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
|
1370 |
13434 | 1371 BLOCK_INPUT; |
1372 | |
1373 do_line_dance (); | |
1374 | |
1375 /* Notice if the cursor will be cleared by this operation. */ | |
1376 if (curs_y == f->phys_cursor_y | |
1377 && curs_x <= f->phys_cursor_x | |
1378 && f->phys_cursor_x < first_unused) | |
24674 | 1379 f->phys_cursor_on = 0; |
13434 | 1380 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1381 w32_clear_area (f, NULL, |
13434 | 1382 CHAR_TO_PIXEL_COL (f, curs_x), |
1383 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
|
1384 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
|
1385 f->output_data.w32->line_height); |
13434 | 1386 |
1387 UNBLOCK_INPUT; | |
1388 } | |
1389 | |
21831
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
1390 static void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1391 w32_clear_frame () |
13434 | 1392 { |
1393 struct frame *f = updating_frame; | |
1394 | |
1395 if (f == 0) | |
1396 f = selected_frame; | |
1397 | |
24674 | 1398 f->phys_cursor_on = 0; /* Cursor not visible. */ |
13434 | 1399 curs_x = 0; /* Nominal cursor position is top left. */ |
1400 curs_y = 0; | |
1401 | |
1402 BLOCK_INPUT; | |
1403 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1404 w32_clear_window (f); |
13434 | 1405 |
1406 /* We have to clear the scroll bars, too. If we have changed | |
1407 colors or something like that, then they should be notified. */ | |
1408 x_scroll_bar_clear (f); | |
1409 | |
1410 UNBLOCK_INPUT; | |
1411 } | |
1412 | |
1413 /* Make audible bell. */ | |
1414 | |
21831
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
1415 static void |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
1416 w32_ring_bell (void) |
13434 | 1417 { |
1418 BLOCK_INPUT; | |
1419 | |
1420 if (visible_bell) | |
22059
23fda104cd36
(w32_ring_bell): Flash window correctly.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21885
diff
changeset
|
1421 { |
23fda104cd36
(w32_ring_bell): Flash window correctly.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21885
diff
changeset
|
1422 int i; |
23fda104cd36
(w32_ring_bell): Flash window correctly.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21885
diff
changeset
|
1423 HWND hwnd = FRAME_W32_WINDOW (selected_frame); |
23fda104cd36
(w32_ring_bell): Flash window correctly.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21885
diff
changeset
|
1424 |
23fda104cd36
(w32_ring_bell): Flash window correctly.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21885
diff
changeset
|
1425 for (i = 0; i < 5; i++) |
23fda104cd36
(w32_ring_bell): Flash window correctly.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21885
diff
changeset
|
1426 { |
23fda104cd36
(w32_ring_bell): Flash window correctly.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21885
diff
changeset
|
1427 FlashWindow (hwnd, TRUE); |
23fda104cd36
(w32_ring_bell): Flash window correctly.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21885
diff
changeset
|
1428 Sleep (10); |
23fda104cd36
(w32_ring_bell): Flash window correctly.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21885
diff
changeset
|
1429 } |
23fda104cd36
(w32_ring_bell): Flash window correctly.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21885
diff
changeset
|
1430 FlashWindow (hwnd, FALSE); |
23fda104cd36
(w32_ring_bell): Flash window correctly.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21885
diff
changeset
|
1431 } |
13434 | 1432 else |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1433 w32_sys_ring_bell (); |
13434 | 1434 |
1435 UNBLOCK_INPUT; | |
1436 } | |
1437 | |
1438 /* Insert and delete character. | |
1439 These are not supposed to be used because we are supposed to turn | |
1440 off the feature of using them. */ | |
1441 | |
21831
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
1442 static void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1443 w32_insert_glyphs (start, len) |
21831
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
1444 register GLYPH *start; |
13434 | 1445 register int len; |
1446 { | |
1447 abort (); | |
1448 } | |
1449 | |
21831
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
1450 static void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1451 w32_delete_glyphs (n) |
13434 | 1452 register int n; |
1453 { | |
1454 abort (); | |
1455 } | |
1456 | |
1457 /* Specify how many text lines, from the top of the window, | |
1458 should be affected by insert-lines and delete-lines operations. | |
1459 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
|
1460 that is bounded by calls to w32_update_begin and w32_update_end. */ |
13434 | 1461 |
21831
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
1462 static void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1463 w32_set_terminal_window (n) |
13434 | 1464 register int n; |
1465 { | |
1466 if (updating_frame == 0) | |
1467 abort (); | |
1468 | |
1469 if ((n <= 0) || (n > updating_frame->height)) | |
1470 flexlines = updating_frame->height; | |
1471 else | |
1472 flexlines = n; | |
1473 } | |
1474 | |
1475 /* These variables need not be per frame | |
1476 because redisplay is done on a frame-by-frame basis | |
1477 and the line dance for one frame is finished before | |
1478 anything is done for another frame. */ | |
1479 | |
1480 /* Array of line numbers from cached insert/delete operations. | |
1481 line_dance[i] is the old position of the line that we want | |
1482 to move to line i, or -1 if we want a blank line there. */ | |
1483 static int *line_dance; | |
1484 | |
1485 /* Allocated length of that array. */ | |
1486 static int line_dance_len; | |
1487 | |
1488 /* Flag indicating whether we've done any work. */ | |
1489 static int line_dance_in_progress; | |
1490 | |
1491 /* Perform an insert-lines or delete-lines operation, | |
1492 inserting N lines or deleting -N lines at vertical position VPOS. */ | |
21831
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
1493 |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
1494 static void |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1495 w32_ins_del_lines (vpos, n) |
13434 | 1496 int vpos, n; |
1497 { | |
1498 register int fence, i; | |
1499 | |
1500 if (vpos >= flexlines) | |
21831
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
1501 return; |
13434 | 1502 |
1503 if (!line_dance_in_progress) | |
1504 { | |
1505 int ht = updating_frame->height; | |
1506 if (ht > line_dance_len) | |
1507 { | |
1508 line_dance = (int *)xrealloc (line_dance, ht * sizeof (int)); | |
1509 line_dance_len = ht; | |
1510 } | |
1511 for (i = 0; i < ht; ++i) line_dance[i] = i; | |
1512 line_dance_in_progress = 1; | |
1513 } | |
1514 if (n >= 0) | |
1515 { | |
1516 if (n > flexlines - vpos) | |
1517 n = flexlines - vpos; | |
1518 fence = vpos + n; | |
1519 for (i = flexlines; --i >= fence;) | |
1520 line_dance[i] = line_dance[i-n]; | |
1521 for (i = fence; --i >= vpos;) | |
1522 line_dance[i] = -1; | |
1523 } | |
1524 else | |
1525 { | |
1526 n = -n; | |
1527 if (n > flexlines - vpos) | |
1528 n = flexlines - vpos; | |
1529 fence = flexlines - n; | |
1530 for (i = vpos; i < fence; ++i) | |
1531 line_dance[i] = line_dance[i + n]; | |
1532 for (i = fence; i < flexlines; ++i) | |
1533 line_dance[i] = -1; | |
1534 } | |
1535 } | |
1536 | |
1537 /* Here's where we actually move the pixels around. | |
1538 Must be called with input blocked. */ | |
1539 static void | |
1540 do_line_dance () | |
1541 { | |
1542 register int i, j, distance; | |
1543 register struct frame *f; | |
1544 int ht; | |
1545 int intborder; | |
1546 HDC hdc; | |
1547 | |
1548 /* Must check this flag first. If it's not set, then not only is the | |
1549 array uninitialized, but we might not even have a frame. */ | |
1550 if (!line_dance_in_progress) | |
1551 return; | |
1552 | |
1553 f = updating_frame; | |
1554 if (f == 0) | |
1555 abort (); | |
1556 | |
1557 ht = f->height; | |
24674 | 1558 intborder = CHAR_TO_PIXEL_COL (f, FRAME_LEFT_SCROLL_BAR_WIDTH (f)); |
13434 | 1559 |
1560 x_display_cursor (updating_frame, 0); | |
1561 | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1562 hdc = get_frame_dc (f); |
13434 | 1563 |
1564 for (i = 0; i < ht; ++i) | |
1565 if (line_dance[i] != -1 && (distance = line_dance[i]-i) > 0) | |
1566 { | |
1567 for (j = i; (j < ht && line_dance[j] != -1 | |
1568 && line_dance[j]-j == distance); ++j); | |
1569 /* Copy [i,j) upward from [i+distance, j+distance) */ | |
1570 BitBlt (hdc, | |
1571 intborder, CHAR_TO_PIXEL_ROW (f, i+distance), | |
24674 | 1572 FRAME_WINDOW_WIDTH (f) * FONT_WIDTH (FRAME_FONT (f)), |
1573 (j-i) * FRAME_LINE_HEIGHT (f), | |
13434 | 1574 hdc, |
1575 intborder, CHAR_TO_PIXEL_ROW (f, i), | |
1576 SRCCOPY); | |
1577 i = j-1; | |
1578 } | |
1579 | |
1580 for (i = ht; --i >=0; ) | |
1581 if (line_dance[i] != -1 && (distance = line_dance[i]-i) < 0) | |
1582 { | |
1583 for (j = i; (--j >= 0 && line_dance[j] != -1 | |
1584 && line_dance[j]-j == distance);); | |
1585 /* Copy (j, i] downward from (j+distance, i+distance] */ | |
1586 BitBlt (hdc, | |
1587 intborder, CHAR_TO_PIXEL_ROW (f, j+1+distance), | |
24674 | 1588 FRAME_WINDOW_WIDTH (f) * FONT_WIDTH (FRAME_FONT (f)), |
1589 (i-j) * FRAME_LINE_HEIGHT (f), | |
13434 | 1590 hdc, |
1591 intborder, CHAR_TO_PIXEL_ROW (f, j+1), | |
1592 SRCCOPY); | |
1593 i = j+1; | |
1594 } | |
1595 | |
1596 for (i = 0; i < ht; ++i) | |
1597 if (line_dance[i] == -1) | |
1598 { | |
1599 for (j = i; j < ht && line_dance[j] == -1; ++j); | |
1600 /* Clear [i,j) */ | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
1601 w32_clear_area (f, hdc, |
13434 | 1602 intborder, |
1603 CHAR_TO_PIXEL_ROW (f, i), | |
24674 | 1604 FRAME_WINDOW_WIDTH (f) * FONT_WIDTH (FRAME_FONT (f)), |
1605 (j-i) * FRAME_LINE_HEIGHT (f)); | |
13434 | 1606 i = j-1; |
1607 } | |
1608 line_dance_in_progress = 0; | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
1609 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
1610 release_frame_dc (f, hdc); |
13434 | 1611 } |
1612 | |
1613 /* Support routines for exposure events. */ | |
1614 static void clear_cursor (); | |
1615 | |
1616 /* Output into a rectangle of a window (for frame F) | |
1617 the characters in f->phys_lines that overlap that rectangle. | |
1618 TOP and LEFT are the position of the upper left corner of the rectangle. | |
1619 ROWS and COLS are the size of the rectangle. | |
1620 Call this function with input blocked. */ | |
1621 | |
1622 void | |
1623 dumprectangle (f, left, top, cols, rows) | |
1624 struct frame *f; | |
1625 register int left, top, cols, rows; | |
1626 { | |
1627 register struct frame_glyphs *active_frame = FRAME_CURRENT_GLYPHS (f); | |
1628 int cursor_cleared = 0; | |
1629 int bottom, right; | |
1630 register int y; | |
1631 | |
1632 if (FRAME_GARBAGED_P (f)) | |
1633 return; | |
1634 | |
1635 /* Express rectangle as four edges, instead of position-and-size. */ | |
1636 bottom = top + rows; | |
1637 right = left + cols; | |
1638 | |
1639 /* Convert rectangle edges in pixels to edges in chars. | |
1640 Round down for left and top, up for right and bottom. */ | |
1641 top = PIXEL_TO_CHAR_ROW (f, top); | |
1642 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
|
1643 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
|
1644 right += (FONT_WIDTH (f->output_data.w32->font) - 1); |
13434 | 1645 bottom = PIXEL_TO_CHAR_ROW (f, bottom); |
1646 right = PIXEL_TO_CHAR_COL (f, right); | |
1647 | |
1648 /* Clip the rectangle to what can be visible. */ | |
24674 | 1649 if (left < FRAME_LEFT_SCROLL_BAR_WIDTH (f)) |
1650 left = FRAME_LEFT_SCROLL_BAR_WIDTH (f); | |
13434 | 1651 if (top < 0) |
1652 top = 0; | |
24674 | 1653 if (right > f->width + FRAME_LEFT_SCROLL_BAR_WIDTH (f)) |
1654 right = f->width + FRAME_LEFT_SCROLL_BAR_WIDTH (f); | |
13434 | 1655 if (bottom > f->height) |
1656 bottom = f->height; | |
1657 | |
1658 /* Get size in chars of the rectangle. */ | |
1659 cols = right - left; | |
1660 rows = bottom - top; | |
1661 | |
1662 /* If rectangle has zero area, return. */ | |
1663 if (rows <= 0) return; | |
1664 if (cols <= 0) return; | |
1665 | |
1666 /* Turn off the cursor if it is in the rectangle. | |
1667 We will turn it back on afterward. */ | |
1668 if ((f->phys_cursor_x >= left) && (f->phys_cursor_x < right) | |
1669 && (f->phys_cursor_y >= top) && (f->phys_cursor_y < bottom)) | |
1670 { | |
1671 clear_cursor (f); | |
1672 cursor_cleared = 1; | |
1673 } | |
1674 | |
1675 /* Display the text in the rectangle, one text line at a time. */ | |
1676 | |
1677 for (y = top; y < bottom; y++) | |
1678 { | |
1679 GLYPH *line = &active_frame->glyphs[y][left]; | |
1680 | |
1681 if (! active_frame->enable[y] || left > active_frame->used[y]) | |
1682 continue; | |
1683 | |
1684 dumpglyphs (f, | |
1685 CHAR_TO_PIXEL_COL (f, left), | |
1686 CHAR_TO_PIXEL_ROW (f, y), | |
1687 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
|
1688 active_frame->highlight[y], 0, NULL); |
13434 | 1689 } |
1690 | |
1691 /* Turn the cursor on if we turned it off. */ | |
1692 | |
1693 if (cursor_cleared) | |
1694 x_display_cursor (f, 1); | |
1695 } | |
1696 | |
1697 static void | |
1698 frame_highlight (f) | |
1699 struct frame *f; | |
1700 { | |
1701 x_display_cursor (f, 1); | |
1702 } | |
1703 | |
1704 static void | |
1705 frame_unhighlight (f) | |
1706 struct frame *f; | |
1707 { | |
1708 x_display_cursor (f, 1); | |
1709 } | |
1710 | |
1711 static void x_frame_rehighlight (); | |
1712 | |
1713 /* The focus has changed. Update the frames as necessary to reflect | |
1714 the new situation. Note that we can't change the selected frame | |
1715 here, because the Lisp code we are interrupting might become confused. | |
1716 Each event gets marked with the frame in which it occurred, so the | |
1717 Lisp code can tell when the switch took place by examining the events. */ | |
1718 | |
1719 void | |
1720 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
|
1721 struct w32_display_info *dpyinfo; |
13434 | 1722 struct frame *frame; |
1723 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1724 struct frame *old_focus = dpyinfo->w32_focus_frame; |
13434 | 1725 int events_enqueued = 0; |
1726 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1727 if (frame != dpyinfo->w32_focus_frame) |
13434 | 1728 { |
1729 /* 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
|
1730 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
|
1731 dpyinfo->w32_focus_frame = frame; |
13434 | 1732 |
1733 if (old_focus && old_focus->auto_lower) | |
1734 x_lower_frame (old_focus); | |
1735 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1736 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
|
1737 pending_autoraise_frame = dpyinfo->w32_focus_frame; |
13434 | 1738 else |
1739 pending_autoraise_frame = 0; | |
1740 } | |
1741 | |
1742 x_frame_rehighlight (dpyinfo); | |
1743 } | |
1744 | |
1745 /* Handle an event saying the mouse has moved out of an Emacs frame. */ | |
1746 | |
1747 void | |
1748 x_mouse_leave (dpyinfo) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1749 struct w32_display_info *dpyinfo; |
13434 | 1750 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1751 x_new_focus_frame (dpyinfo, dpyinfo->w32_focus_event_frame); |
13434 | 1752 } |
1753 | |
1754 /* The focus has changed, or we have redirected a frame's focus to | |
1755 another frame (this happens when a frame uses a surrogate | |
1756 minibuffer frame). Shift the highlight as appropriate. | |
1757 | |
1758 The FRAME argument doesn't necessarily have anything to do with which | |
1759 frame is being highlighted or unhighlighted; we only use it to find | |
1760 the appropriate display info. */ | |
1761 static void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1762 w32_frame_rehighlight (frame) |
13434 | 1763 struct frame *frame; |
1764 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1765 x_frame_rehighlight (FRAME_W32_DISPLAY_INFO (frame)); |
13434 | 1766 } |
1767 | |
1768 static void | |
1769 x_frame_rehighlight (dpyinfo) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1770 struct w32_display_info *dpyinfo; |
13434 | 1771 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1772 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
|
1773 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1774 if (dpyinfo->w32_focus_frame) |
13434 | 1775 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1776 dpyinfo->w32_highlight_frame |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1777 = ((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
|
1778 ? 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
|
1779 : dpyinfo->w32_focus_frame); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1780 if (! FRAME_LIVE_P (dpyinfo->w32_highlight_frame)) |
13434 | 1781 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1782 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
|
1783 dpyinfo->w32_highlight_frame = dpyinfo->w32_focus_frame; |
13434 | 1784 } |
1785 } | |
1786 else | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1787 dpyinfo->w32_highlight_frame = 0; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1788 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1789 if (dpyinfo->w32_highlight_frame != old_highlight) |
13434 | 1790 { |
1791 if (old_highlight) | |
1792 frame_unhighlight (old_highlight); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1793 if (dpyinfo->w32_highlight_frame) |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1794 frame_highlight (dpyinfo->w32_highlight_frame); |
13434 | 1795 } |
1796 } | |
1797 | |
1798 /* Keyboard processing - modifier keys, etc. */ | |
1799 | |
1800 /* Convert a keysym to its name. */ | |
1801 | |
1802 char * | |
1803 x_get_keysym_name (keysym) | |
1804 int keysym; | |
1805 { | |
1806 /* Make static so we can always return it */ | |
1807 static char value[100]; | |
1808 | |
1809 BLOCK_INPUT; | |
1810 GetKeyNameText(keysym, value, 100); | |
1811 UNBLOCK_INPUT; | |
1812 | |
1813 return value; | |
1814 } | |
1815 | |
1816 /* Mouse clicks and mouse movement. Rah. */ | |
1817 | |
1818 /* Given a pixel position (PIX_X, PIX_Y) on the frame F, return | |
1819 glyph co-ordinates in (*X, *Y). Set *BOUNDS to the rectangle | |
1820 that the glyph at X, Y occupies, if BOUNDS != 0. | |
1821 If NOCLIP is nonzero, do not force the value into range. */ | |
1822 | |
1823 void | |
1824 pixel_to_glyph_coords (f, pix_x, pix_y, x, y, bounds, noclip) | |
1825 FRAME_PTR f; | |
1826 register int pix_x, pix_y; | |
1827 register int *x, *y; | |
1828 RECT *bounds; | |
1829 int noclip; | |
1830 { | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1831 /* Support tty mode: if Vwindow_system is nil, behave correctly. */ |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1832 if (NILP (Vwindow_system)) |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1833 { |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1834 *x = pix_x; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1835 *y = pix_y; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1836 return; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1837 } |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1838 |
13434 | 1839 /* Arrange for the division in PIXEL_TO_CHAR_COL etc. to round down |
1840 even for negative values. */ | |
1841 if (pix_x < 0) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1842 pix_x -= FONT_WIDTH ((f)->output_data.w32->font) - 1; |
13434 | 1843 if (pix_y < 0) |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1844 pix_y -= (f)->output_data.w32->line_height - 1; |
13434 | 1845 |
1846 pix_x = PIXEL_TO_CHAR_COL (f, pix_x); | |
1847 pix_y = PIXEL_TO_CHAR_ROW (f, pix_y); | |
1848 | |
1849 if (bounds) | |
1850 { | |
1851 bounds->left = CHAR_TO_PIXEL_COL (f, pix_x); | |
1852 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
|
1853 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
|
1854 bounds->bottom = bounds->top + f->output_data.w32->line_height - 1; |
13434 | 1855 } |
1856 | |
1857 if (!noclip) | |
1858 { | |
1859 if (pix_x < 0) | |
1860 pix_x = 0; | |
1861 else if (pix_x > f->width) | |
1862 pix_x = f->width; | |
1863 | |
1864 if (pix_y < 0) | |
1865 pix_y = 0; | |
1866 else if (pix_y > f->height) | |
1867 pix_y = f->height; | |
1868 } | |
1869 | |
1870 *x = pix_x; | |
1871 *y = pix_y; | |
1872 } | |
1873 | |
1874 void | |
1875 glyph_to_pixel_coords (f, x, y, pix_x, pix_y) | |
1876 FRAME_PTR f; | |
1877 register int x, y; | |
1878 register int *pix_x, *pix_y; | |
1879 { | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1880 /* Support tty mode: if Vwindow_system is nil, behave correctly. */ |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1881 if (NILP (Vwindow_system)) |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1882 { |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1883 *pix_x = x; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1884 *pix_y = y; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1885 return; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1886 } |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1887 |
13434 | 1888 *pix_x = CHAR_TO_PIXEL_COL (f, x); |
1889 *pix_y = CHAR_TO_PIXEL_ROW (f, y); | |
1890 } | |
1891 | |
1892 BOOL | |
1893 parse_button (message, pbutton, pup) | |
1894 int message; | |
1895 int * pbutton; | |
1896 int * pup; | |
1897 { | |
1898 int button = 0; | |
1899 int up = 0; | |
1900 | |
1901 switch (message) | |
1902 { | |
1903 case WM_LBUTTONDOWN: | |
1904 button = 0; | |
1905 up = 0; | |
1906 break; | |
1907 case WM_LBUTTONUP: | |
1908 button = 0; | |
1909 up = 1; | |
1910 break; | |
1911 case WM_MBUTTONDOWN: | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1912 if (NILP (Vw32_swap_mouse_buttons)) |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1913 button = 1; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1914 else |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1915 button = 2; |
13434 | 1916 up = 0; |
1917 break; | |
1918 case WM_MBUTTONUP: | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1919 if (NILP (Vw32_swap_mouse_buttons)) |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1920 button = 1; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1921 else |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1922 button = 2; |
13434 | 1923 up = 1; |
1924 break; | |
1925 case WM_RBUTTONDOWN: | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1926 if (NILP (Vw32_swap_mouse_buttons)) |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1927 button = 2; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1928 else |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1929 button = 1; |
13434 | 1930 up = 0; |
1931 break; | |
1932 case WM_RBUTTONUP: | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1933 if (NILP (Vw32_swap_mouse_buttons)) |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1934 button = 2; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1935 else |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
1936 button = 1; |
13434 | 1937 up = 1; |
1938 break; | |
1939 default: | |
1940 return (FALSE); | |
1941 } | |
1942 | |
1943 if (pup) *pup = up; | |
1944 if (pbutton) *pbutton = button; | |
1945 | |
1946 return (TRUE); | |
1947 } | |
1948 | |
1949 | |
1950 /* Prepare a mouse-event in *RESULT for placement in the input queue. | |
1951 | |
1952 If the event is a button press, then note that we have grabbed | |
1953 the mouse. */ | |
1954 | |
1955 static void | |
1956 construct_mouse_click (result, msg, f) | |
1957 struct input_event *result; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
1958 W32Msg *msg; |
13434 | 1959 struct frame *f; |
1960 { | |
1961 int button; | |
1962 int up; | |
1963 | |
1964 parse_button (msg->msg.message, &button, &up); | |
1965 | |
1966 /* Make the event type no_event; we'll change that when we decide | |
1967 otherwise. */ | |
1968 result->kind = mouse_click; | |
1969 result->code = button; | |
1970 result->timestamp = msg->msg.time; | |
1971 result->modifiers = (msg->dwModifiers | |
1972 | (up | |
1973 ? up_modifier | |
1974 : down_modifier)); | |
1975 | |
1976 { | |
1977 int row, column; | |
1978 | |
1979 XSETINT (result->x, LOWORD (msg->msg.lParam)); | |
1980 XSETINT (result->y, HIWORD (msg->msg.lParam)); | |
1981 XSETFRAME (result->frame_or_window, f); | |
1982 } | |
1983 } | |
1984 | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
1985 static void |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
1986 construct_mouse_wheel (result, msg, f) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
1987 struct input_event *result; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
1988 W32Msg *msg; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
1989 struct frame *f; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
1990 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
1991 POINT p; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
1992 result->kind = mouse_wheel; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
1993 result->code = (short) HIWORD (msg->msg.wParam); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
1994 result->timestamp = msg->msg.time; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
1995 result->modifiers = msg->dwModifiers; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
1996 p.x = LOWORD (msg->msg.lParam); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
1997 p.y = HIWORD (msg->msg.lParam); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
1998 ScreenToClient(msg->msg.hwnd, &p); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
1999 XSETINT (result->x, p.x); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2000 XSETINT (result->y, p.y); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2001 XSETFRAME (result->frame_or_window, f); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2002 } |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2003 |
21885 | 2004 static void |
2005 construct_drag_n_drop (result, msg, f) | |
2006 struct input_event *result; | |
2007 W32Msg *msg; | |
2008 struct frame *f; | |
2009 { | |
2010 Lisp_Object files; | |
2011 Lisp_Object frame; | |
2012 HDROP hdrop; | |
2013 POINT p; | |
2014 WORD num_files; | |
2015 char *name; | |
2016 int i, len; | |
2017 | |
2018 result->kind = drag_n_drop; | |
2019 result->code = 0; | |
2020 result->timestamp = msg->msg.time; | |
2021 result->modifiers = msg->dwModifiers; | |
2022 | |
24265
c5f1a1deffbb
(construct_drag_n_drop): Call DraqQueryPoint before
Andrew Innes <andrewi@gnu.org>
parents:
24146
diff
changeset
|
2023 hdrop = (HDROP) msg->msg.wParam; |
c5f1a1deffbb
(construct_drag_n_drop): Call DraqQueryPoint before
Andrew Innes <andrewi@gnu.org>
parents:
24146
diff
changeset
|
2024 DragQueryPoint (hdrop, &p); |
c5f1a1deffbb
(construct_drag_n_drop): Call DraqQueryPoint before
Andrew Innes <andrewi@gnu.org>
parents:
24146
diff
changeset
|
2025 |
24674 | 2026 #if 0 |
21885 | 2027 p.x = LOWORD (msg->msg.lParam); |
2028 p.y = HIWORD (msg->msg.lParam); | |
2029 ScreenToClient (msg->msg.hwnd, &p); | |
24674 | 2030 #endif |
2031 | |
21885 | 2032 XSETINT (result->x, p.x); |
2033 XSETINT (result->y, p.y); | |
2034 | |
2035 num_files = DragQueryFile (hdrop, 0xFFFFFFFF, NULL, 0); | |
2036 files = Qnil; | |
2037 | |
2038 for (i = 0; i < num_files; i++) | |
2039 { | |
2040 len = DragQueryFile (hdrop, i, NULL, 0); | |
2041 if (len <= 0) | |
2042 continue; | |
2043 name = alloca (len + 1); | |
2044 DragQueryFile (hdrop, i, name, len + 1); | |
2045 files = Fcons (build_string (name), files); | |
2046 } | |
2047 | |
2048 DragFinish (hdrop); | |
2049 | |
2050 XSETFRAME (frame, f); | |
2051 result->frame_or_window = Fcons (frame, files); | |
2052 } | |
2053 | |
13434 | 2054 |
2055 /* Function to report a mouse movement to the mainstream Emacs code. | |
2056 The input handler calls this. | |
2057 | |
2058 We have received a mouse movement event, which is given in *event. | |
2059 If the mouse is over a different glyph than it was last time, tell | |
2060 the mainstream emacs code by setting mouse_moved. If not, ask for | |
2061 another motion event, so we can check again the next time it moves. */ | |
2062 | |
2063 static void | |
2064 note_mouse_movement (frame, msg) | |
2065 FRAME_PTR frame; | |
2066 MSG *msg; | |
2067 { | |
2068 last_mouse_movement_time = msg->time; | |
2069 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2070 if (msg->hwnd != FRAME_W32_WINDOW (frame)) |
13434 | 2071 { |
2072 frame->mouse_moved = 1; | |
2073 last_mouse_scroll_bar = Qnil; | |
2074 | |
2075 note_mouse_highlight (frame, -1, -1); | |
2076 } | |
2077 | |
2078 /* Has the mouse moved off the glyph it was on at the last sighting? */ | |
2079 else if (LOWORD (msg->lParam) < last_mouse_glyph.left | |
2080 || 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
|
2081 || HIWORD (msg->lParam) < last_mouse_glyph.top |
13434 | 2082 || HIWORD (msg->lParam) > last_mouse_glyph.bottom) |
2083 { | |
2084 frame->mouse_moved = 1; | |
2085 last_mouse_scroll_bar = Qnil; | |
2086 | |
2087 note_mouse_highlight (frame, LOWORD (msg->lParam), HIWORD (msg->lParam)); | |
2088 } | |
2089 } | |
2090 | |
2091 /* This is used for debugging, to turn off note_mouse_highlight. */ | |
2092 static int disable_mouse_highlight; | |
2093 | |
2094 /* Take proper action when the mouse has moved to position X, Y on frame F | |
2095 as regards highlighting characters that have mouse-face properties. | |
2096 Also dehighlighting chars where the mouse was before. | |
2097 X and Y can be negative or out of range. */ | |
2098 | |
2099 static void | |
2100 note_mouse_highlight (f, x, y) | |
2101 FRAME_PTR f; | |
2102 int x, y; | |
2103 { | |
2104 int row, column, portion; | |
2105 RECT new_glyph; | |
2106 Lisp_Object window; | |
2107 struct window *w; | |
2108 | |
2109 if (disable_mouse_highlight) | |
2110 return; | |
2111 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2112 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
|
2113 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
|
2114 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
|
2115 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2116 if (FRAME_W32_DISPLAY_INFO (f)->mouse_face_defer) |
13434 | 2117 return; |
2118 | |
2119 if (gc_in_progress) | |
2120 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2121 FRAME_W32_DISPLAY_INFO (f)->mouse_face_deferred_gc = 1; |
13434 | 2122 return; |
2123 } | |
2124 | |
2125 /* Find out which glyph the mouse is on. */ | |
2126 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
|
2127 &new_glyph, FRAME_W32_DISPLAY_INFO (f)->grabbed); |
13434 | 2128 |
2129 /* Which window is that in? */ | |
2130 window = window_from_coordinates (f, column, row, &portion); | |
2131 w = XWINDOW (window); | |
2132 | |
2133 /* 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
|
2134 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
|
2135 clear_mouse_face (FRAME_W32_DISPLAY_INFO (f)); |
13434 | 2136 |
2137 /* Are we in a window whose display is up to date? | |
2138 And verify the buffer's text has not changed. */ | |
2139 if (WINDOWP (window) && portion == 0 && row >= 0 && column >= 0 | |
2140 && row < FRAME_HEIGHT (f) && column < FRAME_WIDTH (f) | |
2141 && 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
|
2142 && 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
|
2143 && w->last_overlay_modified == BUF_OVERLAY_MODIFF (XBUFFER (w->buffer))) |
13434 | 2144 { |
2145 int *ptr = FRAME_CURRENT_GLYPHS (f)->charstarts[row]; | |
2146 int i, pos; | |
2147 | |
2148 /* Find which buffer position the mouse corresponds to. */ | |
2149 for (i = column; i >= 0; i--) | |
2150 if (ptr[i] > 0) | |
2151 break; | |
2152 pos = ptr[i]; | |
2153 /* Is it outside the displayed active region (if any)? */ | |
2154 if (pos <= 0) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2155 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
|
2156 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
|
2157 && 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
|
2158 && 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
|
2159 && (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
|
2160 || 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
|
2161 && (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
|
2162 || 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
|
2163 || FRAME_W32_DISPLAY_INFO (f)->mouse_face_past_end))) |
13434 | 2164 { |
2165 Lisp_Object mouse_face, overlay, position; | |
2166 Lisp_Object *overlay_vec; | |
2167 int len, noverlays, ignor1; | |
2168 struct buffer *obuf; | |
2169 int obegv, ozv; | |
2170 | |
2171 /* If we get an out-of-range value, return now; avoid an error. */ | |
2172 if (pos > BUF_Z (XBUFFER (w->buffer))) | |
2173 return; | |
2174 | |
2175 /* Make the window's buffer temporarily current for | |
2176 overlays_at and compute_char_face. */ | |
2177 obuf = current_buffer; | |
2178 current_buffer = XBUFFER (w->buffer); | |
2179 obegv = BEGV; | |
2180 ozv = ZV; | |
2181 BEGV = BEG; | |
2182 ZV = Z; | |
2183 | |
2184 /* 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
|
2185 clear_mouse_face (FRAME_W32_DISPLAY_INFO (f)); |
13434 | 2186 |
2187 /* Is this char mouse-active? */ | |
2188 XSETINT (position, pos); | |
2189 | |
2190 len = 10; | |
2191 overlay_vec = (Lisp_Object *) xmalloc (len * sizeof (Lisp_Object)); | |
2192 | |
2193 /* Put all the overlays we want in a vector in overlay_vec. | |
2194 Store the length in len. */ | |
2195 noverlays = overlays_at (XINT (pos), 1, &overlay_vec, &len, | |
2196 NULL, NULL); | |
2197 noverlays = sort_overlays (overlay_vec, noverlays, w); | |
2198 | |
2199 /* Find the highest priority overlay that has a mouse-face prop. */ | |
2200 overlay = Qnil; | |
2201 for (i = 0; i < noverlays; i++) | |
2202 { | |
2203 mouse_face = Foverlay_get (overlay_vec[i], Qmouse_face); | |
2204 if (!NILP (mouse_face)) | |
2205 { | |
2206 overlay = overlay_vec[i]; | |
2207 break; | |
2208 } | |
2209 } | |
2210 free (overlay_vec); | |
2211 /* If no overlay applies, get a text property. */ | |
2212 if (NILP (overlay)) | |
2213 mouse_face = Fget_text_property (position, Qmouse_face, w->buffer); | |
2214 | |
2215 /* Handle the overlay case. */ | |
2216 if (! NILP (overlay)) | |
2217 { | |
2218 /* Find the range of text around this char that | |
2219 should be active. */ | |
2220 Lisp_Object before, after; | |
2221 int ignore; | |
2222 | |
2223 before = Foverlay_start (overlay); | |
2224 after = Foverlay_end (overlay); | |
2225 /* Record this as the current active region. */ | |
2226 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
|
2227 &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
|
2228 &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
|
2229 FRAME_W32_DISPLAY_INFO (f)->mouse_face_past_end |
13434 | 2230 = !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
|
2231 &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
|
2232 &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
|
2233 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
|
2234 FRAME_W32_DISPLAY_INFO (f)->mouse_face_face_id |
13434 | 2235 = compute_char_face (f, w, pos, 0, 0, |
2236 &ignore, pos + 1, 1); | |
2237 | |
2238 /* Display it as active. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2239 show_mouse_face (FRAME_W32_DISPLAY_INFO (f), 1); |
13434 | 2240 } |
2241 /* Handle the text property case. */ | |
2242 else if (! NILP (mouse_face)) | |
2243 { | |
2244 /* Find the range of text around this char that | |
2245 should be active. */ | |
2246 Lisp_Object before, after, beginning, end; | |
2247 int ignore; | |
2248 | |
2249 beginning = Fmarker_position (w->start); | |
2250 XSETINT (end, (BUF_Z (XBUFFER (w->buffer)) | |
2251 - XFASTINT (w->window_end_pos))); | |
2252 before | |
2253 = Fprevious_single_property_change (make_number (pos + 1), | |
2254 Qmouse_face, | |
2255 w->buffer, beginning); | |
2256 after | |
2257 = Fnext_single_property_change (position, Qmouse_face, | |
2258 w->buffer, end); | |
2259 /* Record this as the current active region. */ | |
2260 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
|
2261 &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
|
2262 &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
|
2263 FRAME_W32_DISPLAY_INFO (f)->mouse_face_past_end |
13434 | 2264 = !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
|
2265 &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
|
2266 &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
|
2267 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
|
2268 FRAME_W32_DISPLAY_INFO (f)->mouse_face_face_id |
13434 | 2269 = compute_char_face (f, w, pos, 0, 0, |
2270 &ignore, pos + 1, 1); | |
2271 | |
2272 /* Display it as active. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2273 show_mouse_face (FRAME_W32_DISPLAY_INFO (f), 1); |
13434 | 2274 } |
2275 BEGV = obegv; | |
2276 ZV = ozv; | |
2277 current_buffer = obuf; | |
2278 } | |
2279 } | |
2280 } | |
2281 | |
2282 /* Find the row and column of position POS in window WINDOW. | |
2283 Store them in *COLUMNP and *ROWP. | |
2284 This assumes display in WINDOW is up to date. | |
2285 If POS is above start of WINDOW, return coords | |
2286 of start of first screen line. | |
2287 If POS is after end of WINDOW, return coords of end of last screen line. | |
2288 | |
2289 Value is 1 if POS is in range, 0 if it was off screen. */ | |
2290 | |
2291 static int | |
2292 fast_find_position (window, pos, columnp, rowp) | |
2293 Lisp_Object window; | |
2294 int pos; | |
2295 int *columnp, *rowp; | |
2296 { | |
2297 struct window *w = XWINDOW (window); | |
2298 FRAME_PTR f = XFRAME (WINDOW_FRAME (w)); | |
2299 int i; | |
2300 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
|
2301 int left = WINDOW_LEFT_MARGIN (w); |
13434 | 2302 int top = w->top; |
2303 int height = XFASTINT (w->height) - ! MINI_WINDOW_P (w); | |
2304 int width = window_internal_width (w); | |
2305 int *charstarts; | |
2306 int lastcol; | |
2307 int maybe_next_line = 0; | |
2308 | |
2309 /* Find the right row. */ | |
2310 for (i = 0; | |
2311 i < height; | |
2312 i++) | |
2313 { | |
2314 int linestart = FRAME_CURRENT_GLYPHS (f)->charstarts[top + i][left]; | |
2315 if (linestart > pos) | |
2316 break; | |
2317 /* If the position sought is the end of the buffer, | |
2318 don't include the blank lines at the bottom of the window. */ | |
2319 if (linestart == pos && pos == BUF_ZV (XBUFFER (w->buffer))) | |
2320 { | |
2321 maybe_next_line = 1; | |
2322 break; | |
2323 } | |
2324 if (linestart > 0) | |
2325 row = i; | |
2326 } | |
2327 | |
2328 /* Find the right column with in it. */ | |
2329 charstarts = FRAME_CURRENT_GLYPHS (f)->charstarts[top + row]; | |
2330 lastcol = left; | |
2331 for (i = 0; i < width; i++) | |
2332 { | |
2333 if (charstarts[left + i] == pos) | |
2334 { | |
2335 *rowp = row + top; | |
2336 *columnp = i + left; | |
2337 return 1; | |
2338 } | |
2339 else if (charstarts[left + i] > pos) | |
2340 break; | |
2341 else if (charstarts[left + i] > 0) | |
2342 lastcol = left + i; | |
2343 } | |
2344 | |
2345 /* If we're looking for the end of the buffer, | |
2346 and we didn't find it in the line we scanned, | |
2347 use the start of the following line. */ | |
2348 if (maybe_next_line) | |
2349 { | |
2350 row++; | |
2351 i = 0; | |
2352 } | |
2353 | |
2354 *rowp = row + top; | |
2355 *columnp = lastcol; | |
2356 return 0; | |
2357 } | |
2358 | |
2359 /* Display the active region described by mouse_face_* | |
2360 in its mouse-face if HL > 0, in its normal face if HL = 0. */ | |
2361 | |
2362 static void | |
2363 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
|
2364 struct w32_display_info *dpyinfo; |
13434 | 2365 int hl; |
2366 { | |
2367 struct window *w = XWINDOW (dpyinfo->mouse_face_window); | |
2368 int width = window_internal_width (w); | |
2369 FRAME_PTR f = XFRAME (WINDOW_FRAME (w)); | |
2370 int i; | |
2371 int cursor_off = 0; | |
2372 int old_curs_x = curs_x; | |
2373 int old_curs_y = curs_y; | |
2374 | |
2375 /* Set these variables temporarily | |
2376 so that if we have to turn the cursor off and on again | |
2377 we will put it back at the same place. */ | |
2378 curs_x = f->phys_cursor_x; | |
2379 curs_y = f->phys_cursor_y; | |
2380 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2381 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
|
2382 i <= FRAME_W32_DISPLAY_INFO (f)->mouse_face_end_row; i++) |
13434 | 2383 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2384 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
|
2385 ? 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
|
2386 : WINDOW_LEFT_MARGIN (w)); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2387 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
|
2388 ? 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
|
2389 : WINDOW_LEFT_MARGIN (w) + width); |
13434 | 2390 endcolumn = min (endcolumn, FRAME_CURRENT_GLYPHS (f)->used[i]); |
2391 | |
2392 /* If the cursor's in the text we are about to rewrite, | |
2393 turn the cursor off. */ | |
2394 if (i == curs_y | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2395 && curs_x >= column - 1 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2396 && curs_x <= endcolumn) |
13434 | 2397 { |
2398 x_display_cursor (f, 0); | |
2399 cursor_off = 1; | |
2400 } | |
2401 | |
2402 dumpglyphs (f, | |
2403 CHAR_TO_PIXEL_COL (f, column), | |
2404 CHAR_TO_PIXEL_ROW (f, i), | |
2405 FRAME_CURRENT_GLYPHS (f)->glyphs[i] + column, | |
2406 endcolumn - column, | |
2407 /* Highlight with mouse face if hl > 0. */ | |
21614
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
2408 hl > 0 ? 3 : 0, 0, NULL); |
13434 | 2409 } |
2410 | |
2411 /* If we turned the cursor off, turn it back on. */ | |
2412 if (cursor_off) | |
2413 x_display_cursor (f, 1); | |
2414 | |
2415 curs_x = old_curs_x; | |
2416 curs_y = old_curs_y; | |
2417 | |
2418 /* Change the mouse cursor according to the value of HL. */ | |
2419 if (hl > 0) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2420 SetCursor (f->output_data.w32->cross_cursor); |
13434 | 2421 else |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2422 SetCursor (f->output_data.w32->text_cursor); |
13434 | 2423 } |
2424 | |
2425 /* Clear out the mouse-highlighted active region. | |
2426 Redraw it unhighlighted first. */ | |
2427 | |
2428 static void | |
2429 clear_mouse_face (dpyinfo) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2430 struct w32_display_info *dpyinfo; |
13434 | 2431 { |
2432 if (! NILP (dpyinfo->mouse_face_window)) | |
2433 show_mouse_face (dpyinfo, 0); | |
2434 | |
2435 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; | |
2436 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; | |
2437 dpyinfo->mouse_face_window = Qnil; | |
2438 } | |
24827
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
2439 |
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
2440 /* Just discard the mouse face information for frame F, if any. |
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
2441 This is used when the size of F is changed. */ |
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
2442 |
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
2443 void |
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
2444 cancel_mouse_face (f) |
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
2445 FRAME_PTR f; |
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
2446 { |
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
2447 Lisp_Object window; |
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
2448 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
2449 |
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
2450 window = dpyinfo->mouse_face_window; |
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
2451 if (! NILP (window) && XFRAME (XWINDOW (window)->frame) == f) |
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
2452 { |
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
2453 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; |
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
2454 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; |
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
2455 dpyinfo->mouse_face_window = Qnil; |
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
2456 } |
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
2457 } |
13434 | 2458 |
2459 struct scroll_bar *x_window_to_scroll_bar (); | |
2460 static void x_scroll_bar_report_motion (); | |
2461 | |
2462 /* Return the current position of the mouse. | |
2463 *fp should be a frame which indicates which display to ask about. | |
2464 | |
2465 If the mouse movement started in a scroll bar, set *fp, *bar_window, | |
2466 and *part to the frame, window, and scroll bar part that the mouse | |
2467 is over. Set *x and *y to the portion and whole of the mouse's | |
2468 position on the scroll bar. | |
2469 | |
2470 If the mouse movement started elsewhere, set *fp to the frame the | |
2471 mouse is on, *bar_window to nil, and *x and *y to the character cell | |
2472 the mouse is over. | |
2473 | |
2474 Set *time to the server timestamp for the time at which the mouse | |
2475 was at this position. | |
2476 | |
2477 Don't store anything if we don't have a valid set of values to report. | |
2478 | |
2479 This clears the mouse_moved flag, so we can wait for the next mouse | |
2480 movement. This also calls XQueryPointer, which will cause the | |
2481 server to give us another MotionNotify when the mouse moves | |
2482 again. */ | |
2483 | |
2484 static void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2485 w32_mouse_position (fp, insist, bar_window, part, x, y, time) |
13434 | 2486 FRAME_PTR *fp; |
2487 int insist; | |
2488 Lisp_Object *bar_window; | |
2489 enum scroll_bar_part *part; | |
2490 Lisp_Object *x, *y; | |
2491 unsigned long *time; | |
2492 { | |
2493 FRAME_PTR f1; | |
2494 | |
2495 BLOCK_INPUT; | |
2496 | |
20179
b4fe0e8ac819
(w32_mouse_position): Handle INSIST < 0.
Karl Heuer <kwzh@gnu.org>
parents:
19713
diff
changeset
|
2497 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
|
2498 /* This is never called at the moment. */ |
13434 | 2499 x_scroll_bar_report_motion (fp, bar_window, part, x, y, time); |
2500 else | |
2501 { | |
2502 POINT pt; | |
2503 | |
2504 Lisp_Object frame, tail; | |
2505 | |
2506 /* Clear the mouse-moved flag for every frame on this display. */ | |
2507 FOR_EACH_FRAME (tail, frame) | |
2508 XFRAME (frame)->mouse_moved = 0; | |
2509 | |
2510 last_mouse_scroll_bar = Qnil; | |
2511 | |
2512 GetCursorPos (&pt); | |
2513 | |
2514 /* Now we have a position on the root; find the innermost window | |
2515 containing the pointer. */ | |
2516 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2517 if (FRAME_W32_DISPLAY_INFO (*fp)->grabbed && last_mouse_frame |
13434 | 2518 && FRAME_LIVE_P (last_mouse_frame)) |
2519 { | |
24752
80c46fd667da
(w32_read_socket): Reset the grabbed flag when a frame gains or
Andrew Innes <andrewi@gnu.org>
parents:
24733
diff
changeset
|
2520 /* If mouse was grabbed on a frame, give coords for that frame |
80c46fd667da
(w32_read_socket): Reset the grabbed flag when a frame gains or
Andrew Innes <andrewi@gnu.org>
parents:
24733
diff
changeset
|
2521 even if the mouse is now outside it. */ |
13434 | 2522 f1 = last_mouse_frame; |
2523 } | |
2524 else | |
2525 { | |
24752
80c46fd667da
(w32_read_socket): Reset the grabbed flag when a frame gains or
Andrew Innes <andrewi@gnu.org>
parents:
24733
diff
changeset
|
2526 /* Is window under mouse one of our frames? */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2527 f1 = x_window_to_frame (FRAME_W32_DISPLAY_INFO (*fp), WindowFromPoint(pt)); |
13434 | 2528 } |
2529 | |
2530 /* If not, is it one of our scroll bars? */ | |
2531 if (! f1) | |
2532 { | |
2533 struct scroll_bar *bar = x_window_to_scroll_bar (WindowFromPoint(pt)); | |
2534 | |
2535 if (bar) | |
2536 { | |
2537 f1 = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); | |
2538 } | |
2539 } | |
2540 | |
20179
b4fe0e8ac819
(w32_mouse_position): Handle INSIST < 0.
Karl Heuer <kwzh@gnu.org>
parents:
19713
diff
changeset
|
2541 if (f1 == 0 && insist > 0) |
13434 | 2542 f1 = selected_frame; |
2543 | |
2544 if (f1) | |
2545 { | |
2546 int ignore1, ignore2; | |
2547 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2548 ScreenToClient (FRAME_W32_WINDOW (f1), &pt); |
13434 | 2549 |
2550 /* Ok, we found a frame. Store all the values. */ | |
2551 | |
2552 pixel_to_glyph_coords (f1, pt.x, pt.y, &ignore1, &ignore2, | |
2553 &last_mouse_glyph, | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2554 FRAME_W32_DISPLAY_INFO (f1)->grabbed |
13434 | 2555 || insist); |
2556 | |
2557 *bar_window = Qnil; | |
2558 *part = 0; | |
2559 *fp = f1; | |
2560 XSETINT (*x, pt.x); | |
2561 XSETINT (*y, pt.y); | |
2562 *time = last_mouse_movement_time; | |
2563 } | |
2564 } | |
2565 } | |
2566 | |
2567 UNBLOCK_INPUT; | |
2568 } | |
2569 | |
2570 /* Scroll bar support. */ | |
2571 | |
2572 /* Given an window ID, find the struct scroll_bar which manages it. | |
2573 This can be called in GC, so we have to make sure to strip off mark | |
2574 bits. */ | |
2575 struct scroll_bar * | |
2576 x_window_to_scroll_bar (window_id) | |
2577 Window window_id; | |
2578 { | |
2579 Lisp_Object tail, frame; | |
2580 | |
2581 for (tail = Vframe_list; | |
2582 XGCTYPE (tail) == Lisp_Cons; | |
2583 tail = XCONS (tail)->cdr) | |
2584 { | |
2585 Lisp_Object frame, bar, condemned; | |
2586 | |
2587 frame = XCONS (tail)->car; | |
2588 /* All elements of Vframe_list should be frames. */ | |
2589 if (! GC_FRAMEP (frame)) | |
2590 abort (); | |
2591 | |
2592 /* Scan this frame's scroll bar list for a scroll bar with the | |
2593 right window ID. */ | |
2594 condemned = FRAME_CONDEMNED_SCROLL_BARS (XFRAME (frame)); | |
2595 for (bar = FRAME_SCROLL_BARS (XFRAME (frame)); | |
2596 /* This trick allows us to search both the ordinary and | |
2597 condemned scroll bar lists with one loop. */ | |
2598 ! GC_NILP (bar) || (bar = condemned, | |
2599 condemned = Qnil, | |
2600 ! GC_NILP (bar)); | |
2601 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
|
2602 if (SCROLL_BAR_W32_WINDOW (XSCROLL_BAR (bar)) == window_id) |
13434 | 2603 return XSCROLL_BAR (bar); |
2604 } | |
2605 | |
2606 return 0; | |
2607 } | |
2608 | |
2609 HWND | |
2610 my_create_scrollbar (f, bar) | |
2611 struct frame * f; | |
2612 struct scroll_bar * bar; | |
2613 { | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2614 return (HWND) SendMessage (FRAME_W32_WINDOW (f), |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2615 WM_EMACS_CREATESCROLLBAR, (WPARAM) f, |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2616 (LPARAM) bar); |
13434 | 2617 } |
2618 | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2619 //#define ATTACH_THREADS |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2620 |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2621 BOOL |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2622 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
|
2623 { |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2624 #ifndef ATTACH_THREADS |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2625 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
|
2626 (WPARAM) hwnd, (LPARAM) how); |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2627 #else |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2628 return ShowWindow (hwnd, how); |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2629 #endif |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2630 } |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2631 |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2632 void |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2633 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
|
2634 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
|
2635 { |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2636 #ifndef ATTACH_THREADS |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2637 WINDOWPOS pos; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2638 pos.hwndInsertAfter = hwndAfter; |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2639 pos.x = x; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2640 pos.y = y; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2641 pos.cx = cx; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2642 pos.cy = cy; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2643 pos.flags = flags; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2644 SendMessage (hwnd, WM_EMACS_SETWINDOWPOS, (WPARAM) &pos, 0); |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2645 #else |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2646 SetWindowPos (hwnd, hwndAfter, x, y, cx, cy, flags); |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2647 #endif |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2648 } |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
2649 |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2650 BOOL |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2651 my_set_focus (f, hwnd) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2652 struct frame * f; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2653 HWND hwnd; |
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 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
|
2656 (WPARAM) hwnd, 0); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2657 } |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2658 |
21614
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
2659 BOOL |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
2660 my_set_foreground_window (hwnd) |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
2661 HWND hwnd; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
2662 { |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
2663 SendMessage (hwnd, WM_EMACS_SETFOREGROUND, (WPARAM) hwnd, 0); |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
2664 } |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
2665 |
13434 | 2666 void |
2667 my_destroy_window (f, hwnd) | |
2668 struct frame * f; | |
2669 HWND hwnd; | |
2670 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2671 SendMessage (FRAME_W32_WINDOW (f), WM_EMACS_DESTROYWINDOW, |
13434 | 2672 (WPARAM) hwnd, 0); |
2673 } | |
2674 | |
2675 /* Open a new window to serve as a scroll bar, and return the | |
2676 scroll bar vector for it. */ | |
2677 static struct scroll_bar * | |
2678 x_scroll_bar_create (window, top, left, width, height) | |
2679 struct window *window; | |
2680 int top, left, width, height; | |
2681 { | |
2682 FRAME_PTR f = XFRAME (WINDOW_FRAME (window)); | |
2683 struct scroll_bar *bar | |
2684 = XSCROLL_BAR (Fmake_vector (make_number (SCROLL_BAR_VEC_SIZE), Qnil)); | |
2685 HWND hwnd; | |
2686 | |
2687 BLOCK_INPUT; | |
2688 | |
2689 XSETWINDOW (bar->window, window); | |
2690 XSETINT (bar->top, top); | |
2691 XSETINT (bar->left, left); | |
2692 XSETINT (bar->width, width); | |
2693 XSETINT (bar->height, height); | |
2694 XSETINT (bar->start, 0); | |
2695 XSETINT (bar->end, 0); | |
2696 bar->dragging = Qnil; | |
2697 | |
2698 /* Requires geometry to be set before call to create the real window */ | |
2699 | |
2700 hwnd = my_create_scrollbar (f, bar); | |
2701 | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2702 if (pfnSetScrollInfo) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2703 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2704 SCROLLINFO si; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2705 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2706 si.cbSize = sizeof (si); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2707 si.fMask = SIF_ALL; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2708 si.nMin = 0; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2709 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
|
2710 + VERTICAL_SCROLL_BAR_MIN_HANDLE; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2711 si.nPage = si.nMax; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2712 si.nPos = 0; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2713 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2714 pfnSetScrollInfo (hwnd, SB_CTL, &si, FALSE); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2715 } |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2716 else |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2717 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2718 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
|
2719 SetScrollPos (hwnd, SB_CTL, 0, FALSE); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2720 } |
13434 | 2721 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2722 SET_SCROLL_BAR_W32_WINDOW (bar, hwnd); |
13434 | 2723 |
2724 /* Add bar to its frame's list of scroll bars. */ | |
2725 bar->next = FRAME_SCROLL_BARS (f); | |
2726 bar->prev = Qnil; | |
2727 XSETVECTOR (FRAME_SCROLL_BARS (f), bar); | |
2728 if (! NILP (bar->next)) | |
2729 XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar); | |
2730 | |
2731 UNBLOCK_INPUT; | |
2732 | |
2733 return bar; | |
2734 } | |
2735 | |
2736 /* Draw BAR's handle in the proper position. | |
2737 If the handle is already drawn from START to END, don't bother | |
2738 redrawing it, unless REBUILD is non-zero; in that case, always | |
2739 redraw it. (REBUILD is handy for drawing the handle after expose | |
2740 events.) | |
2741 | |
2742 Normally, we want to constrain the start and end of the handle to | |
2743 fit inside its rectangle, but if the user is dragging the scroll bar | |
2744 handle, we want to let them drag it down all the way, so that the | |
2745 bar's top is as far down as it goes; otherwise, there's no way to | |
2746 move to the very end of the buffer. */ | |
2747 static void | |
2748 x_scroll_bar_set_handle (bar, start, end, rebuild) | |
2749 struct scroll_bar *bar; | |
2750 int start, end; | |
2751 int rebuild; | |
2752 { | |
2753 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
|
2754 Window w = SCROLL_BAR_W32_WINDOW (bar); |
13434 | 2755 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); |
2756 | |
2757 /* If the display is already accurate, do nothing. */ | |
2758 if (! rebuild | |
2759 && start == XINT (bar->start) | |
2760 && end == XINT (bar->end)) | |
2761 return; | |
2762 | |
2763 BLOCK_INPUT; | |
2764 | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2765 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2766 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
|
2767 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2768 /* 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
|
2769 the distance between start and end. */ |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2770 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2771 int length = end - start; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2772 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2773 if (start < 0) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2774 start = 0; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2775 else if (start > top_range) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2776 start = top_range; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2777 end = start + length; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2778 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2779 if (end < start) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2780 end = start; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2781 else if (end > top_range && ! dragging) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2782 end = top_range; |
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 } |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2785 |
13434 | 2786 /* Store the adjusted setting in the scroll bar. */ |
2787 XSETINT (bar->start, start); | |
2788 XSETINT (bar->end, end); | |
2789 | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2790 /* 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
|
2791 if (!dragging) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2792 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2793 if (pfnSetScrollInfo) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2794 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2795 SCROLLINFO si; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2796 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2797 si.cbSize = sizeof (si); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2798 si.fMask = SIF_PAGE | SIF_POS; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2799 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
|
2800 si.nPos = start; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2801 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2802 pfnSetScrollInfo (w, SB_CTL, &si, TRUE); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2803 } |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2804 else |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2805 SetScrollPos (w, SB_CTL, start, TRUE); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2806 } |
13434 | 2807 |
2808 UNBLOCK_INPUT; | |
2809 } | |
2810 | |
2811 /* Move a scroll bar around on the screen, to accommodate changing | |
2812 window configurations. */ | |
2813 static void | |
2814 x_scroll_bar_move (bar, top, left, width, height) | |
2815 struct scroll_bar *bar; | |
2816 int top, left, width, height; | |
2817 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2818 Window w = SCROLL_BAR_W32_WINDOW (bar); |
13434 | 2819 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); |
2820 | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2821 /* If already correctly positioned, do nothing. */ |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2822 if ( XINT (bar->left) == left |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2823 && XINT (bar->top) == top |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2824 && XINT (bar->width) == width |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2825 && XINT (bar->height) == height ) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2826 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2827 /* Redraw after clear_frame. */ |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2828 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
|
2829 InvalidateRect (w, NULL, FALSE); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2830 return; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2831 } |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2832 |
13434 | 2833 BLOCK_INPUT; |
2834 | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2835 /* 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
|
2836 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
|
2837 my_show_window (f, w, SW_HIDE); |
13434 | 2838 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
|
2839 if (pfnSetScrollInfo) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2840 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2841 SCROLLINFO si; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2842 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2843 si.cbSize = sizeof (si); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2844 si.fMask = SIF_RANGE; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2845 si.nMin = 0; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2846 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
|
2847 + VERTICAL_SCROLL_BAR_MIN_HANDLE; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2848 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2849 pfnSetScrollInfo (w, SB_CTL, &si, FALSE); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2850 } |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2851 else |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2852 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
|
2853 my_show_window (f, w, SW_NORMAL); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2854 // InvalidateRect (w, NULL, FALSE); |
13434 | 2855 |
2856 XSETINT (bar->left, left); | |
2857 XSETINT (bar->top, top); | |
2858 XSETINT (bar->width, width); | |
2859 XSETINT (bar->height, height); | |
2860 | |
2861 UNBLOCK_INPUT; | |
2862 } | |
2863 | |
2864 /* Destroy the window for BAR, and set its Emacs window's scroll bar | |
2865 to nil. */ | |
2866 static void | |
2867 x_scroll_bar_remove (bar) | |
2868 struct scroll_bar *bar; | |
2869 { | |
2870 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); | |
2871 | |
2872 BLOCK_INPUT; | |
2873 | |
2874 /* Destroy the window. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2875 my_destroy_window (f, SCROLL_BAR_W32_WINDOW (bar)); |
13434 | 2876 |
2877 /* Disassociate this scroll bar from its window. */ | |
2878 XWINDOW (bar->window)->vertical_scroll_bar = Qnil; | |
2879 | |
2880 UNBLOCK_INPUT; | |
2881 } | |
2882 | |
2883 /* Set the handle of the vertical scroll bar for WINDOW to indicate | |
2884 that we are displaying PORTION characters out of a total of WHOLE | |
2885 characters, starting at POSITION. If WINDOW has no scroll bar, | |
2886 create one. */ | |
2887 static void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2888 w32_set_vertical_scroll_bar (window, portion, whole, position) |
13434 | 2889 struct window *window; |
2890 int portion, whole, position; | |
2891 { | |
2892 FRAME_PTR f = XFRAME (WINDOW_FRAME (window)); | |
2893 int top = XINT (window->top); | |
2894 int left = WINDOW_VERTICAL_SCROLL_BAR_COLUMN (window); | |
2895 int height = WINDOW_VERTICAL_SCROLL_BAR_HEIGHT (window); | |
2896 | |
2897 /* Where should this scroll bar be, pixelwise? */ | |
2898 int pixel_top = CHAR_TO_PIXEL_ROW (f, top); | |
2899 int pixel_left = CHAR_TO_PIXEL_COL (f, left); | |
2900 int pixel_width | |
2901 = (FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0 | |
2902 ? 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
|
2903 : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.w32->font))); |
13434 | 2904 int pixel_height = VERTICAL_SCROLL_BAR_PIXEL_HEIGHT (f, height); |
2905 | |
2906 struct scroll_bar *bar; | |
2907 | |
2908 /* Does the scroll bar exist yet? */ | |
2909 if (NILP (window->vertical_scroll_bar)) | |
2910 bar = x_scroll_bar_create (window, | |
2911 pixel_top, pixel_left, | |
2912 pixel_width, pixel_height); | |
2913 else | |
2914 { | |
2915 /* It may just need to be moved and resized. */ | |
2916 bar = XSCROLL_BAR (window->vertical_scroll_bar); | |
2917 x_scroll_bar_move (bar, pixel_top, pixel_left, pixel_width, pixel_height); | |
2918 } | |
2919 | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2920 /* Set the scroll bar's current state. */ |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2921 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2922 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
|
2923 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2924 if (whole == 0) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2925 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
|
2926 else |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2927 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2928 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
|
2929 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
|
2930 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2931 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
|
2932 } |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
2933 } |
13434 | 2934 |
2935 XSETVECTOR (window->vertical_scroll_bar, bar); | |
2936 } | |
2937 | |
2938 | |
2939 /* The following three hooks are used when we're doing a thorough | |
2940 redisplay of the frame. We don't explicitly know which scroll bars | |
2941 are going to be deleted, because keeping track of when windows go | |
2942 away is a real pain - "Can you say set-window-configuration, boys | |
2943 and girls?" Instead, we just assert at the beginning of redisplay | |
2944 that *all* scroll bars are to be removed, and then save a scroll bar | |
2945 from the fiery pit when we actually redisplay its window. */ | |
2946 | |
2947 /* Arrange for all scroll bars on FRAME to be removed at the next call | |
2948 to `*judge_scroll_bars_hook'. A scroll bar may be spared if | |
2949 `*redeem_scroll_bar_hook' is applied to its window before the judgement. */ | |
2950 static void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2951 w32_condemn_scroll_bars (frame) |
13434 | 2952 FRAME_PTR frame; |
2953 { | |
21614
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
2954 /* 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
|
2955 while (! NILP (FRAME_SCROLL_BARS (frame))) |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
2956 { |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
2957 Lisp_Object bar; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
2958 bar = FRAME_SCROLL_BARS (frame); |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
2959 FRAME_SCROLL_BARS (frame) = XSCROLL_BAR (bar)->next; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
2960 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
|
2961 XSCROLL_BAR (bar)->prev = Qnil; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
2962 if (! NILP (FRAME_CONDEMNED_SCROLL_BARS (frame))) |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
2963 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
|
2964 FRAME_CONDEMNED_SCROLL_BARS (frame) = bar; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
2965 } |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
2966 #ifdef PIGSFLY |
13434 | 2967 /* The condemned list should be empty at this point; if it's not, |
2968 then the rest of Emacs isn't using the condemn/redeem/judge | |
2969 protocol correctly. */ | |
2970 if (! NILP (FRAME_CONDEMNED_SCROLL_BARS (frame))) | |
2971 abort (); | |
2972 | |
2973 /* Move them all to the "condemned" list. */ | |
2974 FRAME_CONDEMNED_SCROLL_BARS (frame) = FRAME_SCROLL_BARS (frame); | |
2975 FRAME_SCROLL_BARS (frame) = Qnil; | |
21614
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
2976 #endif |
13434 | 2977 } |
2978 | |
2979 /* Unmark WINDOW's scroll bar for deletion in this judgement cycle. | |
2980 Note that WINDOW isn't necessarily condemned at all. */ | |
2981 static void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
2982 w32_redeem_scroll_bar (window) |
13434 | 2983 struct window *window; |
2984 { | |
2985 struct scroll_bar *bar; | |
2986 | |
2987 /* We can't redeem this window's scroll bar if it doesn't have one. */ | |
2988 if (NILP (window->vertical_scroll_bar)) | |
2989 abort (); | |
2990 | |
2991 bar = XSCROLL_BAR (window->vertical_scroll_bar); | |
2992 | |
2993 /* Unlink it from the condemned list. */ | |
2994 { | |
2995 FRAME_PTR f = XFRAME (WINDOW_FRAME (window)); | |
2996 | |
2997 if (NILP (bar->prev)) | |
2998 { | |
2999 /* 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
|
3000 the lists. */ |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3001 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
|
3002 /* It's not condemned. Everything's fine. */ |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3003 return; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3004 else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f), |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3005 window->vertical_scroll_bar)) |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3006 FRAME_CONDEMNED_SCROLL_BARS (f) = bar->next; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3007 else |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3008 /* 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
|
3009 one or the other! */ |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3010 abort (); |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3011 } |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3012 else |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3013 XSCROLL_BAR (bar->prev)->next = bar->next; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3014 |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3015 if (! NILP (bar->next)) |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3016 XSCROLL_BAR (bar->next)->prev = bar->prev; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3017 |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3018 bar->next = FRAME_SCROLL_BARS (f); |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3019 bar->prev = Qnil; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3020 XSETVECTOR (FRAME_SCROLL_BARS (f), bar); |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3021 if (! NILP (bar->next)) |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3022 XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar); |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3023 } |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3024 #ifdef PIGSFLY |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3025 struct scroll_bar *bar; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3026 |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3027 /* 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
|
3028 if (NILP (window->vertical_scroll_bar)) |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3029 abort (); |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3030 |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3031 bar = XSCROLL_BAR (window->vertical_scroll_bar); |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3032 |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3033 /* Unlink it from the condemned list. */ |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3034 { |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3035 FRAME_PTR f = XFRAME (WINDOW_FRAME (window)); |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3036 |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3037 if (NILP (bar->prev)) |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3038 { |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3039 /* If the prev pointer is nil, it must be the first in one of |
13434 | 3040 the lists. */ |
3041 if (EQ (FRAME_SCROLL_BARS (f), window->vertical_scroll_bar)) | |
3042 /* It's not condemned. Everything's fine. */ | |
3043 return; | |
3044 else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f), | |
3045 window->vertical_scroll_bar)) | |
3046 FRAME_CONDEMNED_SCROLL_BARS (f) = bar->next; | |
3047 else | |
3048 /* If its prev pointer is nil, it must be at the front of | |
3049 one or the other! */ | |
3050 abort (); | |
3051 } | |
3052 else | |
3053 XSCROLL_BAR (bar->prev)->next = bar->next; | |
3054 | |
3055 if (! NILP (bar->next)) | |
3056 XSCROLL_BAR (bar->next)->prev = bar->prev; | |
3057 | |
3058 bar->next = FRAME_SCROLL_BARS (f); | |
3059 bar->prev = Qnil; | |
3060 XSETVECTOR (FRAME_SCROLL_BARS (f), bar); | |
3061 if (! NILP (bar->next)) | |
3062 XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar); | |
3063 } | |
21614
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3064 #endif |
13434 | 3065 } |
3066 | |
3067 /* Remove all scroll bars on FRAME that haven't been saved since the | |
3068 last call to `*condemn_scroll_bars_hook'. */ | |
3069 static void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3070 w32_judge_scroll_bars (f) |
13434 | 3071 FRAME_PTR f; |
3072 { | |
3073 Lisp_Object bar, next; | |
3074 | |
3075 bar = FRAME_CONDEMNED_SCROLL_BARS (f); | |
3076 | |
3077 /* Clear out the condemned list now so we won't try to process any | |
3078 more events on the hapless scroll bars. */ | |
3079 FRAME_CONDEMNED_SCROLL_BARS (f) = Qnil; | |
3080 | |
3081 for (; ! NILP (bar); bar = next) | |
3082 { | |
3083 struct scroll_bar *b = XSCROLL_BAR (bar); | |
3084 | |
3085 x_scroll_bar_remove (b); | |
3086 | |
3087 next = b->next; | |
3088 b->next = b->prev = Qnil; | |
3089 } | |
3090 | |
3091 /* Now there should be no references to the condemned scroll bars, | |
3092 and they should get garbage-collected. */ | |
21614
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3093 #ifdef PIGSFLY |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3094 Lisp_Object bar, next; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3095 |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3096 bar = FRAME_CONDEMNED_SCROLL_BARS (f); |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3097 |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3098 /* 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
|
3099 more events on the hapless scroll bars. */ |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3100 FRAME_CONDEMNED_SCROLL_BARS (f) = Qnil; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3101 |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3102 for (; ! NILP (bar); bar = next) |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3103 { |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3104 struct scroll_bar *b = XSCROLL_BAR (bar); |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3105 |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3106 x_scroll_bar_remove (b); |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3107 |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3108 next = b->next; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3109 b->next = b->prev = Qnil; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3110 } |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3111 |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3112 /* 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
|
3113 and they should get garbage-collected. */ |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3114 #endif |
13434 | 3115 } |
3116 | |
3117 /* Handle a mouse click on the scroll bar BAR. If *EMACS_EVENT's kind | |
3118 is set to something other than no_event, it is enqueued. | |
3119 | |
3120 This may be called from a signal handler, so we have to ignore GC | |
3121 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
|
3122 |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3123 static int |
13434 | 3124 x_scroll_bar_handle_click (bar, msg, emacs_event) |
3125 struct scroll_bar *bar; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3126 W32Msg *msg; |
13434 | 3127 struct input_event *emacs_event; |
3128 { | |
3129 if (! GC_WINDOWP (bar->window)) | |
3130 abort (); | |
3131 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3132 emacs_event->kind = w32_scroll_bar_click; |
13434 | 3133 emacs_event->code = 0; |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3134 /* not really meaningful to distinguish up/down */ |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3135 emacs_event->modifiers = msg->dwModifiers; |
13434 | 3136 emacs_event->frame_or_window = bar->window; |
3137 emacs_event->timestamp = msg->msg.time; | |
3138 | |
3139 { | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3140 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
|
3141 int y; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3142 int dragging = !NILP (bar->dragging); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3143 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3144 if (pfnGetScrollInfo) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3145 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3146 SCROLLINFO si; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3147 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3148 si.cbSize = sizeof (si); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3149 si.fMask = SIF_POS; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3150 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3151 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
|
3152 y = si.nPos; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3153 } |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3154 else |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3155 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
|
3156 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3157 bar->dragging = Qnil; |
13434 | 3158 |
3159 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
|
3160 { |
f639c5d732a3
(x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents:
15204
diff
changeset
|
3161 case SB_LINEDOWN: |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3162 emacs_event->part = scroll_bar_down_arrow; |
13434 | 3163 break; |
15216
f639c5d732a3
(x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents:
15204
diff
changeset
|
3164 case SB_LINEUP: |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3165 emacs_event->part = scroll_bar_up_arrow; |
13434 | 3166 break; |
15216
f639c5d732a3
(x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents:
15204
diff
changeset
|
3167 case SB_PAGEUP: |
13434 | 3168 emacs_event->part = scroll_bar_above_handle; |
3169 break; | |
15216
f639c5d732a3
(x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents:
15204
diff
changeset
|
3170 case SB_PAGEDOWN: |
13434 | 3171 emacs_event->part = scroll_bar_below_handle; |
3172 break; | |
15216
f639c5d732a3
(x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents:
15204
diff
changeset
|
3173 case SB_TOP: |
13434 | 3174 emacs_event->part = scroll_bar_handle; |
3175 y = 0; | |
3176 break; | |
15216
f639c5d732a3
(x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents:
15204
diff
changeset
|
3177 case SB_BOTTOM: |
13434 | 3178 emacs_event->part = scroll_bar_handle; |
3179 y = top_range; | |
3180 break; | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3181 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
|
3182 case SB_THUMBPOSITION: |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3183 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
|
3184 y = HIWORD (msg->msg.wParam); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3185 bar->dragging = Qt; |
13434 | 3186 emacs_event->part = scroll_bar_handle; |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3187 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3188 /* "Silently" update current position. */ |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3189 if (pfnSetScrollInfo) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3190 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3191 SCROLLINFO si; |
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 si.cbSize = sizeof (si); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3194 si.fMask = SIF_POS; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3195 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3196 #if 0 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3197 /* 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
|
3198 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3199 int start = XINT (bar->start); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3200 int end = XINT (bar->end); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3201 int len = end - start; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3202 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3203 /* 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
|
3204 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
|
3205 sizes of len and top_range. */ |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3206 if (y + len > top_range - 2) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3207 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3208 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
|
3209 if (len < 0) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3210 len = 0; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3211 } |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3212 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
|
3213 si.fMask |= SIF_PAGE; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3214 } |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3215 #endif |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3216 si.nPos = y; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3217 /* 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
|
3218 position, so don't set that directly. */ |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3219 last_scroll_bar_drag_pos = y; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3220 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3221 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
|
3222 } |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3223 else |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3224 SetScrollPos (SCROLL_BAR_W32_WINDOW (bar), SB_CTL, y, FALSE); |
13434 | 3225 break; |
15216
f639c5d732a3
(x_scroll_bar_set_handle): Always use start in calling SetScrollPos.
Richard M. Stallman <rms@gnu.org>
parents:
15204
diff
changeset
|
3226 case SB_ENDSCROLL: |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3227 /* 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
|
3228 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
|
3229 nothing. */ |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3230 if (dragging) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3231 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3232 if (pfnSetScrollInfo) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3233 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3234 SCROLLINFO si; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3235 int start = XINT (bar->start); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3236 int end = XINT (bar->end); |
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 si.cbSize = sizeof (si); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3239 si.fMask = SIF_PAGE | SIF_POS; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3240 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
|
3241 si.nPos = last_scroll_bar_drag_pos; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3242 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3243 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
|
3244 } |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3245 else |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3246 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
|
3247 } |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3248 /* 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
|
3249 default: |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3250 emacs_event->kind = no_event; |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3251 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
|
3252 } |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3253 |
13434 | 3254 XSETINT (emacs_event->x, y); |
3255 XSETINT (emacs_event->y, top_range); | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3256 |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3257 return TRUE; |
13434 | 3258 } |
3259 } | |
3260 | |
3261 /* Return information to the user about the current position of the mouse | |
3262 on the scroll bar. */ | |
3263 static void | |
3264 x_scroll_bar_report_motion (fp, bar_window, part, x, y, time) | |
3265 FRAME_PTR *fp; | |
3266 Lisp_Object *bar_window; | |
3267 enum scroll_bar_part *part; | |
3268 Lisp_Object *x, *y; | |
3269 unsigned long *time; | |
3270 { | |
3271 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
|
3272 Window w = SCROLL_BAR_W32_WINDOW (bar); |
13434 | 3273 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); |
3274 int pos; | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3275 int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (XINT (bar->height)); |
13434 | 3276 |
3277 BLOCK_INPUT; | |
3278 | |
3279 *fp = f; | |
3280 *bar_window = bar->window; | |
3281 | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3282 if (pfnGetScrollInfo) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3283 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3284 SCROLLINFO si; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3285 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3286 si.cbSize = sizeof (si); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3287 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
|
3288 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3289 pfnGetScrollInfo (w, SB_CTL, &si); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3290 pos = si.nPos; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3291 top_range = si.nMax - si.nPage + 1; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3292 } |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3293 else |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3294 pos = GetScrollPos (w, SB_CTL); |
13434 | 3295 |
3296 switch (LOWORD (last_mouse_scroll_bar_pos)) | |
3297 { | |
3298 case SB_THUMBPOSITION: | |
3299 case SB_THUMBTRACK: | |
3300 *part = scroll_bar_handle; | |
3301 if (VERTICAL_SCROLL_BAR_TOP_RANGE (XINT (bar->height)) <= 0xffff) | |
3302 pos = HIWORD (last_mouse_scroll_bar_pos); | |
3303 break; | |
3304 case SB_LINEDOWN: | |
3305 *part = scroll_bar_handle; | |
3306 pos++; | |
3307 break; | |
3308 default: | |
3309 *part = scroll_bar_handle; | |
3310 break; | |
3311 } | |
3312 | |
3313 XSETINT(*x, pos); | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3314 XSETINT(*y, top_range); |
13434 | 3315 |
3316 f->mouse_moved = 0; | |
3317 last_mouse_scroll_bar = Qnil; | |
3318 | |
3319 *time = last_mouse_movement_time; | |
3320 | |
3321 UNBLOCK_INPUT; | |
3322 } | |
3323 | |
3324 /* The screen has been cleared so we may have changed foreground or | |
3325 background colors, and the scroll bars may need to be redrawn. | |
3326 Clear out the scroll bars, and ask for expose events, so we can | |
3327 redraw them. */ | |
3328 | |
3329 x_scroll_bar_clear (f) | |
3330 FRAME_PTR f; | |
3331 { | |
3332 Lisp_Object bar; | |
3333 | |
3334 for (bar = FRAME_SCROLL_BARS (f); VECTORP (bar); | |
3335 bar = XSCROLL_BAR (bar)->next) | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3336 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3337 HWND window = SCROLL_BAR_W32_WINDOW (XSCROLL_BAR (bar)); |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3338 HDC hdc = GetDC (window); |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3339 RECT rect; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3340 |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3341 /* 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
|
3342 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
|
3343 my_show_window (f, window, SW_HIDE); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3344 |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3345 GetClientRect (window, &rect); |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3346 select_palette (f, hdc); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3347 w32_clear_rect (f, hdc, &rect); |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3348 deselect_palette (f, hdc); |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3349 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3350 ReleaseDC (window, hdc); |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3351 } |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3352 } |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3353 |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3354 show_scroll_bars (f, how) |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3355 FRAME_PTR f; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3356 int how; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3357 { |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3358 Lisp_Object bar; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3359 |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3360 for (bar = FRAME_SCROLL_BARS (f); VECTORP (bar); |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3361 bar = XSCROLL_BAR (bar)->next) |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3362 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3363 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
|
3364 my_show_window (f, window, how); |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3365 } |
13434 | 3366 } |
3367 | |
3368 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3369 /* The main W32 event-reading loop - w32_read_socket. */ |
13434 | 3370 |
3371 /* Timestamp of enter window event. This is only used by w32_read_socket, | |
3372 but we have to put it out here, since static variables within functions | |
3373 sometimes don't work. */ | |
3374 static Time enter_timestamp; | |
3375 | |
3376 /* Record the last 100 characters stored | |
3377 to help debug the loss-of-chars-during-GC problem. */ | |
3378 int temp_index; | |
3379 short temp_buffer[100]; | |
3380 | |
14462
599a3ae1e8ea
(convert_to_key_event, is_dead_key): New functions.
Geoff Voelker <voelker@cs.washington.edu>
parents:
14351
diff
changeset
|
3381 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3382 /* Read events coming from the W32 shell. |
13434 | 3383 This routine is called by the SIGIO handler. |
3384 We return as soon as there are no more events to be read. | |
3385 | |
3386 Events representing keys are stored in buffer BUFP, | |
3387 which can hold up to NUMCHARS characters. | |
3388 We return the number of characters stored into the buffer, | |
3389 thus pretending to be `read'. | |
3390 | |
3391 EXPECTED is nonzero if the caller knows input is available. | |
3392 | |
3393 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
|
3394 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
|
3395 the data nor can we guarantee the state we are in. So if we dispatch them |
13434 | 3396 we will get into an infinite loop. To prevent this from ever happening we |
3397 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
|
3398 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
|
3399 recursively with different messages by the system. |
13434 | 3400 */ |
3401 | |
3402 int | |
16326
a85909645f7a
(w32_read_socket): Delete WAITP arg.
Richard M. Stallman <rms@gnu.org>
parents:
16258
diff
changeset
|
3403 w32_read_socket (sd, bufp, numchars, expected) |
13434 | 3404 register int sd; |
3405 register struct input_event *bufp; | |
3406 register int numchars; | |
3407 int expected; | |
3408 { | |
3409 int count = 0; | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3410 int check_visibility = 0; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3411 W32Msg msg; |
13434 | 3412 struct frame *f; |
3413 Lisp_Object part; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3414 struct w32_display_info *dpyinfo = &one_w32_display_info; |
13434 | 3415 |
3416 if (interrupt_input_blocked) | |
3417 { | |
3418 interrupt_input_pending = 1; | |
3419 return -1; | |
3420 } | |
3421 | |
3422 interrupt_input_pending = 0; | |
3423 BLOCK_INPUT; | |
3424 | |
3425 /* So people can tell when we have read the available input. */ | |
3426 input_signal_count++; | |
3427 | |
3428 if (numchars <= 0) | |
3429 abort (); /* Don't think this happens. */ | |
3430 | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3431 while (get_next_msg (&msg, FALSE)) |
13434 | 3432 { |
3433 switch (msg.msg.message) | |
3434 { | |
3435 case WM_PAINT: | |
3436 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | |
3437 | |
3438 if (f) | |
3439 { | |
21740
92c501ecca49
(w32_read_socket): Don't misinterpret WM_PAINT message
Geoff Voelker <voelker@cs.washington.edu>
parents:
21614
diff
changeset
|
3440 if (msg.rect.right == msg.rect.left || |
92c501ecca49
(w32_read_socket): Don't misinterpret WM_PAINT message
Geoff Voelker <voelker@cs.washington.edu>
parents:
21614
diff
changeset
|
3441 msg.rect.bottom == msg.rect.top) |
13434 | 3442 { |
21740
92c501ecca49
(w32_read_socket): Don't misinterpret WM_PAINT message
Geoff Voelker <voelker@cs.washington.edu>
parents:
21614
diff
changeset
|
3443 /* We may get paint messages even though the client |
92c501ecca49
(w32_read_socket): Don't misinterpret WM_PAINT message
Geoff Voelker <voelker@cs.washington.edu>
parents:
21614
diff
changeset
|
3444 area is clipped - these are not expose events. */ |
92c501ecca49
(w32_read_socket): Don't misinterpret WM_PAINT message
Geoff Voelker <voelker@cs.washington.edu>
parents:
21614
diff
changeset
|
3445 DebPrint (("clipped frame %04x (%s) got WM_PAINT\n", f, |
92c501ecca49
(w32_read_socket): Don't misinterpret WM_PAINT message
Geoff Voelker <voelker@cs.washington.edu>
parents:
21614
diff
changeset
|
3446 XSTRING (f->name)->data)); |
92c501ecca49
(w32_read_socket): Don't misinterpret WM_PAINT message
Geoff Voelker <voelker@cs.washington.edu>
parents:
21614
diff
changeset
|
3447 } |
92c501ecca49
(w32_read_socket): Don't misinterpret WM_PAINT message
Geoff Voelker <voelker@cs.washington.edu>
parents:
21614
diff
changeset
|
3448 else if (f->async_visible != 1) |
92c501ecca49
(w32_read_socket): Don't misinterpret WM_PAINT message
Geoff Voelker <voelker@cs.washington.edu>
parents:
21614
diff
changeset
|
3449 { |
92c501ecca49
(w32_read_socket): Don't misinterpret WM_PAINT message
Geoff Voelker <voelker@cs.washington.edu>
parents:
21614
diff
changeset
|
3450 /* Definitely not obscured, so mark as visible. */ |
13434 | 3451 f->async_visible = 1; |
3452 f->async_iconified = 0; | |
3453 SET_FRAME_GARBAGED (f); | |
21740
92c501ecca49
(w32_read_socket): Don't misinterpret WM_PAINT message
Geoff Voelker <voelker@cs.washington.edu>
parents:
21614
diff
changeset
|
3454 DebPrint (("frame %04x (%s) reexposed\n", f, |
92c501ecca49
(w32_read_socket): Don't misinterpret WM_PAINT message
Geoff Voelker <voelker@cs.washington.edu>
parents:
21614
diff
changeset
|
3455 XSTRING (f->name)->data)); |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3456 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3457 /* 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
|
3458 visibility changes properly. */ |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3459 if (f->iconified) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3460 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3461 bufp->kind = deiconify_event; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3462 XSETFRAME (bufp->frame_or_window, f); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3463 bufp++; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3464 count++; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3465 numchars--; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3466 } |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3467 else if (! NILP(Vframe_list) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3468 && ! NILP (XCONS (Vframe_list)->cdr)) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3469 /* 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
|
3470 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
|
3471 record_asynch_buffer_change (); |
13434 | 3472 } |
3473 else | |
3474 { | |
15723
d2cee951f37e
(w32_read_socket): Need to erase background
Karl Heuer <kwzh@gnu.org>
parents:
15651
diff
changeset
|
3475 /* 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
|
3476 w32_clear_rect (f, NULL, &msg.rect); |
13434 | 3477 dumprectangle (f, |
3478 msg.rect.left, | |
3479 msg.rect.top, | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3480 msg.rect.right - msg.rect.left, |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3481 msg.rect.bottom - msg.rect.top); |
13434 | 3482 } |
3483 } | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3484 break; |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3485 |
23677
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3486 case WM_INPUTLANGCHANGE: |
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3487 /* Generate a language change event. */ |
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3488 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); |
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3489 |
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3490 if (f) |
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3491 { |
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3492 if (numchars == 0) |
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3493 abort (); |
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3494 |
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3495 bufp->kind = language_change_event; |
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3496 XSETFRAME (bufp->frame_or_window, f); |
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3497 bufp->code = msg.msg.wParam; |
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3498 bufp->modifiers = msg.msg.lParam & 0xffff; |
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3499 bufp++; |
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3500 count++; |
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3501 numchars--; |
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3502 } |
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3503 break; |
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3504 |
13434 | 3505 case WM_KEYDOWN: |
3506 case WM_SYSKEYDOWN: | |
3507 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | |
3508 | |
3509 if (f && !f->iconified) | |
3510 { | |
3511 if (temp_index == sizeof temp_buffer / sizeof (short)) | |
3512 temp_index = 0; | |
3513 temp_buffer[temp_index++] = msg.msg.wParam; | |
3514 bufp->kind = non_ascii_keystroke; | |
3515 bufp->code = msg.msg.wParam; | |
23677
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3516 bufp->modifiers = msg.dwModifiers; |
13434 | 3517 XSETFRAME (bufp->frame_or_window, f); |
3518 bufp->timestamp = msg.msg.time; | |
3519 bufp++; | |
3520 numchars--; | |
3521 count++; | |
3522 } | |
3523 break; | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3524 |
13434 | 3525 case WM_SYSCHAR: |
3526 case WM_CHAR: | |
3527 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | |
3528 | |
3529 if (f && !f->iconified) | |
3530 { | |
23677
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3531 if (temp_index == sizeof temp_buffer / sizeof (short)) |
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3532 temp_index = 0; |
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3533 temp_buffer[temp_index++] = msg.msg.wParam; |
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3534 bufp->kind = ascii_keystroke; |
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3535 bufp->code = msg.msg.wParam; |
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3536 bufp->modifiers = msg.dwModifiers; |
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3537 XSETFRAME (bufp->frame_or_window, f); |
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3538 bufp->timestamp = msg.msg.time; |
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3539 bufp++; |
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3540 numchars--; |
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3541 count++; |
13434 | 3542 } |
3543 break; | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3544 |
13434 | 3545 case WM_MOUSEMOVE: |
3546 if (dpyinfo->grabbed && last_mouse_frame | |
3547 && FRAME_LIVE_P (last_mouse_frame)) | |
3548 f = last_mouse_frame; | |
3549 else | |
3550 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | |
3551 | |
3552 if (f) | |
3553 note_mouse_movement (f, &msg.msg); | |
3554 else | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3555 clear_mouse_face (FRAME_W32_DISPLAY_INFO (f)); |
13434 | 3556 |
3557 break; | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3558 |
13434 | 3559 case WM_LBUTTONDOWN: |
3560 case WM_LBUTTONUP: | |
3561 case WM_MBUTTONDOWN: | |
3562 case WM_MBUTTONUP: | |
3563 case WM_RBUTTONDOWN: | |
3564 case WM_RBUTTONUP: | |
3565 { | |
3566 int button; | |
3567 int up; | |
3568 | |
3569 if (dpyinfo->grabbed && last_mouse_frame | |
3570 && FRAME_LIVE_P (last_mouse_frame)) | |
3571 f = last_mouse_frame; | |
3572 else | |
3573 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | |
3574 | |
3575 if (f) | |
3576 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3577 if ((!dpyinfo->w32_focus_frame || f == dpyinfo->w32_focus_frame) |
13434 | 3578 && (numchars >= 1)) |
3579 { | |
3580 construct_mouse_click (bufp, &msg, f); | |
3581 bufp++; | |
3582 count++; | |
3583 numchars--; | |
3584 } | |
3585 } | |
3586 | |
3587 parse_button (msg.msg.message, &button, &up); | |
3588 | |
3589 if (up) | |
3590 { | |
3591 dpyinfo->grabbed &= ~ (1 << button); | |
3592 } | |
3593 else | |
3594 { | |
3595 dpyinfo->grabbed |= (1 << button); | |
3596 last_mouse_frame = f; | |
3597 } | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3598 break; |
13434 | 3599 } |
3600 | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3601 case WM_MOUSEWHEEL: |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3602 if (dpyinfo->grabbed && last_mouse_frame |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3603 && FRAME_LIVE_P (last_mouse_frame)) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3604 f = last_mouse_frame; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3605 else |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3606 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
|
3607 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3608 if (f) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3609 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3610 if ((!dpyinfo->w32_focus_frame |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3611 || f == dpyinfo->w32_focus_frame) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3612 && (numchars >= 1)) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3613 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3614 construct_mouse_wheel (bufp, &msg, f); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3615 bufp++; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3616 count++; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3617 numchars--; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3618 } |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3619 } |
13434 | 3620 break; |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3621 |
21885 | 3622 case WM_DROPFILES: |
3623 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | |
3624 | |
3625 if (f) | |
3626 { | |
3627 construct_drag_n_drop (bufp, &msg, f); | |
3628 bufp++; | |
3629 count++; | |
3630 numchars--; | |
3631 } | |
3632 break; | |
3633 | |
13434 | 3634 case WM_VSCROLL: |
3635 { | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3636 struct scroll_bar *bar = |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3637 x_window_to_scroll_bar ((HWND)msg.msg.lParam); |
13434 | 3638 |
3639 if (bar && numchars >= 1) | |
3640 { | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3641 if (x_scroll_bar_handle_click (bar, &msg, bufp)) |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3642 { |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3643 bufp++; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3644 count++; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3645 numchars--; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3646 } |
13434 | 3647 } |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3648 break; |
13434 | 3649 } |
3650 | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3651 case WM_WINDOWPOSCHANGED: |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3652 case WM_ACTIVATE: |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3653 case WM_ACTIVATEAPP: |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3654 check_visibility = 1; |
13434 | 3655 break; |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3656 |
13434 | 3657 case WM_MOVE: |
3658 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | |
3659 | |
3660 if (f && !f->async_iconified) | |
3661 { | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3662 int x, y; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3663 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3664 x_real_positions (f, &x, &y); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3665 f->output_data.w32->left_pos = x; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3666 f->output_data.w32->top_pos = y; |
13434 | 3667 } |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3668 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3669 check_visibility = 1; |
13434 | 3670 break; |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3671 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3672 case WM_SHOWWINDOW: |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3673 /* 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
|
3674 being maximised or minimised/restored, then recheck |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3675 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
|
3676 windows get handled by WM_SIZE. */ |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3677 #if 0 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3678 if (msg.msg.lParam != 0) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3679 check_visibility = 1; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3680 else |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3681 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3682 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
|
3683 f->async_visible = msg.msg.wParam; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3684 } |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3685 #endif |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3686 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3687 check_visibility = 1; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3688 break; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3689 |
13434 | 3690 case WM_SIZE: |
3691 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | |
3692 | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3693 /* 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
|
3694 if (f) |
13434 | 3695 { |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3696 switch (msg.msg.wParam) |
13434 | 3697 { |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3698 case SIZE_MINIMIZED: |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3699 f->async_visible = 0; |
13434 | 3700 f->async_iconified = 1; |
3701 | |
3702 bufp->kind = iconify_event; | |
3703 XSETFRAME (bufp->frame_or_window, f); | |
3704 bufp++; | |
3705 count++; | |
3706 numchars--; | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3707 break; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3708 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3709 case SIZE_MAXIMIZED: |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3710 case SIZE_RESTORED: |
13434 | 3711 f->async_visible = 1; |
3712 f->async_iconified = 0; | |
3713 | |
3714 /* wait_reading_process_input will notice this and update | |
3715 the frame's display structures. */ | |
3716 SET_FRAME_GARBAGED (f); | |
3717 | |
3718 if (f->iconified) | |
3719 { | |
24827
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
3720 int x, y; |
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
3721 |
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
3722 /* Reset top and left positions of the Window |
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
3723 here since Windows sends a WM_MOVE message |
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
3724 BEFORE telling us the Window is minimized |
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
3725 when the Window is iconified, with 3000,3000 |
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
3726 as the co-ords. */ |
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
3727 x_real_positions (f, &x, &y); |
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
3728 f->output_data.w32->left_pos = x; |
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
3729 f->output_data.w32->top_pos = y; |
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
3730 |
13434 | 3731 bufp->kind = deiconify_event; |
3732 XSETFRAME (bufp->frame_or_window, f); | |
3733 bufp++; | |
3734 count++; | |
3735 numchars--; | |
3736 } | |
3737 else | |
3738 /* Force a redisplay sooner or later | |
3739 to update the frame titles | |
3740 in case this is the second frame. */ | |
3741 record_asynch_buffer_change (); | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3742 break; |
13434 | 3743 } |
3744 } | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3745 |
21614
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3746 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
|
3747 { |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3748 RECT rect; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3749 int rows; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3750 int columns; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3751 int width; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3752 int height; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3753 |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3754 GetClientRect(msg.msg.hwnd, &rect); |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3755 |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3756 height = rect.bottom - rect.top; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3757 width = rect.right - rect.left; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3758 |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3759 rows = PIXEL_TO_CHAR_HEIGHT (f, height); |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3760 columns = PIXEL_TO_CHAR_WIDTH (f, width); |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3761 |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3762 /* TODO: Clip size to the screen dimensions. */ |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3763 |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3764 /* 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
|
3765 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
|
3766 to check the pixel dimensions as well. */ |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3767 |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3768 if (columns != f->width |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3769 || rows != f->height |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3770 || width != f->output_data.w32->pixel_width |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3771 || height != f->output_data.w32->pixel_height) |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3772 { |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3773 /* 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
|
3774 |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3775 change_frame_size (f, rows, columns, 0, 1); |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3776 SET_FRAME_GARBAGED (f); |
24827
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
3777 cancel_mouse_face (f); |
21614
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3778 f->output_data.w32->pixel_width = width; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3779 f->output_data.w32->pixel_height = height; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3780 f->output_data.w32->win_gravity = NorthWestGravity; |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3781 } |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3782 } |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
3783 |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3784 check_visibility = 1; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3785 break; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3786 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3787 case WM_SETFOCUS: |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3788 case WM_KILLFOCUS: |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3789 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); |
13434 | 3790 |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3791 if (msg.msg.message == WM_SETFOCUS) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3792 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3793 x_new_focus_frame (dpyinfo, f); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3794 } |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3795 else if (f == dpyinfo->w32_focus_frame) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3796 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3797 x_new_focus_frame (dpyinfo, 0); |
24752
80c46fd667da
(w32_read_socket): Reset the grabbed flag when a frame gains or
Andrew Innes <andrewi@gnu.org>
parents:
24733
diff
changeset
|
3798 |
80c46fd667da
(w32_read_socket): Reset the grabbed flag when a frame gains or
Andrew Innes <andrewi@gnu.org>
parents:
24733
diff
changeset
|
3799 if (f == dpyinfo->mouse_face_mouse_frame) |
80c46fd667da
(w32_read_socket): Reset the grabbed flag when a frame gains or
Andrew Innes <andrewi@gnu.org>
parents:
24733
diff
changeset
|
3800 clear_mouse_face (dpyinfo); |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3801 } |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3802 |
24752
80c46fd667da
(w32_read_socket): Reset the grabbed flag when a frame gains or
Andrew Innes <andrewi@gnu.org>
parents:
24733
diff
changeset
|
3803 dpyinfo->grabbed = 0; |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3804 check_visibility = 1; |
13434 | 3805 break; |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3806 |
13434 | 3807 case WM_CLOSE: |
3808 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | |
3809 | |
3810 if (f) | |
3811 { | |
3812 if (numchars == 0) | |
3813 abort (); | |
3814 | |
3815 bufp->kind = delete_window_event; | |
3816 XSETFRAME (bufp->frame_or_window, f); | |
3817 bufp++; | |
3818 count++; | |
3819 numchars--; | |
3820 } | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3821 break; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3822 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3823 case WM_INITMENU: |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3824 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); |
13434 | 3825 |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3826 if (f) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3827 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3828 if (numchars == 0) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3829 abort (); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3830 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3831 bufp->kind = menu_bar_activate_event; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3832 XSETFRAME (bufp->frame_or_window, f); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3833 bufp++; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3834 count++; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3835 numchars--; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3836 } |
13434 | 3837 break; |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3838 |
13434 | 3839 case WM_COMMAND: |
3840 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | |
21740
92c501ecca49
(w32_read_socket): Don't misinterpret WM_PAINT message
Geoff Voelker <voelker@cs.washington.edu>
parents:
21614
diff
changeset
|
3841 |
13434 | 3842 if (f) |
3843 { | |
23677
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3844 extern void menubar_selection_callback |
70999481c915
(convert_to_key_event): Removed.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23639
diff
changeset
|
3845 (FRAME_PTR f, void * client_data); |
21740
92c501ecca49
(w32_read_socket): Don't misinterpret WM_PAINT message
Geoff Voelker <voelker@cs.washington.edu>
parents:
21614
diff
changeset
|
3846 menubar_selection_callback (f, (void *)msg.msg.wParam); |
13434 | 3847 } |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3848 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3849 check_visibility = 1; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3850 break; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3851 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3852 case WM_DISPLAYCHANGE: |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3853 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
|
3854 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3855 if (f) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3856 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3857 dpyinfo->width = (short) LOWORD (msg.msg.lParam); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3858 dpyinfo->height = (short) HIWORD (msg.msg.lParam); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3859 dpyinfo->n_cbits = msg.msg.wParam; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3860 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
|
3861 dpyinfo->height)); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3862 } |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3863 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3864 check_visibility = 1; |
13434 | 3865 break; |
21875
16414f4d07e7
(msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21831
diff
changeset
|
3866 |
16414f4d07e7
(msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21831
diff
changeset
|
3867 default: |
16414f4d07e7
(msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21831
diff
changeset
|
3868 /* Check for messages registered at runtime. */ |
16414f4d07e7
(msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21831
diff
changeset
|
3869 if (msg.msg.message == msh_mousewheel) |
16414f4d07e7
(msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21831
diff
changeset
|
3870 { |
16414f4d07e7
(msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21831
diff
changeset
|
3871 if (dpyinfo->grabbed && last_mouse_frame |
16414f4d07e7
(msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21831
diff
changeset
|
3872 && FRAME_LIVE_P (last_mouse_frame)) |
16414f4d07e7
(msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21831
diff
changeset
|
3873 f = last_mouse_frame; |
16414f4d07e7
(msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21831
diff
changeset
|
3874 else |
16414f4d07e7
(msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21831
diff
changeset
|
3875 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); |
16414f4d07e7
(msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21831
diff
changeset
|
3876 |
16414f4d07e7
(msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21831
diff
changeset
|
3877 if (f) |
16414f4d07e7
(msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21831
diff
changeset
|
3878 { |
16414f4d07e7
(msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21831
diff
changeset
|
3879 if ((!dpyinfo->w32_focus_frame |
16414f4d07e7
(msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21831
diff
changeset
|
3880 || f == dpyinfo->w32_focus_frame) |
16414f4d07e7
(msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21831
diff
changeset
|
3881 && (numchars >= 1)) |
16414f4d07e7
(msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21831
diff
changeset
|
3882 { |
16414f4d07e7
(msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21831
diff
changeset
|
3883 construct_mouse_wheel (bufp, &msg, f); |
16414f4d07e7
(msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21831
diff
changeset
|
3884 bufp++; |
16414f4d07e7
(msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21831
diff
changeset
|
3885 count++; |
16414f4d07e7
(msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21831
diff
changeset
|
3886 numchars--; |
16414f4d07e7
(msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21831
diff
changeset
|
3887 } |
16414f4d07e7
(msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21831
diff
changeset
|
3888 } |
16414f4d07e7
(msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21831
diff
changeset
|
3889 } |
16414f4d07e7
(msh_mousewheel): Declare.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21831
diff
changeset
|
3890 break; |
13434 | 3891 } |
3892 } | |
3893 | |
3894 /* If the focus was just given to an autoraising frame, | |
3895 raise it now. */ | |
3896 /* ??? This ought to be able to handle more than one such frame. */ | |
3897 if (pending_autoraise_frame) | |
3898 { | |
3899 x_raise_frame (pending_autoraise_frame); | |
3900 pending_autoraise_frame = 0; | |
3901 } | |
3902 | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3903 /* 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
|
3904 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
|
3905 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
|
3906 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
|
3907 changed (at least, not in all cases). */ |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3908 if (count > 0 || check_visibility) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3909 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3910 Lisp_Object tail, frame; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3911 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3912 FOR_EACH_FRAME (tail, frame) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3913 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3914 FRAME_PTR f = XFRAME (frame); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3915 /* 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
|
3916 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
|
3917 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
|
3918 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
|
3919 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3920 RECT clipbox; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3921 HDC hdc = get_frame_dc (f); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3922 GetClipBox (hdc, &clipbox); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3923 release_frame_dc (f, hdc); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3924 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3925 if (clipbox.right == clipbox.left |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3926 || clipbox.bottom == clipbox.top) |
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 /* 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
|
3929 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
|
3930 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
|
3931 will skip it). */ |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3932 f->async_visible = 2; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3933 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3934 if (!FRAME_OBSCURED_P (f)) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3935 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3936 DebPrint (("frame %04x (%s) obscured\n", f, |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3937 XSTRING (f->name)->data)); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3938 } |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3939 } |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3940 else |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3941 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3942 /* 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
|
3943 f->async_visible = 1; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3944 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3945 if (FRAME_OBSCURED_P (f)) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3946 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3947 SET_FRAME_GARBAGED (f); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3948 DebPrint (("frame %04x (%s) reexposed\n", f, |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3949 XSTRING (f->name)->data)); |
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 /* Force a redisplay sooner or later. */ |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3952 record_asynch_buffer_change (); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3953 } |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3954 } |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3955 } |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3956 } |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3957 } |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
3958 |
13434 | 3959 UNBLOCK_INPUT; |
3960 return count; | |
3961 } | |
3962 | |
3963 /* Drawing the cursor. */ | |
3964 | |
3965 | |
3966 /* Draw a hollow box cursor. Don't change the inside of the box. */ | |
3967 | |
3968 static void | |
3969 x_draw_box (f) | |
3970 struct frame *f; | |
3971 { | |
3972 RECT rect; | |
3973 HBRUSH hb; | |
3974 HDC hdc; | |
3975 | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3976 hdc = get_frame_dc (f); |
13434 | 3977 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
3978 hb = CreateSolidBrush (f->output_data.w32->cursor_pixel); |
13434 | 3979 |
3980 rect.left = CHAR_TO_PIXEL_COL (f, curs_x); | |
3981 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
|
3982 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
|
3983 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
|
3984 |
13434 | 3985 FrameRect (hdc, &rect, hb); |
3986 DeleteObject (hb); | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3987 |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
3988 release_frame_dc (f, hdc); |
13434 | 3989 } |
3990 | |
3991 /* Clear the cursor of frame F to background color, | |
3992 and mark the cursor as not shown. | |
3993 This is used when the text where the cursor is | |
3994 is about to be rewritten. */ | |
3995 | |
3996 static void | |
3997 clear_cursor (f) | |
3998 struct frame *f; | |
3999 { | |
4000 if (! FRAME_VISIBLE_P (f) | |
24674 | 4001 || !f->phys_cursor_on) |
13434 | 4002 return; |
4003 | |
4004 x_display_cursor (f, 0); | |
24674 | 4005 f->phys_cursor_on = 0; |
13434 | 4006 } |
4007 | |
4008 /* Redraw the glyph at ROW, COLUMN on frame F, in the style | |
4009 HIGHLIGHT. HIGHLIGHT is as defined for dumpglyphs. Return the | |
4010 glyph drawn. */ | |
4011 | |
4012 static void | |
4013 x_draw_single_glyph (f, row, column, glyph, highlight) | |
4014 struct frame *f; | |
4015 int row, column; | |
4016 GLYPH glyph; | |
4017 int highlight; | |
4018 { | |
4019 dumpglyphs (f, | |
4020 CHAR_TO_PIXEL_COL (f, column), | |
4021 CHAR_TO_PIXEL_ROW (f, row), | |
21614
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
4022 &glyph, 1, highlight, 0, NULL); |
13434 | 4023 } |
4024 | |
4025 static void | |
4026 x_display_bar_cursor (f, on) | |
4027 struct frame *f; | |
4028 int on; | |
4029 { | |
4030 struct frame_glyphs *current_glyphs = FRAME_CURRENT_GLYPHS (f); | |
4031 | |
4032 /* This is pointless on invisible frames, and dangerous on garbaged | |
4033 frames; in the latter case, the frame may be in the midst of | |
4034 changing its size, and curs_x and curs_y may be off the frame. */ | |
4035 if (! FRAME_VISIBLE_P (f) || FRAME_GARBAGED_P (f)) | |
4036 return; | |
4037 | |
24674 | 4038 if (! on && ! f->phys_cursor_on) |
13434 | 4039 return; |
4040 | |
4041 /* If there is anything wrong with the current cursor state, remove it. */ | |
24674 | 4042 if (f->phys_cursor_on |
13434 | 4043 && (!on |
4044 || f->phys_cursor_x != curs_x | |
4045 || 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
|
4046 || f->output_data.w32->current_cursor != bar_cursor)) |
13434 | 4047 { |
4048 /* Erase the cursor by redrawing the character underneath it. */ | |
4049 x_draw_single_glyph (f, f->phys_cursor_y, f->phys_cursor_x, | |
4050 f->phys_cursor_glyph, | |
4051 current_glyphs->highlight[f->phys_cursor_y]); | |
24674 | 4052 f->phys_cursor_on = 0; |
13434 | 4053 } |
4054 | |
4055 /* If we now need a cursor in the new place or in the new form, do it so. */ | |
4056 if (on | |
24674 | 4057 && (! f->phys_cursor_on |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4058 || (f->output_data.w32->current_cursor != bar_cursor))) |
13434 | 4059 { |
4060 f->phys_cursor_glyph | |
4061 = ((current_glyphs->enable[curs_y] | |
4062 && curs_x < current_glyphs->used[curs_y]) | |
4063 ? current_glyphs->glyphs[curs_y][curs_x] | |
4064 : SPACEGLYPH); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4065 w32_fill_area (f, NULL, f->output_data.w32->cursor_pixel, |
13434 | 4066 CHAR_TO_PIXEL_COL (f, curs_x), |
4067 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
|
4068 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
|
4069 f->output_data.w32->line_height); |
13434 | 4070 |
4071 f->phys_cursor_x = curs_x; | |
4072 f->phys_cursor_y = curs_y; | |
24674 | 4073 f->phys_cursor_on = 1; |
13434 | 4074 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4075 f->output_data.w32->current_cursor = bar_cursor; |
13434 | 4076 } |
4077 } | |
4078 | |
4079 | |
4080 /* Turn the displayed cursor of frame F on or off according to ON. | |
4081 If ON is nonzero, where to put the cursor is specified | |
4082 by F->cursor_x and F->cursor_y. */ | |
4083 | |
4084 static void | |
4085 x_display_box_cursor (f, on) | |
4086 struct frame *f; | |
4087 int on; | |
4088 { | |
4089 struct frame_glyphs *current_glyphs = FRAME_CURRENT_GLYPHS (f); | |
4090 | |
4091 /* This is pointless on invisible frames, and dangerous on garbaged | |
4092 frames; in the latter case, the frame may be in the midst of | |
4093 changing its size, and curs_x and curs_y may be off the frame. */ | |
4094 if (! FRAME_VISIBLE_P (f) || FRAME_GARBAGED_P (f)) | |
4095 return; | |
4096 | |
4097 /* If cursor is off and we want it off, return quickly. */ | |
24674 | 4098 if (!on && ! f->phys_cursor_on) |
13434 | 4099 return; |
4100 | |
4101 /* If cursor is currently being shown and we don't want it to be | |
4102 or it is in the wrong place, | |
4103 or we want a hollow box and it's not so, (pout!) | |
4104 erase it. */ | |
24674 | 4105 if (f->phys_cursor_on |
13434 | 4106 && (!on |
4107 || f->phys_cursor_x != curs_x | |
4108 || 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
|
4109 || (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
|
4110 && (f != FRAME_W32_DISPLAY_INFO (f)->w32_highlight_frame)))) |
13434 | 4111 { |
4112 int mouse_face_here = 0; | |
4113 struct frame_glyphs *active_glyphs = FRAME_CURRENT_GLYPHS (f); | |
4114 | |
4115 /* If the cursor is in the mouse face area, redisplay that when | |
4116 we clear the cursor. */ | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4117 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
|
4118 && (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
|
4119 || (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
|
4120 && 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
|
4121 && (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
|
4122 || (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
|
4123 && f->phys_cursor_x < FRAME_W32_DISPLAY_INFO (f)->mouse_face_end_col)) |
13434 | 4124 /* Don't redraw the cursor's spot in mouse face |
4125 if it is at the end of a line (on a newline). | |
4126 The cursor appears there, but mouse highlighting does not. */ | |
4127 && active_glyphs->used[f->phys_cursor_y] > f->phys_cursor_x) | |
4128 mouse_face_here = 1; | |
4129 | |
4130 /* If the font is not as tall as a whole line, | |
4131 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
|
4132 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
|
4133 w32_clear_area (f, NULL, |
13434 | 4134 CHAR_TO_PIXEL_COL (f, f->phys_cursor_x), |
4135 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
|
4136 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
|
4137 f->output_data.w32->line_height); |
13434 | 4138 /* Erase the cursor by redrawing the character underneath it. */ |
4139 x_draw_single_glyph (f, f->phys_cursor_y, f->phys_cursor_x, | |
4140 f->phys_cursor_glyph, | |
4141 (mouse_face_here | |
4142 ? 3 | |
4143 : current_glyphs->highlight[f->phys_cursor_y])); | |
24674 | 4144 f->phys_cursor_on = 0; |
13434 | 4145 } |
4146 | |
4147 /* If we want to show a cursor, | |
4148 or we want a box cursor and it's not so, | |
4149 write it in the right place. */ | |
4150 if (on | |
24674 | 4151 && (! f->phys_cursor_on |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4152 || (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
|
4153 && f == FRAME_W32_DISPLAY_INFO (f)->w32_highlight_frame))) |
13434 | 4154 { |
4155 f->phys_cursor_glyph | |
4156 = ((current_glyphs->enable[curs_y] | |
4157 && curs_x < current_glyphs->used[curs_y]) | |
4158 ? current_glyphs->glyphs[curs_y][curs_x] | |
4159 : SPACEGLYPH); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4160 if (f != FRAME_W32_DISPLAY_INFO (f)->w32_highlight_frame) |
13434 | 4161 { |
4162 x_draw_box (f); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4163 f->output_data.w32->current_cursor = hollow_box_cursor; |
13434 | 4164 } |
4165 else | |
4166 { | |
4167 x_draw_single_glyph (f, curs_y, curs_x, | |
4168 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
|
4169 f->output_data.w32->current_cursor = filled_box_cursor; |
13434 | 4170 } |
4171 | |
4172 f->phys_cursor_x = curs_x; | |
4173 f->phys_cursor_y = curs_y; | |
24674 | 4174 f->phys_cursor_on = 1; |
13434 | 4175 } |
4176 } | |
4177 | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4178 /* 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
|
4179 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
|
4180 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
|
4181 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
|
4182 of F. */ |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4183 |
13434 | 4184 x_display_cursor (f, on) |
4185 struct frame *f; | |
4186 int on; | |
4187 { | |
4188 BLOCK_INPUT; | |
4189 | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4190 /* 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
|
4191 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
|
4192 if (f != updating_frame) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4193 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4194 curs_x = FRAME_CURSOR_X (f); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4195 curs_y = FRAME_CURSOR_Y (f); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4196 } |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4197 |
13434 | 4198 if (FRAME_DESIRED_CURSOR (f) == filled_box_cursor) |
4199 x_display_box_cursor (f, on); | |
4200 else if (FRAME_DESIRED_CURSOR (f) == bar_cursor) | |
4201 x_display_bar_cursor (f, on); | |
4202 else | |
4203 /* Those are the only two we have implemented! */ | |
4204 abort (); | |
4205 | |
4206 UNBLOCK_INPUT; | |
4207 } | |
4208 | |
4209 /* Changing the font of the frame. */ | |
4210 | |
4211 /* Give frame F the font named FONTNAME as its default font, and | |
4212 return the full name of that font. FONTNAME may be a wildcard | |
4213 pattern; in that case, we choose some font that fits the pattern. | |
4214 The return value shows which font we chose. */ | |
4215 | |
4216 Lisp_Object | |
4217 x_new_font (f, fontname) | |
4218 struct frame *f; | |
4219 register char *fontname; | |
4220 { | |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4221 struct font_info *fontp |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4222 = fs_load_font (f, FRAME_W32_FONT_TABLE (f), CHARSET_ASCII, |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4223 fontname, -1); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4224 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4225 if (!fontp) |
13434 | 4226 return Qnil; |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4227 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4228 FRAME_FONT (f) = (XFontStruct *) (fontp->font); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4229 f->output_data.w32->font_baseline |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
4230 = FONT_BASE (FRAME_FONT (f)) + fontp->baseline_offset; |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4231 FRAME_FONTSET (f) = -1; |
13434 | 4232 |
4233 /* Compute the scroll bar width in character columns. */ | |
4234 if (f->scroll_bar_pixel_width > 0) | |
4235 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4236 int wid = FONT_WIDTH (f->output_data.w32->font); |
13434 | 4237 f->scroll_bar_cols = (f->scroll_bar_pixel_width + wid-1) / wid; |
4238 } | |
4239 else | |
4240 f->scroll_bar_cols = 2; | |
4241 | |
4242 /* 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
|
4243 if (FRAME_W32_WINDOW (f) != 0) |
13434 | 4244 { |
4245 frame_update_line_height (f); | |
4246 x_set_window_size (f, 0, f->width, f->height); | |
4247 } | |
4248 else | |
4249 /* If we are setting a new frame's font for the first time, | |
4250 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
|
4251 f->output_data.w32->line_height = FONT_HEIGHT (f->output_data.w32->font); |
13434 | 4252 |
4253 { | |
4254 Lisp_Object lispy_name; | |
4255 | |
4256 lispy_name = build_string (fontname); | |
4257 | |
4258 return lispy_name; | |
4259 } | |
4260 } | |
4261 | |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4262 /* Give frame F the fontset named FONTSETNAME as its default font, and |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4263 return the full name of that fontset. FONTSETNAME may be a wildcard |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4264 pattern; in that case, we choose some fontset that fits the pattern. |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4265 The return value shows which fontset we chose. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4266 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4267 Lisp_Object |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4268 x_new_fontset (f, fontsetname) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4269 struct frame *f; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4270 char *fontsetname; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4271 { |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4272 int fontset = fs_query_fontset (f, fontsetname); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4273 struct fontset_info *fontsetp; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4274 Lisp_Object result; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4275 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4276 if (fontset < 0) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4277 return Qnil; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4278 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4279 if (FRAME_FONTSET (f) == fontset) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4280 /* This fontset is already set in frame F. There's nothing more |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4281 to do. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4282 return build_string (fontsetname); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4283 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4284 fontsetp = FRAME_FONTSET_DATA (f)->fontset_table[fontset]; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4285 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4286 if (!fontsetp->fontname[CHARSET_ASCII]) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4287 /* This fontset doesn't contain ASCII font. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4288 return Qnil; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4289 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4290 result = x_new_font (f, fontsetp->fontname[CHARSET_ASCII]); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4291 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4292 if (!STRINGP (result)) |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4293 /* Can't load ASCII font. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4294 return Qnil; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4295 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4296 /* Since x_new_font doesn't update any fontset information, do it now. */ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4297 FRAME_FONTSET(f) = fontset; |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4298 FS_LOAD_FONT (f, FRAME_W32_FONT_TABLE (f), |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4299 CHARSET_ASCII, XSTRING (result)->data, fontset); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4300 |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4301 return build_string (fontsetname); |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4302 } |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4303 |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4304 /* Calculate the absolute position in frame F |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4305 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
|
4306 |
13434 | 4307 x_calc_absolute_position (f) |
4308 struct frame *f; | |
4309 { | |
4310 Window win, child; | |
4311 POINT pt; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4312 int flags = f->output_data.w32->size_hint_flags; |
13434 | 4313 |
4314 pt.x = pt.y = 0; | |
4315 | |
4316 /* Find the position of the outside upper-left corner of | |
4317 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
|
4318 if (f->output_data.w32->parent_desc != FRAME_W32_DISPLAY_INFO (f)->root_window) |
13434 | 4319 { |
4320 BLOCK_INPUT; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4321 MapWindowPoints (FRAME_W32_WINDOW (f), |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4322 f->output_data.w32->parent_desc, |
13434 | 4323 &pt, 1); |
4324 UNBLOCK_INPUT; | |
4325 } | |
4326 | |
4327 { | |
4328 RECT rt; | |
4329 rt.left = rt.right = rt.top = rt.bottom = 0; | |
4330 | |
4331 BLOCK_INPUT; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4332 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
|
4333 FRAME_EXTERNAL_MENU_BAR (f)); |
13434 | 4334 UNBLOCK_INPUT; |
4335 | |
4336 pt.x += (rt.right - rt.left); | |
4337 pt.y += (rt.bottom - rt.top); | |
4338 } | |
4339 | |
4340 /* Treat negative positions as relative to the leftmost bottommost | |
4341 position that fits on the screen. */ | |
4342 if (flags & XNegative) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4343 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
|
4344 - 2 * f->output_data.w32->border_width - pt.x |
13434 | 4345 - PIXEL_WIDTH (f) |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4346 + f->output_data.w32->left_pos); |
13434 | 4347 |
4348 if (flags & YNegative) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4349 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
|
4350 - 2 * f->output_data.w32->border_width - pt.y |
13434 | 4351 - PIXEL_HEIGHT (f) |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4352 + f->output_data.w32->top_pos); |
13434 | 4353 /* The left_pos and top_pos |
4354 are now relative to the top and left screen edges, | |
4355 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
|
4356 f->output_data.w32->size_hint_flags &= ~ (XNegative | YNegative); |
13434 | 4357 } |
4358 | |
4359 /* CHANGE_GRAVITY is 1 when calling from Fset_frame_position, | |
4360 to really change the position, and 0 when calling from | |
4361 x_make_frame_visible (in that case, XOFF and YOFF are the current | |
4362 position values). It is -1 when calling from x_set_frame_parameters, | |
4363 which means, do adjust for borders but don't change the gravity. */ | |
4364 | |
4365 x_set_offset (f, xoff, yoff, change_gravity) | |
4366 struct frame *f; | |
4367 register int xoff, yoff; | |
4368 int change_gravity; | |
4369 { | |
4370 int modified_top, modified_left; | |
4371 | |
4372 if (change_gravity > 0) | |
4373 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4374 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
|
4375 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
|
4376 f->output_data.w32->size_hint_flags &= ~ (XNegative | YNegative); |
13434 | 4377 if (xoff < 0) |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4378 f->output_data.w32->size_hint_flags |= XNegative; |
13434 | 4379 if (yoff < 0) |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4380 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
|
4381 f->output_data.w32->win_gravity = NorthWestGravity; |
13434 | 4382 } |
4383 x_calc_absolute_position (f); | |
4384 | |
4385 BLOCK_INPUT; | |
4386 x_wm_set_size_hint (f, (long) 0, 0); | |
4387 | |
4388 /* It is a mystery why we need to add the border_width here | |
4389 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
|
4390 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
|
4391 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
|
4392 #ifndef HAVE_NTGUI |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4393 /* Do not add in border widths under W32. */ |
13434 | 4394 if (change_gravity != 0) |
4395 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4396 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
|
4397 modified_top += f->output_data.w32->border_width; |
13434 | 4398 } |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4399 #endif |
13434 | 4400 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4401 my_set_window_pos (FRAME_W32_WINDOW (f), |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
4402 NULL, |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
4403 modified_left, modified_top, |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
4404 0, 0, |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4405 SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); |
13434 | 4406 UNBLOCK_INPUT; |
4407 } | |
4408 | |
4409 /* Call this to change the size of frame F's x-window. | |
4410 If CHANGE_GRAVITY is 1, we change to top-left-corner window gravity | |
4411 for this size change and subsequent size changes. | |
4412 Otherwise we leave the window gravity unchanged. */ | |
4413 | |
4414 x_set_window_size (f, change_gravity, cols, rows) | |
4415 struct frame *f; | |
4416 int change_gravity; | |
4417 int cols, rows; | |
4418 { | |
4419 int pixelwidth, pixelheight; | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4420 struct w32_display_info *dpyinfo = &one_w32_display_info; |
13434 | 4421 |
4422 BLOCK_INPUT; | |
4423 | |
4424 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
|
4425 f->output_data.w32->vertical_scroll_bar_extra |
13434 | 4426 = (!FRAME_HAS_VERTICAL_SCROLL_BARS (f) |
4427 ? 0 | |
4428 : FRAME_SCROLL_BAR_PIXEL_WIDTH (f) > 0 | |
4429 ? 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
|
4430 : (FRAME_SCROLL_BAR_COLS (f) * FONT_WIDTH (f->output_data.w32->font))); |
13434 | 4431 pixelwidth = CHAR_TO_PIXEL_WIDTH (f, cols); |
4432 pixelheight = CHAR_TO_PIXEL_HEIGHT (f, rows); | |
4433 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4434 f->output_data.w32->win_gravity = NorthWestGravity; |
13434 | 4435 x_wm_set_size_hint (f, (long) 0, 0); |
4436 | |
4437 { | |
4438 RECT rect; | |
4439 | |
4440 rect.left = rect.top = 0; | |
4441 rect.right = pixelwidth; | |
4442 rect.bottom = pixelheight; | |
4443 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4444 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
|
4445 FRAME_EXTERNAL_MENU_BAR (f)); |
13434 | 4446 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4447 my_set_window_pos (FRAME_W32_WINDOW (f), |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
4448 NULL, |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
4449 0, 0, |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4450 rect.right - rect.left, |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4451 rect.bottom - rect.top, |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4452 SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); |
13434 | 4453 } |
4454 | |
4455 /* Now, strictly speaking, we can't be sure that this is accurate, | |
4456 but the window manager will get around to dealing with the size | |
4457 change request eventually, and we'll hear how it went when the | |
4458 ConfigureNotify event gets here. | |
4459 | |
4460 We could just not bother storing any of this information here, | |
4461 and let the ConfigureNotify event set everything up, but that | |
4462 might be kind of confusing to the lisp code, since size changes | |
4463 wouldn't be reported in the frame parameters until some random | |
4464 point in the future when the ConfigureNotify event arrives. */ | |
4465 change_frame_size (f, rows, cols, 0, 0); | |
4466 PIXEL_WIDTH (f) = pixelwidth; | |
4467 PIXEL_HEIGHT (f) = pixelheight; | |
4468 | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4469 /* 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
|
4470 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
|
4471 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
|
4472 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
|
4473 SET_FRAME_GARBAGED (f); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4474 |
13434 | 4475 /* If cursor was outside the new size, mark it as off. */ |
4476 if (f->phys_cursor_y >= rows | |
4477 || f->phys_cursor_x >= cols) | |
4478 { | |
24674 | 4479 f->phys_cursor_x = 0; |
4480 f->phys_cursor_y = 0; | |
4481 f->phys_cursor_on = 0; | |
13434 | 4482 } |
4483 | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4484 /* 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
|
4485 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
|
4486 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
|
4487 so don't try--just let the highlighting be done afresh with new size. */ |
24827
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
4488 cancel_mouse_face (f); |
487fdbc8de0f
(cancel_mouse_face): new function. See equiv
Karl Heuer <kwzh@gnu.org>
parents:
24752
diff
changeset
|
4489 |
13434 | 4490 UNBLOCK_INPUT; |
4491 } | |
4492 | |
4493 /* Mouse warping. */ | |
4494 | |
4495 void | |
15616
a73836346910
(x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents:
15435
diff
changeset
|
4496 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
|
4497 struct frame *f; |
a73836346910
(x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents:
15435
diff
changeset
|
4498 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
|
4499 { |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4500 RECT rect; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4501 POINT pt; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4502 |
15616
a73836346910
(x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents:
15435
diff
changeset
|
4503 BLOCK_INPUT; |
a73836346910
(x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents:
15435
diff
changeset
|
4504 |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4505 GetClientRect (FRAME_W32_WINDOW (f), &rect); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4506 pt.x = rect.left + pix_x; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4507 pt.y = rect.top + pix_y; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4508 ClientToScreen (FRAME_W32_WINDOW (f), &pt); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4509 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4510 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
|
4511 |
a73836346910
(x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents:
15435
diff
changeset
|
4512 UNBLOCK_INPUT; |
a73836346910
(x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents:
15435
diff
changeset
|
4513 } |
a73836346910
(x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents:
15435
diff
changeset
|
4514 |
a73836346910
(x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents:
15435
diff
changeset
|
4515 void |
13434 | 4516 x_set_mouse_position (f, x, y) |
4517 struct frame *f; | |
4518 int x, y; | |
4519 { | |
4520 int pix_x, pix_y; | |
4521 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4522 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
|
4523 pix_y = CHAR_TO_PIXEL_ROW (f, y) + f->output_data.w32->line_height / 2; |
13434 | 4524 |
4525 if (pix_x < 0) pix_x = 0; | |
4526 if (pix_x > PIXEL_WIDTH (f)) pix_x = PIXEL_WIDTH (f); | |
4527 | |
4528 if (pix_y < 0) pix_y = 0; | |
4529 if (pix_y > PIXEL_HEIGHT (f)) pix_y = PIXEL_HEIGHT (f); | |
4530 | |
15616
a73836346910
(x_set_mouse_pixel_position): Adjust coords by frame position.
Miles Bader <miles@gnu.org>
parents:
15435
diff
changeset
|
4531 x_set_mouse_pixel_position (f, pix_x, pix_y); |
13434 | 4532 } |
4533 | |
4534 /* focus shifting, raising and lowering. */ | |
4535 | |
4536 x_focus_on_frame (f) | |
4537 struct frame *f; | |
4538 { | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4539 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
|
4540 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4541 /* Give input focus to frame. */ |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4542 BLOCK_INPUT; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4543 #if 0 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4544 /* 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
|
4545 if (x_window_to_frame (dpyinfo, GetForegroundWindow ())) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4546 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
|
4547 else |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4548 #endif |
21614
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
4549 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
|
4550 UNBLOCK_INPUT; |
13434 | 4551 } |
4552 | |
4553 x_unfocus_frame (f) | |
4554 struct frame *f; | |
4555 { | |
4556 } | |
4557 | |
4558 /* Raise frame F. */ | |
4559 | |
4560 x_raise_frame (f) | |
4561 struct frame *f; | |
4562 { | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4563 BLOCK_INPUT; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4564 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4565 /* 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
|
4566 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
|
4567 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
|
4568 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
|
4569 click-to-focus. |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4570 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4571 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
|
4572 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
|
4573 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
|
4574 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
|
4575 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
|
4576 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
|
4577 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
|
4578 completely obscured) with input focus. |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4579 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4580 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
|
4581 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
|
4582 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
|
4583 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4584 if (NILP (Vw32_grab_focus_on_raise)) |
13434 | 4585 { |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4586 /* 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
|
4587 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
|
4588 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
|
4589 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
|
4590 more cumbersome method. */ |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4591 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4592 HDWP handle = BeginDeferWindowPos (2); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4593 if (handle) |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4594 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4595 DeferWindowPos (handle, |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4596 FRAME_W32_WINDOW (f), |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4597 HWND_TOP, |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4598 0, 0, 0, 0, |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4599 SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4600 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4601 DeferWindowPos (handle, |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4602 GetForegroundWindow (), |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4603 FRAME_W32_WINDOW (f), |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4604 0, 0, 0, 0, |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4605 SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4606 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4607 EndDeferWindowPos (handle); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4608 } |
13434 | 4609 } |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4610 else |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4611 { |
21614
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
4612 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
|
4613 } |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4614 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4615 UNBLOCK_INPUT; |
13434 | 4616 } |
4617 | |
4618 /* Lower frame F. */ | |
4619 | |
4620 x_lower_frame (f) | |
4621 struct frame *f; | |
4622 { | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4623 BLOCK_INPUT; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4624 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
|
4625 HWND_BOTTOM, |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4626 0, 0, 0, 0, |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4627 SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4628 UNBLOCK_INPUT; |
13434 | 4629 } |
4630 | |
4631 static void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4632 w32_frame_raise_lower (f, raise) |
13434 | 4633 FRAME_PTR f; |
4634 int raise; | |
4635 { | |
4636 if (raise) | |
4637 x_raise_frame (f); | |
4638 else | |
4639 x_lower_frame (f); | |
4640 } | |
4641 | |
4642 /* Change of visibility. */ | |
4643 | |
4644 /* This tries to wait until the frame is really visible. | |
4645 However, if the window manager asks the user where to position | |
4646 the frame, this will return before the user finishes doing that. | |
4647 The frame will not actually be visible at that time, | |
4648 but it will become visible later when the window manager | |
4649 finishes with it. */ | |
4650 | |
4651 x_make_frame_visible (f) | |
4652 struct frame *f; | |
4653 { | |
4654 BLOCK_INPUT; | |
4655 | |
4656 if (! FRAME_VISIBLE_P (f)) | |
4657 { | |
4658 /* We test FRAME_GARBAGED_P here to make sure we don't | |
4659 call x_set_offset a second time | |
4660 if we get to x_make_frame_visible a second time | |
4661 before the window gets really visible. */ | |
4662 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
|
4663 && ! 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
|
4664 x_set_offset (f, f->output_data.w32->left_pos, f->output_data.w32->top_pos, 0); |
13434 | 4665 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4666 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
|
4667 |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4668 // 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
|
4669 my_show_window (f, FRAME_W32_WINDOW (f), SW_SHOWNORMAL); |
13434 | 4670 } |
4671 | |
4672 /* Synchronize to ensure Emacs knows the frame is visible | |
4673 before we do anything else. We do this loop with input not blocked | |
4674 so that incoming events are handled. */ | |
4675 { | |
4676 Lisp_Object frame; | |
4677 int count = input_signal_count; | |
4678 | |
4679 /* This must come after we set COUNT. */ | |
4680 UNBLOCK_INPUT; | |
4681 | |
4682 XSETFRAME (frame, f); | |
4683 | |
4684 while (1) | |
4685 { | |
4686 /* Once we have handled input events, | |
4687 we should have received the MapNotify if one is coming. | |
4688 So if we have not got it yet, stop looping. | |
4689 Some window managers make their own decisions | |
4690 about visibility. */ | |
4691 if (input_signal_count != count) | |
4692 break; | |
4693 /* Machines that do polling rather than SIGIO have been observed | |
4694 to go into a busy-wait here. So we'll fake an alarm signal | |
4695 to let the handler know that there's something to be read. | |
4696 We used to raise a real alarm, but it seems that the handler | |
4697 isn't always enabled here. This is probably a bug. */ | |
4698 if (input_polling_used ()) | |
4699 { | |
4700 /* It could be confusing if a real alarm arrives while processing | |
4701 the fake one. Turn it off and let the handler reset it. */ | |
4702 alarm (0); | |
21831
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
4703 input_poll_signal (0); |
13434 | 4704 } |
4705 /* Once we have handled input events, | |
4706 we should have received the MapNotify if one is coming. | |
4707 So if we have not got it yet, stop looping. | |
4708 Some window managers make their own decisions | |
4709 about visibility. */ | |
4710 if (input_signal_count != count) | |
4711 break; | |
4712 } | |
4713 FRAME_SAMPLE_VISIBILITY (f); | |
4714 } | |
4715 } | |
4716 | |
4717 /* Change from mapped state to withdrawn state. */ | |
4718 | |
4719 /* Make the frame visible (mapped and not iconified). */ | |
4720 | |
4721 x_make_frame_invisible (f) | |
4722 struct frame *f; | |
4723 { | |
4724 Window window; | |
4725 | |
4726 /* 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
|
4727 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
|
4728 FRAME_W32_DISPLAY_INFO (f)->w32_highlight_frame = 0; |
13434 | 4729 |
4730 BLOCK_INPUT; | |
4731 | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4732 my_show_window (f, FRAME_W32_WINDOW (f), SW_HIDE); |
13434 | 4733 |
4734 /* We can't distinguish this from iconification | |
4735 just by the event that we get from the server. | |
4736 So we can't win using the usual strategy of letting | |
4737 FRAME_SAMPLE_VISIBILITY set this. So do it by hand, | |
4738 and synchronize with the server to make sure we agree. */ | |
4739 f->visible = 0; | |
4740 FRAME_ICONIFIED_P (f) = 0; | |
4741 f->async_visible = 0; | |
4742 f->async_iconified = 0; | |
4743 | |
4744 UNBLOCK_INPUT; | |
4745 } | |
4746 | |
4747 /* Change window state from mapped to iconified. */ | |
4748 | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
4749 void |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
4750 x_iconify_frame (f) |
13434 | 4751 struct frame *f; |
4752 { | |
4753 int result; | |
4754 | |
4755 /* 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
|
4756 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
|
4757 FRAME_W32_DISPLAY_INFO (f)->w32_highlight_frame = 0; |
13434 | 4758 |
4759 if (f->async_iconified) | |
4760 return; | |
4761 | |
4762 BLOCK_INPUT; | |
4763 | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4764 /* Simulate the user minimizing the frame. */ |
23951
ef1cba882819
(x_iconify_frame): Wait for frame to be iconified; do
Andrew Innes <andrewi@gnu.org>
parents:
23806
diff
changeset
|
4765 SendMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_MINIMIZE, 0); |
13434 | 4766 |
4767 UNBLOCK_INPUT; | |
4768 } | |
4769 | |
4770 /* Destroy the window of frame F. */ | |
4771 | |
4772 x_destroy_window (f) | |
4773 struct frame *f; | |
4774 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4775 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); |
13434 | 4776 |
4777 BLOCK_INPUT; | |
4778 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4779 my_destroy_window (f, FRAME_W32_WINDOW (f)); |
13434 | 4780 free_frame_menubar (f); |
4781 free_frame_faces (f); | |
4782 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4783 xfree (f->output_data.w32); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4784 f->output_data.w32 = 0; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4785 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
|
4786 dpyinfo->w32_focus_frame = 0; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4787 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
|
4788 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
|
4789 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
|
4790 dpyinfo->w32_highlight_frame = 0; |
13434 | 4791 |
4792 dpyinfo->reference_count--; | |
4793 | |
4794 if (f == dpyinfo->mouse_face_mouse_frame) | |
4795 { | |
4796 dpyinfo->mouse_face_beg_row | |
4797 = dpyinfo->mouse_face_beg_col = -1; | |
4798 dpyinfo->mouse_face_end_row | |
4799 = dpyinfo->mouse_face_end_col = -1; | |
4800 dpyinfo->mouse_face_window = Qnil; | |
4801 } | |
4802 | |
4803 UNBLOCK_INPUT; | |
4804 } | |
4805 | |
4806 /* Setting window manager hints. */ | |
4807 | |
4808 /* Set the normal size hints for the window manager, for frame F. | |
4809 FLAGS is the flags word to use--or 0 meaning preserve the flags | |
4810 that the window now has. | |
4811 If USER_POSITION is nonzero, we set the USPosition | |
4812 flag (this is useful when FLAGS is 0). */ | |
4813 | |
4814 x_wm_set_size_hint (f, flags, user_position) | |
4815 struct frame *f; | |
4816 long flags; | |
4817 int user_position; | |
4818 { | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4819 Window window = FRAME_W32_WINDOW (f); |
13434 | 4820 |
4821 flexlines = f->height; | |
4822 | |
14351
fb2ce4ebc871
ubackout 1.3 and 1.4
Geoff Voelker <voelker@cs.washington.edu>
parents:
14248
diff
changeset
|
4823 enter_crit (); |
13434 | 4824 |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
4825 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
|
4826 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
|
4827 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
|
4828 SetWindowLong (window, WND_SCROLLBAR_INDEX, f->output_data.w32->vertical_scroll_bar_extra); |
13434 | 4829 |
14351
fb2ce4ebc871
ubackout 1.3 and 1.4
Geoff Voelker <voelker@cs.washington.edu>
parents:
14248
diff
changeset
|
4830 leave_crit (); |
13434 | 4831 } |
4832 | |
4833 /* Window manager things */ | |
4834 x_wm_set_icon_position (f, icon_x, icon_y) | |
4835 struct frame *f; | |
4836 int icon_x, icon_y; | |
4837 { | |
4838 #if 0 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4839 Window window = FRAME_W32_WINDOW (f); |
13434 | 4840 |
4841 f->display.x->wm_hints.flags |= IconPositionHint; | |
4842 f->display.x->wm_hints.icon_x = icon_x; | |
4843 f->display.x->wm_hints.icon_y = icon_y; | |
4844 | |
4845 XSetWMHints (FRAME_X_DISPLAY (f), window, &f->display.x->wm_hints); | |
4846 #endif | |
4847 } | |
4848 | |
4849 | |
4850 /* Initialization. */ | |
4851 | |
4852 #ifdef USE_X_TOOLKIT | |
4853 static XrmOptionDescRec emacs_options[] = { | |
4854 {"-geometry", ".geometry", XrmoptionSepArg, NULL}, | |
4855 {"-iconic", ".iconic", XrmoptionNoArg, (XtPointer) "yes"}, | |
4856 | |
4857 {"-internal-border-width", "*EmacsScreen.internalBorderWidth", | |
4858 XrmoptionSepArg, NULL}, | |
4859 {"-ib", "*EmacsScreen.internalBorderWidth", XrmoptionSepArg, NULL}, | |
4860 | |
4861 {"-T", "*EmacsShell.title", XrmoptionSepArg, (XtPointer) NULL}, | |
4862 {"-wn", "*EmacsShell.title", XrmoptionSepArg, (XtPointer) NULL}, | |
4863 {"-title", "*EmacsShell.title", XrmoptionSepArg, (XtPointer) NULL}, | |
4864 {"-iconname", "*EmacsShell.iconName", XrmoptionSepArg, (XtPointer) NULL}, | |
4865 {"-in", "*EmacsShell.iconName", XrmoptionSepArg, (XtPointer) NULL}, | |
4866 {"-mc", "*pointerColor", XrmoptionSepArg, (XtPointer) NULL}, | |
4867 {"-cr", "*cursorColor", XrmoptionSepArg, (XtPointer) NULL} | |
4868 }; | |
4869 #endif /* USE_X_TOOLKIT */ | |
4870 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4871 static int w32_initialized = 0; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4872 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4873 struct w32_display_info * |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4874 w32_term_init (display_name, xrm_option, resource_name) |
13434 | 4875 Lisp_Object display_name; |
4876 char *xrm_option; | |
4877 char *resource_name; | |
4878 { | |
4879 Lisp_Object frame; | |
4880 char *defaultvalue; | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4881 struct w32_display_info *dpyinfo; |
13434 | 4882 HDC hdc; |
14351
fb2ce4ebc871
ubackout 1.3 and 1.4
Geoff Voelker <voelker@cs.washington.edu>
parents:
14248
diff
changeset
|
4883 |
13434 | 4884 BLOCK_INPUT; |
4885 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4886 if (!w32_initialized) |
13434 | 4887 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4888 w32_initialize (); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4889 w32_initialized = 1; |
13434 | 4890 } |
4891 | |
4892 { | |
4893 int argc = 0; | |
4894 char *argv[3]; | |
4895 | |
4896 argv[0] = ""; | |
4897 argc = 1; | |
4898 if (xrm_option) | |
4899 { | |
4900 argv[argc++] = "-xrm"; | |
4901 argv[argc++] = xrm_option; | |
4902 } | |
4903 } | |
4904 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4905 dpyinfo = &one_w32_display_info; |
13434 | 4906 |
4907 /* Put this display on the chain. */ | |
4908 dpyinfo->next = NULL; | |
4909 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4910 /* 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
|
4911 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
|
4912 w32_display_name_list); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4913 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
|
4914 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4915 dpyinfo->w32_id_name |
13434 | 4916 = (char *) xmalloc (XSTRING (Vinvocation_name)->size |
4917 + XSTRING (Vsystem_name)->size | |
4918 + 2); | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4919 sprintf (dpyinfo->w32_id_name, "%s@%s", |
13434 | 4920 XSTRING (Vinvocation_name)->data, XSTRING (Vsystem_name)->data); |
4921 | |
4922 #if 0 | |
4923 xrdb = x_load_resources (dpyinfo->display, xrm_option, | |
4924 resource_name, EMACS_CLASS); | |
4925 | |
4926 /* Put the rdb where we can find it in a way that works on | |
4927 all versions. */ | |
4928 dpyinfo->xrdb = xrdb; | |
4929 #endif | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
4930 hdc = GetDC (GetDesktopWindow ()); |
13434 | 4931 |
4932 dpyinfo->height = GetDeviceCaps (hdc, VERTRES); | |
4933 dpyinfo->width = GetDeviceCaps (hdc, HORZRES); | |
4934 dpyinfo->root_window = GetDesktopWindow (); | |
4935 dpyinfo->n_planes = GetDeviceCaps (hdc, PLANES); | |
4936 dpyinfo->n_cbits = GetDeviceCaps (hdc, BITSPIXEL); | |
4937 dpyinfo->height_in = GetDeviceCaps (hdc, LOGPIXELSX); | |
4938 dpyinfo->width_in = GetDeviceCaps (hdc, LOGPIXELSY); | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
4939 dpyinfo->has_palette = GetDeviceCaps (hdc, RASTERCAPS) & RC_PALETTE; |
13434 | 4940 dpyinfo->grabbed = 0; |
4941 dpyinfo->reference_count = 0; | |
4942 dpyinfo->n_fonts = 0; | |
4943 dpyinfo->font_table_size = 0; | |
4944 dpyinfo->bitmaps = 0; | |
4945 dpyinfo->bitmaps_size = 0; | |
4946 dpyinfo->bitmaps_last = 0; | |
4947 dpyinfo->mouse_face_mouse_frame = 0; | |
4948 dpyinfo->mouse_face_deferred_gc = 0; | |
4949 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; | |
4950 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; | |
4951 dpyinfo->mouse_face_face_id = 0; | |
4952 dpyinfo->mouse_face_window = Qnil; | |
4953 dpyinfo->mouse_face_mouse_x = dpyinfo->mouse_face_mouse_y = 0; | |
4954 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
|
4955 dpyinfo->w32_focus_frame = 0; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4956 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
|
4957 dpyinfo->w32_highlight_frame = 0; |
13434 | 4958 |
4959 ReleaseDC (GetDesktopWindow (), hdc); | |
4960 | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
4961 /* 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
|
4962 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
|
4963 mouse-3. */ |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4964 XSETINT (Vw32_num_mouse_buttons, GetSystemMetrics (SM_CMOUSEBUTTONS)); |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
4965 |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
4966 /* initialise palette with white and black */ |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
4967 { |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
4968 COLORREF color; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
4969 defined_color (0, "white", &color, 1); |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
4970 defined_color (0, "black", &color, 1); |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
4971 } |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
4972 |
13434 | 4973 #ifndef F_SETOWN_BUG |
4974 #ifdef F_SETOWN | |
4975 #ifdef F_SETOWN_SOCK_NEG | |
4976 /* stdin is a socket here */ | |
4977 fcntl (connection, F_SETOWN, -getpid ()); | |
4978 #else /* ! defined (F_SETOWN_SOCK_NEG) */ | |
4979 fcntl (connection, F_SETOWN, getpid ()); | |
4980 #endif /* ! defined (F_SETOWN_SOCK_NEG) */ | |
4981 #endif /* ! defined (F_SETOWN) */ | |
4982 #endif /* F_SETOWN_BUG */ | |
4983 | |
4984 #ifdef SIGIO | |
4985 if (interrupt_input) | |
4986 init_sigio (connection); | |
4987 #endif /* ! defined (SIGIO) */ | |
4988 | |
4989 UNBLOCK_INPUT; | |
4990 | |
4991 return dpyinfo; | |
4992 } | |
4993 | |
4994 /* Get rid of display DPYINFO, assuming all frames are already gone. */ | |
4995 | |
4996 void | |
4997 x_delete_display (dpyinfo) | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
4998 struct w32_display_info *dpyinfo; |
13434 | 4999 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
5000 /* Discard this display from w32_display_name_list and w32_display_list. |
13434 | 5001 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
|
5002 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
|
5003 && 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
|
5004 w32_display_name_list = XCONS (w32_display_name_list)->cdr; |
13434 | 5005 else |
5006 { | |
5007 Lisp_Object tail; | |
5008 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
5009 tail = w32_display_name_list; |
13434 | 5010 while (CONSP (tail) && CONSP (XCONS (tail)->cdr)) |
5011 { | |
5012 if (EQ (XCONS (XCONS (tail)->cdr)->car, | |
5013 dpyinfo->name_list_element)) | |
5014 { | |
5015 XCONS (tail)->cdr = XCONS (XCONS (tail)->cdr)->cdr; | |
5016 break; | |
5017 } | |
5018 tail = XCONS (tail)->cdr; | |
5019 } | |
5020 } | |
5021 | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
5022 /* free palette table */ |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
5023 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
5024 struct w32_palette_entry * plist; |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
5025 |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
5026 plist = dpyinfo->color_list; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
5027 while (plist) |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
5028 { |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
5029 struct w32_palette_entry * pentry = plist; |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
5030 plist = plist->next; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
5031 xfree(pentry); |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
5032 } |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
5033 dpyinfo->color_list = NULL; |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
5034 if (dpyinfo->palette) |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
5035 DeleteObject(dpyinfo->palette); |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
5036 } |
13434 | 5037 xfree (dpyinfo->font_table); |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
5038 xfree (dpyinfo->w32_id_name); |
13434 | 5039 } |
5040 | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
5041 /* Set up use of W32. */ |
13434 | 5042 |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5043 DWORD w32_msg_worker (); |
13434 | 5044 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
5045 w32_initialize () |
13434 | 5046 { |
21831
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
5047 /* MSVC does not type K&R functions with no arguments correctly, and |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
5048 so we must explicitly cast them. */ |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
5049 clear_frame_hook = (void (*)(void)) w32_clear_frame; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
5050 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
|
5051 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
|
5052 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
|
5053 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
|
5054 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
|
5055 delete_glyphs_hook = w32_delete_glyphs; |
21831
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
5056 ring_bell_hook = (void (*)(void)) w32_ring_bell; |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
5057 reset_terminal_modes_hook = (void (*)(void)) w32_reset_terminal_modes; |
6b659713b90b
Forward declare hooks with full function prototypes.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21740
diff
changeset
|
5058 set_terminal_modes_hook = (void (*)(void)) w32_set_terminal_modes; |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
5059 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
|
5060 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
|
5061 set_terminal_window_hook = w32_set_terminal_window; |
13434 | 5062 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
|
5063 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
|
5064 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
|
5065 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
|
5066 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
|
5067 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
|
5068 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
|
5069 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
|
5070 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
|
5071 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
|
5072 judge_scroll_bars_hook = w32_judge_scroll_bars; |
13434 | 5073 |
5074 scroll_region_ok = 1; /* we'll scroll partial frames */ | |
5075 char_ins_del_ok = 0; /* just as fast to write the line */ | |
5076 line_ins_del_ok = 1; /* we'll just blt 'em */ | |
5077 fast_clear_end_of_line = 1; /* X does this well */ | |
5078 memory_below_frame = 0; /* we don't remember what scrolls | |
5079 off the bottom */ | |
5080 baud_rate = 19200; | |
5081 | |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5082 /* 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
|
5083 8 bit character input, standard quit char. */ |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5084 Fset_input_mode (Qnil, Qnil, make_number (2), Qnil); |
13434 | 5085 |
5086 /* Create the window thread - it will terminate itself or when the app terminates */ | |
5087 | |
5088 init_crit (); | |
5089 | |
5090 dwMainThreadId = GetCurrentThreadId (); | |
5091 DuplicateHandle (GetCurrentProcess (), GetCurrentThread (), | |
5092 GetCurrentProcess (), &hMainThread, 0, TRUE, DUPLICATE_SAME_ACCESS); | |
5093 | |
5094 /* Wait for thread to start */ | |
5095 | |
5096 { | |
5097 MSG msg; | |
5098 | |
5099 PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE); | |
5100 | |
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16588
diff
changeset
|
5101 hWindowsThread = CreateThread (NULL, 0, |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5102 (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
|
5103 0, 0, &dwWindowsThreadId); |
13434 | 5104 |
5105 GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE); | |
5106 } | |
5107 | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
5108 /* 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
|
5109 focus window and active window as windowsThread. Unfortunately, the |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
5110 following call to AttachThreadInput, which should do precisely what |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
5111 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
|
5112 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
|
5113 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
|
5114 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
|
5115 window state. */ |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
5116 #ifdef ATTACH_THREADS |
16884
36babc489b0c
Change all uses of win95, winnt, and win32
Geoff Voelker <voelker@cs.washington.edu>
parents:
16588
diff
changeset
|
5117 AttachThreadInput (dwMainThreadId, dwWindowsThreadId, TRUE); |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
5118 #endif |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5119 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5120 /* Dynamically link to optional system components. */ |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5121 { |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5122 HANDLE user_lib = LoadLibrary ("user32.dll"); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5123 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5124 #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
|
5125 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5126 /* New proportional scroll bar functions. */ |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5127 LOAD_PROC( SetScrollInfo ); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5128 LOAD_PROC( GetScrollInfo ); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5129 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5130 #undef LOAD_PROC |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5131 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5132 FreeLibrary (user_lib); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5133 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5134 /* 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
|
5135 otherwise use the fixed height. */ |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5136 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
|
5137 GetSystemMetrics (SM_CYVTHUMB); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5138 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5139 /* 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
|
5140 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
|
5141 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
|
5142 = GetSystemMetrics (SM_CYVSCROLL); |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5143 } |
13434 | 5144 } |
5145 | |
5146 void | |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
5147 syms_of_w32term () |
13434 | 5148 { |
24131
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5149 Lisp_Object codepage; |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5150 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
5151 staticpro (&w32_display_name_list); |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
5152 w32_display_name_list = Qnil; |
13434 | 5153 |
5154 staticpro (&last_mouse_scroll_bar); | |
5155 last_mouse_scroll_bar = Qnil; | |
5156 | |
5157 staticpro (&Qvendor_specific_keysyms); | |
5158 Qvendor_specific_keysyms = intern ("vendor-specific-keysyms"); | |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
5159 |
16588
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
5160 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
|
5161 &Vw32_num_mouse_buttons, |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
5162 "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
|
5163 Vw32_num_mouse_buttons = Qnil; |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
5164 |
481b7874a1e9
Change identifiers of the form win32* to w32*.
Geoff Voelker <voelker@cs.washington.edu>
parents:
16326
diff
changeset
|
5165 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
|
5166 &Vw32_swap_mouse_buttons, |
15151
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
5167 "Swap the mapping of middle and right mouse buttons.\n\ |
ed6ddfc0d954
(Vwindow_system): Declared.
Geoff Voelker <voelker@cs.washington.edu>
parents:
15035
diff
changeset
|
5168 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
|
5169 Vw32_swap_mouse_buttons = Qnil; |
19713
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5170 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5171 DEFVAR_LISP ("w32-grab-focus-on-raise", |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5172 &Vw32_grab_focus_on_raise, |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5173 "Raised frame grabs input focus.\n\ |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5174 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
|
5175 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
|
5176 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
|
5177 Vw32_grab_focus_on_raise = Qt; |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5178 |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5179 DEFVAR_LISP ("w32-capslock-is-shiftlock", |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5180 &Vw32_capslock_is_shiftlock, |
043ccce224fb
(SIF_*): Win95 macros defined for NT.
Geoff Voelker <voelker@cs.washington.edu>
parents:
18877
diff
changeset
|
5181 "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
|
5182 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
|
5183 Vw32_capslock_is_shiftlock = Qnil; |
21614
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
5184 |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
5185 DEFVAR_LISP ("w32-recognize-altgr", |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
5186 &Vw32_recognize_altgr, |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
5187 "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
|
5188 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
|
5189 interpreted normally."); |
2624d8dcc73f
(Vw32_recognize_altgr): New variable.
Geoff Voelker <voelker@cs.washington.edu>
parents:
21456
diff
changeset
|
5190 Vw32_recognize_altgr = Qt; |
23638
e6fb9ffee4f4
(dumpglyphs): Use FRAME_FONT for w32_fill_area.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23510
diff
changeset
|
5191 |
23639
516fc58a7b7b
(w32_enable_unicode_output): Rename from
Geoff Voelker <voelker@cs.washington.edu>
parents:
23638
diff
changeset
|
5192 DEFVAR_BOOL ("w32-enable-unicode-output", |
516fc58a7b7b
(w32_enable_unicode_output): Rename from
Geoff Voelker <voelker@cs.washington.edu>
parents:
23638
diff
changeset
|
5193 &w32_enable_unicode_output, |
516fc58a7b7b
(w32_enable_unicode_output): Rename from
Geoff Voelker <voelker@cs.washington.edu>
parents:
23638
diff
changeset
|
5194 "Enable the use of Unicode for text output if non-nil.\n\ |
23507
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
5195 Unicode output may prevent some third party applications for displaying\n\ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
5196 Far-East Languages on Windows 95/98 from working properly.\n\ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
5197 NT uses Unicode internally anyway, so this flag will probably have no\n\ |
8a448630a9b5
Include fontset.h. Define codepage macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
22059
diff
changeset
|
5198 affect on NT machines."); |
23639
516fc58a7b7b
(w32_enable_unicode_output): Rename from
Geoff Voelker <voelker@cs.washington.edu>
parents:
23638
diff
changeset
|
5199 w32_enable_unicode_output = 1; |
24131
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5200 |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5201 DEFVAR_LISP ("w32-charset-to-codepage-alist", |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5202 &Vw32_charset_to_codepage_alist, |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5203 "Alist linking character sets to Windows Codepages."); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5204 Vw32_charset_to_codepage_alist = Qnil; |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5205 /* Initialise the alist with some defaults. */ |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5206 XSETFASTINT (codepage, 936); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5207 store_in_alist (&Vw32_charset_to_codepage_alist, |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5208 build_string ("gb2312"), codepage); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5209 XSETFASTINT (codepage, 950); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5210 store_in_alist (&Vw32_charset_to_codepage_alist, |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5211 build_string ("big5"), codepage); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5212 XSETFASTINT (codepage, 949); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5213 store_in_alist (&Vw32_charset_to_codepage_alist, |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
5214 build_string ("ksc5601.1987"), codepage); |
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
5215 XSETFASTINT (codepage, 1361); |
24131
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5216 store_in_alist (&Vw32_charset_to_codepage_alist, |
24146
9ed2245a9b79
(W32_TEXTOUT): New macro.
Geoff Voelker <voelker@cs.washington.edu>
parents:
24131
diff
changeset
|
5217 build_string ("ksc5601.1992"), codepage); |
24131
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5218 XSETFASTINT (codepage, 932); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5219 store_in_alist (&Vw32_charset_to_codepage_alist, |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5220 build_string ("jisx0208-sjis"), codepage); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5221 XSETFASTINT (codepage, 874); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5222 store_in_alist (&Vw32_charset_to_codepage_alist, |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5223 build_string ("tis620"), codepage); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5224 XSETFASTINT (codepage, 20866); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5225 store_in_alist (&Vw32_charset_to_codepage_alist, |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5226 build_string ("koi8-r"), codepage); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5227 /* iso8859-13 is not yet officially adopted, but it is conveniently |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5228 covered by CP 1257. */ |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5229 XSETFASTINT (codepage, 1257); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5230 store_in_alist (&Vw32_charset_to_codepage_alist, |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5231 build_string ("iso8859-13"), codepage); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5232 XSETFASTINT (codepage, 1254); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5233 store_in_alist (&Vw32_charset_to_codepage_alist, |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5234 build_string ("iso8859-9"), codepage); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5235 XSETFASTINT (codepage, 1255); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5236 store_in_alist (&Vw32_charset_to_codepage_alist, |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5237 build_string ("iso8859-8"), codepage); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5238 XSETFASTINT (codepage, 28597); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5239 store_in_alist (&Vw32_charset_to_codepage_alist, |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5240 build_string ("iso8859-7"), codepage); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5241 XSETFASTINT (codepage, 28596); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5242 store_in_alist (&Vw32_charset_to_codepage_alist, |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5243 build_string ("iso8859-6"), codepage); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5244 XSETFASTINT (codepage, 28595); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5245 store_in_alist (&Vw32_charset_to_codepage_alist, |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5246 build_string ("iso8859-5"), codepage); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5247 XSETFASTINT (codepage, 28594); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5248 store_in_alist (&Vw32_charset_to_codepage_alist, |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5249 build_string ("iso8859-4"), codepage); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5250 XSETFASTINT (codepage, 28593); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5251 store_in_alist (&Vw32_charset_to_codepage_alist, |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5252 build_string ("iso8859-3"), codepage); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5253 XSETFASTINT (codepage, 28592); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5254 store_in_alist (&Vw32_charset_to_codepage_alist, |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5255 build_string ("iso8859-2"), codepage); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5256 XSETFASTINT (codepage, 1252); |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5257 store_in_alist (&Vw32_charset_to_codepage_alist, |
34f6ec762e5e
Remove codepage macros. Remove redundant BIG5 macros.
Geoff Voelker <voelker@cs.washington.edu>
parents:
23951
diff
changeset
|
5258 build_string ("iso8859-1"), codepage); |
13434 | 5259 } |