]> code.delx.au - gnu-emacs/blobdiff - src/macterm.h
*** empty log message ***
[gnu-emacs] / src / macterm.h
index f32b13000e60fcd809a15ba8b7108250881c2aaa..fdc74cb63765758d5063808c6e3eb235fbda49d4 100644 (file)
@@ -1,5 +1,6 @@
 /* Display module for Mac OS.
-   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2002, 2003, 2004,
+                 2005, 2006 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -15,8 +16,8 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with GNU Emacs; see the file COPYING.  If not, write to
-the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
+the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+Boston, MA 02110-1301, USA.  */
 
 /* Contributed by Andrew Choi (akochoi@mac.com).  */
 
@@ -38,13 +39,8 @@ Boston, MA 02111-1307, USA.  */
 #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_WIDTH(f)  ((f)->max_bounds.width)
+#define FONT_HEIGHT(f) ((f)->ascent + (f)->descent)
 #define FONT_BASE(f)    ((f)->ascent)
 #define FONT_DESCENT(f) ((f)->descent)
 
@@ -83,19 +79,11 @@ struct mac_display_info
   /* Number of planes on this screen.  */
   int n_planes;
 
-  /* Whether the screen supports color */ 
+  /* 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;
-#if 0
-  int height_in,width_in;
-#endif
 
   /* Mask of things that cause the mouse to be grabbed.  */
   int grabbed;
@@ -115,33 +103,12 @@ struct mac_display_info
   /* Resource data base */
   XrmDatabase xrdb;
 
-#if 0
-  /* color palette information.  */
-  int has_palette;
-  struct w32_palette_entry * color_list;
-  unsigned num_colors;
-  HPALETTE palette;
-
-  /* deferred action flags checked when starting frame update.  */
-  int regen_palette;
-
-  /* Keystroke that has been faked by Emacs and will be ignored when
-     received; value is reset after key is received.  */
-  int faked_key;
-
-#endif
-
   /* A table of all the fonts we have already loaded.  */
   struct font_info *font_table;
 
   /* The current capacity of font_table.  */
   int font_table_size;
 
-  /* The number of fonts actually stored in the font table.
-     font_table[n] is used and valid iff 0 <= n < n_fonts. 0 <=
-     n_fonts <= font_table_size. and font_table[i].name != 0. */
-  int n_fonts;
-
   /* Minimum width over all characters in all fonts in font_table.  */
   int smallest_char_width;
 
@@ -149,10 +116,10 @@ struct mac_display_info
   int smallest_font_height;
 
   /* Reusable Graphics Context for drawing a cursor in a non-default face. */
-  XGCValues *scratch_cursor_gc;
+  GC scratch_cursor_gc;
 
   /* These variables describe the range of text currently shown in its
-     mouse-face, together with the window they apply to. As long as
+     mouse-face, together with the window they apply to.  As long as
      the mouse stays within this range, we need not redraw anything on
      its account.  Rows and columns are glyph matrix positions in
      MOUSE_FACE_WINDOW.  */
@@ -172,7 +139,6 @@ struct mac_display_info
   /* FRAME and X, Y position of mouse when last checked for
      highlighting.  X and Y can be negative or out of range for the frame.  */
   struct frame *mouse_face_mouse_frame;
-
   int mouse_face_mouse_x, mouse_face_mouse_y;
 
   /* Nonzero means defer mouse-motion highlighting.  */
@@ -185,6 +151,11 @@ struct mac_display_info
 
   char *mac_id_name;
 
+  /* The number of fonts actually stored in the font table.
+     font_table[n] is used and valid iff 0 <= n < n_fonts.  0 <=
+     n_fonts <= font_table_size and font_table[i].name != 0.  */
+  int n_fonts;
+
   /* Pointer to bitmap records.  */
   struct mac_bitmap_record *bitmaps;
 
@@ -195,14 +166,14 @@ struct mac_display_info
   int bitmaps_last;
 
   /* The frame (if any) which has the window that has keyboard focus.
-     Zero if none.  This is examined by Ffocus_frame in w32fns.c.  Note
+     Zero if none.  This is examined by Ffocus_frame in macfns.c.  Note
      that a mere EnterNotify event can set this; if you need to know the
      last frame specified in a FocusIn or FocusOut event, use
-     w32_focus_event_frame.  */
+     x_focus_event_frame.  */
   struct frame *x_focus_frame;
 
   /* The last frame mentioned in a FocusIn or FocusOut event.  This is
-     separate from w32_focus_frame, because whether or not LeaveNotify
+     separate from x_focus_frame, because whether or not LeaveNotify
      events cause us to lose focus depends on whether or not we have
      received a FocusIn event for it.  */
   struct frame *x_focus_event_frame;
