diff options
author | Miles Bader <miles@gnu.org> | 2007-10-11 16:24:58 +0000 |
---|---|---|
committer | Miles Bader <miles@gnu.org> | 2007-10-11 16:24:58 +0000 |
commit | c73bd236f75b742ad4642ec94798987ae6e3e1e8 (patch) | |
tree | ef5edc8db557fc1d25a17c379e4ae63a38b3ba5c /src/macterm.c | |
parent | ecb21060d5c1752d41d7a742be565c59b5fcb855 (diff) | |
parent | 58ade22bf16a9ec2ff0aee6c59d8db4d1703e94f (diff) | |
download | emacs-c73bd236f75b742ad4642ec94798987ae6e3e1e8.tar.gz emacs-c73bd236f75b742ad4642ec94798987ae6e3e1e8.tar.bz2 emacs-c73bd236f75b742ad4642ec94798987ae6e3e1e8.zip |
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 866-879)
- Merge multi-tty branch
- Update from CVS
- Merge from emacs--rel--22
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-257
Diffstat (limited to 'src/macterm.c')
-rw-r--r-- | src/macterm.c | 149 |
1 files changed, 99 insertions, 50 deletions
diff --git a/src/macterm.c b/src/macterm.c index 734bf52e180..ed7411615f5 100644 --- a/src/macterm.c +++ b/src/macterm.c @@ -228,14 +228,14 @@ void x_raise_frame P_ ((struct frame *)); void x_set_window_size P_ ((struct frame *, int, int, int)); void x_wm_set_window_state P_ ((struct frame *, int)); void x_wm_set_icon_pixmap P_ ((struct frame *, int)); -void mac_initialize P_ ((void)); +static void mac_initialize P_ ((void)); static void x_font_min_bounds P_ ((XFontStruct *, int *, int *)); static int x_compute_min_glyph_bounds P_ ((struct frame *)); static void x_update_end P_ ((struct frame *)); static void XTframe_up_to_date P_ ((struct frame *)); -static void XTset_terminal_modes P_ ((void)); -static void XTreset_terminal_modes P_ ((void)); -static void x_clear_frame P_ ((void)); +static void XTset_terminal_modes P_ ((struct terminal *)); +static void XTreset_terminal_modes P_ ((struct terminal *)); +static void x_clear_frame P_ ((struct frame *)); static void frame_highlight P_ ((struct frame *)); static void frame_unhighlight P_ ((struct frame *)); static void x_new_focus_frame P_ ((struct x_display_info *, struct frame *)); @@ -263,6 +263,8 @@ static void x_scroll_bar_report_motion P_ ((struct frame **, Lisp_Object *, static int is_emacs_window P_ ((WindowRef)); static XCharStruct *mac_per_char_metric P_ ((XFontStruct *, XChar2b *, int)); static void XSetFont P_ ((Display *, GC, XFontStruct *)); +static struct terminal *mac_create_terminal P_ ((struct mac_display_info *dpyinfo)); + #define GC_FORE_COLOR(gc) (&(gc)->fore_color) #define GC_BACK_COLOR(gc) (&(gc)->back_color) @@ -2360,6 +2362,9 @@ mac_define_fringe_bitmap (which, bits, h, wd) for (i = 0; i < h; i++) bits[i] = ~bits[i]; + + BLOCK_INPUT; + provider = CGDataProviderCreateWithData (NULL, bits, sizeof (unsigned short) * h, NULL); if (provider) @@ -2369,6 +2374,8 @@ mac_define_fringe_bitmap (which, bits, h, wd) provider, NULL, 0); CGDataProviderRelease (provider); } + + UNBLOCK_INPUT; } static void @@ -2379,7 +2386,11 @@ mac_destroy_fringe_bitmap (which) return; if (fringe_bmp[which]) - CGImageRelease (fringe_bmp[which]); + { + BLOCK_INPUT; + CGImageRelease (fringe_bmp[which]); + UNBLOCK_INPUT; + } fringe_bmp[which] = 0; } #endif @@ -2391,7 +2402,7 @@ mac_destroy_fringe_bitmap (which) rarely happens). */ static void -XTset_terminal_modes () +XTset_terminal_modes (struct terminal *t) { } @@ -2399,7 +2410,7 @@ XTset_terminal_modes () the windows go away, and suspending requires no action. */ static void -XTreset_terminal_modes () +XTreset_terminal_modes (struct terminal *t) { } @@ -4049,15 +4060,8 @@ x_delete_glyphs (n) frame. Otherwise clear the selected frame. */ static void -x_clear_frame () +x_clear_frame (struct frame *f) { - struct frame *f; - - if (updating_frame) - f = updating_frame; - else - f = SELECTED_FRAME (); - /* Clearing the frame will erase any cursor, so mark them all as no longer visible. */ mark_window_cursors_off (XWINDOW (FRAME_ROOT_WINDOW (f))); @@ -4575,7 +4579,7 @@ note_mouse_movement (frame, pos) clear_mouse_face (dpyinfo); dpyinfo->mouse_face_mouse_frame = 0; if (!dpyinfo->grabbed) - rif->define_frame_cursor (frame, + FRAME_RIF (frame)->define_frame_cursor (frame, frame->output_data.mac->nontext_cursor); } @@ -8781,7 +8785,7 @@ mac_load_query_font (f, fontname) font_id = atsu_find_font_from_family_name (family); if (font_id == kATSUInvalidFontID) - return; + return NULL; size_fixed = Long2Fix (size); bold_p = (fontface & bold) != 0; italic_p = (fontface & italic) != 0; @@ -12174,7 +12178,13 @@ XTread_socket (sd, expected, hold_quit) will be selected only when it is active. */ if (WINDOWP (window) && !EQ (window, last_window) - && !EQ (window, selected_window)) + && !EQ (window, selected_window) + /* For click-to-focus window managers + create event iff we don't leave the + selected frame. */ + && (focus_follows_mouse + || (EQ (XWINDOW (window)->frame, + XWINDOW (selected_window)->frame)))) { inev.kind = SELECT_WINDOW_EVENT; inev.frame_or_window = window; @@ -12552,6 +12562,7 @@ mac_term_init (display_name, xrm_option, resource_name) char *resource_name; { struct mac_display_info *dpyinfo; + struct terminal *terminal; BLOCK_INPUT; @@ -12567,6 +12578,13 @@ mac_term_init (display_name, xrm_option, resource_name) dpyinfo = &one_mac_display_info; bzero (dpyinfo, sizeof (*dpyinfo)); + terminal = mac_create_terminal (dpyinfo); + + /* Set the name of the terminal. */ + terminal->name = (char *) xmalloc (SBYTES (display_name) + 1); + strncpy (terminal->name, SDATA (display_name), SBYTES (display_name)); + terminal->name[SBYTES (display_name)] = 0; + #ifdef MAC_OSX dpyinfo->mac_id_name = (char *) xmalloc (SCHARS (Vinvocation_name) @@ -12608,6 +12626,10 @@ mac_term_init (display_name, xrm_option, resource_name) x_display_name_list); dpyinfo->name_list_element = XCAR (x_display_name_list); +#if USE_CG_DRAWING + mac_init_fringe (terminal->rif); +#endif + UNBLOCK_INPUT; return dpyinfo; @@ -12768,44 +12790,72 @@ static struct redisplay_interface x_redisplay_interface = mac_shift_glyphs_for_insert }; -void +static struct terminal * +mac_create_terminal (struct mac_display_info *dpyinfo) +{ + struct terminal *terminal; + + terminal = create_terminal (); + + terminal->type = output_mac; + terminal->display_info.mac = dpyinfo; + dpyinfo->terminal = terminal; + + terminal->clear_frame_hook = x_clear_frame; + terminal->ins_del_lines_hook = x_ins_del_lines; + terminal->delete_glyphs_hook = x_delete_glyphs; + terminal->ring_bell_hook = XTring_bell; + terminal->reset_terminal_modes_hook = XTreset_terminal_modes; + terminal->set_terminal_modes_hook = XTset_terminal_modes; + terminal->update_begin_hook = x_update_begin; + terminal->update_end_hook = x_update_end; + terminal->set_terminal_window_hook = XTset_terminal_window; + terminal->read_socket_hook = XTread_socket; + terminal->frame_up_to_date_hook = XTframe_up_to_date; + terminal->mouse_position_hook = XTmouse_position; + terminal->frame_rehighlight_hook = XTframe_rehighlight; + terminal->frame_raise_lower_hook = XTframe_raise_lower; + /* terminal->fullscreen_hook = XTfullscreen_hook; */ + terminal->set_vertical_scroll_bar_hook = XTset_vertical_scroll_bar; + terminal->condemn_scroll_bars_hook = XTcondemn_scroll_bars; + terminal->redeem_scroll_bar_hook = XTredeem_scroll_bar; + terminal->judge_scroll_bars_hook = XTjudge_scroll_bars; + terminal->delete_frame_hook = x_destroy_window; + /* terminal->delete_terminal_hook = x_delete_terminal; */ + + terminal->rif = &x_redisplay_interface; +#if 0 + TTY_SCROLL_REGION_OK (CURTTY ()) = 1; /* we'll scroll partial frames */ + TTY_CHAR_INS_DEL_OK (CURTTY ()) = 1; + TTY_LINE_INS_DEL_OK (CURTTY ()) = 1; /* we'll just blt 'em */ + TTY_FAST_CLEAR_END_OF_LINE (CURTTY ()) = 1; /* X does this well */ + TTY_MEMORY_BELOW_FRAME (CURTTY ()) = 0; /* we don't remember what + scrolls off the + bottom */ +#else + terminal->scroll_region_ok = 1; /* We'll scroll partial frames. */ + terminal->char_ins_del_ok = 1; + terminal->line_ins_del_ok = 1; /* We'll just blt 'em. */ + terminal->fast_clear_end_of_line = 1; /* X does this well. */ + terminal->memory_below_frame = 0; /* We don't remember what scrolls + off the bottom. */ + +#endif + + return terminal; +} + +static void mac_initialize () { - rif = &x_redisplay_interface; - - clear_frame_hook = x_clear_frame; - ins_del_lines_hook = x_ins_del_lines; - delete_glyphs_hook = x_delete_glyphs; - ring_bell_hook = XTring_bell; - reset_terminal_modes_hook = XTreset_terminal_modes; - set_terminal_modes_hook = XTset_terminal_modes; - update_begin_hook = x_update_begin; - update_end_hook = x_update_end; - set_terminal_window_hook = XTset_terminal_window; - read_socket_hook = XTread_socket; - frame_up_to_date_hook = XTframe_up_to_date; - mouse_position_hook = XTmouse_position; - frame_rehighlight_hook = XTframe_rehighlight; - frame_raise_lower_hook = XTframe_raise_lower; - - set_vertical_scroll_bar_hook = XTset_vertical_scroll_bar; - condemn_scroll_bars_hook = XTcondemn_scroll_bars; - redeem_scroll_bar_hook = XTredeem_scroll_bar; - judge_scroll_bars_hook = XTjudge_scroll_bars; - - scroll_region_ok = 1; /* we'll scroll partial frames */ - char_ins_del_ok = 1; - line_ins_del_ok = 1; /* we'll just blt 'em */ - fast_clear_end_of_line = 1; /* X does this well */ - memory_below_frame = 0; /* we don't remember what scrolls - off the bottom */ + baud_rate = 19200; last_tool_bar_item = -1; any_help_event_p = 0; /* Try to use interrupt input; if we can't, then start polling. */ - Fset_input_mode (Qt, Qnil, Qt, Qnil); + Fset_input_interrupt_mode (Qt); BLOCK_INPUT; @@ -12837,11 +12887,10 @@ mac_initialize () #if USE_CG_DRAWING init_cg_color (); - - mac_init_fringe (); #endif UNBLOCK_INPUT; + } |