comparison src/xterm.h @ 51214:4011d3fb2912 kfs_20030524_post

(struct x_output): Move members left_pos, top_pos, border_width, pixel_height, pixel_width, line_height, internal_border_width, vertical_scroll_bar_extra, left_fringe_width, right_fringe_width, fringe_cols, fringes_extra, win_gravity, size_hint_flags, want_fullscreen, x_pixels_diff, and y_pixels_diff to struct frame (frame.h). (FRAME_INTERNAL_BORDER_WIDTH, FRAME_LINE_HEIGHT): Move to frame.h. (FRAME_DEFAULT_FONT_WIDTH): Remove macro. (PIXEL_WIDTH, PIXEL_HEIGHT) (FRAME_X_FRINGE_COLS, FRAME_X_FRINGE_WIDTH) (FRAME_X_LEFT_FRINGE_WIDTH, FRAME_X_RIGHT_FRINGE_WIDTH): Moved to frame.h and renamed [see frame.h changes]. (CHAR_TO_PIXEL_ROW, CHAR_TO_PIXEL_COL, CHAR_TO_PIXEL_WIDTH) (CHAR_TO_PIXEL_HEIGHT, PIXEL_TO_CHAR_ROW, PIXEL_TO_CHAR_COL) (PIXEL_TO_CHAR_WIDTH, PIXEL_TO_CHAR_HEIGHT): Moved to frame.h and renamed [see frame.h changes].
author Kim F. Storm <storm@cua.dk>
date Sat, 24 May 2003 22:10:38 +0000
parents d0f7882a3321
children 5c89c59e087d
comparison
equal deleted inserted replaced
51213:791af636af55 51214:4011d3fb2912
403 in the output_data.x field. The x_output structure contains 403 in the output_data.x field. The x_output structure contains
404 the information that is specific to X windows. */ 404 the information that is specific to X windows. */
405 405
406 struct x_output 406 struct x_output
407 { 407 {
408 /* Position of the X window (x and y offsets in root window). */
409 int left_pos;
410 int top_pos;
411
412 /* Border width of the X window as known by the X window system. */
413 int border_width;
414
415 /* Size of the X window in pixels. */
416 int pixel_height, pixel_width;
417
418 /* Height of menu bar widget, in pixels. 408 /* Height of menu bar widget, in pixels.
419 Zero if not using the X toolkit. 409 Zero if not using the X toolkit.
420 When using the toolkit, this value is not meaningful 410 When using the toolkit, this value is not meaningful
421 if the menubar is turned off. */ 411 if the menubar is turned off. */
422 int menubar_height; 412 int menubar_height;
423 413
424 /* Height of tool bar widget, in pixels. 414 /* Height of tool bar widget, in pixels.
425 Zero if not using an external tool bar. */ 415 Zero if not using an external tool bar. */
426 int toolbar_height; 416 int toolbar_height;
427 417
428 /* Height of a line, in pixels. */
429 int line_height;
430
431 /* The tiled border used when the mouse is out of the frame. */ 418 /* The tiled border used when the mouse is out of the frame. */
432 Pixmap border_tile; 419 Pixmap border_tile;
433 420
434 /* Here are the Graphics Contexts for the default font. */ 421 /* Here are the Graphics Contexts for the default font. */
435 GC normal_gc; /* Normal video */ 422 GC normal_gc; /* Normal video */
436 GC reverse_gc; /* Reverse video */ 423 GC reverse_gc; /* Reverse video */
437 GC cursor_gc; /* cursor drawing */ 424 GC cursor_gc; /* cursor drawing */
438
439 /* Width of the internal border. This is a line of background color
440 just inside the window's border. When the frame is selected,
441 a highlighting is displayed inside the internal border. */
442 int internal_border_width;
443 425
444 /* The X window used for this frame. 426 /* The X window used for this frame.
445 May be zero while the frame object is being created 427 May be zero while the frame object is being created
446 and the X window has not yet been created. */ 428 and the X window has not yet been created. */
447 Window window_desc; 429 Window window_desc;
554 the same throughout the execution of Emacs. So, we keep this 536 the same throughout the execution of Emacs. So, we keep this
555 structure around, just leaving values in it and adding new bits 537 structure around, just leaving values in it and adding new bits
556 to the mask as we go. */ 538 to the mask as we go. */
557 XWMHints wm_hints; 539 XWMHints wm_hints;
558 540
559 /* The size of the extra width currently allotted for vertical
560 scroll bars, in pixels. */
561 int vertical_scroll_bar_extra;
562
563 /* The extra width currently allotted for the areas in which
564 truncation marks, continuation marks, and overlay arrows are
565 displayed. */
566 int left_fringe_width, right_fringe_width;
567 int fringe_cols, fringes_extra;
568
569 /* This is the gravity value for the specified window position. */
570 int win_gravity;
571
572 /* The geometry flags for this window. */
573 int size_hint_flags;
574
575 /* This is the Emacs structure for the X display this frame is on. */ 541 /* This is the Emacs structure for the X display this frame is on. */
576 struct x_display_info *display_info; 542 struct x_display_info *display_info;
577 543
578 /* This is a button event that wants to activate the menubar. 544 /* This is a button event that wants to activate the menubar.
579 We save it here until the command loop gets to think about it. */ 545 We save it here until the command loop gets to think about it. */
618 EmacsFrameSetCharSize when the shell widget is resized. For some 584 EmacsFrameSetCharSize when the shell widget is resized. For some
619 window managers like fvwm2 2.2.5 and KDE 2.1 this event doesn't 585 window managers like fvwm2 2.2.5 and KDE 2.1 this event doesn't
620 arrive for an unknown reason and Emacs hangs in Xt. If this is 586 arrive for an unknown reason and Emacs hangs in Xt. If this is
621 zero, tell Xt not to wait. */ 587 zero, tell Xt not to wait. */
622 int wait_for_wm; 588 int wait_for_wm;
623
624 /* See enum below */
625 int want_fullscreen;
626
627 /* This many pixels are the difference between the outer window (i.e. the
628 left of the window manager decoration) and FRAME_X_WINDOW. */
629 int x_pixels_diff;
630
631 /* This many pixels are the difference between the outer window (i.e. the
632 top of the window manager titlebar) and FRAME_X_WINDOW. */
633 int y_pixels_diff;
634 589
635 /* As x_pixels_diff, but to FRAME_OUTER_WINDOW. For some reason the 590 /* As x_pixels_diff, but to FRAME_OUTER_WINDOW. For some reason the
636 two might differ by a pixel, depending on WM */ 591 two might differ by a pixel, depending on WM */
637 int x_pixels_outer_diff; 592 int x_pixels_outer_diff;
638 593
691 #endif 646 #endif
692 647
693 648
694 #define FRAME_FONT(f) ((f)->output_data.x->font) 649 #define FRAME_FONT(f) ((f)->output_data.x->font)
695 #define FRAME_FONTSET(f) ((f)->output_data.x->fontset) 650 #define FRAME_FONTSET(f) ((f)->output_data.x->fontset)
696 #define FRAME_INTERNAL_BORDER_WIDTH(f) ((f)->output_data.x->internal_border_width)
697 #define FRAME_MENUBAR_HEIGHT(f) ((f)->output_data.x->menubar_height) 651 #define FRAME_MENUBAR_HEIGHT(f) ((f)->output_data.x->menubar_height)
698 #define FRAME_TOOLBAR_HEIGHT(f) ((f)->output_data.x->toolbar_height) 652 #define FRAME_TOOLBAR_HEIGHT(f) ((f)->output_data.x->toolbar_height)
699 #define FRAME_LINE_HEIGHT(f) ((f)->output_data.x->line_height)
700
701 /* Width of the default font of frame F. Must be defined by each
702 terminal specific header. */
703 #define FRAME_DEFAULT_FONT_WIDTH(F) FONT_WIDTH (FRAME_FONT (F))
704 #define FRAME_BASELINE_OFFSET(f) ((f)->output_data.x->baseline_offset) 653 #define FRAME_BASELINE_OFFSET(f) ((f)->output_data.x->baseline_offset)
705 654
706 /* This gives the x_display_info structure for the display F is on. */ 655 /* This gives the x_display_info structure for the display F is on. */
707 #define FRAME_X_DISPLAY_INFO(f) ((f)->output_data.x->display_info) 656 #define FRAME_X_DISPLAY_INFO(f) ((f)->output_data.x->display_info)
708 657
719 /* This is the Colormap which frame F uses. */ 668 /* This is the Colormap which frame F uses. */
720 #define FRAME_X_COLORMAP(f) FRAME_X_DISPLAY_INFO (f)->cmap 669 #define FRAME_X_COLORMAP(f) FRAME_X_DISPLAY_INFO (f)->cmap
721 670
722 /* This is the 'font_info *' which frame F has. */ 671 /* This is the 'font_info *' which frame F has. */
723 #define FRAME_X_FONT_TABLE(f) (FRAME_X_DISPLAY_INFO (f)->font_table) 672 #define FRAME_X_FONT_TABLE(f) (FRAME_X_DISPLAY_INFO (f)->font_table)
724
725 /* These two really ought to be called FRAME_PIXEL_{WIDTH,HEIGHT}. */
726 #define PIXEL_WIDTH(f) ((f)->output_data.x->pixel_width)
727 #define PIXEL_HEIGHT(f) ((f)->output_data.x->pixel_height)
728 673
729 /* The difference in pixels between the top left corner of the 674 /* The difference in pixels between the top left corner of the
730 Emacs window (including possible window manager decorations) 675 Emacs window (including possible window manager decorations)
731 and FRAME_X_WINDOW (f). */ 676 and FRAME_X_WINDOW (f). */
732 #define FRAME_OUTER_TO_INNER_DIFF_X(f) \ 677 #define FRAME_OUTER_TO_INNER_DIFF_X(f) \
755 /* Return a pointer to the image cache of frame F. */ 700 /* Return a pointer to the image cache of frame F. */
756 701
757 #define FRAME_X_IMAGE_CACHE(F) FRAME_X_DISPLAY_INFO ((F))->image_cache 702 #define FRAME_X_IMAGE_CACHE(F) FRAME_X_DISPLAY_INFO ((F))->image_cache
758 703
759 704
760 /* Total width of fringes reserved for drawing truncation bitmaps,
761 continuation bitmaps and alike. The width is in canonical char
762 units of the frame. This must currently be the case because window
763 sizes aren't pixel values. If it weren't the case, we wouldn't be
764 able to split windows horizontally nicely. */
765
766 #define FRAME_X_FRINGE_COLS(F) ((F)->output_data.x->fringe_cols)
767
768 /* Total width of fringes in pixels. */
769
770 #define FRAME_X_FRINGE_WIDTH(F) ((F)->output_data.x->fringes_extra)
771
772 /* Pixel-width of the left and right fringe. */
773
774 #define FRAME_X_LEFT_FRINGE_WIDTH(F) ((F)->output_data.x->left_fringe_width)
775 #define FRAME_X_RIGHT_FRINGE_WIDTH(F) ((F)->output_data.x->right_fringe_width)
776
777
778
779 /* X-specific scroll bar stuff. */ 705 /* X-specific scroll bar stuff. */
780 706
781 /* We represent scroll bars as lisp vectors. This allows us to place 707 /* We represent scroll bars as lisp vectors. This allows us to place
782 references to them in windows without worrying about whether we'll 708 references to them in windows without worrying about whether we'll
783 end up with windows referring to dead scroll bars; the garbage 709 end up with windows referring to dead scroll bars; the garbage
913 #define VERTICAL_SCROLL_BAR_MIN_HANDLE (5) 839 #define VERTICAL_SCROLL_BAR_MIN_HANDLE (5)
914 840
915 /* Trimming off a few pixels from each side prevents 841 /* Trimming off a few pixels from each side prevents
916 text from glomming up against the scroll bar */ 842 text from glomming up against the scroll bar */
917 #define VERTICAL_SCROLL_BAR_WIDTH_TRIM (0) 843 #define VERTICAL_SCROLL_BAR_WIDTH_TRIM (0)
918
919
920 /* Manipulating pixel sizes and character sizes.
921 Knowledge of which factors affect the overall size of the window should
922 be hidden in these macros, if that's possible.
923
924 Return the upper/left pixel position of the character cell on frame F
925 at ROW/COL. */
926 #define CHAR_TO_PIXEL_ROW(f, row) \
927 ((f)->output_data.x->internal_border_width \
928 + (row) * (f)->output_data.x->line_height)
929 #define CHAR_TO_PIXEL_COL(f, col) \
930 ((f)->output_data.x->internal_border_width \
931 + (col) * FONT_WIDTH ((f)->output_data.x->font))
932
933 /* Return the pixel width/height of frame F if it has
934 WIDTH columns/HEIGHT rows. */
935 #define CHAR_TO_PIXEL_WIDTH(f, width) \
936 (CHAR_TO_PIXEL_COL (f, width) \
937 + (f)->output_data.x->vertical_scroll_bar_extra \
938 + (f)->output_data.x->fringes_extra \
939 + (f)->output_data.x->internal_border_width)
940 #define CHAR_TO_PIXEL_HEIGHT(f, height) \
941 (CHAR_TO_PIXEL_ROW (f, height) \
942 + (f)->output_data.x->internal_border_width)
943
944
945 /* Return the row/column (zero-based) of the character cell containing
946 the pixel on FRAME at ROW/COL. */
947 #define PIXEL_TO_CHAR_ROW(f, row) \
948 (((row) - (f)->output_data.x->internal_border_width) \
949 / (f)->output_data.x->line_height)
950 #define PIXEL_TO_CHAR_COL(f, col) \
951 (((col) - (f)->output_data.x->internal_border_width) \
952 / FONT_WIDTH ((f)->output_data.x->font))
953
954 /* How many columns/rows of text can we fit in WIDTH/HEIGHT pixels on
955 frame F? */
956 #define PIXEL_TO_CHAR_WIDTH(f, width) \
957 (PIXEL_TO_CHAR_COL (f, ((width) \
958 - (f)->output_data.x->internal_border_width \
959 - (f)->output_data.x->fringes_extra \
960 - (f)->output_data.x->vertical_scroll_bar_extra)))
961 #define PIXEL_TO_CHAR_HEIGHT(f, height) \
962 (PIXEL_TO_CHAR_ROW (f, ((height) \
963 - (f)->output_data.x->internal_border_width)))
964 844
965 845
966 /* If a struct input_event has a kind which is SELECTION_REQUEST_EVENT 846 /* If a struct input_event has a kind which is SELECTION_REQUEST_EVENT
967 or SELECTION_CLEAR_EVENT, then its contents are really described 847 or SELECTION_CLEAR_EVENT, then its contents are really described
968 by this structure. */ 848 by this structure. */
1120 #endif 1000 #endif
1121 extern void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object)); 1001 extern void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
1122 1002
1123 /* Defined in xfaces.c */ 1003 /* Defined in xfaces.c */
1124 1004
1125 extern int frame_update_line_height P_ ((struct frame *));
1126 extern int compute_glyph_face P_ ((struct frame *, int, int)); 1005 extern int compute_glyph_face P_ ((struct frame *, int, int));
1127 extern int compute_glyph_face_1 P_ ((struct frame *, Lisp_Object, int)); 1006 extern int compute_glyph_face_1 P_ ((struct frame *, Lisp_Object, int));
1128 extern void x_free_dpy_colors P_ ((Display *, Screen *, Colormap, 1007 extern void x_free_dpy_colors P_ ((Display *, Screen *, Colormap,
1129 unsigned long *, int)); 1008 unsigned long *, int));
1130 1009