@@ -210,7 +181,7 @@ struct mac_display_info
   /* The frame which currently has the visual highlight, and should get
      keyboard input (other sorts of input have the frame encoded in the
      event).  It points to the focus frame's selected window's
-     frame.  It differs from w32_focus_frame when we're using a global
+     frame.  It differs from x_focus_frame when we're using a global
      minibuffer.  */
   struct frame *x_highlight_frame;
 
@@ -235,13 +206,10 @@ extern struct mac_display_info one_mac_display_info;
    FONT-LIST-CACHE records previous values returned by x-list-fonts.  */
 extern Lisp_Object x_display_name_list;
 
-/* A flag to control how to display unibyte 8-bit character.  */
-extern int unibyte_display_via_language_environment;
-
 extern struct x_display_info *x_display_info_for_display P_ ((Display *));
 extern struct x_display_info *x_display_info_for_name P_ ((Lisp_Object));
 
-extern struct mac_display_info *mac_term_init ();
+extern struct mac_display_info *mac_term_init P_ ((Lisp_Object, char *, char *));
 
 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));
@@ -266,33 +234,8 @@ struct mac_output {
   /* Menubar "widget" handle.  */
   int menubar_widget;
 
-  Window mWP;                  /* pointer to QuickDraw window */
   FRAME_PTR mFP;               /* points back to the frame struct */
 
-#if 0
-  int mNumCols;                        /* number of characters per column */
-  int mNumRows;                        /* number of characters per row */
-  int mLineHeight;             /* height of one line of text in pixels */
-  int mCharWidth;              /* width of one character in pixels */
-  int mHomeX;                  /* X pixel coordinate of lower left
-                                  corner of character at (0, 0) */
-  int mHomeY;                  /* Y pixel coordinate of lower left
-                                  corner of character at (0, 0) */
-  int mHighlight;              /* current highlight state (0 = off). */
-  int mTermWinSize;            /* num of lines from top of window
-                                  affected by ins_del_lines; set by
-                                  set_terminal_window. */
-#endif /* 0 */
-
-#if 0
-  /* stuffs used by xfaces.c */
-  struct face **param_faces;
-  int n_param_faces;
-  struct face **computed_faces;
-  int n_computed_faces;
-  int size_computed_faces;
-#endif
-
   /* Here are the Graphics Contexts for the default font.  */
   GC normal_gc;                                /* Normal video */
   GC reverse_gc;                       /* Reverse video */
@@ -326,6 +269,7 @@ struct mac_output {
   unsigned long mouse_pixel;
   unsigned long cursor_foreground_pixel;
 
+#if 0
   /* 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;
@@ -334,6 +278,7 @@ struct mac_output {
      default (background color of the frame for non-toolkit scroll
      bars).  */
   unsigned long scroll_bar_background_pixel;
+#endif
 
   /* Descriptor for the cursor in use for this window.  */
   Cursor text_cursor;
@@ -355,8 +300,10 @@ struct mac_output {
 
 #endif
 
-#if 0
-  DWORD dwStyle;
+#if TARGET_API_MAC_CARBON
+  /* The Mac control reference for the hourglass (progress indicator)
+     shown at the upper-right corner of the window.  */
+  ControlRef hourglass_control;
 #endif
 
   /* This is the Emacs structure for the display this frame is on.  */
@@ -372,17 +319,10 @@ struct mac_output {
   /* Nonzero means menubar is currently active.  */
   char menubar_active;
 
-  /* Nonzero means a menu command is being processed.  */
-  char menu_command_in_progress;
-
-  /* Nonzero means menubar is about to become active, but should be
-     brought up to date first.  */
-  volatile char pending_menu_activation;
-
   /* Relief GCs, colors etc.  */
   struct relief
   {
-    XGCValues *gc;
+    GC gc;
     unsigned long pixel;
     int allocated_p;
   }
@@ -394,6 +334,16 @@ struct mac_output {
 
   /* Hints for the size and the position of a window.  */
   XSizeHints *size_hints;
+
+#if TARGET_API_MAC_CARBON
+  /* File name for the proxy icon of this frame.  Might be NULL.  */
+  char *file_name;
+#endif
+
+#if USE_CG_DRAWING
+  /* Quartz 2D graphics context.  */
+  CGContextRef cg_context;
+#endif
 };
 
 typedef struct mac_output mac_output;
@@ -402,8 +352,8 @@ typedef struct mac_output mac_output;
 #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_MAC_WINDOW(f) ((f)->output_data.mac->window_desc)
+#define FRAME_X_WINDOW(f) ((f)->output_data.mac->window_desc)
 
 #define FRAME_FOREGROUND_PIXEL(f) ((f)->output_data.x->foreground_pixel)
 #define FRAME_BACKGROUND_PIXEL(f) ((f)->output_data.x->background_pixel)
@@ -415,7 +365,9 @@ typedef struct mac_output mac_output;
 
 #define FRAME_SIZE_HINTS(f) ((f)->output_data.mac->size_hints)
 
-/* This gives the w32_display_info structure for the display F is on.  */
+#define FRAME_FILE_NAME(f) ((f)->output_data.mac->file_name)
+
+/* This gives the mac_display_info structure for the display F is on.  */
 #define FRAME_MAC_DISPLAY_INFO(f) (&one_mac_display_info)
 #define FRAME_X_DISPLAY_INFO(f) (&one_mac_display_info)
 
@@ -489,6 +441,12 @@ struct scroll_bar {
      place where the user grabbed it.  If the handle isn't currently
      being dragged, this is Qnil.  */
   Lisp_Object dragging;
+
+#ifdef USE_TOOLKIT_SCROLL_BARS
+  /* The position and size of the scroll bar handle track area in
+     pixels, relative to the frame.  */
+  Lisp_Object track_top, track_height;
+#endif
 };
 
 /* The number of elements a vector holding a struct scroll_bar needs.  */
@@ -523,7 +481,7 @@ struct scroll_bar {
 
 /* Return the inside width of a vertical scroll bar, given the outside
    width.  */
-#define VERTICAL_SCROLL_BAR_INSIDE_WIDTH(f,width) \
+#define VERTICAL_SCROLL_BAR_INSIDE_WIDTH(f, width) \
   ((width) \
    - VERTICAL_SCROLL_BAR_LEFT_BORDER \
    - VERTICAL_SCROLL_BAR_RIGHT_BORDER \
@@ -573,6 +531,14 @@ struct scroll_bar {
    text from glomming up against the scroll bar */
 #define VERTICAL_SCROLL_BAR_WIDTH_TRIM (0)
 
+/* Variations of possible Aqua scroll bar width.  */
+#define MAC_AQUA_VERTICAL_SCROLL_BAR_WIDTH (15)
+#define MAC_AQUA_SMALL_VERTICAL_SCROLL_BAR_WIDTH (11)
+
+/* Size of hourglass controls */
+#define HOURGLASS_WIDTH 16
+#define HOURGLASS_HEIGHT 16
+
 struct frame;
 struct face;
 struct image;
@@ -585,14 +551,21 @@ 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);
+extern int XParseGeometry P_ ((char *, int *, int *, unsigned int *,
+                              unsigned int *));
 
 /* Defined in macterm.c.  */
 
 extern void x_set_window_size P_ ((struct frame *, int, int, int));
+extern void x_set_mouse_position P_ ((struct frame *, int, int));
+extern void x_set_mouse_pixel_position P_ ((struct frame *, int, int));
 extern void x_make_frame_visible P_ ((struct frame *));
+extern void x_make_frame_invisible P_ ((struct frame *));
+extern void x_iconify_frame P_ ((struct frame *));
+extern void x_free_frame_resources P_ ((struct frame *));
+extern void x_destroy_window P_ ((struct frame *));
+extern void x_wm_set_size_hint P_ ((struct frame *, long, int));
+extern void x_delete_display P_ ((struct x_display_info *));
 extern void mac_initialize P_ ((void));
 extern Pixmap XCreatePixmap P_ ((Display *, WindowPtr, unsigned int,
                                 unsigned int, unsigned int));
@@ -601,19 +574,79 @@ extern Pixmap XCreatePixmapFromBitmapData P_ ((Display *, WindowPtr, char *,
                                               unsigned long, unsigned long,
                                               unsigned int));
 extern void XFreePixmap P_ ((Display *, Pixmap));
+extern GC XCreateGC P_ ((Display *, Window, unsigned long, XGCValues *));
+extern void XFreeGC P_ ((Display *, GC));
 extern void XSetForeground P_ ((Display *, GC, unsigned long));
 extern void XSetBackground P_ ((Display *, GC, unsigned long));
 extern void XSetWindowBackground P_ ((Display *, WindowPtr, unsigned long));
 extern void mac_draw_line_to_pixmap P_ ((Display *, Pixmap, GC, int, int,
                                         int, int));
+extern void mac_clear_area P_ ((struct frame *, int, int,
+                               unsigned int, unsigned int));
 extern void mac_unload_font P_ ((struct mac_display_info *, XFontStruct *));
+extern OSErr install_window_handler P_ ((WindowPtr));
+extern void remove_window_handler P_ ((WindowPtr));
+extern void do_menu_choice P_ ((SInt32));
+extern OSStatus mac_post_mouse_moved_event P_ ((void));
+#if USE_CG_DRAWING
+extern void mac_prepare_for_quickdraw P_ ((struct frame *));
+#endif
 
 #define FONT_TYPE_FOR_UNIBYTE(font, ch) 0
 #define FONT_TYPE_FOR_MULTIBYTE(font, ch) 0
 
+#define TYPE_FILE_NAME 'fNam'
+
+/* Defined in macselect.c */
+
+extern void x_clear_frame_selections P_ ((struct frame *));
+
+/* Defined in macfns.c */
+
+extern int have_menus_p P_ ((void));
+
+extern void x_real_positions P_ ((struct frame *, int *, int *));
+extern void x_set_menu_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
+extern int x_pixel_width P_ ((struct frame *));
+extern int x_pixel_height P_ ((struct frame *));
+extern int x_char_width P_ ((struct frame *));
+extern int x_char_height P_ ((struct frame *));
+extern void x_sync P_ ((struct frame *));
+extern void x_set_tool_bar_lines P_ ((struct frame *, Lisp_Object, Lisp_Object));
+extern void mac_update_title_bar P_ ((struct frame *, int));
+
+/* Defined in macmenu.c */
+
+extern void x_activate_menubar P_ ((struct frame *));
+extern void free_frame_menubar P_ ((struct frame *));
+
+/* Defined in mac.c.  */
+
+extern void mac_clear_font_name_table P_ ((void));
+extern Lisp_Object mac_aedesc_to_lisp P_ ((const AEDesc *));
 #if TARGET_API_MAC_CARBON
+extern OSErr create_apple_event_from_event_ref P_ ((EventRef, UInt32,
+                                                   EventParamName *,
+                                                   EventParamType *,
+                                                   AppleEvent *));
+extern OSErr create_apple_event_from_drag_ref P_ ((DragRef, UInt32,
+                                                  FlavorType *,
+                                                  AppleEvent *));
 extern CFStringRef cfstring_create_with_utf8_cstring P_ ((const char *));
+extern CFStringRef cfstring_create_with_string P_ ((Lisp_Object));
+extern Lisp_Object cfdata_to_lisp P_ ((CFDataRef));
+extern Lisp_Object cfstring_to_lisp_nodecode P_ ((CFStringRef));
+extern Lisp_Object cfstring_to_lisp P_ ((CFStringRef));
+extern Lisp_Object cfnumber_to_lisp P_ ((CFNumberRef));
+extern Lisp_Object cfdate_to_lisp P_ ((CFDateRef));
+extern Lisp_Object cfboolean_to_lisp P_ ((CFBooleanRef));
+extern Lisp_Object cfobject_desc_to_lisp P_ ((CFTypeRef));
+extern Lisp_Object cfproperty_list_to_lisp P_ ((CFPropertyListRef, int, int));
 #endif
+extern void xrm_merge_string_database P_ ((XrmDatabase, char *));
+extern Lisp_Object xrm_get_resource P_ ((XrmDatabase, char *, char *));
+extern XrmDatabase xrm_get_preference_database P_ ((char *));
+EXFUN (Fmac_get_preference, 4);
 
 /* arch-tag: 6b4ca125-5bef-476d-8ee8-31ed808b7e79
    (do not change this comment) */