annotate src/w32term.h @ 15069:6237f2b08205

Spelling error.
author Edward M. Reingold <reingold@emr.cs.iit.edu>
date Wed, 24 Apr 1996 23:36:43 +0000
parents e8a969370f33
children 2dd4961cefaa
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
13543
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
1 /* Definitions and headers for communication with Win32 GUI.
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
2 Copyright (C) 1995 Free Software Foundation, Inc.
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
3
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
4 This file is part of GNU Emacs.
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
5
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
6 GNU Emacs is free software; you can redistribute it and/or modify
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
7 it under the terms of the GNU General Public License as published by
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
8 the Free Software Foundation; either version 2, or (at your option)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
9 any later version.
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
10
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
11 GNU Emacs is distributed in the hope that it will be useful,
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
14 GNU General Public License for more details.
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
15
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
17 along with GNU Emacs; see the file COPYING. If not, write to
14186
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 13543
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
ee40177f6c68 Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents: 13543
diff changeset
19 Boston, MA 02111-1307, USA. */
13543
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
20
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
21 /* Added by Kevin Gallo */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
22
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
23 #include <win32.h>
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
24
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
25 /* The class of this X application. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
26 #define EMACS_CLASS "Emacs"
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
27
14984
e8a969370f33 (BLACK_PIX_DEFAULT, WHITE_PIX_DEFAULT): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14809
diff changeset
28 #define BLACK_PIX_DEFAULT(f) PALETTERGB(0,0,0)
e8a969370f33 (BLACK_PIX_DEFAULT, WHITE_PIX_DEFAULT): Use PALETTERGB instead of RGB.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14809
diff changeset
29 #define WHITE_PIX_DEFAULT(f) PALETTERGB(255,255,255)
13543
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
30
14521
4ffaeb5318c0 (FONT_WIDTH): Use average character width, not maximum.
Geoff Voelker <voelker@cs.washington.edu>
parents: 14353
diff changeset
31 #define FONT_WIDTH(f) ((f)->tm.tmAveCharWidth)
13543
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
32 #define FONT_HEIGHT(f) ((f)->tm.tmHeight)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
33 #define FONT_BASE(f) ((f)->tm.tmAscent)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
34
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
35 #define CHECK_WIN32_FRAME(f, frame) \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
36 if (NILP (frame)) \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
37 f = selected_frame; \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
38 else \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
39 { \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
40 CHECK_LIVE_FRAME (frame, 0); \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
41 f = XFRAME (frame); \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
42 } \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
43 if (! FRAME_WIN32_P (f))
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
44
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
45 /* Indicates whether we are in the readsocket call and the message we
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
46 are processing in the current loop */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
47
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
48 extern MSG CurMsg;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
49 extern BOOL bUseDflt;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
50
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
51 extern struct frame *x_window_to_frame ();
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
52
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
53 enum text_cursor_kinds {
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
54 filled_box_cursor, hollow_box_cursor, bar_cursor
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
55 };
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
56
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
57 /* This data type is used for the font_table field
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
58 of struct win32_display_info. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
59
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
60 struct font_info
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
61 {
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
62 XFontStruct *font;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
63 char *name;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
64 };
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
65
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
66 /* Structure recording bitmaps and reference count.
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
67 If REFCOUNT is 0 then this record is free to be reused. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
68
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
69 struct win32_bitmap_record
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
70 {
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
71 Pixmap pixmap;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
72 char *file;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
73 HINSTANCE hinst; /* Used to load the file */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
74 int refcount;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
75 /* Record some info about this pixmap. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
76 int height, width, depth;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
77 };
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
78
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
79 /* For each display (currently only one on win32), we have a structure that
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
80 records information about it. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
81
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
82 struct win32_display_info
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
83 {
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
84 /* Chain of all win32_display_info structures. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
85 struct win32_display_info *next;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
86 /* This is a cons cell of the form (NAME . FONT-LIST-CACHE).
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
87 The same cons cell also appears in x_display_name_list. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
88 Lisp_Object name_list_element;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
89 /* Number of frames that are on this display. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
90 int reference_count;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
91 /* Number of planes on this screen. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
92 int n_planes;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
93 /* Number of bits per pixel on this screen. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
94 int n_cbits;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
95 /* Dimensions of this screen. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
96 int height, width;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
97 int height_in,width_in;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
98 /* Mask of things that cause the mouse to be grabbed. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
99 int grabbed;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
100 /* The root window of this screen. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
101 Window root_window;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
102 /* The cursor to use for vertical scroll bars. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
103 Cursor vertical_scroll_bar_cursor;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
104
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
105 /* A table of all the fonts we have already loaded. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
106 struct font_info *font_table;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
107
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
108 /* The current capacity of x_font_table. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
109 int font_table_size;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
110
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
111 /* These variables describe the range of text currently shown
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
112 in its mouse-face, together with the window they apply to.
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
113 As long as the mouse stays within this range, we need not
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
114 redraw anything on its account. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
115 int mouse_face_beg_row, mouse_face_beg_col;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
116 int mouse_face_end_row, mouse_face_end_col;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
117 int mouse_face_past_end;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
118 Lisp_Object mouse_face_window;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
119 int mouse_face_face_id;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
120
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
121 /* 1 if a mouse motion event came and we didn't handle it right away because
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
122 gc was in progress. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
123 int mouse_face_deferred_gc;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
124
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
125 /* FRAME and X, Y position of mouse when last checked for
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
126 highlighting. X and Y can be negative or out of range for the frame. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
127 struct frame *mouse_face_mouse_frame;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
128 int mouse_face_mouse_x, mouse_face_mouse_y;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
129
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
130 /* Nonzero means defer mouse-motion highlighting. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
131 int mouse_face_defer;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
132
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
133 char *win32_id_name;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
134
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
135 /* The number of fonts actually stored in win32_font_table.
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
136 font_table[n] is used and valid iff 0 <= n < n_fonts.
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
137 0 <= n_fonts <= font_table_size. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
138 int n_fonts;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
139
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
140 /* Pointer to bitmap records. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
141 struct win32_bitmap_record *bitmaps;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
142
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
143 /* Allocated size of bitmaps field. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
144 int bitmaps_size;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
145
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
146 /* Last used bitmap index. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
147 int bitmaps_last;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
148
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
149 /* The frame (if any) which has the window that has keyboard focus.
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
150 Zero if none. This is examined by Ffocus_frame in w32fns.c. Note
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
151 that a mere EnterNotify event can set this; if you need to know the
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
152 last frame specified in a FocusIn or FocusOut event, use
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
153 win32_focus_event_frame. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
154 struct frame *win32_focus_frame;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
155
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
156 /* The last frame mentioned in a FocusIn or FocusOut event. This is
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
157 separate from win32_focus_frame, because whether or not LeaveNotify
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
158 events cause us to lose focus depends on whether or not we have
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
159 received a FocusIn event for it. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
160 struct frame *win32_focus_event_frame;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
161
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
162 /* The frame which currently has the visual highlight, and should get
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
163 keyboard input (other sorts of input have the frame encoded in the
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
164 event). It points to the focus frame's selected window's
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
165 frame. It differs from win32_focus_frame when we're using a global
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
166 minibuffer. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
167 struct frame *win32_highlight_frame;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
168 };
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
169
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
170 /* This is a chain of structures for all the displays currently in use. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
171 extern struct win32_display_info one_win32_display_info;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
172
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
173 /* This is a list of cons cells, each of the form (NAME . FONT-LIST-CACHE),
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
174 one for each element of win32_display_list and in the same order.
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
175 NAME is the name of the frame.
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
176 FONT-LIST-CACHE records previous values returned by x-list-fonts. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
177 extern Lisp_Object win32_display_name_list;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
178
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
179 extern struct win32_display_info *x_display_info_for_display ();
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
180 extern struct win32_display_info *x_display_info_for_name ();
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
181
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
182 extern struct win32_display_info *win32_term_init ();
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
183
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
184 /* Each Win32 frame object points to its own struct win32_display object
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
185 in the output_data.win32 field. The win32_display structure contains all
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
186 the information that is specific to Win32 windows. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
187
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
188 struct win32_output
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
189 {
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
190 /* Position of the Win32 window (x and y offsets in root window). */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
191 int left_pos;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
192 int top_pos;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
193
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
194 /* Border width of the Win32 window as known by the window system. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
195 int border_width;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
196
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
197 /* Size of the Win32 window in pixels. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
198 int pixel_height, pixel_width;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
199
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
200 /* Height of a line, in pixels. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
201 int line_height;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
202
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
203 /* Width of the internal border. This is a line of background color
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
204 just inside the window's border. When the frame is selected,
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
205 a highlighting is displayed inside the internal border. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
206 int internal_border_width;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
207
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
208 /* The window used for this frame.
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
209 May be zero while the frame object is being created
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
210 and the window has not yet been created. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
211 Window window_desc;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
212
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
213 /* The window that is the parent of this window.
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
214 Usually this is a window that was made by the window manager,
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
215 but it can be the root window, and it can be explicitly specified
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
216 (see the explicit_parent field, below). */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
217 Window parent_desc;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
218
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
219 XFontStruct *font;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
220
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
221 /* Pixel values used for various purposes.
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
222 border_pixel may be -1 meaning use a gray tile. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
223 unsigned long background_pixel;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
224 unsigned long foreground_pixel;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
225 unsigned long cursor_pixel;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
226 unsigned long border_pixel;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
227 unsigned long mouse_pixel;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
228 unsigned long cursor_foreground_pixel;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
229
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
230 /* Descriptor for the cursor in use for this window. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
231 Cursor text_cursor;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
232 Cursor nontext_cursor;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
233 Cursor modeline_cursor;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
234 Cursor cross_cursor;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
235
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
236 /* Flag to set when the window needs to be completely repainted. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
237 int needs_exposure;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
238
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
239 /* What kind of text cursor is drawn in this window right now?
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
240 (If there is no cursor (phys_cursor_x < 0), then this means nothing.) */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
241 enum text_cursor_kinds current_cursor;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
242
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
243 /* What kind of text cursor should we draw in the future?
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
244 This should always be filled_box_cursor or bar_cursor. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
245 enum text_cursor_kinds desired_cursor;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
246
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
247 /* Width of bar cursor (if we are using that). */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
248 int cursor_width;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
249
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
250 DWORD dwStyle;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
251
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
252 /* The size of the extra width currently allotted for vertical
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
253 scroll bars, in pixels. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
254 int vertical_scroll_bar_extra;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
255
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
256 /* Table of parameter faces for this frame. Any resources (pixel
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
257 values, fonts) referred to here have been allocated explicitly
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
258 for this face, and should be freed if we change the face. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
259 struct face **param_faces;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
260 int n_param_faces;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
261
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
262 /* Table of computed faces for this frame. These are the faces
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
263 whose indexes go into the upper bits of a glyph, computed by
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
264 combining the parameter faces specified by overlays, text
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
265 properties, and what have you. The resources mentioned here
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
266 are all shared with parameter faces. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
267 struct face **computed_faces;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
268 int n_computed_faces; /* How many are valid */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
269 int size_computed_faces; /* How many are allocated */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
270
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
271 /* This is the gravity value for the specified window position. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
272 int win_gravity;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
273
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
274 /* The geometry flags for this window. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
275 int size_hint_flags;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
276
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
277 /* This is the Emacs structure for the display this frame is on. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
278 /* struct win32_display_info *display_info; */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
279
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
280 /* Nonzero means our parent is another application's window
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
281 and was explicitly specified. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
282 char explicit_parent;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
283
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
284 /* Nonzero means tried already to make this frame visible. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
285 char asked_for_visible;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
286 };
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
287
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
288 /* Get at the computed faces of an X window frame. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
289 #define FRAME_PARAM_FACES(f) ((f)->output_data.win32->param_faces)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
290 #define FRAME_N_PARAM_FACES(f) ((f)->output_data.win32->n_param_faces)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
291 #define FRAME_DEFAULT_PARAM_FACE(f) (FRAME_PARAM_FACES (f)[0])
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
292 #define FRAME_MODE_LINE_PARAM_FACE(f) (FRAME_PARAM_FACES (f)[1])
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
293
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
294 #define FRAME_COMPUTED_FACES(f) ((f)->output_data.win32->computed_faces)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
295 #define FRAME_N_COMPUTED_FACES(f) ((f)->output_data.win32->n_computed_faces)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
296 #define FRAME_SIZE_COMPUTED_FACES(f) ((f)->output_data.win32->size_computed_faces)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
297 #define FRAME_DEFAULT_FACE(f) ((f)->output_data.win32->computed_faces[0])
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
298 #define FRAME_MODE_LINE_FACE(f) ((f)->output_data.win32->computed_faces[1])
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
299
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
300 /* Return the window associated with the frame F. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
301 #define FRAME_WIN32_WINDOW(f) ((f)->output_data.win32->window_desc)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
302
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
303 #define FRAME_FOREGROUND_PIXEL(f) ((f)->output_data.win32->foreground_pixel)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
304 #define FRAME_BACKGROUND_PIXEL(f) ((f)->output_data.win32->background_pixel)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
305 #define FRAME_FONT(f) ((f)->output_data.win32->font)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
306 #define FRAME_INTERNAL_BORDER_WIDTH(f) ((f)->output_data.win32->internal_border_width)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
307
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
308 /* This gives the win32_display_info structure for the display F is on. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
309 #define FRAME_WIN32_DISPLAY_INFO(f) (&one_win32_display_info)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
310
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
311 /* These two really ought to be called FRAME_PIXEL_{WIDTH,HEIGHT}. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
312 #define PIXEL_WIDTH(f) ((f)->output_data.win32->pixel_width)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
313 #define PIXEL_HEIGHT(f) ((f)->output_data.win32->pixel_height)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
314 #define FRAME_LINE_HEIGHT(f) ((f)->output_data.win32->line_height)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
315
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
316 #define FRAME_DESIRED_CURSOR(f) ((f)->output_data.win32->desired_cursor)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
317
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
318
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
319 /* Win32-specific scroll bar stuff. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
320
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
321 /* We represent scroll bars as lisp vectors. This allows us to place
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
322 references to them in windows without worrying about whether we'll
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
323 end up with windows referring to dead scroll bars; the garbage
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
324 collector will free it when its time comes.
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
325
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
326 We use struct scroll_bar as a template for accessing fields of the
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
327 vector. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
328
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
329 struct scroll_bar {
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
330
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
331 /* These fields are shared by all vectors. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
332 EMACS_INT size_from_Lisp_Vector_struct;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
333 struct Lisp_Vector *next_from_Lisp_Vector_struct;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
334
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
335 /* The window we're a scroll bar for. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
336 Lisp_Object window;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
337
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
338 /* The next and previous in the chain of scroll bars in this frame. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
339 Lisp_Object next, prev;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
340
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
341 /* The window representing this scroll bar. Since this is a full
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
342 32-bit quantity, we store it split into two 32-bit values. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
343 Lisp_Object win32_window_low, win32_window_high;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
344
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
345 /* The position and size of the scroll bar in pixels, relative to the
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
346 frame. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
347 Lisp_Object top, left, width, height;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
348
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
349 /* The starting and ending positions of the handle, relative to the
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
350 handle area (i.e. zero is the top position, not
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
351 SCROLL_BAR_TOP_BORDER). If they're equal, that means the handle
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
352 hasn't been drawn yet.
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
353
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
354 These are not actually the locations where the beginning and end
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
355 are drawn; in order to keep handles from becoming invisible when
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
356 editing large files, we establish a minimum height by always
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
357 drawing handle bottoms VERTICAL_SCROLL_BAR_MIN_HANDLE pixels below
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
358 where they would be normally; the bottom and top are in a
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
359 different co-ordinate system. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
360 Lisp_Object start, end;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
361
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
362 /* If the scroll bar handle is currently being dragged by the user,
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
363 this is the number of pixels from the top of the handle to the
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
364 place where the user grabbed it. If the handle isn't currently
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
365 being dragged, this is Qnil. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
366 Lisp_Object dragging;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
367 };
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
368
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
369 /* The number of elements a vector holding a struct scroll_bar needs. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
370 #define SCROLL_BAR_VEC_SIZE \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
371 ((sizeof (struct scroll_bar) \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
372 - sizeof (EMACS_INT) - sizeof (struct Lisp_Vector *)) \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
373 / sizeof (Lisp_Object))
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
374
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
375 /* Turning a lisp vector value into a pointer to a struct scroll_bar. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
376 #define XSCROLL_BAR(vec) ((struct scroll_bar *) XVECTOR (vec))
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
377
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
378
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
379 /* Building a 32-bit C integer from two 16-bit lisp integers. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
380 #define SCROLL_BAR_PACK(low, high) (XINT (high) << 16 | XINT (low))
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
381
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
382 /* Setting two lisp integers to the low and high words of a 32-bit C int. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
383 #define SCROLL_BAR_UNPACK(low, high, int32) \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
384 (XSETINT ((low), (int32) & 0xffff), \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
385 XSETINT ((high), ((int32) >> 16) & 0xffff))
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
386
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
387
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
388 /* Extract the window id of the scroll bar from a struct scroll_bar. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
389 #define SCROLL_BAR_WIN32_WINDOW(ptr) \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
390 ((Window) SCROLL_BAR_PACK ((ptr)->win32_window_low, (ptr)->win32_window_high))
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
391
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
392 /* Store a window id in a struct scroll_bar. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
393 #define SET_SCROLL_BAR_WIN32_WINDOW(ptr, id) \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
394 (SCROLL_BAR_UNPACK ((ptr)->win32_window_low, (ptr)->win32_window_high, (int) id))
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
395
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
396
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
397 /* Return the outside pixel height for a vertical scroll bar HEIGHT
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
398 rows high on frame F. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
399 #define VERTICAL_SCROLL_BAR_PIXEL_HEIGHT(f, height) \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
400 ((height) * (f)->output_data.win32->line_height)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
401
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
402 /* Return the inside width of a vertical scroll bar, given the outside
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
403 width. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
404 #define VERTICAL_SCROLL_BAR_INSIDE_WIDTH(width) \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
405 ((width) - VERTICAL_SCROLL_BAR_LEFT_BORDER - VERTICAL_SCROLL_BAR_RIGHT_BORDER)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
406
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
407 /* Return the length of the rectangle within which the top of the
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
408 handle must stay. This isn't equivalent to the inside height,
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
409 because the scroll bar handle has a minimum height.
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
410
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
411 This is the real range of motion for the scroll bar, so when we're
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
412 scaling buffer positions to scroll bar positions, we use this, not
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
413 VERTICAL_SCROLL_BAR_INSIDE_HEIGHT. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
414 #define VERTICAL_SCROLL_BAR_TOP_RANGE(height) \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
415 (VERTICAL_SCROLL_BAR_INSIDE_HEIGHT (height) - VERTICAL_SCROLL_BAR_MIN_HANDLE)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
416
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
417 /* Return the inside height of vertical scroll bar, given the outside
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
418 height. See VERTICAL_SCROLL_BAR_TOP_RANGE too. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
419 #define VERTICAL_SCROLL_BAR_INSIDE_HEIGHT(height) \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
420 ((height) - VERTICAL_SCROLL_BAR_TOP_BORDER - VERTICAL_SCROLL_BAR_BOTTOM_BORDER)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
421
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
422
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
423 /* Border widths for scroll bars.
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
424
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
425 Scroll bar windows don't have any borders; their border width is
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
426 set to zero, and we redraw borders ourselves. This makes the code
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
427 a bit cleaner, since we don't have to convert between outside width
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
428 (used when relating to the rest of the screen) and inside width
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
429 (used when sizing and drawing the scroll bar window itself).
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
430
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
431 The handle moves up and down/back and forth in a rectangle inset
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
432 from the edges of the scroll bar. These are widths by which we
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
433 inset the handle boundaries from the scroll bar edges. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
434 #define VERTICAL_SCROLL_BAR_LEFT_BORDER (0)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
435 #define VERTICAL_SCROLL_BAR_RIGHT_BORDER (0)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
436 #define VERTICAL_SCROLL_BAR_TOP_BORDER (0)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
437 #define VERTICAL_SCROLL_BAR_BOTTOM_BORDER (0)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
438
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
439 /* Minimum lengths for scroll bar handles, in pixels. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
440 #define VERTICAL_SCROLL_BAR_MIN_HANDLE (0)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
441
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
442
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
443 /* Manipulating pixel sizes and character sizes.
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
444 Knowledge of which factors affect the overall size of the window should
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
445 be hidden in these macros, if that's possible.
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
446
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
447 Return the upper/left pixel position of the character cell on frame F
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
448 at ROW/COL. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
449 #define CHAR_TO_PIXEL_ROW(f, row) \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
450 ((f)->output_data.win32->internal_border_width \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
451 + (row) * (f)->output_data.win32->line_height)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
452 #define CHAR_TO_PIXEL_COL(f, col) \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
453 ((f)->output_data.win32->internal_border_width \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
454 + (col) * FONT_WIDTH ((f)->output_data.win32->font))
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
455
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
456 /* Return the pixel width/height of frame F if it has
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
457 WIDTH columns/HEIGHT rows. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
458 #define CHAR_TO_PIXEL_WIDTH(f, width) \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
459 (CHAR_TO_PIXEL_COL (f, width) \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
460 + (f)->output_data.win32->vertical_scroll_bar_extra \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
461 + (f)->output_data.win32->internal_border_width)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
462 #define CHAR_TO_PIXEL_HEIGHT(f, height) \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
463 (CHAR_TO_PIXEL_ROW (f, height) \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
464 + (f)->output_data.win32->internal_border_width)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
465
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
466
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
467 /* Return the row/column (zero-based) of the character cell containing
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
468 the pixel on FRAME at ROW/COL. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
469 #define PIXEL_TO_CHAR_ROW(f, row) \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
470 (((row) - (f)->output_data.win32->internal_border_width) \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
471 / (f)->output_data.win32->line_height)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
472 #define PIXEL_TO_CHAR_COL(f, col) \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
473 (((col) - (f)->output_data.win32->internal_border_width) \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
474 / FONT_WIDTH ((f)->output_data.win32->font))
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
475
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
476 /* How many columns/rows of text can we fit in WIDTH/HEIGHT pixels on
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
477 frame F? */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
478 #define PIXEL_TO_CHAR_WIDTH(f, width) \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
479 (PIXEL_TO_CHAR_COL (f, ((width) \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
480 - (f)->output_data.win32->internal_border_width \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
481 - (f)->output_data.win32->vertical_scroll_bar_extra)))
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
482 #define PIXEL_TO_CHAR_HEIGHT(f, height) \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
483 (PIXEL_TO_CHAR_ROW (f, ((height) \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
484 - (f)->output_data.win32->internal_border_width)))
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
485
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
486 /* Interface to the face code functions. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
487
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
488 /* Create the first two computed faces for a frame -- the ones that
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
489 have GC's. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
490 extern void init_frame_faces (/* FRAME_PTR */);
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
491
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
492 /* Free the resources for the faces associated with a frame. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
493 extern void free_frame_faces (/* FRAME_PTR */);
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
494
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
495 /* Given a computed face, find or make an equivalent display face
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
496 in face_vector, and return a pointer to it. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
497 extern struct face *intern_face (/* FRAME_PTR, struct face * */);
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
498
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
499 /* Given a frame and a face name, return the face's ID number, or
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
500 zero if it isn't a recognized face name. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
501 extern int face_name_id_number (/* FRAME_PTR, Lisp_Object */);
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
502
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
503 /* Return non-zero if FONT1 and FONT2 have the same size bounding box.
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
504 We assume that they're both character-cell fonts. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
505 extern int same_size_fonts (/* XFontStruct *, XFontStruct * */);
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
506
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
507 /* Recompute the GC's for the default and modeline faces.
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
508 We call this after changing frame parameters on which those GC's
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
509 depend. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
510 extern void recompute_basic_faces (/* FRAME_PTR */);
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
511
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
512 /* Return the face ID associated with a buffer position POS. Store
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
513 into *ENDPTR the next position at which a different face is
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
514 needed. This does not take account of glyphs that specify their
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
515 own face codes. F is the frame in use for display, and W is a
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
516 window displaying the current buffer.
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
517
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
518 REGION_BEG, REGION_END delimit the region, so it can be highlighted. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
519 extern int compute_char_face (/* FRAME_PTR frame,
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
520 struct window *w,
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
521 int pos,
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
522 int region_beg, int region_end,
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
523 int *endptr */);
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
524 /* Return the face ID to use to display a special glyph which selects
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
525 FACE_CODE as the face ID, assuming that ordinarily the face would
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
526 be BASIC_FACE. F is the frame. */
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
527 extern int compute_glyph_face (/* FRAME_PTR, int */);
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
528
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
529 extern void win32_fill_rect ();
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
530 extern void win32_clear_window ();
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
531
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
532 #define win32_fill_area(f,hdc,pix,x,y,nx,ny) \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
533 { \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
534 RECT rect; \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
535 rect.left = x; \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
536 rect.top = y; \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
537 rect.right = x + nx; \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
538 rect.bottom = y + ny; \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
539 win32_fill_rect (f,hdc,pix,&rect); \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
540 }
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
541
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
542 #define win32_clear_rect(f,hdc,lprect) \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
543 win32_fill_rect (f,hdc,f->output_data.win32->background_pixel,lprect)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
544
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
545 #define win32_clear_area(f,hdc,x,y,nx,ny) \
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
546 win32_fill_area (f,hdc,f->output_data.win32->background_pixel,x,y,nx,ny)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
547
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
548 extern XFontStruct *win32_load_font ();
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
549 extern void win32_unload_font ();
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
550
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14240
diff changeset
551 extern HDC map_mode();
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14240
diff changeset
552
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14240
diff changeset
553 #define my_get_dc(hwnd) (map_mode (GetDC (hwnd)))
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14240
diff changeset
554
13543
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
555 #define WM_EMACS_START (WM_USER + 1)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
556 #define WM_EMACS_KILL (WM_EMACS_START + 0x00)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
557 #define WM_EMACS_CREATEWINDOW (WM_EMACS_START + 0x01)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
558 #define WM_EMACS_DONE (WM_EMACS_START + 0x02)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
559 #define WM_EMACS_CREATESCROLLBAR (WM_EMACS_START + 0x03)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
560 #define WM_EMACS_DESTROYWINDOW (WM_EMACS_START + 0x04)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
561 #define WM_EMACS_END (WM_EMACS_START + 0x10)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
562
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
563 #define WND_X_UNITS_INDEX (0)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
564 #define WND_Y_UNITS_INDEX (4)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
565 #define WND_BACKGROUND_INDEX (8)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
566
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
567 #define WND_LAST_INDEX (16)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
568 #define WND_EXTRA_BYTES (WND_LAST_INDEX)
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
569
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
570 extern DWORD dwWinThreadId;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
571 extern HANDLE hWinThread;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
572 extern DWORD dwMainThreadId;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
573 extern HANDLE hMainThread;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
574
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
575 typedef struct Win32Msg {
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
576 MSG msg;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
577 DWORD dwModifiers;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
578 RECT rect;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
579 } Win32Msg;
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
580
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
581 extern void init_crit ();
14353
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14240
diff changeset
582 extern void enter_crit ();
d0d8d9d73f7f backout 1.3
Geoff Voelker <voelker@cs.washington.edu>
parents: 14240
diff changeset
583 extern void leave_crit ();
13543
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
584 extern void delete_crit ();
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
585
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
586 extern BOOL get_next_msg ();
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
587 extern BOOL post_msg ();
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
588 extern void wait_for_sync ();
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
589
23c68d2e061f Initial revision
Geoff Voelker <voelker@cs.washington.edu>
parents:
diff changeset
590 extern BOOL parse_button ();
14809
fb9e2125fc2e (VK_NUMPAD_*, VK_LWIN, VK_RWIN, VK_APPS):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14521
diff changeset
591
fb9e2125fc2e (VK_NUMPAD_*, VK_LWIN, VK_RWIN, VK_APPS):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14521
diff changeset
592 /* Keypad command key support. Win32 doesn't have virtual keys defined
fb9e2125fc2e (VK_NUMPAD_*, VK_LWIN, VK_RWIN, VK_APPS):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14521
diff changeset
593 for the function keys on the keypad (they are mapped to the standard
fb9e2125fc2e (VK_NUMPAD_*, VK_LWIN, VK_RWIN, VK_APPS):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14521
diff changeset
594 fuction keys), so we define our own. */
fb9e2125fc2e (VK_NUMPAD_*, VK_LWIN, VK_RWIN, VK_APPS):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14521
diff changeset
595 #define VK_NUMPAD_BEGIN 0x92
fb9e2125fc2e (VK_NUMPAD_*, VK_LWIN, VK_RWIN, VK_APPS):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14521
diff changeset
596 #define VK_NUMPAD_CLEAR (VK_NUMPAD_BEGIN + 0)
fb9e2125fc2e (VK_NUMPAD_*, VK_LWIN, VK_RWIN, VK_APPS):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14521
diff changeset
597 #define VK_NUMPAD_ENTER (VK_NUMPAD_BEGIN + 1)
fb9e2125fc2e (VK_NUMPAD_*, VK_LWIN, VK_RWIN, VK_APPS):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14521
diff changeset
598 #define VK_NUMPAD_PRIOR (VK_NUMPAD_BEGIN + 2)
fb9e2125fc2e (VK_NUMPAD_*, VK_LWIN, VK_RWIN, VK_APPS):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14521
diff changeset
599 #define VK_NUMPAD_NEXT (VK_NUMPAD_BEGIN + 3)
fb9e2125fc2e (VK_NUMPAD_*, VK_LWIN, VK_RWIN, VK_APPS):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14521
diff changeset
600 #define VK_NUMPAD_END (VK_NUMPAD_BEGIN + 4)
fb9e2125fc2e (VK_NUMPAD_*, VK_LWIN, VK_RWIN, VK_APPS):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14521
diff changeset
601 #define VK_NUMPAD_HOME (VK_NUMPAD_BEGIN + 5)
fb9e2125fc2e (VK_NUMPAD_*, VK_LWIN, VK_RWIN, VK_APPS):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14521
diff changeset
602 #define VK_NUMPAD_LEFT (VK_NUMPAD_BEGIN + 6)
fb9e2125fc2e (VK_NUMPAD_*, VK_LWIN, VK_RWIN, VK_APPS):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14521
diff changeset
603 #define VK_NUMPAD_UP (VK_NUMPAD_BEGIN + 7)
fb9e2125fc2e (VK_NUMPAD_*, VK_LWIN, VK_RWIN, VK_APPS):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14521
diff changeset
604 #define VK_NUMPAD_RIGHT (VK_NUMPAD_BEGIN + 8)
fb9e2125fc2e (VK_NUMPAD_*, VK_LWIN, VK_RWIN, VK_APPS):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14521
diff changeset
605 #define VK_NUMPAD_DOWN (VK_NUMPAD_BEGIN + 9)
fb9e2125fc2e (VK_NUMPAD_*, VK_LWIN, VK_RWIN, VK_APPS):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14521
diff changeset
606 #define VK_NUMPAD_INSERT (VK_NUMPAD_BEGIN + 10)
fb9e2125fc2e (VK_NUMPAD_*, VK_LWIN, VK_RWIN, VK_APPS):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14521
diff changeset
607 #define VK_NUMPAD_DELETE (VK_NUMPAD_BEGIN + 11)
fb9e2125fc2e (VK_NUMPAD_*, VK_LWIN, VK_RWIN, VK_APPS):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14521
diff changeset
608
fb9e2125fc2e (VK_NUMPAD_*, VK_LWIN, VK_RWIN, VK_APPS):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14521
diff changeset
609 #ifndef VK_LWIN
fb9e2125fc2e (VK_NUMPAD_*, VK_LWIN, VK_RWIN, VK_APPS):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14521
diff changeset
610 /* Older compiler environments don't have these defined. */
fb9e2125fc2e (VK_NUMPAD_*, VK_LWIN, VK_RWIN, VK_APPS):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14521
diff changeset
611 #define VK_LWIN 0x5B
fb9e2125fc2e (VK_NUMPAD_*, VK_LWIN, VK_RWIN, VK_APPS):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14521
diff changeset
612 #define VK_RWIN 0x5C
fb9e2125fc2e (VK_NUMPAD_*, VK_LWIN, VK_RWIN, VK_APPS):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14521
diff changeset
613 #define VK_APPS 0x5D
fb9e2125fc2e (VK_NUMPAD_*, VK_LWIN, VK_RWIN, VK_APPS):
Geoff Voelker <voelker@cs.washington.edu>
parents: 14521
diff changeset
614 #endif