X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/bd59ac2c02356237441a2a9f1d668337a3964bc5..9f14330b7bd7166616c72898e1f33fd556266b1c:/src/macterm.h diff --git a/src/macterm.h b/src/macterm.h index c5d3e17412..ff7110828b 100644 --- a/src/macterm.h +++ b/src/macterm.h @@ -23,18 +23,26 @@ Boston, MA 02111-1307, USA. */ #include "macgui.h" #include "frame.h" -/* The class of this X application. */ -#define EMACS_CLASS "Emacs" - #define RGB_TO_ULONG(r, g, b) (((r) << 16) | ((g) << 8) | (b)) #define RED_FROM_ULONG(color) ((color) >> 16) #define GREEN_FROM_ULONG(color) (((color) >> 8) & 0xff) #define BLUE_FROM_ULONG(color) ((color) & 0xff) +/* Do not change `* 0x101' in the following lines to `<< 8'. If + changed, image masks in 1-bit depth will not work. */ +#define RED16_FROM_ULONG(color) (RED_FROM_ULONG(color) * 0x101) +#define GREEN16_FROM_ULONG(color) (GREEN_FROM_ULONG(color) * 0x101) +#define BLUE16_FROM_ULONG(color) (BLUE_FROM_ULONG(color) * 0x101) + #define BLACK_PIX_DEFAULT(f) RGB_TO_ULONG(0,0,0) #define WHITE_PIX_DEFAULT(f) RGB_TO_ULONG(255,255,255) +/* A black pixel in a mask bitmap/pixmap means ``draw a source + pixel''. A white pixel means ``retain the current pixel''. */ +#define PIX_MASK_DRAW(f) BLACK_PIX_DEFAULT(f) +#define PIX_MASK_RETAIN(f) WHITE_PIX_DEFAULT(f) + #define FONT_WIDTH(f) ((f)->max_bounds.width) #define FONT_HEIGHT(f) ((f)->ascent + (f)->descent) #define FONT_BASE(f) ((f)->ascent) @@ -45,9 +53,10 @@ Boston, MA 02111-1307, USA. */ /* Structure recording bitmaps and reference count. If REFCOUNT is 0 then this record is free to be reused. */ -struct mac_bitmap_record +struct mac_bitmap_record { char *bitmap_data; + char *file; int refcount; int height, width; }; @@ -74,8 +83,13 @@ struct mac_display_info /* Number of planes on this screen. */ int n_planes; + /* Whether the screen supports color */ + int color_p; + +#if 0 /* Number of bits per pixel on this screen. */ int n_cbits; +#endif /* Dimensions of this screen. */ int height, width; @@ -96,7 +110,10 @@ struct mac_display_info Window root_window; /* The cursor to use for vertical scroll bars. */ - struct Cursor *vertical_scroll_bar_cursor; + Cursor vertical_scroll_bar_cursor; + + /* Resource data base */ + XrmDatabase xrdb; #if 0 /* color palette information. */ @@ -223,6 +240,12 @@ extern struct x_display_info *x_display_info_for_name P_ ((Lisp_Object)); extern struct mac_display_info *mac_term_init (); +extern Lisp_Object x_list_fonts P_ ((struct frame *, Lisp_Object, int, int)); +extern struct font_info *x_get_font_info P_ ((struct frame *f, int)); +extern struct font_info *x_load_font P_ ((struct frame *, char *, int)); +extern struct font_info *x_query_font P_ ((struct frame *, char *)); +extern void x_find_ccl_program P_ ((struct font_info *)); + /* When Emacs uses a tty window, tty_display in frame.c points to an x_output struct . */ struct x_output @@ -267,29 +290,11 @@ struct mac_output { int size_computed_faces; #endif - /* Position of the Mac window (x and y offsets in global coordinates). */ - int left_pos; - int top_pos; - - /* Border width of the W32 window as known by the window system. */ - int border_width; - - /* Size of the W32 window in pixels. */ - int pixel_height, pixel_width; - - /* Height of a line, in pixels. */ - int line_height; - /* Here are the Graphics Contexts for the default font. */ GC normal_gc; /* Normal video */ GC reverse_gc; /* Reverse video */ GC cursor_gc; /* cursor drawing */ - /* Width of the internal border. This is a line of background color - just inside the window's border. When the frame is selected, - a highlighting is displayed inside the internal border. */ - int internal_border_width; - /* The window used for this frame. May be zero while the frame object is being created and the window has not yet been created. */ @@ -321,23 +326,24 @@ struct mac_output { /* Foreground color for scroll bars. A value of -1 means use the default (black for non-toolkit scroll bars). */ unsigned long scroll_bar_foreground_pixel; - + /* Background color for scroll bars. A value of -1 means use the default (background color of the frame for non-toolkit scroll bars). */ unsigned long scroll_bar_background_pixel; /* Descriptor for the cursor in use for this window. */ - struct Cursor *text_cursor; - struct Cursor *nontext_cursor; - struct Cursor *modeline_cursor; - struct Cursor *cross_cursor; - struct Cursor *hourglass_cursor; + Cursor text_cursor; + Cursor nontext_cursor; + Cursor modeline_cursor; + Cursor hand_cursor; + Cursor hourglass_cursor; + Cursor horizontal_drag_cursor; #if 0 /* Window whose cursor is hourglass_cursor. This window is temporarily mapped to display a hourglass-cursor. */ Window hourglass_window; - + /* Non-zero means hourglass cursor is currently displayed. */ unsigned hourglass_p : 1; @@ -350,22 +356,6 @@ struct mac_output { DWORD dwStyle; #endif - /* The size of the extra width currently allotted for vertical - scroll bars, in pixels. */ - int vertical_scroll_bar_extra; - - /* The extra width currently allotted for the areas in which - truncation marks, continuation marks, and overlay arrows are - displayed. */ - int left_fringe_width, right_fringe_width; - int fringe_cols, fringes_extra; - - /* This is the gravity value for the specified window position. */ - int win_gravity; - - /* The geometry flags for this window. */ - int size_hint_flags; - /* This is the Emacs structure for the display this frame is on. */ /* struct w32_display_info *display_info; */ @@ -402,8 +392,12 @@ struct mac_output { typedef struct mac_output mac_output; +/* Return the X output data for frame F. */ +#define FRAME_X_OUTPUT(f) ((f)->output_data.mac) + /* Return the Mac window used for displaying data in frame F. */ #define FRAME_MAC_WINDOW(f) ((f)->output_data.mac->mWP) +#define FRAME_X_WINDOW(f) ((f)->output_data.mac->mWP) #define FRAME_FOREGROUND_PIXEL(f) ((f)->output_data.x->foreground_pixel) #define FRAME_BACKGROUND_PIXEL(f) ((f)->output_data.x->background_pixel) @@ -411,13 +405,6 @@ typedef struct mac_output mac_output; #define FRAME_FONT(f) ((f)->output_data.mac->font) #define FRAME_FONTSET(f) ((f)->output_data.mac->fontset) -#undef FRAME_INTERNAL_BORDER_WIDTH -#define FRAME_INTERNAL_BORDER_WIDTH(f) \ - ((f)->output_data.mac->internal_border_width) -#define FRAME_LINE_HEIGHT(f) ((f)->output_data.mac->line_height) -/* Width of the default font of frame F. Must be defined by each - terminal specific header. */ -#define FRAME_DEFAULT_FONT_WIDTH(F) FONT_WIDTH (FRAME_FONT (F)) #define FRAME_BASELINE_OFFSET(f) ((f)->output_data.mac->baseline_offset) /* This gives the w32_display_info structure for the display F is on. */ @@ -426,14 +413,11 @@ typedef struct mac_output mac_output; /* This is the `Display *' which frame F is on. */ #define FRAME_MAC_DISPLAY(f) (0) +#define FRAME_X_DISPLAY(f) (0) /* This is the 'font_info *' which frame F has. */ #define FRAME_MAC_FONT_TABLE(f) (FRAME_MAC_DISPLAY_INFO (f)->font_table) -/* These two really ought to be called FRAME_PIXEL_{WIDTH,HEIGHT}. */ -#define PIXEL_WIDTH(f) ((f)->output_data.mac->pixel_width) -#define PIXEL_HEIGHT(f) ((f)->output_data.mac->pixel_height) - /* Value is the smallest width of any character in any font on frame F. */ #define FRAME_SMALLEST_CHAR_WIDTH(F) \ @@ -448,25 +432,6 @@ typedef struct mac_output mac_output; #define FRAME_X_IMAGE_CACHE(F) FRAME_MAC_DISPLAY_INFO ((F))->image_cache - -/* Total width of fringes reserved for drawing truncation bitmaps, - continuation bitmaps and alike. The width is in canonical char - units of the frame. This must currently be the case because window - sizes aren't pixel values. If it weren't the case, we wouldn't be - able to split windows horizontally nicely. */ - -#define FRAME_X_FRINGE_COLS(F) ((F)->output_data.mac->fringe_cols) - -/* Total width of fringes in pixels. */ - -#define FRAME_X_FRINGE_WIDTH(F) ((F)->output_data.mac->fringes_extra) - -/* Pixel-width of the left and right fringe. */ - -#define FRAME_X_LEFT_FRINGE_WIDTH(F) ((F)->output_data.mac->left_fringe_width) -#define FRAME_X_RIGHT_FRINGE_WIDTH(F) ((F)->output_data.mac->right_fringe_width) - - /* Mac-specific scroll bar stuff. */ @@ -558,7 +523,7 @@ struct scroll_bar { /* Return the length of the rectangle within which the top of the handle must stay. This isn't equivalent to the inside height, - because the scroll bar handle has a minimum height. + because the scroll bar handle has a minimum height. This is the real range of motion for the scroll bar, so when we're scaling buffer positions to scroll bar positions, we use this, not @@ -600,51 +565,44 @@ struct scroll_bar { text from glomming up against the scroll bar */ #define VERTICAL_SCROLL_BAR_WIDTH_TRIM (0) - -/* Manipulating pixel sizes and character sizes. - Knowledge of which factors affect the overall size of the window should - be hidden in these macros, if that's possible. - - Return the upper/left pixel position of the character cell on frame F - at ROW/COL. */ -#define CHAR_TO_PIXEL_ROW(f, row) \ - ((f)->output_data.mac->internal_border_width \ - + (row) * (f)->output_data.mac->line_height) -#define CHAR_TO_PIXEL_COL(f, col) \ - ((f)->output_data.mac->internal_border_width \ - + (col) * FONT_WIDTH ((f)->output_data.mac->font)) - -/* Return the pixel width/height of frame F if it has - WIDTH columns/HEIGHT rows. */ -#define CHAR_TO_PIXEL_WIDTH(f, width) \ - (CHAR_TO_PIXEL_COL (f, width) \ - + (f)->output_data.mac->vertical_scroll_bar_extra \ - + (f)->output_data.mac->fringes_extra \ - + (f)->output_data.mac->internal_border_width) -#define CHAR_TO_PIXEL_HEIGHT(f, height) \ - (CHAR_TO_PIXEL_ROW (f, height) \ - + (f)->output_data.mac->internal_border_width) - - -/* Return the row/column (zero-based) of the character cell containing - the pixel on FRAME at ROW/COL. */ -#define PIXEL_TO_CHAR_ROW(f, row) \ - (((row) - (f)->output_data.mac->internal_border_width) \ - / (f)->output_data.mac->line_height) -#define PIXEL_TO_CHAR_COL(f, col) \ - (((col) - (f)->output_data.mac->internal_border_width) \ - / FONT_WIDTH ((f)->output_data.mac->font)) - -/* How many columns/rows of text can we fit in WIDTH/HEIGHT pixels on - frame F? */ -#define PIXEL_TO_CHAR_WIDTH(f, width) \ - (PIXEL_TO_CHAR_COL (f, ((width) \ - - (f)->output_data.mac->internal_border_width \ - - (f)->output_data.mac->fringes_extra \ - - (f)->output_data.mac->vertical_scroll_bar_extra))) -#define PIXEL_TO_CHAR_HEIGHT(f, height) \ - (PIXEL_TO_CHAR_ROW (f, ((height) \ - - (f)->output_data.mac->internal_border_width))) - -struct frame * check_x_frame (Lisp_Object); +struct frame; +struct face; +struct image; + +Lisp_Object display_x_get_resource P_ ((struct x_display_info *, + Lisp_Object, Lisp_Object, + Lisp_Object, Lisp_Object)); +struct frame *check_x_frame P_ ((Lisp_Object)); +EXFUN (Fx_display_color_p, 1); +EXFUN (Fx_display_grayscale_p, 1); +EXFUN (Fx_display_planes, 1); +extern void x_free_gcs P_ ((struct frame *)); + +void activate_scroll_bars (FRAME_PTR); +void deactivate_scroll_bars (FRAME_PTR); + +/* Defined in macterm.c. */ + +extern void x_set_window_size P_ ((struct frame *, int, int, int)); +extern void x_make_frame_visible P_ ((struct frame *)); +extern void mac_initialize P_ ((void)); +extern Pixmap XCreatePixmap P_ ((Display *, WindowPtr, unsigned int, + unsigned int, unsigned int)); +extern Pixmap XCreatePixmapFromBitmapData P_ ((Display *, WindowPtr, char *, + unsigned int, unsigned int, + unsigned long, unsigned long, + unsigned int)); +extern void XFreePixmap P_ ((Display *, Pixmap)); +extern void XSetForeground P_ ((Display *, GC, unsigned long)); +extern void mac_draw_line_to_pixmap P_ ((Display *, Pixmap, GC, int, int, + int, int)); + +#define FONT_TYPE_FOR_UNIBYTE(font, ch) 0 +#define FONT_TYPE_FOR_MULTIBYTE(font, ch) 0 + +#if TARGET_API_MAC_CARBON +extern CFStringRef cfstring_create_with_utf8_cstring P_ ((const char *)); +#endif +/* arch-tag: 6b4ca125-5bef-476d-8ee8-31ed808b7e79 + (do not change this comment) */