aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew Choi <[email protected]>2003-03-24 19:59:08 +0000
committerAndrew Choi <[email protected]>2003-03-24 19:59:08 +0000
commit365fa1b37dd1b61fb384c4ce9fe3b43c91a627e2 (patch)
tree17fc1662d746075bcd58901719384e10c9b4d818 /src
parent73ceba9f1a70558433cb9962a9e5255482b561dc (diff)
Allow building on Mac OS X again after Kim's merging of display code.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog21
-rw-r--r--src/config.in3
-rw-r--r--src/dispextern.h31
-rw-r--r--src/fns.c6
-rw-r--r--src/keyboard.c5
-rw-r--r--src/macgui.h2
-rw-r--r--src/macterm.h43
-rw-r--r--src/xdisp.c124
8 files changed, 109 insertions, 126 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f356ee5515..d4ae917d9b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,24 @@
+2003-03-24 Andrew Choi <[email protected]>
+
+ * 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 <[email protected]>
* xdisp.c (redisplay_window): If mini window's buffer is not
diff --git a/src/config.in b/src/config.in
index 628458ce91..3f107e4707 100644
--- a/src/config.in
+++ b/src/config.in
@@ -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 */
diff --git a/src/dispextern.h b/src/dispextern.h
index a19e0966e2..dcb3640f9a 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -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
diff --git a/src/fns.c b/src/fns.c
index fe3e0f82a3..6c752fc9dd 100644
--- 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"
diff --git a/src/keyboard.c b/src/keyboard.c
index 5a1fc4fa42..4c7aaa0385 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -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
diff --git a/src/macgui.h b/src/macgui.h
index 3e11f2b3d4..d497005e34 100644
--- a/src/macgui.h
+++ b/src/macgui.h
@@ -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
diff --git a/src/macterm.h b/src/macterm.h
index 07f0d6136b..d1b991f5ee 100644
--- a/src/macterm.h
+++ b/src/macterm.h
@@ -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. */
diff --git a/src/xdisp.c b/src/xdisp.c
index a82b71a556..718ef1702d 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -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);
}