aboutsummaryrefslogtreecommitdiffstats
path: root/src/macterm.c
diff options
context:
space:
mode:
authorDan Nicolaescu2007-05-19 19:08:02 +0000
committerDan Nicolaescu2007-05-19 19:08:02 +0000
commit80ca7302d820bd3460a06db39165bbc35144c684 (patch)
tree9cbfeba96180f4d60e44037a71bf4a1fff4a2022 /src/macterm.c
parent696758702fa8eae3cfa46859cc260398b15d71bd (diff)
downloademacs-80ca7302d820bd3460a06db39165bbc35144c684.tar.gz
emacs-80ca7302d820bd3460a06db39165bbc35144c684.zip
* s/darwin.h (SYSTEM_PURESIZE_EXTRA): Define here.
* termhooks.h (union display_info): Add mac_display_info. * term.c (init_tty): Only use terminal->kboard when MULTI_KBOARD is defined. * macterm.h (struct mac_display_info): Add terminal. * w32term.c (w32_initialize): Make static. * macterm.c (XTset_terminal_modes): Add a terminal parameter. (XTreset_terminal_modes): Likewise. (x_clear_frame): Add a frame parameter. (note_mouse_movement): Get rif from the frame. (mac_term_init): Initialize the terminal. (mac_initialize): Make static and move terminal initialization ... (mac_create_terminal): ... in this new function. * macmenu.c: Reorder includes. (Fx_popup_menu): Use terminal specific mouse_position_hook. * macfns.c (x_set_mouse_color): Get rif from the frame. (x_set_tool_bar_lines): Don't use updating_frame. (mac_window): Add 2 new parameters for consistency with other systems. (Fx_create_frame): Fix doc string. Rename the parameter. (Fx_create_frame): Set the frame parameters following what is done in X11 and w32. (Fx_open_connection): Remove window-system check. (start_hourglass): Likewise. (x_create_tip_frame): Get the keyboard from the terminal. * w32fns.c (Fx_create_frame): Use kboard from the terminal. * term/mac-win.el: Provide mac-win. (mac-initialized): New variable. (mac-initialize-window-system): New function. Move global setup here. (handle-args-function-alist, frame-creation-function-alist): (window-system-initialization-alist): Add mac entries. * loadup.el: Load mac-win on a Mac.
Diffstat (limited to 'src/macterm.c')
-rw-r--r--src/macterm.c106
1 files changed, 67 insertions, 39 deletions
diff --git a/src/macterm.c b/src/macterm.c
index 316e61cc537..b48ffb47fdb 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -231,14 +231,14 @@ void x_raise_frame P_ ((struct frame *));
231void x_set_window_size P_ ((struct frame *, int, int, int)); 231void x_set_window_size P_ ((struct frame *, int, int, int));
232void x_wm_set_window_state P_ ((struct frame *, int)); 232void x_wm_set_window_state P_ ((struct frame *, int));
233void x_wm_set_icon_pixmap P_ ((struct frame *, int)); 233void x_wm_set_icon_pixmap P_ ((struct frame *, int));
234void mac_initialize P_ ((void)); 234static void mac_initialize P_ ((void));
235static void x_font_min_bounds P_ ((XFontStruct *, int *, int *)); 235static void x_font_min_bounds P_ ((XFontStruct *, int *, int *));
236static int x_compute_min_glyph_bounds P_ ((struct frame *)); 236static int x_compute_min_glyph_bounds P_ ((struct frame *));
237static void x_update_end P_ ((struct frame *)); 237static void x_update_end P_ ((struct frame *));
238static void XTframe_up_to_date P_ ((struct frame *)); 238static void XTframe_up_to_date P_ ((struct frame *));
239static void XTset_terminal_modes P_ ((void)); 239static void XTset_terminal_modes P_ ((struct terminal *));
240static void XTreset_terminal_modes P_ ((void)); 240static void XTreset_terminal_modes P_ ((struct terminal *));
241static void x_clear_frame P_ ((void)); 241static void x_clear_frame P_ ((struct frame *));
242static void frame_highlight P_ ((struct frame *)); 242static void frame_highlight P_ ((struct frame *));
243static void frame_unhighlight P_ ((struct frame *)); 243static void frame_unhighlight P_ ((struct frame *));
244static void x_new_focus_frame P_ ((struct x_display_info *, struct frame *)); 244static void x_new_focus_frame P_ ((struct x_display_info *, struct frame *));
@@ -266,6 +266,8 @@ static void x_scroll_bar_report_motion P_ ((struct frame **, Lisp_Object *,
266static int is_emacs_window P_ ((WindowPtr)); 266static int is_emacs_window P_ ((WindowPtr));
267static XCharStruct *mac_per_char_metric P_ ((XFontStruct *, XChar2b *, int)); 267static XCharStruct *mac_per_char_metric P_ ((XFontStruct *, XChar2b *, int));
268static void XSetFont P_ ((Display *, GC, XFontStruct *)); 268static void XSetFont P_ ((Display *, GC, XFontStruct *));
269static struct terminal *mac_create_terminal P_ ((struct mac_display_info *dpyinfo));
270
269 271
270#define GC_FORE_COLOR(gc) (&(gc)->fore_color) 272#define GC_FORE_COLOR(gc) (&(gc)->fore_color)
271#define GC_BACK_COLOR(gc) (&(gc)->back_color) 273#define GC_BACK_COLOR(gc) (&(gc)->back_color)
@@ -2306,7 +2308,7 @@ mac_destroy_fringe_bitmap (which)
2306 rarely happens). */ 2308 rarely happens). */
2307 2309
2308static void 2310static void
2309XTset_terminal_modes () 2311XTset_terminal_modes (struct terminal *t)
2310{ 2312{
2311} 2313}
2312 2314
@@ -2314,7 +2316,7 @@ XTset_terminal_modes ()
2314 the windows go away, and suspending requires no action. */ 2316 the windows go away, and suspending requires no action. */
2315 2317
2316static void 2318static void
2317XTreset_terminal_modes () 2319XTreset_terminal_modes (struct terminal *t)
2318{ 2320{
2319} 2321}
2320 2322
@@ -3957,15 +3959,8 @@ x_delete_glyphs (n)
3957 frame. Otherwise clear the selected frame. */ 3959 frame. Otherwise clear the selected frame. */
3958 3960
3959static void 3961static void
3960x_clear_frame () 3962x_clear_frame (struct frame *f)
3961{ 3963{
3962 struct frame *f;
3963
3964 if (updating_frame)
3965 f = updating_frame;
3966 else
3967 f = SELECTED_FRAME ();
3968
3969 /* Clearing the frame will erase any cursor, so mark them all as no 3964 /* Clearing the frame will erase any cursor, so mark them all as no
3970 longer visible. */ 3965 longer visible. */
3971 mark_window_cursors_off (XWINDOW (FRAME_ROOT_WINDOW (f))); 3966 mark_window_cursors_off (XWINDOW (FRAME_ROOT_WINDOW (f)));
@@ -4499,7 +4494,7 @@ note_mouse_movement (frame, pos)
4499 clear_mouse_face (dpyinfo); 4494 clear_mouse_face (dpyinfo);
4500 dpyinfo->mouse_face_mouse_frame = 0; 4495 dpyinfo->mouse_face_mouse_frame = 0;
4501 if (!dpyinfo->grabbed) 4496 if (!dpyinfo->grabbed)
4502 rif->define_frame_cursor (frame, 4497 FRAME_RIF (frame)->define_frame_cursor (frame,
4503 frame->output_data.mac->nontext_cursor); 4498 frame->output_data.mac->nontext_cursor);
4504 } 4499 }
4505 4500
@@ -11626,6 +11621,7 @@ mac_term_init (display_name, xrm_option, resource_name)
11626 char *resource_name; 11621 char *resource_name;
11627{ 11622{
11628 struct mac_display_info *dpyinfo; 11623 struct mac_display_info *dpyinfo;
11624 struct terminal *terminal;
11629 11625
11630 BLOCK_INPUT; 11626 BLOCK_INPUT;
11631 11627
@@ -11641,6 +11637,13 @@ mac_term_init (display_name, xrm_option, resource_name)
11641 dpyinfo = &one_mac_display_info; 11637 dpyinfo = &one_mac_display_info;
11642 bzero (dpyinfo, sizeof (*dpyinfo)); 11638 bzero (dpyinfo, sizeof (*dpyinfo));
11643 11639
11640 terminal = mac_create_terminal (dpyinfo);
11641
11642 /* Set the name of the terminal. */
11643 terminal->name = (char *) xmalloc (SBYTES (display_name) + 1);
11644 strncpy (terminal->name, SDATA (display_name), SBYTES (display_name));
11645 terminal->name[SBYTES (display_name)] = 0;
11646
11644#ifdef MAC_OSX 11647#ifdef MAC_OSX
11645 dpyinfo->mac_id_name 11648 dpyinfo->mac_id_name
11646 = (char *) xmalloc (SCHARS (Vinvocation_name) 11649 = (char *) xmalloc (SCHARS (Vinvocation_name)
@@ -11844,31 +11847,39 @@ static struct redisplay_interface x_redisplay_interface =
11844 mac_shift_glyphs_for_insert 11847 mac_shift_glyphs_for_insert
11845}; 11848};
11846 11849
11847void 11850static struct terminal *
11848mac_initialize () 11851mac_create_terminal (struct mac_display_info *dpyinfo)
11849{ 11852{
11850 rif = &x_redisplay_interface; 11853 struct terminal *terminal;
11851 11854
11852 clear_frame_hook = x_clear_frame; 11855 terminal = create_terminal ();
11853 ins_del_lines_hook = x_ins_del_lines; 11856
11854 delete_glyphs_hook = x_delete_glyphs; 11857 terminal->type = output_mac;
11855 ring_bell_hook = XTring_bell; 11858 terminal->display_info.mac = dpyinfo;
11856 reset_terminal_modes_hook = XTreset_terminal_modes; 11859 dpyinfo->terminal = terminal;
11857 set_terminal_modes_hook = XTset_terminal_modes; 11860
11858 update_begin_hook = x_update_begin; 11861 terminal->rif = &x_redisplay_interface;
11859 update_end_hook = x_update_end; 11862 terminal->clear_frame_hook = x_clear_frame;
11860 set_terminal_window_hook = XTset_terminal_window; 11863 terminal->ins_del_lines_hook = x_ins_del_lines;
11861 read_socket_hook = XTread_socket; 11864 terminal->delete_glyphs_hook = x_delete_glyphs;
11862 frame_up_to_date_hook = XTframe_up_to_date; 11865 terminal->ring_bell_hook = XTring_bell;
11863 mouse_position_hook = XTmouse_position; 11866 terminal->reset_terminal_modes_hook = XTreset_terminal_modes;
11864 frame_rehighlight_hook = XTframe_rehighlight; 11867 terminal->set_terminal_modes_hook = XTset_terminal_modes;
11865 frame_raise_lower_hook = XTframe_raise_lower; 11868 terminal->update_begin_hook = x_update_begin;
11866 11869 terminal->update_end_hook = x_update_end;
11867 set_vertical_scroll_bar_hook = XTset_vertical_scroll_bar; 11870 terminal->set_terminal_window_hook = XTset_terminal_window;
11868 condemn_scroll_bars_hook = XTcondemn_scroll_bars; 11871 terminal->read_socket_hook = XTread_socket;
11869 redeem_scroll_bar_hook = XTredeem_scroll_bar; 11872 terminal->frame_up_to_date_hook = XTframe_up_to_date;
11870 judge_scroll_bars_hook = XTjudge_scroll_bars; 11873 terminal->mouse_position_hook = XTmouse_position;
11874 terminal->frame_rehighlight_hook = XTframe_rehighlight;
11875 terminal->frame_raise_lower_hook = XTframe_raise_lower;
11876
11877 terminal->set_vertical_scroll_bar_hook = XTset_vertical_scroll_bar;
11878 terminal->condemn_scroll_bars_hook = XTcondemn_scroll_bars;
11879 terminal->redeem_scroll_bar_hook = XTredeem_scroll_bar;
11880 terminal->judge_scroll_bars_hook = XTjudge_scroll_bars;
11871 11881
11882#if 0
11872 TTY_SCROLL_REGION_OK (CURTTY ()) = 1; /* we'll scroll partial frames */ 11883 TTY_SCROLL_REGION_OK (CURTTY ()) = 1; /* we'll scroll partial frames */
11873 TTY_CHAR_INS_DEL_OK (CURTTY ()) = 1; 11884 TTY_CHAR_INS_DEL_OK (CURTTY ()) = 1;
11874 TTY_LINE_INS_DEL_OK (CURTTY ()) = 1; /* we'll just blt 'em */ 11885 TTY_LINE_INS_DEL_OK (CURTTY ()) = 1; /* we'll just blt 'em */
@@ -11876,6 +11887,22 @@ mac_initialize ()
11876 TTY_MEMORY_BELOW_FRAME (CURTTY ()) = 0; /* we don't remember what 11887 TTY_MEMORY_BELOW_FRAME (CURTTY ()) = 0; /* we don't remember what
11877 scrolls off the 11888 scrolls off the
11878 bottom */ 11889 bottom */
11890#else
11891 terminal->scroll_region_ok = 1; /* We'll scroll partial frames. */
11892 terminal->char_ins_del_ok = 1;
11893 terminal->line_ins_del_ok = 1; /* We'll just blt 'em. */
11894 terminal->fast_clear_end_of_line = 1; /* X does this well. */
11895 terminal->memory_below_frame = 0; /* We don't remember what scrolls
11896 off the bottom. */
11897
11898#endif
11899 return terminal;
11900}
11901
11902static void
11903mac_initialize ()
11904{
11905
11879 baud_rate = 19200; 11906 baud_rate = 19200;
11880 11907
11881 last_tool_bar_item = -1; 11908 last_tool_bar_item = -1;
@@ -11925,6 +11952,7 @@ mac_initialize ()
11925#endif 11952#endif
11926 11953
11927 UNBLOCK_INPUT; 11954 UNBLOCK_INPUT;
11955
11928} 11956}
11929 11957
11930 11958