]> git.eshelyaron.com Git - emacs.git/commitdiff
Allow building on Mac OS X again after Kim's merging of display code.
authorAndrew Choi <akochoi@shaw.ca>
Mon, 24 Mar 2003 19:59:08 +0000 (19:59 +0000)
committerAndrew Choi <akochoi@shaw.ca>
Mon, 24 Mar 2003 19:59:08 +0000 (19:59 +0000)
src/ChangeLog
src/config.in
src/dispextern.h
src/fns.c
src/keyboard.c
src/macgui.h
src/macterm.h
src/xdisp.c

index f356ee5515b977a09716949a92fc541a3d2f17c7..d4ae917d9b1659b44ac38a2d806aaeae39f6d0fb 100644 (file)
@@ -1,3 +1,24 @@
+2003-03-24  Andrew Choi  <akochoi@shaw.ca>
+
+       * config.in [MAC_OSX]: Do not redefine bcopy, bzero, and bcmp.
+
+       * dispextern.h [HAVE_CARBON]: Include Carbon.h.
+
+       * fns.c [MAC_OSX]: Do not redefine vector.
+
+       * keyboard.c [MAC_OSX]: Handle SIGINT with interrupt_signal.
+
+       * macgui.h: Remove definition of No_Cursor.
+
+       * macterm.h: Include Carbon.h.  Replace (struct Cursor *) by
+       Cursor.
+
+       * xdisp.c: Define No_Cursor.
+       (x_write_glyphs, notice_overwritten_cursor)
+       (draw_phys_cursor_glyph, note_mode_line_or_margin_highlight)
+       (note_mouse_highlight): Remove Mac-specific code.
+       (note_mouse_highlight): Use bcmp instead of == to compare Cursors.
+       
 2003-03-24  John Paul Wallington  <jpw@gnu.org>
 
        * xdisp.c (redisplay_window): If mini window's buffer is not
index 628458ce91bdac83bb76167fd9ad93a0682e0f2f..3f107e470757a4cf3d86932d0052d9badd8bada8 100644 (file)
@@ -1013,6 +1013,8 @@ typedef unsigned size_t;
 #  endif
 #endif
 
+#ifndef MAC_OSX
+/* On Mac OS X, macros already defined in precompiled headers.  */
 /* avoid deprecated functions */
 #if HAVE_MEMCPY
 #  define bcopy(a,b,s) memcpy (b,a,s)
@@ -1024,6 +1026,7 @@ typedef unsigned size_t;
 #  define BCMP memcmp
 #  define bcmp memcmp
 #endif
+#endif /* MAC_OSX */
 
 #endif /* EMACS_CONFIG_H */
 
index a19e0966e2eb11d26e416285a29b44e5eb1d2dde..dcb3640f9a67b32777dd657c48a5a46d0d8ac192 100644 (file)
@@ -58,9 +58,38 @@ typedef struct x_display_info Display_Info;
 typedef struct w32_display_info Display_Info;
 #endif
 
-#ifdef MAC_OS
+#ifdef HAVE_CARBON
 #include "macgui.h"
 typedef struct mac_display_info Display_Info;
+
+/* Include Carbon.h to define Cursor and Rect.  */
+#undef mktime
+#undef DEBUG
+#undef Z
+#undef free
+#undef malloc
+#undef realloc
+/* Macros max and min defined in lisp.h conflict with those in
+   precompiled header Carbon.h.  */
+#undef max
+#undef min
+#undef init_process
+#include <Carbon/Carbon.h>
+#undef Z
+#define Z (current_buffer->text->z)
+#undef free
+#define free unexec_free
+#undef malloc
+#define malloc unexec_malloc
+#undef realloc
+#define realloc unexec_realloc
+#undef min
+#define min(a, b) ((a) < (b) ? (a) : (b))
+#undef max
+#define max(a, b) ((a) > (b) ? (a) : (b))
+#undef init_process
+#define init_process emacs_init_process
+
 #endif
 
 
index fe3e0f82a3f9b06ce32d10f0f8fd47ee6485a435..6c752fc9dd99e7ec89928c7b55cc805c2e756da6 100644 (file)
--- a/src/fns.c
+++ b/src/fns.c
@@ -26,10 +26,16 @@ Boston, MA 02111-1307, USA.  */
 #endif
 #include <time.h>
 
+#ifndef MAC_OSX
+/* On Mac OS X, defining this conflicts with precompiled headers.  */
+
 /* Note on some machines this defines `vector' as a typedef,
    so make sure we don't use that name in this file.  */
 #undef vector
 #define vector *****
+
+#endif  /* ! MAC_OSX */
+
 #include "lisp.h"
 #include "commands.h"
 #include "charset.h"
index 5a1fc4fa4241bafb3cb9fe641c5daf7fbdfdad6a..4c7aaa0385926d041ac14c1e2501c25f1be898f5 100644 (file)
@@ -10584,6 +10584,11 @@ init_keyboard ()
   poll_suppress_count = 1;
   start_polling ();
 #endif
