diff options
| author | Jason Rumney | 2000-01-23 03:24:54 +0000 |
|---|---|---|
| committer | Jason Rumney | 2000-01-23 03:24:54 +0000 |
| commit | 51dcffad6d79a027396b016e186554b97f51409d (patch) | |
| tree | f534b7cd6754115ee5a97658adbf53bbda612073 | |
| parent | 791f420fea18d7ef5ddfc386509de2c84d4f39c3 (diff) | |
| download | emacs-51dcffad6d79a027396b016e186554b97f51409d.tar.gz emacs-51dcffad6d79a027396b016e186554b97f51409d.zip | |
(XCharStruct): New struct for emulating X.
| -rw-r--r-- | src/w32term.h | 311 |
1 files changed, 205 insertions, 106 deletions
diff --git a/src/w32term.h b/src/w32term.h index f762bd3afcc..71804a9b61a 100644 --- a/src/w32term.h +++ b/src/w32term.h | |||
| @@ -20,7 +20,7 @@ Boston, MA 02111-1307, USA. */ | |||
| 20 | 20 | ||
| 21 | /* Added by Kevin Gallo */ | 21 | /* Added by Kevin Gallo */ |
| 22 | 22 | ||
| 23 | #include <w32gui.h> | 23 | #include "w32gui.h" |
| 24 | 24 | ||
| 25 | /* The class of this X application. */ | 25 | /* The class of this X application. */ |
| 26 | #define EMACS_CLASS "Emacs" | 26 | #define EMACS_CLASS "Emacs" |
| @@ -32,15 +32,16 @@ Boston, MA 02111-1307, USA. */ | |||
| 32 | ((f)->bdf ? (f)->bdf->width : (f)->tm.tmAveCharWidth) | 32 | ((f)->bdf ? (f)->bdf->width : (f)->tm.tmAveCharWidth) |
| 33 | #define FONT_HEIGHT(f) \ | 33 | #define FONT_HEIGHT(f) \ |
| 34 | ((f)->bdf ? (f)->bdf->height : (f)->tm.tmHeight) | 34 | ((f)->bdf ? (f)->bdf->height : (f)->tm.tmHeight) |
| 35 | /* No idea why 5 seems to work in here, but it does */ | ||
| 36 | #define FONT_BASE(f) \ | 35 | #define FONT_BASE(f) \ |
| 37 | ((f)->bdf ? (f)->bdf->ury : (f)->tm.tmAscent) | 36 | ((f)->bdf ? (f)->bdf->ury : (f)->tm.tmAscent) |
| 37 | #define FONT_DESCENT(f) \ | ||
| 38 | ((f)->bdf ? (f)->bdf->lly : (f)->tm.tmDescent) | ||
| 38 | #define FONT_MAX_WIDTH(f) \ | 39 | #define FONT_MAX_WIDTH(f) \ |
| 39 | ((f)->bdf ? (f)->bdf->width : (f)->tm.tmMaxCharWidth) | 40 | ((f)->bdf ? (f)->bdf->width : (f)->tm.tmMaxCharWidth) |
| 40 | 41 | ||
| 41 | #define CHECK_W32_FRAME(f, frame) \ | 42 | #define CHECK_W32_FRAME(f, frame) \ |
| 42 | if (NILP (frame)) \ | 43 | if (NILP (frame)) \ |
| 43 | f = selected_frame; \ | 44 | f = SELECTED_FRAME (); \ |
| 44 | else \ | 45 | else \ |
| 45 | { \ | 46 | { \ |
| 46 | CHECK_LIVE_FRAME (frame, 0); \ | 47 | CHECK_LIVE_FRAME (frame, 0); \ |
| @@ -48,6 +49,17 @@ Boston, MA 02111-1307, USA. */ | |||
| 48 | } \ | 49 | } \ |
| 49 | if (! FRAME_W32_P (f)) | 50 | if (! FRAME_W32_P (f)) |
| 50 | 51 | ||
| 52 | /* Emulate XCharStruct. */ | ||
| 53 | typedef struct _XCharStruct | ||
| 54 | { | ||
| 55 | int rbearing; | ||
| 56 | int lbearing; | ||
| 57 | int width; | ||
| 58 | int ascent; | ||
| 59 | int descent; | ||
| 60 | } XCharStruct; | ||
| 61 | |||
| 62 | |||
| 51 | /* Indicates whether we are in the readsocket call and the message we | 63 | /* Indicates whether we are in the readsocket call and the message we |
| 52 | are processing in the current loop */ | 64 | are processing in the current loop */ |
| 53 | 65 | ||
| @@ -57,7 +69,10 @@ extern BOOL bUseDflt; | |||
| 57 | extern struct frame *x_window_to_frame (); | 69 | extern struct frame *x_window_to_frame (); |
| 58 | 70 | ||
| 59 | enum text_cursor_kinds { | 71 | enum text_cursor_kinds { |
| 60 | filled_box_cursor, hollow_box_cursor, bar_cursor | 72 | NO_CURSOR = -1, |
| 73 | FILLED_BOX_CURSOR, | ||
| 74 | HOLLOW_BOX_CURSOR, | ||
| 75 | BAR_CURSOR | ||
| 61 | }; | 76 | }; |
| 62 | 77 | ||
| 63 | /* Structure recording bitmaps and reference count. | 78 | /* Structure recording bitmaps and reference count. |
| @@ -97,22 +112,37 @@ struct w32_display_info | |||
| 97 | { | 112 | { |
| 98 | /* Chain of all w32_display_info structures. */ | 113 | /* Chain of all w32_display_info structures. */ |
| 99 | struct w32_display_info *next; | 114 | struct w32_display_info *next; |
| 115 | |||
| 100 | /* This is a cons cell of the form (NAME . FONT-LIST-CACHE). | 116 | /* This is a cons cell of the form (NAME . FONT-LIST-CACHE). |
| 101 | The same cons cell also appears in x_display_name_list. */ | 117 | The same cons cell also appears in x_display_name_list. */ |
| 102 | Lisp_Object name_list_element; | 118 | Lisp_Object name_list_element; |
| 119 | |||
| 103 | /* Number of frames that are on this display. */ | 120 | /* Number of frames that are on this display. */ |
| 104 | int reference_count; | 121 | int reference_count; |
| 122 | |||
| 123 | /* Dots per inch of the screen. */ | ||
| 124 | double resx, resy; | ||
| 125 | |||
| 105 | /* Number of planes on this screen. */ | 126 | /* Number of planes on this screen. */ |
| 106 | int n_planes; | 127 | int n_planes; |
| 128 | |||
| 107 | /* Number of bits per pixel on this screen. */ | 129 | /* Number of bits per pixel on this screen. */ |
| 108 | int n_cbits; | 130 | int n_cbits; |
| 131 | |||
| 109 | /* Dimensions of this screen. */ | 132 | /* Dimensions of this screen. */ |
| 110 | int height, width; | 133 | int height, width; |
| 111 | int height_in,width_in; | 134 | int height_in,width_in; |
| 135 | |||
| 112 | /* Mask of things that cause the mouse to be grabbed. */ | 136 | /* Mask of things that cause the mouse to be grabbed. */ |
| 113 | int grabbed; | 137 | int grabbed; |
| 138 | |||
| 139 | /* Emacs bitmap-id of the default icon bitmap for this frame. | ||
| 140 | Or -1 if none has been allocated yet. */ | ||
| 141 | int icon_bitmap_id; | ||
| 142 | |||
| 114 | /* The root window of this screen. */ | 143 | /* The root window of this screen. */ |
| 115 | Window root_window; | 144 | Window root_window; |
| 145 | |||
| 116 | /* The cursor to use for vertical scroll bars. */ | 146 | /* The cursor to use for vertical scroll bars. */ |
| 117 | Cursor vertical_scroll_bar_cursor; | 147 | Cursor vertical_scroll_bar_cursor; |
| 118 | 148 | ||
| @@ -135,12 +165,24 @@ struct w32_display_info | |||
| 135 | /* The current capacity of font_table. */ | 165 | /* The current capacity of font_table. */ |
| 136 | int font_table_size; | 166 | int font_table_size; |
| 137 | 167 | ||
| 138 | /* These variables describe the range of text currently shown | 168 | /* Minimum width over all characters in all fonts in font_table. */ |
| 139 | in its mouse-face, together with the window they apply to. | 169 | int smallest_char_width; |
| 140 | As long as the mouse stays within this range, we need not | 170 | |
| 141 | redraw anything on its account. */ | 171 | /* Minimum font height over all fonts in font_table. */ |
| 172 | int smallest_font_height; | ||
| 173 | |||
| 174 | /* Reusable Graphics Context for drawing a cursor in a non-default face. */ | ||
| 175 | XGCValues *scratch_cursor_gc; | ||
| 176 | |||
| 177 | /* These variables describe the range of text currently shown in its | ||
| 178 | mouse-face, together with the window they apply to. As long as | ||
| 179 | the mouse stays within this range, we need not redraw anything on | ||
| 180 | its account. Rows and columns are glyph matrix positions in | ||
| 181 | MOUSE_FACE_WINDOW. */ | ||
| 142 | int mouse_face_beg_row, mouse_face_beg_col; | 182 | int mouse_face_beg_row, mouse_face_beg_col; |
| 183 | int mouse_face_beg_x, mouse_face_beg_y; | ||
| 143 | int mouse_face_end_row, mouse_face_end_col; | 184 | int mouse_face_end_row, mouse_face_end_col; |
| 185 | int mouse_face_end_x, mouse_face_end_y; | ||
| 144 | int mouse_face_past_end; | 186 | int mouse_face_past_end; |
| 145 | Lisp_Object mouse_face_window; | 187 | Lisp_Object mouse_face_window; |
| 146 | int mouse_face_face_id; | 188 | int mouse_face_face_id; |
| @@ -157,11 +199,13 @@ struct w32_display_info | |||
| 157 | /* Nonzero means defer mouse-motion highlighting. */ | 199 | /* Nonzero means defer mouse-motion highlighting. */ |
| 158 | int mouse_face_defer; | 200 | int mouse_face_defer; |
| 159 | 201 | ||
| 202 | int mouse_face_image_state; | ||
| 203 | |||
| 160 | char *w32_id_name; | 204 | char *w32_id_name; |
| 161 | 205 | ||
| 162 | /* The number of fonts actually stored in w32_font_table. | 206 | /* The number of fonts actually stored in w32_font_table. |
| 163 | font_table[n] is used and valid iff 0 <= n < n_fonts. | 207 | font_table[n] is used and valid iff 0 <= n < n_fonts. 0 <= |
| 164 | 0 <= n_fonts <= font_table_size. */ | 208 | n_fonts <= font_table_size. and font_table[i].name != 0. */ |
| 165 | int n_fonts; | 209 | int n_fonts; |
| 166 | 210 | ||
| 167 | /* Pointer to bitmap records. */ | 211 | /* Pointer to bitmap records. */ |
| @@ -192,6 +236,9 @@ struct w32_display_info | |||
| 192 | frame. It differs from w32_focus_frame when we're using a global | 236 | frame. It differs from w32_focus_frame when we're using a global |
| 193 | minibuffer. */ | 237 | minibuffer. */ |
| 194 | struct frame *w32_highlight_frame; | 238 | struct frame *w32_highlight_frame; |
| 239 | |||
| 240 | /* Cache of images. */ | ||
| 241 | struct image_cache *image_cache; | ||
| 195 | }; | 242 | }; |
| 196 | 243 | ||
| 197 | /* This is a chain of structures for all the displays currently in use. */ | 244 | /* This is a chain of structures for all the displays currently in use. */ |
| @@ -209,21 +256,37 @@ extern Lisp_Object Vx_pixel_size_width_font_regexp; | |||
| 209 | /* A flag to control how to display unibyte 8-bit character. */ | 256 | /* A flag to control how to display unibyte 8-bit character. */ |
| 210 | extern int unibyte_display_via_language_environment; | 257 | extern int unibyte_display_via_language_environment; |
| 211 | 258 | ||
| 212 | extern struct w32_display_info *x_display_info_for_display (); | 259 | /* NTEMACS_TODO: This does not seem to be defined. Check and remove. */ |
| 213 | extern struct w32_display_info *x_display_info_for_name (); | 260 | struct w32_display_info *x_display_info_for_display (); |
| 261 | struct w32_display_info *x_display_info_for_name (); | ||
| 214 | 262 | ||
| 215 | extern struct w32_display_info *w32_term_init (); | 263 | extern struct w32_display_info *w32_term_init (); |
| 216 | 264 | ||
| 217 | extern Lisp_Object w32_list_fonts (); | 265 | extern Lisp_Object w32_list_fonts P_ ((struct frame *, Lisp_Object, int, int)); |
| 218 | extern struct font_info *w32_get_font_info (), *w32_query_font (); | 266 | extern struct font_info *w32_get_font_info (), *w32_query_font (); |
| 219 | extern void w32_find_ccl_program(); | 267 | extern void w32_find_ccl_program(); |
| 220 | 268 | ||
| 269 | #define PIX_TYPE COLORREF | ||
| 270 | |||
| 221 | /* Each W32 frame object points to its own struct w32_display object | 271 | /* Each W32 frame object points to its own struct w32_display object |
| 222 | in the output_data.w32 field. The w32_display structure contains all | 272 | in the output_data.w32 field. The w32_display structure contains all |
| 223 | the information that is specific to W32 windows. */ | 273 | the information that is specific to W32 windows. */ |
| 224 | 274 | ||
| 275 | /* Put some things in x_output for compatibility. | ||
| 276 | NTEMACS_TODO: Move all common things here to eliminate unneccesary | ||
| 277 | diffs between X and w32 code. */ | ||
| 278 | struct x_output | ||
| 279 | { | ||
| 280 | PIX_TYPE background_pixel; | ||
| 281 | PIX_TYPE foreground_pixel; | ||
| 282 | }; | ||
| 283 | |||
| 284 | |||
| 225 | struct w32_output | 285 | struct w32_output |
| 226 | { | 286 | { |
| 287 | /* Placeholder for things accessed through output_data.x. */ | ||
| 288 | struct x_output x_compatibile; | ||
| 289 | |||
| 227 | /* Menubar "widget" handle. */ | 290 | /* Menubar "widget" handle. */ |
| 228 | HMENU menubar_widget; | 291 | HMENU menubar_widget; |
| 229 | 292 | ||
| @@ -243,6 +306,9 @@ struct w32_output | |||
| 243 | /* Height of a line, in pixels. */ | 306 | /* Height of a line, in pixels. */ |
| 244 | int line_height; | 307 | int line_height; |
| 245 | 308 | ||
| 309 | /* Here are the Graphics Contexts for the default font. */ | ||
| 310 | XGCValues *cursor_gc; /* cursor drawing */ | ||
| 311 | |||
| 246 | /* Width of the internal border. This is a line of background color | 312 | /* Width of the internal border. This is a line of background color |
| 247 | just inside the window's border. When the frame is selected, | 313 | just inside the window's border. When the frame is selected, |
| 248 | a highlighting is displayed inside the internal border. */ | 314 | a highlighting is displayed inside the internal border. */ |
| @@ -262,8 +328,8 @@ struct w32_output | |||
| 262 | /* Default ASCII font of this frame. */ | 328 | /* Default ASCII font of this frame. */ |
| 263 | XFontStruct *font; | 329 | XFontStruct *font; |
| 264 | 330 | ||
| 265 | /* The baseline position of the default ASCII font. */ | 331 | /* The baseline offset of the default ASCII font. */ |
| 266 | int font_baseline; | 332 | int baseline_offset; |
| 267 | 333 | ||
| 268 | /* If a fontset is specified for this frame instead of font, this | 334 | /* If a fontset is specified for this frame instead of font, this |
| 269 | value contains an ID of the fontset, else -1. */ | 335 | value contains an ID of the fontset, else -1. */ |
| @@ -271,18 +337,33 @@ struct w32_output | |||
| 271 | 337 | ||
| 272 | /* Pixel values used for various purposes. | 338 | /* Pixel values used for various purposes. |
| 273 | border_pixel may be -1 meaning use a gray tile. */ | 339 | border_pixel may be -1 meaning use a gray tile. */ |
| 274 | unsigned long background_pixel; | 340 | COLORREF cursor_pixel; |
| 275 | unsigned long foreground_pixel; | 341 | COLORREF border_pixel; |
| 276 | unsigned long cursor_pixel; | 342 | COLORREF mouse_pixel; |
| 277 | unsigned long border_pixel; | 343 | COLORREF cursor_foreground_pixel; |
| 278 | unsigned long mouse_pixel; | 344 | |
| 279 | unsigned long cursor_foreground_pixel; | 345 | /* Foreground color for scroll bars. A value of -1 means use the |
| 346 | default (black for non-toolkit scroll bars). */ | ||
| 347 | COLORREF scroll_bar_foreground_pixel; | ||
| 348 | |||
| 349 | /* Background color for scroll bars. A value of -1 means use the | ||
| 350 | default (background color of the frame for non-toolkit scroll | ||
| 351 | bars). */ | ||
| 352 | COLORREF scroll_bar_background_pixel; | ||
| 280 | 353 | ||
| 281 | /* Descriptor for the cursor in use for this window. */ | 354 | /* Descriptor for the cursor in use for this window. */ |
| 282 | Cursor text_cursor; | 355 | Cursor text_cursor; |
| 283 | Cursor nontext_cursor; | 356 | Cursor nontext_cursor; |
| 284 | Cursor modeline_cursor; | 357 | Cursor modeline_cursor; |
| 285 | Cursor cross_cursor; | 358 | Cursor cross_cursor; |
| 359 | Cursor busy_cursor; | ||
| 360 | |||
| 361 | /* Window whose cursor is busy_cursor. This window is temporarily | ||
| 362 | mapped to display a busy-cursor. */ | ||
| 363 | Window busy_window; | ||
| 364 | |||
| 365 | /* Non-zero means busy cursor is currently displayed. */ | ||
| 366 | unsigned busy_p : 1; | ||
| 286 | 367 | ||
| 287 | /* Flag to set when the window needs to be completely repainted. */ | 368 | /* Flag to set when the window needs to be completely repainted. */ |
| 288 | int needs_exposure; | 369 | int needs_exposure; |
| @@ -304,20 +385,10 @@ struct w32_output | |||
| 304 | scroll bars, in pixels. */ | 385 | scroll bars, in pixels. */ |
| 305 | int vertical_scroll_bar_extra; | 386 | int vertical_scroll_bar_extra; |
| 306 | 387 | ||
| 307 | /* Table of parameter faces for this frame. Any resources (pixel | 388 | /* The extra width currently allotted for the areas in which |
| 308 | values, fonts) referred to here have been allocated explicitly | 389 | truncation marks, continuation marks, and overlay arrows are |
| 309 | for this face, and should be freed if we change the face. */ | 390 | displayed. */ |
| 310 | struct face **param_faces; | 391 | int flags_areas_extra; |
| 311 | int n_param_faces; | ||
| 312 | |||
| 313 | /* Table of computed faces for this frame. These are the faces | ||
| 314 | whose indexes go into the upper bits of a glyph, computed by | ||
| 315 | combining the parameter faces specified by overlays, text | ||
| 316 | properties, and what have you. The resources mentioned here | ||
| 317 | are all shared with parameter faces. */ | ||
| 318 | struct face **computed_faces; | ||
| 319 | int n_computed_faces; /* How many are valid */ | ||
| 320 | int size_computed_faces; /* How many are allocated */ | ||
| 321 | 392 | ||
| 322 | /* This is the gravity value for the specified window position. */ | 393 | /* This is the gravity value for the specified window position. */ |
| 323 | int win_gravity; | 394 | int win_gravity; |
| @@ -341,34 +412,40 @@ struct w32_output | |||
| 341 | /* Nonzero means menubar is about to become active, but should be | 412 | /* Nonzero means menubar is about to become active, but should be |
| 342 | brought up to date first. */ | 413 | brought up to date first. */ |
| 343 | volatile char pending_menu_activation; | 414 | volatile char pending_menu_activation; |
| 415 | |||
| 416 | /* Relief GCs, colors etc. */ | ||
| 417 | struct relief | ||
| 418 | { | ||
| 419 | XGCValues *gc; | ||
| 420 | unsigned long pixel; | ||
| 421 | int allocated_p; | ||
| 422 | } | ||
| 423 | black_relief, white_relief; | ||
| 424 | |||
| 425 | /* The background for which the above relief GCs were set up. | ||
| 426 | They are changed only when a different background is involved. */ | ||
| 427 | unsigned long relief_background; | ||
| 344 | }; | 428 | }; |
| 345 | 429 | ||
| 346 | /* A (mostly empty) structure describing a w32 terminal frame display. */ | ||
| 347 | extern struct w32_output w32term_display; | 430 | extern struct w32_output w32term_display; |
| 348 | 431 | ||
| 349 | /* Get at the computed faces of an X window frame. */ | ||
| 350 | #define FRAME_PARAM_FACES(f) ((f)->output_data.w32->param_faces) | ||
| 351 | #define FRAME_N_PARAM_FACES(f) ((f)->output_data.w32->n_param_faces) | ||
| 352 | #define FRAME_DEFAULT_PARAM_FACE(f) (FRAME_PARAM_FACES (f)[0]) | ||
| 353 | #define FRAME_MODE_LINE_PARAM_FACE(f) (FRAME_PARAM_FACES (f)[1]) | ||
| 354 | |||
| 355 | #define FRAME_COMPUTED_FACES(f) ((f)->output_data.w32->computed_faces) | ||
| 356 | #define FRAME_N_COMPUTED_FACES(f) ((f)->output_data.w32->n_computed_faces) | ||
| 357 | #define FRAME_SIZE_COMPUTED_FACES(f) ((f)->output_data.w32->size_computed_faces) | ||
| 358 | #define FRAME_DEFAULT_FACE(f) ((f)->output_data.w32->computed_faces[0]) | ||
| 359 | #define FRAME_MODE_LINE_FACE(f) ((f)->output_data.w32->computed_faces[1]) | ||
| 360 | |||
| 361 | /* Return the window associated with the frame F. */ | 432 | /* Return the window associated with the frame F. */ |
| 362 | #define FRAME_W32_WINDOW(f) ((f)->output_data.w32->window_desc) | 433 | #define FRAME_W32_WINDOW(f) ((f)->output_data.w32->window_desc) |
| 363 | 434 | ||
| 364 | #define FRAME_FOREGROUND_PIXEL(f) ((f)->output_data.w32->foreground_pixel) | 435 | #define FRAME_FOREGROUND_PIXEL(f) ((f)->output_data.x->foreground_pixel) |
| 365 | #define FRAME_BACKGROUND_PIXEL(f) ((f)->output_data.w32->background_pixel) | 436 | #define FRAME_BACKGROUND_PIXEL(f) ((f)->output_data.x->background_pixel) |
| 366 | #define FRAME_FONT(f) ((f)->output_data.w32->font) | 437 | #define FRAME_FONT(f) ((f)->output_data.w32->font) |
| 367 | #define FRAME_FONTSET(f) ((f)->output_data.w32->fontset) | 438 | #define FRAME_FONTSET(f) ((f)->output_data.w32->fontset) |
| 368 | #define FRAME_INTERNAL_BORDER_WIDTH(f) ((f)->output_data.w32->internal_border_width) | 439 | #define FRAME_INTERNAL_BORDER_WIDTH(f) ((f)->output_data.w32->internal_border_width) |
| 440 | #define FRAME_LINE_HEIGHT(f) ((f)->output_data.w32->line_height) | ||
| 441 | /* Width of the default font of frame F. Must be defined by each | ||
| 442 | terminal specific header. */ | ||
| 443 | #define FRAME_DEFAULT_FONT_WIDTH(F) FONT_WIDTH (FRAME_FONT (F)) | ||
| 444 | #define FRAME_BASELINE_OFFSET(f) ((f)->output_data.w32->baseline_offset) | ||
| 369 | 445 | ||
| 370 | /* This gives the w32_display_info structure for the display F is on. */ | 446 | /* This gives the w32_display_info structure for the display F is on. */ |
| 371 | #define FRAME_W32_DISPLAY_INFO(f) (&one_w32_display_info) | 447 | #define FRAME_W32_DISPLAY_INFO(f) (&one_w32_display_info) |
| 448 | #define FRAME_X_DISPLAY_INFO(f) (&one_w32_display_info) | ||
| 372 | 449 | ||
| 373 | /* This is the 'font_info *' which frame F has. */ | 450 | /* This is the 'font_info *' which frame F has. */ |
| 374 | #define FRAME_W32_FONT_TABLE(f) (FRAME_W32_DISPLAY_INFO (f)->font_table) | 451 | #define FRAME_W32_FONT_TABLE(f) (FRAME_W32_DISPLAY_INFO (f)->font_table) |
| @@ -376,10 +453,58 @@ extern struct w32_output w32term_display; | |||
| 376 | /* These two really ought to be called FRAME_PIXEL_{WIDTH,HEIGHT}. */ | 453 | /* These two really ought to be called FRAME_PIXEL_{WIDTH,HEIGHT}. */ |
| 377 | #define PIXEL_WIDTH(f) ((f)->output_data.w32->pixel_width) | 454 | #define PIXEL_WIDTH(f) ((f)->output_data.w32->pixel_width) |
| 378 | #define PIXEL_HEIGHT(f) ((f)->output_data.w32->pixel_height) | 455 | #define PIXEL_HEIGHT(f) ((f)->output_data.w32->pixel_height) |
| 379 | #define FRAME_LINE_HEIGHT(f) ((f)->output_data.w32->line_height) | ||
| 380 | 456 | ||
| 381 | #define FRAME_DESIRED_CURSOR(f) ((f)->output_data.w32->desired_cursor) | 457 | #define FRAME_DESIRED_CURSOR(f) ((f)->output_data.w32->desired_cursor) |
| 382 | 458 | ||
| 459 | /* Value is the smallest width of any character in any font on frame F. */ | ||
| 460 | |||
| 461 | #define FRAME_SMALLEST_CHAR_WIDTH(F) \ | ||
| 462 | FRAME_W32_DISPLAY_INFO(F)->smallest_char_width | ||
| 463 | |||
| 464 | /* Value is the smallest height of any font on frame F. */ | ||
| 465 | |||
| 466 | #define FRAME_SMALLEST_FONT_HEIGHT(F) \ | ||
| 467 | FRAME_W32_DISPLAY_INFO(F)->smallest_font_height | ||
| 468 | |||
| 469 | /* Return a pointer to the image cache of frame F. */ | ||
| 470 | |||
| 471 | #define FRAME_X_IMAGE_CACHE(F) FRAME_W32_DISPLAY_INFO ((F))->image_cache | ||
| 472 | |||
| 473 | |||
| 474 | /* Pixel width of the bitmaps drawn to indicate truncation, | ||
| 475 | continuation etc. */ | ||
| 476 | |||
| 477 | #define FRAME_FLAGS_BITMAP_WIDTH(f) 8 | ||
| 478 | #define FRAME_FLAGS_BITMAP_HEIGHT(f) 8 | ||
| 479 | |||
| 480 | /* Total width of areas reserved for drawing truncation bitmaps, | ||
| 481 | continuation bitmaps and alike. The width is in canonical char | ||
| 482 | units of the frame. This must currently be the case because window | ||
| 483 | sizes aren't pixel values. If it weren't the case, we wouldn't be | ||
| 484 | able to split windows horizontally nicely. */ | ||
| 485 | |||
| 486 | #define FRAME_X_FLAGS_AREA_COLS(F) \ | ||
| 487 | ((2 * FRAME_FLAGS_BITMAP_WIDTH ((F)) + CANON_X_UNIT ((F)) - 1) \ | ||
| 488 | / CANON_X_UNIT ((F))) | ||
| 489 | |||
| 490 | /* Total width of flags areas in pixels. */ | ||
| 491 | |||
| 492 | #define FRAME_X_FLAGS_AREA_WIDTH(F) \ | ||
| 493 | (FRAME_X_FLAGS_AREA_COLS ((F)) * CANON_X_UNIT ((F))) | ||
| 494 | |||
| 495 | /* Pixel-width of the left flags area. */ | ||
| 496 | |||
| 497 | #define FRAME_X_LEFT_FLAGS_AREA_WIDTH(F) \ | ||
| 498 | (FRAME_X_FLAGS_AREA_WIDTH (F) / 2) | ||
| 499 | |||
| 500 | /* Pixel-width of the right flags area. Note that we are doing | ||
| 501 | integer arithmetic here, so don't loose a pixel if the total | ||
| 502 | width is an odd number. */ | ||
| 503 | |||
| 504 | #define FRAME_X_RIGHT_FLAGS_AREA_WIDTH(F) \ | ||
| 505 | (FRAME_X_FLAGS_AREA_WIDTH (F) - FRAME_X_FLAGS_AREA_WIDTH (F) / 2) | ||
| 506 | |||
| 507 | |||
| 383 | 508 | ||
| 384 | /* W32-specific scroll bar stuff. */ | 509 | /* W32-specific scroll bar stuff. */ |
| 385 | 510 | ||
| @@ -407,6 +532,9 @@ struct scroll_bar { | |||
| 407 | 32-bit quantity, we store it split into two 32-bit values. */ | 532 | 32-bit quantity, we store it split into two 32-bit values. */ |
| 408 | Lisp_Object w32_window_low, w32_window_high; | 533 | Lisp_Object w32_window_low, w32_window_high; |
| 409 | 534 | ||
| 535 | /* Same as above for the widget. */ | ||
| 536 | Lisp_Object w32_widget_low, w32_widget_high; | ||
| 537 | |||
| 410 | /* The position and size of the scroll bar in pixels, relative to the | 538 | /* The position and size of the scroll bar in pixels, relative to the |
| 411 | frame. */ | 539 | frame. */ |
| 412 | Lisp_Object top, left, width, height; | 540 | Lisp_Object top, left, width, height; |
| @@ -458,16 +586,21 @@ struct scroll_bar { | |||
| 458 | #define SET_SCROLL_BAR_W32_WINDOW(ptr, id) \ | 586 | #define SET_SCROLL_BAR_W32_WINDOW(ptr, id) \ |
| 459 | (SCROLL_BAR_UNPACK ((ptr)->w32_window_low, (ptr)->w32_window_high, (int) id)) | 587 | (SCROLL_BAR_UNPACK ((ptr)->w32_window_low, (ptr)->w32_window_high, (int) id)) |
| 460 | 588 | ||
| 589 | /* Extract the X widget of the scroll bar from a struct scroll_bar. */ | ||
| 590 | #define SCROLL_BAR_X_WIDGET(ptr) \ | ||
| 591 | ((Widget) SCROLL_BAR_PACK ((ptr)->x_widget_low, (ptr)->x_widget_high)) | ||
| 461 | 592 | ||
| 462 | /* Return the outside pixel height for a vertical scroll bar HEIGHT | 593 | /* Store a widget id in a struct scroll_bar. */ |
| 463 | rows high on frame F. */ | 594 | #define SET_SCROLL_BAR_X_WIDGET(ptr, w) \ |
| 464 | #define VERTICAL_SCROLL_BAR_PIXEL_HEIGHT(f, height) \ | 595 | (SCROLL_BAR_UNPACK ((ptr)->x_widget_low, (ptr)->x_widget_high, (int) w)) |
| 465 | ((height) * (f)->output_data.w32->line_height) | ||
| 466 | 596 | ||
| 467 | /* Return the inside width of a vertical scroll bar, given the outside | 597 | /* Return the inside width of a vertical scroll bar, given the outside |
| 468 | width. */ | 598 | width. */ |
| 469 | #define VERTICAL_SCROLL_BAR_INSIDE_WIDTH(width) \ | 599 | #define VERTICAL_SCROLL_BAR_INSIDE_WIDTH(f,width) \ |
| 470 | ((width) - VERTICAL_SCROLL_BAR_LEFT_BORDER - VERTICAL_SCROLL_BAR_RIGHT_BORDER) | 600 | ((width) \ |
| 601 | - VERTICAL_SCROLL_BAR_LEFT_BORDER \ | ||
| 602 | - VERTICAL_SCROLL_BAR_RIGHT_BORDER \ | ||
| 603 | - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2) | ||
| 471 | 604 | ||
| 472 | /* Return the length of the rectangle within which the top of the | 605 | /* Return the length of the rectangle within which the top of the |
| 473 | handle must stay. This isn't equivalent to the inside height, | 606 | handle must stay. This isn't equivalent to the inside height, |
| @@ -476,12 +609,12 @@ struct scroll_bar { | |||
| 476 | This is the real range of motion for the scroll bar, so when we're | 609 | This is the real range of motion for the scroll bar, so when we're |
| 477 | scaling buffer positions to scroll bar positions, we use this, not | 610 | scaling buffer positions to scroll bar positions, we use this, not |
| 478 | VERTICAL_SCROLL_BAR_INSIDE_HEIGHT. */ | 611 | VERTICAL_SCROLL_BAR_INSIDE_HEIGHT. */ |
| 479 | #define VERTICAL_SCROLL_BAR_TOP_RANGE(height) \ | 612 | #define VERTICAL_SCROLL_BAR_TOP_RANGE(f,height) \ |
| 480 | (VERTICAL_SCROLL_BAR_INSIDE_HEIGHT (height) - VERTICAL_SCROLL_BAR_MIN_HANDLE) | 613 | (VERTICAL_SCROLL_BAR_INSIDE_HEIGHT (f, height) - VERTICAL_SCROLL_BAR_MIN_HANDLE) |
| 481 | 614 | ||
| 482 | /* Return the inside height of vertical scroll bar, given the outside | 615 | /* Return the inside height of vertical scroll bar, given the outside |
| 483 | height. See VERTICAL_SCROLL_BAR_TOP_RANGE too. */ | 616 | height. See VERTICAL_SCROLL_BAR_TOP_RANGE too. */ |
| 484 | #define VERTICAL_SCROLL_BAR_INSIDE_HEIGHT(height) \ | 617 | #define VERTICAL_SCROLL_BAR_INSIDE_HEIGHT(f,height) \ |
| 485 | ((height) - VERTICAL_SCROLL_BAR_TOP_BORDER - VERTICAL_SCROLL_BAR_BOTTOM_BORDER) | 618 | ((height) - VERTICAL_SCROLL_BAR_TOP_BORDER - VERTICAL_SCROLL_BAR_BOTTOM_BORDER) |
| 486 | 619 | ||
| 487 | 620 | ||
| @@ -504,6 +637,9 @@ struct scroll_bar { | |||
| 504 | /* Minimum lengths for scroll bar handles, in pixels. */ | 637 | /* Minimum lengths for scroll bar handles, in pixels. */ |
| 505 | #define VERTICAL_SCROLL_BAR_MIN_HANDLE (vertical_scroll_bar_min_handle) | 638 | #define VERTICAL_SCROLL_BAR_MIN_HANDLE (vertical_scroll_bar_min_handle) |
| 506 | 639 | ||
| 640 | /* Trimming off a few pixels from each side prevents | ||
| 641 | text from glomming up against the scroll bar */ | ||
| 642 | #define VERTICAL_SCROLL_BAR_WIDTH_TRIM (0) | ||
| 507 | 643 | ||
| 508 | 644 | ||
| 509 | /* Manipulating pixel sizes and character sizes. | 645 | /* Manipulating pixel sizes and character sizes. |
| @@ -524,6 +660,7 @@ struct scroll_bar { | |||
| 524 | #define CHAR_TO_PIXEL_WIDTH(f, width) \ | 660 | #define CHAR_TO_PIXEL_WIDTH(f, width) \ |
| 525 | (CHAR_TO_PIXEL_COL (f, width) \ | 661 | (CHAR_TO_PIXEL_COL (f, width) \ |
| 526 | + (f)->output_data.w32->vertical_scroll_bar_extra \ | 662 | + (f)->output_data.w32->vertical_scroll_bar_extra \ |
| 663 | + (f)->output_data.w32->flags_areas_extra \ | ||
| 527 | + (f)->output_data.w32->internal_border_width) | 664 | + (f)->output_data.w32->internal_border_width) |
| 528 | #define CHAR_TO_PIXEL_HEIGHT(f, height) \ | 665 | #define CHAR_TO_PIXEL_HEIGHT(f, height) \ |
| 529 | (CHAR_TO_PIXEL_ROW (f, height) \ | 666 | (CHAR_TO_PIXEL_ROW (f, height) \ |
| @@ -544,54 +681,13 @@ struct scroll_bar { | |||
| 544 | #define PIXEL_TO_CHAR_WIDTH(f, width) \ | 681 | #define PIXEL_TO_CHAR_WIDTH(f, width) \ |
| 545 | (PIXEL_TO_CHAR_COL (f, ((width) \ | 682 | (PIXEL_TO_CHAR_COL (f, ((width) \ |
| 546 | - (f)->output_data.w32->internal_border_width \ | 683 | - (f)->output_data.w32->internal_border_width \ |
| 684 | - (f)->output_data.w32->flags_areas_extra \ | ||
| 547 | - (f)->output_data.w32->vertical_scroll_bar_extra))) | 685 | - (f)->output_data.w32->vertical_scroll_bar_extra))) |
| 548 | #define PIXEL_TO_CHAR_HEIGHT(f, height) \ | 686 | #define PIXEL_TO_CHAR_HEIGHT(f, height) \ |
| 549 | (PIXEL_TO_CHAR_ROW (f, ((height) \ | 687 | (PIXEL_TO_CHAR_ROW (f, ((height) \ |
| 550 | - (f)->output_data.w32->internal_border_width))) | 688 | - (f)->output_data.w32->internal_border_width))) |
| 551 | |||
| 552 | /* Interface to the face code functions. */ | ||
| 553 | |||
| 554 | /* Create the first two computed faces for a frame -- the ones that | ||
| 555 | have GC's. */ | ||
| 556 | extern void init_frame_faces (/* FRAME_PTR */); | ||
| 557 | |||
| 558 | /* Free the resources for the faces associated with a frame. */ | ||
| 559 | extern void free_frame_faces (/* FRAME_PTR */); | ||
| 560 | |||
| 561 | /* Given a computed face, find or make an equivalent display face | ||
| 562 | in face_vector, and return a pointer to it. */ | ||
| 563 | extern struct face *intern_face (/* FRAME_PTR, struct face * */); | ||
| 564 | |||
| 565 | /* Given a frame and a face name, return the face's ID number, or | ||
| 566 | zero if it isn't a recognized face name. */ | ||
| 567 | extern int face_name_id_number (/* FRAME_PTR, Lisp_Object */); | ||
| 568 | |||
| 569 | /* Return non-zero if FONT1 and FONT2 have the same size bounding box. | ||
| 570 | We assume that they're both character-cell fonts. */ | ||
| 571 | extern int same_size_fonts (/* XFontStruct *, XFontStruct * */); | ||
| 572 | |||
| 573 | /* Recompute the GC's for the default and modeline faces. | ||
| 574 | We call this after changing frame parameters on which those GC's | ||
| 575 | depend. */ | ||
| 576 | extern void recompute_basic_faces (/* FRAME_PTR */); | ||
| 577 | |||
| 578 | /* Return the face ID associated with a buffer position POS. Store | ||
| 579 | into *ENDPTR the next position at which a different face is | ||
| 580 | needed. This does not take account of glyphs that specify their | ||
| 581 | own face codes. F is the frame in use for display, and W is a | ||
| 582 | window displaying the current buffer. | ||
| 583 | |||
| 584 | REGION_BEG, REGION_END delimit the region, so it can be highlighted. */ | ||
| 585 | extern int compute_char_face (/* FRAME_PTR frame, | ||
| 586 | struct window *w, | ||
| 587 | int pos, | ||
| 588 | int region_beg, int region_end, | ||
| 589 | int *endptr */); | ||
| 590 | /* Return the face ID to use to display a special glyph which selects | ||
| 591 | FACE_CODE as the face ID, assuming that ordinarily the face would | ||
| 592 | be BASIC_FACE. F is the frame. */ | ||
| 593 | extern int compute_glyph_face (/* FRAME_PTR, int */); | ||
| 594 | 689 | ||
| 690 | |||
| 595 | extern void w32_fill_rect (); | 691 | extern void w32_fill_rect (); |
| 596 | extern void w32_clear_window (); | 692 | extern void w32_clear_window (); |
| 597 | 693 | ||
| @@ -606,10 +702,10 @@ extern void w32_clear_window (); | |||
| 606 | } | 702 | } |
| 607 | 703 | ||
| 608 | #define w32_clear_rect(f,hdc,lprect) \ | 704 | #define w32_clear_rect(f,hdc,lprect) \ |
| 609 | w32_fill_rect (f,hdc,f->output_data.w32->background_pixel,lprect) | 705 | w32_fill_rect (f,hdc,f->output_data.x->background_pixel,lprect) |
| 610 | 706 | ||
| 611 | #define w32_clear_area(f,hdc,x,y,nx,ny) \ | 707 | #define w32_clear_area(f,hdc,px,py,nx,ny) \ |
| 612 | w32_fill_area (f,hdc,f->output_data.w32->background_pixel,x,y,nx,ny) | 708 | w32_fill_area (f,hdc,f->output_data.x->background_pixel,px,py,nx,ny) |
| 613 | 709 | ||
| 614 | extern struct font_info *w32_load_font (); | 710 | extern struct font_info *w32_load_font (); |
| 615 | extern void w32_unload_font (); | 711 | extern void w32_unload_font (); |
| @@ -725,3 +821,6 @@ extern BOOL parse_button (); | |||
| 725 | #define LEFT_WIN_PRESSED 0x8000 | 821 | #define LEFT_WIN_PRESSED 0x8000 |
| 726 | #define RIGHT_WIN_PRESSED 0x4000 | 822 | #define RIGHT_WIN_PRESSED 0x4000 |
| 727 | #define APPS_PRESSED 0x2000 | 823 | #define APPS_PRESSED 0x2000 |
| 824 | |||
| 825 | XGCValues *XCreateGC (void *, Window, unsigned long, XGCValues *); | ||
| 826 | struct frame * check_x_frame (Lisp_Object); | ||