aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAndrew Choi2003-03-24 19:59:08 +0000
committerAndrew Choi2003-03-24 19:59:08 +0000
commit365fa1b37dd1b61fb384c4ce9fe3b43c91a627e2 (patch)
tree17fc1662d746075bcd58901719384e10c9b4d818 /src
parent73ceba9f1a70558433cb9962a9e5255482b561dc (diff)
downloademacs-365fa1b37dd1b61fb384c4ce9fe3b43c91a627e2.tar.gz
emacs-365fa1b37dd1b61fb384c4ce9fe3b43c91a627e2.zip
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 f356ee5515b..d4ae917d9b1 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,24 @@
12003-03-24 Andrew Choi <akochoi@shaw.ca>
2
3 * config.in [MAC_OSX]: Do not redefine bcopy, bzero, and bcmp.
4
5 * dispextern.h [HAVE_CARBON]: Include Carbon.h.
6
7 * fns.c [MAC_OSX]: Do not redefine vector.
8
9 * keyboard.c [MAC_OSX]: Handle SIGINT with interrupt_signal.
10
11 * macgui.h: Remove definition of No_Cursor.
12
13 * macterm.h: Include Carbon.h. Replace (struct Cursor *) by
14 Cursor.
15
16 * xdisp.c: Define No_Cursor.
17 (x_write_glyphs, notice_overwritten_cursor)
18 (draw_phys_cursor_glyph, note_mode_line_or_margin_highlight)
19 (note_mouse_highlight): Remove Mac-specific code.
20 (note_mouse_highlight): Use bcmp instead of == to compare Cursors.
21
12003-03-24 John Paul Wallington <jpw@gnu.org> 222003-03-24 John Paul Wallington <jpw@gnu.org>
2 23
3 * xdisp.c (redisplay_window): If mini window's buffer is not 24 * xdisp.c (redisplay_window): If mini window's buffer is not
diff --git a/src/config.in b/src/config.in
index 628458ce91b..3f107e47075 100644
--- a/src/config.in
+++ b/src/config.in
@@ -1013,6 +1013,8 @@ typedef unsigned size_t;
1013# endif 1013# endif
1014#endif 1014#endif
1015 1015
1016#ifndef MAC_OSX
1017/* On Mac OS X, macros already defined in precompiled headers. */
1016/* avoid deprecated functions */ 1018/* avoid deprecated functions */
1017#if HAVE_MEMCPY 1019#if HAVE_MEMCPY
1018# define bcopy(a,b,s) memcpy (b,a,s) 1020# define bcopy(a,b,s) memcpy (b,a,s)
@@ -1024,6 +1026,7 @@ typedef unsigned size_t;
1024# define BCMP memcmp 1026# define BCMP memcmp
1025# define bcmp memcmp 1027# define bcmp memcmp
1026#endif 1028#endif
1029#endif /* MAC_OSX */
1027 1030
1028#endif /* EMACS_CONFIG_H */ 1031#endif /* EMACS_CONFIG_H */
1029 1032
diff --git a/src/dispextern.h b/src/dispextern.h
index a19e0966e2e..dcb3640f9a6 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -58,9 +58,38 @@ typedef struct x_display_info Display_Info;
58typedef struct w32_display_info Display_Info; 58typedef struct w32_display_info Display_Info;
59#endif 59#endif
60 60
61#ifdef MAC_OS 61#ifdef HAVE_CARBON
62#include "macgui.h" 62#include "macgui.h"
63typedef struct mac_display_info Display_Info; 63typedef struct mac_display_info Display_Info;
64
65/* Include Carbon.h to define Cursor and Rect. */
66#undef mktime
67#undef DEBUG
68#undef Z
69#undef free
70#undef malloc
71#undef realloc
72/* Macros max and min defined in lisp.h conflict with those in
73 precompiled header Carbon.h. */
74#undef max
75#undef min
76#undef init_process
77#include <Carbon/Carbon.h>
78#undef Z
79#define Z (current_buffer->text->z)
80#undef free
81#define free unexec_free
82#undef malloc
83#define malloc unexec_malloc
84#undef realloc
85#define realloc unexec_realloc
86#undef min
87#define min(a, b) ((a) < (b) ? (a) : (b))
88#undef max
89#define max(a, b) ((a) > (b) ? (a) : (b))
90#undef init_process
91#define init_process emacs_init_process
92
64#endif 93#endif
65 94
66 95
diff --git a/src/fns.c b/src/fns.c
index fe3e0f82a3f..6c752fc9dd9 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -26,10 +26,16 @@ Boston, MA 02111-1307, USA. */
26#endif 26#endif
27#include <time.h> 27#include <time.h>
28 28
29#ifndef MAC_OSX
30/* On Mac OS X, defining this conflicts with precompiled headers. */
31
29/* Note on some machines this defines `vector' as a typedef, 32/* Note on some machines this defines `vector' as a typedef,
30 so make sure we don't use that name in this file. */ 33 so make sure we don't use that name in this file. */
31#undef vector 34#undef vector
32#define vector ***** 35#define vector *****
36
37#endif /* ! MAC_OSX */
38
33#include "lisp.h" 39#include "lisp.h"
34#include "commands.h" 40#include "commands.h"
35#include "charset.h" 41#include "charset.h"
diff --git a/src/keyboard.c b/src/keyboard.c
index 5a1fc4fa424..4c7aaa03859 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -10584,6 +10584,11 @@ init_keyboard ()
10584 poll_suppress_count = 1; 10584 poll_suppress_count = 1;
10585 start_polling (); 10585 start_polling ();
10586#endif 10586#endif
10587
10588#ifdef MAC_OSX
10589 /* At least provide an escape route since C-g doesn't work. */
10590 signal (SIGINT, interrupt_signal);
10591#endif
10587} 10592}
10588 10593
10589/* This type's only use is in syms_of_keyboard, to initialize the 10594/* This type's only use is in syms_of_keyboard, to initialize the
diff --git a/src/macgui.h b/src/macgui.h
index 3e11f2b3d40..d497005e344 100644
--- a/src/macgui.h
+++ b/src/macgui.h
@@ -30,8 +30,6 @@ typedef int Display; /* fix later */
30 30
31typedef unsigned long Time; 31typedef unsigned long Time;
32 32
33#define No_Cursor (0) /* fix later */
34
35#if MAC_OSX 33#if MAC_OSX
36typedef struct OpaqueWindowPtr* Window; 34typedef struct OpaqueWindowPtr* Window;
37#else 35#else
diff --git a/src/macterm.h b/src/macterm.h
index 07f0d6136b6..d1b991f5eef 100644
--- a/src/macterm.h
+++ b/src/macterm.h
@@ -23,6 +23,36 @@ Boston, MA 02111-1307, USA. */
23#include "macgui.h" 23#include "macgui.h"
24#include "frame.h" 24#include "frame.h"
25 25
26/* Include Carbon.h to define Cursor and Rect. */
27#ifdef HAVE_CARBON
28#undef mktime
29#undef DEBUG
30#undef Z
31#undef free
32#undef malloc
33#undef realloc
34/* Macros max and min defined in lisp.h conflict with those in
35 precompiled header Carbon.h. */
36#undef max
37#undef min
38#undef init_process
39#include <Carbon/Carbon.h>
40#undef Z
41#define Z (current_buffer->text->z)
42#undef free
43#define free unexec_free
44#undef malloc
45#define malloc unexec_malloc
46#undef realloc
47#define realloc unexec_realloc
48#undef min
49#define min(a, b) ((a) < (b) ? (a) : (b))
50#undef max
51#define max(a, b) ((a) > (b) ? (a) : (b))
52#undef init_process
53#define init_process emacs_init_process
54#endif /* MAC_OSX */
55
26/* The class of this X application. */ 56/* The class of this X application. */
27#define EMACS_CLASS "Emacs" 57#define EMACS_CLASS "Emacs"
28 58
@@ -96,7 +126,7 @@ struct mac_display_info
96 Window root_window; 126 Window root_window;
97 127
98 /* The cursor to use for vertical scroll bars. */ 128 /* The cursor to use for vertical scroll bars. */
99 struct Cursor *vertical_scroll_bar_cursor; 129 Cursor vertical_scroll_bar_cursor;
100 130
101#if 0 131#if 0
102 /* color palette information. */ 132 /* color palette information. */
@@ -328,11 +358,12 @@ struct mac_output {
328 unsigned long scroll_bar_background_pixel; 358 unsigned long scroll_bar_background_pixel;
329 359
330 /* Descriptor for the cursor in use for this window. */ 360 /* Descriptor for the cursor in use for this window. */
331 struct Cursor *text_cursor; 361 Cursor text_cursor;
332 struct Cursor *nontext_cursor; 362 Cursor nontext_cursor;
333 struct Cursor *modeline_cursor; 363 Cursor modeline_cursor;
334 struct Cursor *hand_cursor; 364 Cursor hand_cursor;
335 struct Cursor *hourglass_cursor; 365 Cursor hourglass_cursor;
366 Cursor horizontal_drag_cursor;
336#if 0 367#if 0
337 /* Window whose cursor is hourglass_cursor. This window is temporarily 368 /* Window whose cursor is hourglass_cursor. This window is temporarily
338 mapped to display a hourglass-cursor. */ 369 mapped to display a hourglass-cursor. */
diff --git a/src/xdisp.c b/src/xdisp.c
index a82b71a5563..718ef1702d0 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -198,6 +198,8 @@ Boston, MA 02111-1307, USA. */
198#endif 198#endif
199#ifdef MAC_OS 199#ifdef MAC_OS
200#include "macterm.h" 200#include "macterm.h"
201
202Cursor No_Cursor;
201#endif 203#endif
202 204
203#ifndef FRAME_X_OUTPUT 205#ifndef FRAME_X_OUTPUT
@@ -18341,9 +18343,6 @@ x_write_glyphs (start, len)
18341 hpos, hpos + len, 18343 hpos, hpos + len,
18342 DRAW_NORMAL_TEXT, 0); 18344 DRAW_NORMAL_TEXT, 0);
18343 18345
18344#ifndef HAVE_CARBON
18345 /* ++KFS: Why not on MAC ? */
18346
18347 /* Invalidate old phys cursor if the glyph at its hpos is redrawn. */ 18346 /* Invalidate old phys cursor if the glyph at its hpos is redrawn. */
18348 if (updated_area == TEXT_AREA 18347 if (updated_area == TEXT_AREA
18349 && updated_window->phys_cursor_on_p 18348 && updated_window->phys_cursor_on_p
@@ -18351,7 +18350,6 @@ x_write_glyphs (start, len)
18351 && updated_window->phys_cursor.hpos >= hpos 18350 && updated_window->phys_cursor.hpos >= hpos
18352 && updated_window->phys_cursor.hpos < hpos + len) 18351 && updated_window->phys_cursor.hpos < hpos + len)
18353 updated_window->phys_cursor_on_p = 0; 18352 updated_window->phys_cursor_on_p = 0;
18354#endif
18355 18353
18356 UNBLOCK_INPUT; 18354 UNBLOCK_INPUT;
18357 18355
@@ -18710,16 +18708,6 @@ notice_overwritten_cursor (w, area, x0, x1, y0, y1)
18710 enum glyph_row_area area; 18708 enum glyph_row_area area;
18711 int x0, y0, x1, y1; 18709 int x0, y0, x1, y1;
18712{ 18710{
18713#ifdef HAVE_CARBON
18714 /* ++KFS: Why is there a special version of this for the mac ? */
18715 if (area == TEXT_AREA
18716 && w->phys_cursor_on_p
18717 && y0 <= w->phys_cursor.y
18718 && y1 >= w->phys_cursor.y + w->phys_cursor_height
18719 && x0 <= w->phys_cursor.x
18720 && (x1 < 0 || x1 > w->phys_cursor.x))
18721 w->phys_cursor_on_p = 0;
18722#else
18723 if (area == TEXT_AREA && w->phys_cursor_on_p) 18711 if (area == TEXT_AREA && w->phys_cursor_on_p)
18724 { 18712 {
18725 int cx0 = w->phys_cursor.x; 18713 int cx0 = w->phys_cursor.x;
@@ -18750,7 +18738,6 @@ notice_overwritten_cursor (w, area, x0, x1, y0, y1)
18750 w->phys_cursor_on_p = 0; 18738 w->phys_cursor_on_p = 0;
18751 } 18739 }
18752 } 18740 }
18753#endif
18754} 18741}
18755 18742
18756#endif /* HAVE_WINDOW_SYSTEM */ 18743#endif /* HAVE_WINDOW_SYSTEM */
@@ -18834,16 +18821,12 @@ draw_phys_cursor_glyph (w, row, hl)
18834 hl, 0); 18821 hl, 0);
18835 w->phys_cursor_on_p = on_p; 18822 w->phys_cursor_on_p = on_p;
18836 18823
18837#ifndef HAVE_CARBON
18838 /* ++KFS: MAC version did not adjust phys_cursor_width (bug?) */
18839 if (hl == DRAW_CURSOR) 18824 if (hl == DRAW_CURSOR)
18840 w->phys_cursor_width = x1 - w->phys_cursor.x; 18825 w->phys_cursor_width = x1 - w->phys_cursor.x;
18841 else
18842#endif
18843 /* When we erase the cursor, and ROW is overlapped by other 18826 /* When we erase the cursor, and ROW is overlapped by other
18844 rows, make sure that these overlapping parts of other rows 18827 rows, make sure that these overlapping parts of other rows
18845 are redrawn. */ 18828 are redrawn. */
18846 if (hl == DRAW_NORMAL_TEXT && row->overlapped_p) 18829 else if (hl == DRAW_NORMAL_TEXT && row->overlapped_p)
18847 { 18830 {
18848 if (row > w->current_matrix->rows 18831 if (row > w->current_matrix->rows
18849 && MATRIX_ROW_OVERLAPS_SUCC_P (row - 1)) 18832 && MATRIX_ROW_OVERLAPS_SUCC_P (row - 1))
@@ -19497,90 +19480,6 @@ fast_find_string_pos (w, pos, object, hpos, vpos, x, y, right_p)
19497} 19480}
19498 19481
19499 19482
19500#ifdef HAVE_CARBON
19501
19502/* ++KFS: Why does MAC have its own version here? Looks like OLD CODE!! */
19503
19504/* Take proper action when mouse has moved to the mode or header line of
19505 window W, x-position X. MODE_LINE_P non-zero means mouse is on the
19506 mode line. X is relative to the start of the text display area of
19507 W, so the width of fringes and scroll bars must be subtracted
19508 to get a position relative to the start of the mode line. */
19509
19510static void
19511note_mode_line_highlight (w, x, mode_line_p)
19512 struct window *w;
19513 int x, mode_line_p;
19514{
19515 struct frame *f = XFRAME (w->frame);
19516 struct mac_display_info *dpyinfo = FRAME_MAC_DISPLAY_INFO (f);
19517 Cursor *cursor = dpyinfo->vertical_scroll_bar_cursor;
19518 struct glyph_row *row;
19519
19520 if (mode_line_p)
19521 row = MATRIX_MODE_LINE_ROW (w->current_matrix);
19522 else
19523 row = MATRIX_HEADER_LINE_ROW (w->current_matrix);
19524
19525 if (row->enabled_p)
19526 {
19527 struct glyph *glyph, *end;
19528 Lisp_Object help, map;
19529 int x0;
19530
19531 /* Find the glyph under X. */
19532 glyph = row->glyphs[TEXT_AREA];
19533 end = glyph + row->used[TEXT_AREA];
19534 x0 = - (FRAME_LEFT_SCROLL_BAR_WIDTH (f) * CANON_X_UNIT (f)
19535 + FRAME_X_LEFT_FRINGE_WIDTH (f));
19536
19537 while (glyph < end
19538 && x >= x0 + glyph->pixel_width)
19539 {
19540 x0 += glyph->pixel_width;
19541 ++glyph;
19542 }
19543
19544 if (glyph < end
19545 && STRINGP (glyph->object)
19546 && STRING_INTERVALS (glyph->object)
19547 && glyph->charpos >= 0
19548 && glyph->charpos < SCHARS (glyph->object))
19549 {
19550 /* If we're on a string with `help-echo' text property,
19551 arrange for the help to be displayed. This is done by
19552 setting the global variable help_echo_string to the help
19553 string. */
19554 help = Fget_text_property (make_number (glyph->charpos),
19555 Qhelp_echo, glyph->object);
19556 if (!NILP (help))
19557 {
19558 help_echo_string = help;
19559 XSETWINDOW (help_echo_window, w);
19560 help_echo_object = glyph->object;
19561 help_echo_pos = glyph->charpos;
19562 }
19563
19564 /* Change the mouse pointer according to what is under X/Y. */
19565 map = Fget_text_property (make_number (glyph->charpos),
19566 Qlocal_map, glyph->object);
19567 if (KEYMAPP (map))
19568 cursor = f->output_data.mac->nontext_cursor;
19569 else
19570 {
19571 map = Fget_text_property (make_number (glyph->charpos),
19572 Qkeymap, glyph->object);
19573 if (KEYMAPP (map))
19574 cursor = f->output_data.mac->nontext_cursor;
19575 }
19576 }
19577 }
19578
19579 rif->define_frame_cursor (f, cursor);
19580}
19581
19582#else
19583
19584/* Take proper action when mouse has moved to the mode or header line 19483/* Take proper action when mouse has moved to the mode or header line
19585 or marginal area AREA of window W, x-position X and y-position Y. 19484 or marginal area AREA of window W, x-position X and y-position Y.
19586 X is relative to the start of the text display area of W, so the 19485 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)
19631 rif->define_frame_cursor (f, cursor); 19530 rif->define_frame_cursor (f, cursor);
19632} 19531}
19633 19532
19634#endif /* !HAVE_CARBON */
19635
19636 19533
19637/* EXPORT: 19534/* EXPORT:
19638 Take proper action when the mouse has moved to position X, Y on 19535 Take proper action when the mouse has moved to position X, Y on
@@ -19702,16 +19599,6 @@ note_mouse_highlight (f, x, y)
19702 return; 19599 return;
19703 } 19600 }
19704 19601
19705#ifdef HAVE_CARBON
19706 /* ++KFS: Why does MAC have its own version here? Looks like OLD CODE!! */
19707
19708 /* Mouse is on the mode or header line? */
19709 if (part == ON_MODE_LINE || part == ON_HEADER_LINE)
19710 {
19711 note_mode_line_highlight (w, x, part == ON_MODE_LINE);
19712 return;
19713 }
19714#else
19715 /* Mouse is on the mode, header line or margin? */ 19602 /* Mouse is on the mode, header line or margin? */
19716 if (part == ON_MODE_LINE || part == ON_HEADER_LINE 19603 if (part == ON_MODE_LINE || part == ON_HEADER_LINE
19717 || part == ON_LEFT_MARGIN || part == ON_RIGHT_MARGIN) 19604 || part == ON_LEFT_MARGIN || part == ON_RIGHT_MARGIN)
@@ -19719,7 +19606,6 @@ note_mouse_highlight (f, x, y)
19719 note_mode_line_or_margin_highlight (w, x, y, part); 19606 note_mode_line_or_margin_highlight (w, x, y, part);
19720 return; 19607 return;
19721 } 19608 }
19722#endif
19723 19609
19724 if (part == ON_VERTICAL_BORDER) 19610 if (part == ON_VERTICAL_BORDER)
19725 cursor = FRAME_X_OUTPUT (f)->horizontal_drag_cursor; 19611 cursor = FRAME_X_OUTPUT (f)->horizontal_drag_cursor;
@@ -20087,7 +19973,11 @@ note_mouse_highlight (f, x, y)
20087 19973
20088 set_cursor: 19974 set_cursor:
20089 19975
19976#ifndef HAVE_CARBON
20090 if (cursor != No_Cursor) 19977 if (cursor != No_Cursor)
19978#else
19979 if (bcmp (&cursor, &No_Cursor, sizeof (Cursor)))
19980#endif
20091 rif->define_frame_cursor (f, cursor); 19981 rif->define_frame_cursor (f, cursor);
20092} 19982}
20093 19983