# HG changeset patch # User Andrew Choi # Date 1048535948 0 # Node ID c0f3ec529c0595902ffb0188c41e8cc3c0ee0293 # Parent 7e4e15b857f3ba964829b82514fbbf7377e76353 Allow building on Mac OS X again after Kim's merging of display code. diff -r 7e4e15b857f3 -r c0f3ec529c05 src/ChangeLog --- a/src/ChangeLog Mon Mar 24 17:41:43 2003 +0000 +++ b/src/ChangeLog Mon Mar 24 19:59:08 2003 +0000 @@ -1,3 +1,24 @@ +2003-03-24 Andrew Choi + + * 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 * xdisp.c (redisplay_window): If mini window's buffer is not diff -r 7e4e15b857f3 -r c0f3ec529c05 src/config.in --- a/src/config.in Mon Mar 24 17:41:43 2003 +0000 +++ b/src/config.in Mon Mar 24 19:59:08 2003 +0000 @@ -1013,6 +1013,8 @@ # 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 @@ # define BCMP memcmp # define bcmp memcmp #endif +#endif /* MAC_OSX */ #endif /* EMACS_CONFIG_H */ diff -r 7e4e15b857f3 -r c0f3ec529c05 src/dispextern.h --- a/src/dispextern.h Mon Mar 24 17:41:43 2003 +0000 +++ b/src/dispextern.h Mon Mar 24 19:59:08 2003 +0000 @@ -58,9 +58,38 @@ 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 +#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 -r 7e4e15b857f3 -r c0f3ec529c05 src/fns.c --- a/src/fns.c Mon Mar 24 17:41:43 2003 +0000 +++ b/src/fns.c Mon Mar 24 19:59:08 2003 +0000 @@ -26,10 +26,16 @@ #endif #include +#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 -r 7e4e15b857f3 -r c0f3ec529c05 src/keyboard.c --- a/src/keyboard.c Mon Mar 24 17:41:43 2003 +0000 +++ b/src/keyboard.c Mon Mar 24 19:59:08 2003 +0000 @@ -10584,6 +10584,11 @@ 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 -r 7e4e15b857f3 -r c0f3ec529c05 src/macgui.h --- a/src/macgui.h Mon Mar 24 17:41:43 2003 +0000 +++ b/src/macgui.h Mon Mar 24 19:59:08 2003 +0000 @@ -30,8 +30,6 @@ typedef unsigned long Time; -#define No_Cursor (0) /* fix later */ - #if MAC_OSX typedef struct OpaqueWindowPtr* Window; #else diff -r 7e4e15b857f3 -r c0f3ec529c05 src/macterm.h --- a/src/macterm.h Mon Mar 24 17:41:43 2003 +0000 +++ b/src/macterm.h Mon Mar 24 19:59:08 2003 +0000 @@ -23,6 +23,36 @@ #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 +#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 @@ 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 @@ 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 -r 7e4e15b857f3 -r c0f3ec529c05 src/xdisp.c --- a/src/xdisp.c Mon Mar 24 17:41:43 2003 +0000 +++ b/src/xdisp.c Mon Mar 24 19:59:08 2003 +0000 @@ -198,6 +198,8 @@ #endif #ifdef MAC_OS #include "macterm.h" + +Cursor No_Cursor; #endif #ifndef FRAME_X_OUTPUT @@ -18341,9 +18343,6 @@ 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 @@ && 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 @@ 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 @@ w->phys_cursor_on_p = 0; } } -#endif } #endif /* HAVE_WINDOW_SYSTEM */ @@ -18834,16 +18821,12 @@ 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 @@ } -#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 @@ 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 @@ 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_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 @@ set_cursor: +#ifndef HAVE_CARBON if (cursor != No_Cursor) +#else + if (bcmp (&cursor, &No_Cursor, sizeof (Cursor))) +#endif rif->define_frame_cursor (f, cursor); }