+
+#ifdef MAC_OSX
+  /* At least provide an escape route since C-g doesn't work.  */
+  signal (SIGINT, interrupt_signal);
+#endif
 }
 
 /* This type's only use is in syms_of_keyboard, to initialize the
index 3e11f2b3d4089db99af984f4a98acab91a8ee9bb..d497005e3444885fab61a9e18cf4c1bd8e735071 100644 (file)
@@ -30,8 +30,6 @@ typedef int Display;  /* fix later */
 
 typedef unsigned long Time;
 
-#define No_Cursor (0)  /* fix later */
-
 #if MAC_OSX
 typedef struct OpaqueWindowPtr* Window;
 #else
index 07f0d6136b677ae9dc781c6dbbd70acc8468f98c..d1b991f5eef05ca5a9fa9338da4a3430b7db5fee 100644 (file)
@@ -23,6 +23,36 @@ Boston, MA 02111-1307, USA.  */
 #include "macgui.h"
 #include "frame.h"
 
+/* Include Carbon.h to define Cursor and Rect.  */
+#ifdef HAVE_CARBON
+#undef mktime
+#undef DEBUG
+#undef Z
+#undef free
+#undef malloc
+#undef realloc
+/* Macros max and min defined in lisp.h conflict with those in
+   precompiled header Carbon.h.  */
+#undef max
+#undef min
+#undef init_process
+#include <Carbon/Carbon.h>
+#undef Z
+#define Z (current_buffer->text->z)
+#undef free
+#define free unexec_free
+#undef malloc
+#define malloc unexec_malloc
+#undef realloc
+#define realloc unexec_realloc
+#undef min
+#define min(a, b) ((a) < (b) ? (a) : (b))
+#undef max
+#define max(a, b) ((a) > (b) ? (a) : (b))
+#undef init_process
+#define init_process emacs_init_process
+#endif /* MAC_OSX */
+
 /* The class of this X application.  */
 #define EMACS_CLASS "Emacs"
 
@@ -96,7 +126,7 @@ 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;
 
 #if 0
   /* color palette information.  */
@@ -328,11 +358,12 @@ struct mac_output {
   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 *hand_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.  */
index a82b71a5563f57922023657ed15906c263f4d375..718ef1702d0cdb72c39c7203edfb74703da939c0 100644 (file)
@@ -198,6 +198,8 @@ Boston, MA 02111-1307, USA.  */
 #endif
 #ifdef MAC_OS
 #include "macterm.h"
+
+Cursor No_Cursor;
 #endif
 
 #ifndef FRAME_X_OUTPUT
@@ -18341,9 +18343,6 @@ x_write_glyphs (start, len)
                   hpos, hpos + len,
                   DRAW_NORMAL_TEXT, 0);
 
-#ifndef HAVE_CARBON  
-  /* ++KFS: Why not on MAC ? */
-
   /* Invalidate old phys cursor if the glyph at its hpos is redrawn.  */
   if (updated_area == TEXT_AREA
       && updated_window->phys_cursor_on_p
@@ -18351,7 +18350,6 @@ x_write_glyphs (start, len)
       && updated_window->phys_cursor.hpos >= hpos
       && updated_window->phys_cursor.hpos < hpos + len)
     updated_window->phys_cursor_on_p = 0;
-#endif
 
   UNBLOCK_INPUT;
 
@@ -18710,16 +18708,6 @@ notice_overwritten_cursor (w, area, x0, x1, y0, y1)
      enum glyph_row_area area;
      int x0, y0, x1, y1;
 {
-#ifdef HAVE_CARBON
-  /* ++KFS:  Why is there a special version of this for the mac ? */
-  if (area == TEXT_AREA
-      && w->phys_cursor_on_p
-      && y0 <= w->phys_cursor.y
-      && y1 >= w->phys_cursor.y + w->phys_cursor_height
-      && x0 <= w->phys_cursor.x
-      && (x1 < 0 || x1 > w->phys_cursor.x))
-    w->phys_cursor_on_p = 0;
-#else
   if (area == TEXT_AREA && w->phys_cursor_on_p)
     {
       int cx0 = w->phys_cursor.x;
@@ -18750,7 +18738,6 @@ notice_overwritten_cursor (w, area, x0, x1, y0, y1)
            w->phys_cursor_on_p = 0;
        }
     }
-#endif
 }
 
 #endif /* HAVE_WINDOW_SYSTEM */
@@ -18834,16 +18821,12 @@ draw_phys_cursor_glyph (w, row, hl)
                        hl, 0);
       w->phys_cursor_on_p = on_p;
 
-#ifndef HAVE_CARBON
-      /* ++KFS: MAC version did not adjust phys_cursor_width (bug?) */
       if (hl == DRAW_CURSOR)
        w->phys_cursor_width = x1 - w->phys_cursor.x;
-      else
-#endif
       /* When we erase the cursor, and ROW is overlapped by other
         rows, make sure that these overlapping parts of other rows
         are redrawn.  */
-      if (hl == DRAW_NORMAL_TEXT && row->overlapped_p)
+      else if (hl == DRAW_NORMAL_TEXT && row->overlapped_p)
        {
          if (row > w->current_matrix->rows
              && MATRIX_ROW_OVERLAPS_SUCC_P (row - 1))
@@ -19497,90 +19480,6 @@ fast_find_string_pos (w, pos, object, hpos, vpos, x, y, right_p)
 }
 
 
