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