comparison src/macterm.c @ 83619:5da6a46ddbd6

* 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.
author Dan Nicolaescu <dann@ics.uci.edu>
date Sat, 19 May 2007 19:08:02 +0000
parents dc002877ce12
children 0a3247aa24a4
comparison
equal deleted inserted replaced
83618:fe83377d2247 83619:5da6a46ddbd6
229 void x_wm_set_size_hint P_ ((struct frame *, long, int)); 229 void x_wm_set_size_hint P_ ((struct frame *, long, int));
230 void x_raise_frame P_ ((struct frame *)); 230 void x_raise_frame P_ ((struct frame *));
231 void x_set_window_size P_ ((struct frame *, int, int, int)); 231 void x_set_window_size P_ ((struct frame *, int, int, int));
232 void x_wm_set_window_state P_ ((struct frame *, int)); 232 void x_wm_set_window_state P_ ((struct frame *, int));
233 void x_wm_set_icon_pixmap P_ ((struct frame *, int)); 233 void x_wm_set_icon_pixmap P_ ((struct frame *, int));
234 void mac_initialize P_ ((void)); 234 static void mac_initialize P_ ((void));
235 static void x_font_min_bounds P_ ((XFontStruct *, int *, int *)); 235 static void x_font_min_bounds P_ ((XFontStruct *, int *, int *));
236 static int x_compute_min_glyph_bounds P_ ((struct frame *)); 236 static int x_compute_min_glyph_bounds P_ ((struct frame *));
237 static void x_update_end P_ ((struct frame *)); 237 static void x_update_end P_ ((struct frame *));
238 static void XTframe_up_to_date P_ ((struct frame *)); 238 static void XTframe_up_to_date P_ ((struct frame *));
239 static void XTset_terminal_modes P_ ((void)); 239 static void XTset_terminal_modes P_ ((struct terminal *));
240 static void XTreset_terminal_modes P_ ((void)); 240 static void XTreset_terminal_modes P_ ((struct terminal *));
241 static void x_clear_frame P_ ((void)); 241 static void x_clear_frame P_ ((struct frame *));
242 static void frame_highlight P_ ((struct frame *)); 242 static void frame_highlight P_ ((struct frame *));
243 static void frame_unhighlight P_ ((struct frame *)); 243 static void frame_unhighlight P_ ((struct frame *));
244 static void x_new_focus_frame P_ ((struct x_display_info *, struct frame *)); 244 static void x_new_focus_frame P_ ((struct x_display_info *, struct frame *));
245 static void mac_focus_changed P_ ((int, struct mac_display_info *, 245 static void mac_focus_changed P_ ((int, struct mac_display_info *,
246 struct frame *, struct input_event *)); 246 struct frame *, struct input_event *));
264 unsigned long *)); 264 unsigned long *));
265 265
266 static int is_emacs_window P_ ((WindowPtr)); 266 static int is_emacs_window P_ ((WindowPtr));
267 static XCharStruct *mac_per_char_metric P_ ((XFontStruct *, XChar2b *, int)); 267 static XCharStruct *mac_per_char_metric P_ ((XFontStruct *, XChar2b *, int));
268 static void XSetFont P_ ((Display *, GC, XFontStruct *)); 268 static void XSetFont P_ ((Display *, GC, XFontStruct *));
269 static 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)
272 #define GC_FONT(gc) ((gc)->xgcv.font) 274 #define GC_FONT(gc) ((gc)->xgcv.font)
273 #define FRAME_NORMAL_GC(f) ((f)->output_data.mac->normal_gc) 275 #define FRAME_NORMAL_GC(f) ((f)->output_data.mac->normal_gc)
2304 suspend. When starting Emacs, no window is mapped. And nothing 2306 suspend. When starting Emacs, no window is mapped. And nothing
2305 must be done to Emacs's own window if it is suspended (though that 2307 must be done to Emacs's own window if it is suspended (though that
2306 rarely happens). */ 2308 rarely happens). */
2307 2309
2308 static void 2310 static void
2309 XTset_terminal_modes () 2311 XTset_terminal_modes (struct terminal *t)
2310 { 2312 {
2311 } 2313 }
2312 2314
2313 /* This is called when exiting or suspending Emacs. Exiting will make 2315 /* This is called when exiting or suspending Emacs. Exiting will make
2314 the windows go away, and suspending requires no action. */ 2316 the windows go away, and suspending requires no action. */
2315 2317
2316 static void 2318 static void
2317 XTreset_terminal_modes () 2319 XTreset_terminal_modes (struct terminal *t)
2318 { 2320 {
2319 } 2321 }
2320 2322
2321 2323
2322 2324
3955 3957
3956 /* Clear entire frame. If updating_frame is non-null, clear that 3958 /* Clear entire frame. If updating_frame is non-null, clear that
3957 frame. Otherwise clear the selected frame. */ 3959 frame. Otherwise clear the selected frame. */
3958 3960
3959 static void 3961 static void
3960 x_clear_frame () 3962 x_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)));
3972 output_cursor.hpos = output_cursor.vpos = 0; 3967 output_cursor.hpos = output_cursor.vpos = 0;
3973 output_cursor.x = -1; 3968 output_cursor.x = -1;
4497 outside the frame, then we're certainly no longer on any text 4492 outside the frame, then we're certainly no longer on any text
4498 in the frame. */ 4493 in the frame. */
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
4506 /* Has the mouse moved off the glyph it was on at the last sighting? */ 4501 /* Has the mouse moved off the glyph it was on at the last sighting? */
4507 if (frame != last_mouse_glyph_frame 4502 if (frame != last_mouse_glyph_frame
11624 Lisp_Object display_name; 11619 Lisp_Object display_name;
11625 char *xrm_option; 11620 char *xrm_option;
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
11632 if (!mac_initialized) 11628 if (!mac_initialized)
11633 { 11629 {
11638 if (x_display_list) 11634 if (x_display_list)
11639 error ("Sorry, this version can only handle one display"); 11635 error ("Sorry, this version can only handle one display");
11640 11636
11641 dpyinfo = &one_mac_display_info; 11637 dpyinfo = &one_mac_display_info;
11642 bzero (dpyinfo, sizeof (*dpyinfo)); 11638 bzero (dpyinfo, sizeof (*dpyinfo));
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;
11643 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)
11647 + SCHARS (Vsystem_name) 11650 + SCHARS (Vsystem_name)
11842 mac_draw_window_cursor, 11845 mac_draw_window_cursor,
11843 mac_draw_vertical_window_border, 11846 mac_draw_vertical_window_border,
11844 mac_shift_glyphs_for_insert 11847 mac_shift_glyphs_for_insert
11845 }; 11848 };
11846 11849
11847 void 11850 static struct terminal *
11848 mac_initialize () 11851 mac_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;
11871 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;
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 */
11875 TTY_FAST_CLEAR_END_OF_LINE (CURTTY ()) = 1; /* X does this well */ 11886 TTY_FAST_CLEAR_END_OF_LINE (CURTTY ()) = 1; /* X does this well */
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
11902 static void
11903 mac_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;
11882 any_help_event_p = 0; 11909 any_help_event_p = 0;
11883 11910
11923 11950
11924 mac_init_fringe (); 11951 mac_init_fringe ();
11925 #endif 11952 #endif
11926 11953
11927 UNBLOCK_INPUT; 11954 UNBLOCK_INPUT;
11955
11928 } 11956 }
11929 11957
11930 11958
11931 void 11959 void
11932 syms_of_macterm () 11960 syms_of_macterm ()