-#ifdef HAVE_CARBON  
-
-/* ++KFS: Why does MAC have its own version here?  Looks like OLD CODE!! */
-
-/* Take proper action when mouse has moved to the mode or header line of
-   window W, x-position X.  MODE_LINE_P non-zero means mouse is on the
-   mode line.  X is relative to the start of the text display area of
-   W, so the width of fringes and scroll bars must be subtracted
-   to get a position relative to the start of the mode line.  */
-
-static void
-note_mode_line_highlight (w, x, mode_line_p)
-     struct window *w;
-     int x, mode_line_p;
-{
-  struct frame *f = XFRAME (w->frame);
-  struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f);
-  Cursor *cursor = dpyinfo->vertical_scroll_bar_cursor;
-  struct glyph_row *row;
-
-  if (mode_line_p)
-    row = MATRIX_MODE_LINE_ROW (w->current_matrix);
-  else
-    row = MATRIX_HEADER_LINE_ROW (w->current_matrix);
-
-  if (row->enabled_p)
-    {
-      struct glyph *glyph, *end;
-      Lisp_Object help, map;
-      int x0;
-
-      /* Find the glyph under X.  */
-      glyph = row->glyphs[TEXT_AREA];
-      end = glyph + row->used[TEXT_AREA];
-      x0 = - (FRAME_LEFT_SCROLL_BAR_WIDTH (f) * CANON_X_UNIT (f)
-             + FRAME_X_LEFT_FRINGE_WIDTH (f));
-
-      while (glyph < end
-            && x >= x0 + glyph->pixel_width)
-       {
-         x0 += glyph->pixel_width;
-         ++glyph;
-       }
-
-      if (glyph < end
-         && STRINGP (glyph->object)
-         && STRING_INTERVALS (glyph->object)
-         && glyph->charpos >= 0
-         && glyph->charpos < SCHARS (glyph->object))
-       {
-         /* If we're on a string with `help-echo' text property,
-            arrange for the help to be displayed.  This is done by
-            setting the global variable help_echo_string to the help
-            string.  */
-         help = Fget_text_property (make_number (glyph->charpos),
-                                    Qhelp_echo, glyph->object);
-         if (!NILP (help))
-            {
-              help_echo_string = help;
-              XSETWINDOW (help_echo_window, w);
-              help_echo_object = glyph->object;
-              help_echo_pos = glyph->charpos;
-            }
-
-         /* Change the mouse pointer according to what is under X/Y.  */
-         map = Fget_text_property (make_number (glyph->charpos),
-                                   Qlocal_map, glyph->object);
-         if (KEYMAPP (map))
-           cursor = f->output_data.mac->nontext_cursor;
-         else
-           {
-             map = Fget_text_property (make_number (glyph->charpos),
-                                       Qkeymap, glyph->object);
-             if (KEYMAPP (map))
-               cursor = f->output_data.mac->nontext_cursor;
-           }
-       }
-    }
-
-  rif->define_frame_cursor (f, cursor);
-}
-
-#else
-
 /* Take proper action when mouse has moved to the mode or header line
    or marginal area AREA of window W, x-position X and y-position Y.
    X is relative to the start of the text display area of W, so the
@@ -19631,8 +19530,6 @@ note_mode_line_or_margin_highlight (w, x, y, area)
   rif->define_frame_cursor (f, cursor);
 }
 
-#endif /* !HAVE_CARBON */
-
 
 /* EXPORT:
    Take proper action when the mouse has moved to position X, Y on
@@ -19702,16 +19599,6 @@ note_mouse_highlight (f, x, y)
       return;
     }
 
-#ifdef HAVE_CARBON
-  /* ++KFS: Why does MAC have its own version here?  Looks like OLD CODE!! */
-
-  /* Mouse is on the mode or header line?  */
-  if (part == ON_MODE_LINE || part == ON_HEADER_LINE)
-    {
-      note_mode_line_highlight (w, x, part == ON_MODE_LINE);
-      return;
-    }
-#else
   /* Mouse is on the mode, header line or margin?  */
   if (part == ON_MODE_LINE || part == ON_HEADER_LINE
       || part == ON_LEFT_MARGIN || part == ON_RIGHT_MARGIN)
@@ -19719,7 +19606,6 @@ note_mouse_highlight (f, x, y)
       note_mode_line_or_margin_highlight (w, x, y, part);
       return;
     }
-#endif
 
   if (part == ON_VERTICAL_BORDER)
     cursor = FRAME_X_OUTPUT (f)->horizontal_drag_cursor;
@@ -20087,7 +19973,11 @@ note_mouse_highlight (f, x, y)
 
  set_cursor:
 
+#ifndef HAVE_CARBON
   if (cursor != No_Cursor)
+#else
+  if (bcmp (&cursor, &No_Cursor, sizeof (Cursor)))
+#endif
     rif->define_frame_cursor (f, cursor);
 }