]> code.delx.au - gnu-emacs/blobdiff - src/macterm.h
Fix pr-interface-map initialization
[gnu-emacs] / src / macterm.h
index c7d86f157f15961bfc4f869c3bdd36ca6dcf7467..9fbbbc5a2f590ee2acd38cebdee306947a3f121a 100644 (file)
@@ -1,12 +1,12 @@
 /* Display module for Mac OS.
    Copyright (C) 2000, 2001, 2002, 2003, 2004,
-                 2005, 2006 Free Software Foundation, Inc.
+                 2005, 2006, 2007 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
 GNU Emacs is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
 any later version.
 
 GNU Emacs is distributed in the hope that it will be useful,
@@ -64,6 +64,9 @@ struct mac_display_info
   /* Chain of all mac_display_info structures.  */
   struct mac_display_info *next;
 
+  /* The generic display parameters corresponding to this X display. */
+  struct terminal *terminal;
+
   /* This is a cons cell of the form (NAME . FONT-LIST-CACHE).
      The same cons cell also appears in x_display_name_list.  */
   Lisp_Object name_list_element;
@@ -150,7 +153,7 @@ 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 <=
+     font_table[n] is used and valid if 0 <= n < n_fonts.  0 <=
      n_fonts <= font_table_size and font_table[i].name != 0.  */
   int n_fonts;
 
@@ -204,7 +207,6 @@ 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;
 
-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 P_ ((Lisp_Object, char *, char *));
@@ -328,9 +330,22 @@ struct mac_output
      They are changed only when a different background is involved.  */
   unsigned long relief_background;
 
+  /* Width of the internal border.  */
+  int internal_border_width;
+
   /* Hints for the size and the position of a window.  */
   XSizeHints *size_hints;
 
+#if USE_MAC_TOOLBAR
+  /* This variable records the gravity value of the window position if
+     the window has an external tool bar when it is created.  The
+     position of the window is adjusted using this information when
+     the tool bar is first redisplayed.  Once the tool bar is
+     redisplayed, it is set to 0 in order to avoid further
+     adjustment.  */
+  int toolbar_win_gravity;
+#endif
+
 #if USE_CG_DRAWING
   /* Quartz 2D graphics context.  */
   CGContextRef cg_context;
@@ -364,6 +379,12 @@ typedef struct mac_output mac_output;
 /* This is the 'font_info *' which frame F has.  */
 #define FRAME_MAC_FONT_TABLE(f) (FRAME_MAC_DISPLAY_INFO (f)->font_table)
 
+/* The difference in pixels between the top left corner of the
+   Emacs window (including possible window manager decorations)
+   and FRAME_MAC_WINDOW (f).  */
+#define FRAME_OUTER_TO_INNER_DIFF_X(f) ((f)->x_pixels_diff)
+#define FRAME_OUTER_TO_INNER_DIFF_Y(f) ((f)->y_pixels_diff)
+
 /* Value is the smallest width of any character in any font on frame F.  */
 
 #define FRAME_SMALLEST_CHAR_WIDTH(F) \
