diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.h | 112 |
1 files changed, 94 insertions, 18 deletions
diff --git a/src/xterm.h b/src/xterm.h index 8098216e3a6..a129e177c86 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -239,8 +239,8 @@ enum text_cursor_kinds { | |||
| 239 | filled_box_cursor, hollow_box_cursor, bar_cursor | 239 | filled_box_cursor, hollow_box_cursor, bar_cursor |
| 240 | }; | 240 | }; |
| 241 | 241 | ||
| 242 | #define PIXEL_WIDTH(s) ((s)->display.x->pixel_width) | 242 | #define PIXEL_WIDTH(f) ((f)->display.x->pixel_width) |
| 243 | #define PIXEL_HEIGHT(s) ((s)->display.x->pixel_height) | 243 | #define PIXEL_HEIGHT(f) ((f)->display.x->pixel_height) |
| 244 | 244 | ||
| 245 | /* Each X frame object points to its own struct x_display object | 245 | /* Each X frame object points to its own struct x_display object |
| 246 | in the display.x field. The x_display structure contains all | 246 | in the display.x field. The x_display structure contains all |
| @@ -299,22 +299,6 @@ struct x_display | |||
| 299 | PIX_TYPE border_pixel; | 299 | PIX_TYPE border_pixel; |
| 300 | PIX_TYPE mouse_pixel; | 300 | PIX_TYPE mouse_pixel; |
| 301 | 301 | ||
| 302 | /* Windows for scrollbars */ | ||
| 303 | Window v_scrollbar; | ||
| 304 | Window v_thumbup; | ||
| 305 | Window v_thumbdown; | ||
| 306 | Window v_slider; | ||
| 307 | |||
| 308 | Window h_scrollbar; | ||
| 309 | Window h_thumbleft; | ||
| 310 | Window h_thumbright; | ||
| 311 | Window h_slider; | ||
| 312 | |||
| 313 | /* Scrollbar info */ | ||
| 314 | |||
| 315 | int v_scrollbar_width; | ||
| 316 | int h_scrollbar_height; | ||
| 317 | |||
| 318 | /* Descriptor for the cursor in use for this window. */ | 302 | /* Descriptor for the cursor in use for this window. */ |
| 319 | #ifdef HAVE_X11 | 303 | #ifdef HAVE_X11 |
| 320 | Cursor text_cursor; | 304 | Cursor text_cursor; |
| @@ -348,6 +332,17 @@ struct x_display | |||
| 348 | structure around, just leaving values in it and adding new bits | 332 | structure around, just leaving values in it and adding new bits |
| 349 | to the mask as we go. */ | 333 | to the mask as we go. */ |
| 350 | XWMHints wm_hints; | 334 | XWMHints wm_hints; |
| 335 | |||
| 336 | /* The list of vertical scrollbars currently being displayed in this | ||
| 337 | frame. */ | ||
| 338 | struct scrollbar *vertical_scrollbars; | ||
| 339 | |||
| 340 | /* The timestamp used to implement the condemn/redeem/judge functions. */ | ||
| 341 | int judge_timestamp; | ||
| 342 | |||
| 343 | /* The size of the extra width currently allotted for vertical | ||
| 344 | scrollbars, in pixels. */ | ||
| 345 | int vertical_scrollbar_extra; | ||
| 351 | }; | 346 | }; |
| 352 | 347 | ||
| 353 | /* Return the window associated with the frame F. */ | 348 | /* Return the window associated with the frame F. */ |
| @@ -380,3 +375,84 @@ struct face | |||
| 380 | 375 | ||
| 381 | #define MAX_FACES_AND_GLYPHS 256 | 376 | #define MAX_FACES_AND_GLYPHS 256 |
| 382 | extern struct face *x_face_table[]; | 377 | extern struct face *x_face_table[]; |
| 378 | |||
| 379 | |||
| 380 | /* X-specific scrollbar stuff. */ | ||
| 381 | |||
| 382 | struct scrollbar { | ||
| 383 | |||
| 384 | /* The frame we're displayed on. */ | ||
| 385 | struct frame *frame; | ||
| 386 | |||
| 387 | /* The next in the chain of scrollbars in this frame. */ | ||
| 388 | struct scrollbar *next; | ||
| 389 | |||
| 390 | /* The window representing this scrollbar. */ | ||
| 391 | Window window; | ||
| 392 | |||
| 393 | /* The position and size of the scrollbar in pixels, relative to the | ||
| 394 | frame. */ | ||
| 395 | int top, left; | ||
| 396 | int width, height; | ||
| 397 | |||
| 398 | /* The starting and ending positions of the handle, relative to | ||
| 399 | the handle area. If they're equal, that means the handle | ||
| 400 | hasn't been drawn yet. */ | ||
| 401 | int start, end; | ||
| 402 | |||
| 403 | /* The timestamp for judgement. If this is less than | ||
| 404 | judge_timestamp in the x_display structure, this scrollbar is | ||
| 405 | damned. */ | ||
| 406 | int judge_timestamp; | ||
| 407 | |||
| 408 | /* If the scrollbar handle is currently being dragged by the user, | ||
| 409 | this is the number of pixels from the top of the handle to the | ||
| 410 | place where the user grabbed it. If the handle isn't currently | ||
| 411 | being dragged, this is -1. */ | ||
| 412 | int dragging; | ||
| 413 | }; | ||
| 414 | |||
| 415 | /* Return the outside pixel width for a vertical scrollbar on frame F. */ | ||
| 416 | #define VERTICAL_SCROLLBAR_PIXEL_WIDTH(f) (2*FONT_WIDTH ((f)->display.x->font)) | ||
| 417 | |||
| 418 | /* Return the outside pixel height for a vertical scrollbar HEIGHT | ||
| 419 | rows high on frame F. */ | ||
| 420 | #define VERTICAL_SCROLLBAR_PIXEL_HEIGHT(f, height) \ | ||
| 421 | ((height) * FONT_HEIGHT ((f)->display.x->font)) | ||
| 422 | |||
| 423 | |||
| 424 | /* Border widths for scrollbars. */ | ||
| 425 | #define VERTICAL_SCROLLBAR_LEFT_BORDER (1) | ||
| 426 | #define VERTICAL_SCROLLBAR_RIGHT_BORDER (2) | ||
| 427 | #define VERTICAL_SCROLLBAR_TOP_BORDER (1) | ||
| 428 | #define VERTICAL_SCROLLBAR_BOTTOM_BORDER (1) | ||
| 429 | |||
| 430 | |||
| 431 | /* Manipulating pixel sizes and character sizes. | ||
| 432 | Knowledge of which factors affect the overall size of the window should | ||
| 433 | be hidden in these macros, if that's possible. | ||
| 434 | |||
| 435 | /* Return the pixel width of frame F if it has WIDTH columns. */ | ||
| 436 | #define CHAR_TO_PIXEL_WIDTH(f, width) \ | ||
| 437 | ((width) * FONT_WIDTH ((f)->display.x->font) \ | ||
| 438 | + 2 * (f)->display.x->internal_border_width \ | ||
| 439 | + (f)->display.x->vertical_scrollbar_extra) | ||
| 440 | |||
| 441 | /* Return the pixel height of frame F if it has HEIGHT rows. */ | ||
| 442 | #define CHAR_TO_PIXEL_HEIGHT(f, height) \ | ||
| 443 | ((height) * FONT_HEIGHT ((f)->display.x->font) \ | ||
| 444 | + 2 * (f)->display.x->internal_border_width) | ||
| 445 | |||
| 446 | /* How many columns of text can we fit in WIDTH pixels on frame F? */ | ||
| 447 | #define PIXEL_TO_CHAR_WIDTH(f, width) \ | ||
| 448 | (((width) \ | ||
| 449 | - (f)->display.x->vertical_scrollbar_extra \ | ||
| 450 | - 2 * (f)->display.x->internal_border_width) \ | ||
| 451 | / FONT_WIDTH ((f)->display.x->font)) | ||
| 452 | |||
| 453 | /* How many rows of text can we fit in HEIGHT pixels on frame F? */ | ||
| 454 | #define PIXEL_TO_CHAR_HEIGHT(f, height) \ | ||
| 455 | (((height) \ | ||
| 456 | - 2 * (f)->display.x->internal_border_width) \ | ||
| 457 | / FONT_HEIGHT ((f)->display.x->font)) | ||
| 458 | |||