#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"
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. */
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. */
#endif
#ifdef MAC_OS
#include "macterm.h"
+
+Cursor No_Cursor;
#endif
#ifndef FRAME_X_OUTPUT
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
&& updated_window->phys_cursor.hpos >= hpos
&& updated_window->phys_cursor.hpos < hpos + len)
updated_window->phys_cursor_on_p = 0;
-#endif
UNBLOCK_INPUT;
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;
w->phys_cursor_on_p = 0;
}
}
-#endif
}
#endif /* HAVE_WINDOW_SYSTEM */
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))
}
-#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
rif->define_frame_cursor (f, cursor);
}
-#endif /* !HAVE_CARBON */
-
/* EXPORT:
Take proper action when the mouse has moved to position X, Y on
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)
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;
set_cursor:
+#ifndef HAVE_CARBON
if (cursor != No_Cursor)
+#else
+ if (bcmp (&cursor, &No_Cursor, sizeof (Cursor)))
+#endif
rif->define_frame_cursor (f, cursor);
}