@@ -401,9 +422,9 @@ struct scroll_bar {
   /* The next and previous in the chain of scroll bars in this frame.  */
   Lisp_Object next, prev;
 
-  /* The Mac control handle of this scroll bar.  Since this is a full
-     32-bit quantity, we store it split into two 32-bit values.  */
-  Lisp_Object control_handle_low, control_handle_high;
+  /* The Mac control reference of this scroll bar.  Since this is a
+     pointer value, we store it split into two Lisp integers.  */
+  Lisp_Object control_ref_low, control_ref_high;
 
   /* The position and size of the scroll bar in pixels, relative to the
      frame.  */
@@ -424,14 +445,25 @@ struct scroll_bar {
 
   /* If the scroll bar handle is currently being dragged by the user,
      this is the number of pixels from the top of the handle to the
-     place where the user grabbed it.  If the handle isn't currently
+     place where the user grabbed it.  If the handle is pressed but
+     not dragged yet, this is a negative integer whose absolute value
+     is the number of pixels plus 1.  If the handle isn't currently
      being dragged, this is Qnil.  */
   Lisp_Object dragging;
 
+#ifdef MAC_OSX
+  /* t if the background of the fringe that is adjacent to a scroll
+     bar is extended to the gap between the fringe and the bar.  */
+  Lisp_Object fringe_extended_p;
+#endif
+
 #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;
+
+  /* Minimum length of the scroll bar handle, in pixels.  */
+  Lisp_Object min_handle;
 #endif
 };
 
@@ -445,25 +477,25 @@ struct scroll_bar {
 #define XSCROLL_BAR(vec) ((struct scroll_bar *) XVECTOR (vec))
 
 
-/* Building a 32-bit C integer from two 16-bit lisp integers.  */
+/* Building a C long integer from two lisp integers.  */
 #define SCROLL_BAR_PACK(low, high) (XINT (high) << 16 | XINT (low))
 
-/* Setting two lisp integers to the low and high words of a 32-bit C int.  */
-#define SCROLL_BAR_UNPACK(low, high, int32) \
-  (XSETINT ((low),   (int32)        & 0xffff), \
-   XSETINT ((high), ((int32) >> 16) & 0xffff))
+/* Setting two lisp integers to two parts of a C unsigned long.  */
+#define SCROLL_BAR_UNPACK(low, high, ulong) \
+  (XSETINT ((low),  (ulong) & 0xffff), \
+   XSETINT ((high), (ulong) >> 16))
 
 
 /* Extract the Mac control handle of the scroll bar from a struct
    scroll_bar.  */
-#define SCROLL_BAR_CONTROL_HANDLE(ptr) \
-  ((ControlHandle) SCROLL_BAR_PACK ((ptr)->control_handle_low, \
-                                    (ptr)->control_handle_high))
+#define SCROLL_BAR_CONTROL_REF(ptr)                            \
+  ((ControlRef) SCROLL_BAR_PACK ((ptr)->control_ref_low,       \
+                                (ptr)->control_ref_high))
 
 /* Store a Mac control handle in a struct scroll_bar.  */
-#define SET_SCROLL_BAR_CONTROL_HANDLE(ptr, id) \
-  (SCROLL_BAR_UNPACK ((ptr)->control_handle_low, \
-                      (ptr)->control_handle_high, (int) id))
+#define SET_SCROLL_BAR_CONTROL_REF(ptr, ref)                           \
+  (SCROLL_BAR_UNPACK ((ptr)->control_ref_low,                          \
+                      (ptr)->control_ref_high, (unsigned long) (ref)))
 
 /* Return the inside width of a vertical scroll bar, given the outside
    width.  */
@@ -522,8 +554,8 @@ struct scroll_bar {
 #define MAC_AQUA_SMALL_VERTICAL_SCROLL_BAR_WIDTH (11)
 
 /* Size of hourglass controls */
-#define HOURGLASS_WIDTH 16
-#define HOURGLASS_HEIGHT 16
+#define HOURGLASS_WIDTH (16)
+#define HOURGLASS_HEIGHT (16)
 
 /* Some constants that are used locally.  */
 /* Creator code for Emacs on Mac OS.  */
@@ -604,10 +636,9 @@ 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,
+extern Pixmap XCreatePixmap P_ ((Display *, WindowRef, unsigned int,
                                 unsigned int, unsigned int));
-extern Pixmap XCreatePixmapFromBitmapData P_ ((Display *, WindowPtr, char *,
+extern Pixmap XCreatePixmapFromBitmapData P_ ((Display *, WindowRef, char *,
                                               unsigned int, unsigned int,
                                               unsigned long, unsigned long,
                                               unsigned int));
@@ -616,7 +647,7 @@ extern GC XCreateGC P_ ((Display *, void *, 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 XSetWindowBackground P_ ((Display *, WindowRef, unsigned long));
 extern void XDrawLine P_ ((Display *, Pixmap, GC, int, int, int, int));
 extern void mac_clear_area P_ ((struct frame *, int, int,
                                unsigned int, unsigned int));
@@ -624,8 +655,8 @@ extern void mac_unload_font P_ ((struct mac_display_info *, XFontStruct *));
 extern int mac_font_panel_visible_p P_ ((void));
 extern OSStatus mac_show_hide_font_panel P_ ((void));
 extern OSStatus mac_set_font_info_for_selection P_ ((struct frame *, int, int));
-extern OSStatus install_window_handler P_ ((WindowPtr));
-extern void remove_window_handler P_ ((WindowPtr));
+extern OSStatus install_window_handler P_ ((WindowRef));
+extern void remove_window_handler P_ ((WindowRef));
 extern OSStatus mac_post_mouse_moved_event P_ ((void));
 #if !TARGET_API_MAC_CARBON
 extern void do_apple_menu P_ ((SInt16));
@@ -633,8 +664,11 @@ extern void do_apple_menu P_ ((SInt16));
 #if USE_CG_DRAWING
 extern void mac_prepare_for_quickdraw P_ ((struct frame *));
 #endif
-#ifdef MAC_OSX
+extern void mac_get_window_bounds P_ ((struct frame *, Rect *, Rect *));
 extern int mac_quit_char_key_p P_ ((UInt32, UInt32));
+#if USE_MAC_TOOLBAR
+extern void update_frame_tool_bar P_ ((FRAME_PTR f));
+extern void free_frame_tool_bar P_ ((FRAME_PTR f));
 #endif
 
 #define FONT_TYPE_FOR_UNIBYTE(font, ch) 0
@@ -646,8 +680,6 @@ 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 *));