comparison src/xterm.c @ 82990:2ecd1f669db9

Fixed X support, preliminary support for X-tty combo sessions. lib-src/emacsclient.c (copy_from_to, pty_conversation): Re-added SIGIO hack. (Sigh.) lisp/frame.el (make-frame-on-tty): Use make-terminal-frame, not make-frame. src/dispnew.c (line_hash_code, line_draw_cost): Updated to use the new display_method parameters. (Fredraw_frame): fflush the tty only if f is a termcap frame. (direct_output_for_insert): Updated to use the new display_method parameters. fflush the tty only if f is a termcap frame. (direct_output_forward_char, update_frame_1, scrolling): Ditto. (update_frame_line, Fding, bitch_at_user): Ditto. (Fsend_string_to_terminal): Fail if current frame is not on a tty. (init_display): Frame size change is safe here. src/frame.c (Vterminal_frame): Restored previously deleted variable. (syms_of_frame): Initialize it. (make_terminal_frame): Copy the frame's display_method from tty_display_info. (Fmake_terminal_frame): Enable simultaneous X and tty frames (buggy). (Fredirect_frame_focus): Don't call frame_rehighlight_hook if frame is on a termcap device. src/frame.h (struct frame): Renamed display to display_method. (Vterminal_frame): Re-added declaration. src/keyboard.c (flow_control): Moved to struct tty_display_info. (read_avail_input): Check ttys even if there is a read_socket_hook. (Fset_input_mode): Call reset_sys_modes/init_sys_modes and set flow_control or meta_key only when the frame is a termcap frame. (Fcurrent_input_mode): Handle flow_control and meta_key right on non-termcap frames. src/scroll.c (calculate_scrolling, calculate_direct_scrolling): Update to use the new display_method parameters. (scrolling_1, scroll_cost): Ditto. src/sysdep.c (init_sys_modes, reset_sys_modes): Always set the terminal parameters if tty_out->input is not stdin. Updated to the new location of flow_control. (hft_init): Moved HFT init code to term_init, as it needs the frame. src/term.c (tty_display_method_template): New variable. (update_begin): Added rif hack. (set_terminal_window, ins_del_lines, term_init): Updated to use the new display_method parameters. (insert_glyphs, ins_del_lines): Only call insert_glyphs_hook if the current frame is not on a tty. (calculate_costs): Don't calculate costs if not on a tty. (term_dummy_init): Fixed tty->output initialization. Preallocate Wcm and display_method. (term_init): Allocate & initialize display_method. Blindly fixed WINDOWSNT-specific parts. Added HFT-specific initialization exception from hft_init. (delete_tty): Only delete termcap frames. Free() the display_method. src/termchar.h (struct tty_display_info): Moved high-level terminal characteristics to struct display_method. Added flow_control and display_method members. src/termhooks.h (struct display_method): New struct (renamed from struct device). Added accessor macros. src/window.c (init_window_once): Initialize Vterminal_frame. src/xdisp.c (init_iterator, expose_frame): Added rif hack. (try_window_id): Updated to use the new display_method parameters. src/xfaces.c (realize_basic_faces): Don't call x_update_menu_appearance if the frame is a tty frame. src/xfns.c (Fx_create_frame): Added rif hack. Initialize display_method. (x_create_tip_frame): Initialize display_method. src/xterm.c (x_display_method): New variable. (x_flush, x_frame_of_widget, XTmouse_position): Ignore non-X frames. (x_window_to_scroll_bar, x_window_to_menu_bar): Ditto. (xim_destroy_callback, xim_instantiate_callback): Ditto. (frame_highlight, frame_unhighlight): Added rif hack. (x_initialize): Don't initialize rif. Do initialize x_display_method. src/xterm.h (x_display_method): New declaration. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-30
author Karoly Lorentey <lorentey@elte.hu>
date Fri, 02 Jan 2004 01:15:26 +0000
parents 09ea561dfa8c
children 5de4189e659d
comparison
equal deleted inserted replaced
82989:f3845715a5f6 82990:2ecd1f669db9
181 static Lisp_Object last_window; 181 static Lisp_Object last_window;
182 182
183 /* Non-zero means make use of UNDERLINE_POSITION font properties. */ 183 /* Non-zero means make use of UNDERLINE_POSITION font properties. */
184 184
185 int x_use_underline_position_properties; 185 int x_use_underline_position_properties;
186
187 /* Generic display parameters for X displays. */
188
189 struct display_method x_display_method;
186 190
187 /* This is a chain of structures for all the X displays currently in 191 /* This is a chain of structures for all the X displays currently in
188 use. */ 192 use. */
189 193
190 struct x_display_info *x_display_list; 194 struct x_display_info *x_display_list;
380 BLOCK_INPUT; 384 BLOCK_INPUT;
381 if (f == NULL) 385 if (f == NULL)
382 { 386 {
383 Lisp_Object rest, frame; 387 Lisp_Object rest, frame;
384 FOR_EACH_FRAME (rest, frame) 388 FOR_EACH_FRAME (rest, frame)
385 x_flush (XFRAME (frame)); 389 if (FRAME_X_P (XFRAME (frame)))
390 x_flush (XFRAME (frame));
386 } 391 }
387 else if (FRAME_X_P (f)) 392 else if (FRAME_X_P (f))
388 XFlush (FRAME_X_DISPLAY (f)); 393 XFlush (FRAME_X_DISPLAY (f));
389 UNBLOCK_INPUT; 394 UNBLOCK_INPUT;
390 } 395 }
466 x_update_begin (f) 471 x_update_begin (f)
467 struct frame *f; 472 struct frame *f;
468 { 473 {
469 /* Nothing to do. */ 474 /* Nothing to do. */
470 } 475 }
471
472 476
473 /* Start update of window W. Set the global variable updated_window 477 /* Start update of window W. Set the global variable updated_window
474 to the window being updated and set output_cursor to the cursor 478 to the window being updated and set output_cursor to the cursor
475 position of W. */ 479 position of W. */
476 480
1363 /* Look for a frame with that top-level widget. Allocate the color 1367 /* Look for a frame with that top-level widget. Allocate the color
1364 on that frame to get the right gamma correction value. */ 1368 on that frame to get the right gamma correction value. */
1365 for (tail = Vframe_list; GC_CONSP (tail); tail = XCDR (tail)) 1369 for (tail = Vframe_list; GC_CONSP (tail); tail = XCDR (tail))
1366 if (GC_FRAMEP (XCAR (tail)) 1370 if (GC_FRAMEP (XCAR (tail))
1367 && (f = XFRAME (XCAR (tail)), 1371 && (f = XFRAME (XCAR (tail)),
1368 (f->output_data.nothing != 1 1372 (FRAME_X_P (f)
1373 && f->output_data.nothing != 1
1369 && FRAME_X_DISPLAY_INFO (f) == dpyinfo)) 1374 && FRAME_X_DISPLAY_INFO (f) == dpyinfo))
1370 && f->output_data.x->widget == widget) 1375 && f->output_data.x->widget == widget)
1371 return f; 1376 return f;
1372 1377
1373 abort (); 1378 abort ();
3055 3060
3056 static void 3061 static void
3057 frame_highlight (f) 3062 frame_highlight (f)
3058 struct frame *f; 3063 struct frame *f;
3059 { 3064 {
3065 /* XXX hack: make sure rif is right. */
3066 rif = f->display_method->rif;
3067
3060 /* We used to only do this if Vx_no_window_manager was non-nil, but 3068 /* We used to only do this if Vx_no_window_manager was non-nil, but
3061 the ICCCM (section 4.1.6) says that the window's border pixmap 3069 the ICCCM (section 4.1.6) says that the window's border pixmap
3062 and border pixel are window attributes which are "private to the 3070 and border pixel are window attributes which are "private to the
3063 client", so we can always change it to whatever we want. */ 3071 client", so we can always change it to whatever we want. */
3064 BLOCK_INPUT; 3072 BLOCK_INPUT;
3070 3078
3071 static void 3079 static void
3072 frame_unhighlight (f) 3080 frame_unhighlight (f)
3073 struct frame *f; 3081 struct frame *f;
3074 { 3082 {
3083 /* XXX hack: make sure rif is right. */
3084 rif = f->display_method->rif;
3085
3075 /* We used to only do this if Vx_no_window_manager was non-nil, but 3086 /* We used to only do this if Vx_no_window_manager was non-nil, but
3076 the ICCCM (section 4.1.6) says that the window's border pixmap 3087 the ICCCM (section 4.1.6) says that the window's border pixmap
3077 and border pixel are window attributes which are "private to the 3088 and border pixel are window attributes which are "private to the
3078 client", so we can always change it to whatever we want. */ 3089 client", so we can always change it to whatever we want. */
3079 BLOCK_INPUT; 3090 BLOCK_INPUT;
3661 3672
3662 Lisp_Object frame, tail; 3673 Lisp_Object frame, tail;
3663 3674
3664 /* Clear the mouse-moved flag for every frame on this display. */ 3675 /* Clear the mouse-moved flag for every frame on this display. */
3665 FOR_EACH_FRAME (tail, frame) 3676 FOR_EACH_FRAME (tail, frame)
3666 if (FRAME_X_DISPLAY (XFRAME (frame)) == FRAME_X_DISPLAY (*fp)) 3677 if (FRAME_X_P (XFRAME (frame))
3678 && FRAME_X_DISPLAY (XFRAME (frame)) == FRAME_X_DISPLAY (*fp))
3667 XFRAME (frame)->mouse_moved = 0; 3679 XFRAME (frame)->mouse_moved = 0;
3668 3680
3669 last_mouse_scroll_bar = Qnil; 3681 last_mouse_scroll_bar = Qnil;
3670 3682
3671 /* Figure out which root window we're on. */ 3683 /* Figure out which root window we're on. */
3875 frame = XCAR (tail); 3887 frame = XCAR (tail);
3876 /* All elements of Vframe_list should be frames. */ 3888 /* All elements of Vframe_list should be frames. */
3877 if (! GC_FRAMEP (frame)) 3889 if (! GC_FRAMEP (frame))
3878 abort (); 3890 abort ();
3879 3891
3892 if (! FRAME_X_P (XFRAME (frame)))
3893 continue;
3894
3880 /* Scan this frame's scroll bar list for a scroll bar with the 3895 /* Scan this frame's scroll bar list for a scroll bar with the
3881 right window ID. */ 3896 right window ID. */
3882 condemned = FRAME_CONDEMNED_SCROLL_BARS (XFRAME (frame)); 3897 condemned = FRAME_CONDEMNED_SCROLL_BARS (XFRAME (frame));
3883 for (bar = FRAME_SCROLL_BARS (XFRAME (frame)); 3898 for (bar = FRAME_SCROLL_BARS (XFRAME (frame));
3884 /* This trick allows us to search both the ordinary and 3899 /* This trick allows us to search both the ordinary and
3909 3924
3910 for (tail = Vframe_list; 3925 for (tail = Vframe_list;
3911 XGCTYPE (tail) == Lisp_Cons; 3926 XGCTYPE (tail) == Lisp_Cons;
3912 tail = XCDR (tail)) 3927 tail = XCDR (tail))
3913 { 3928 {
3914 Lisp_Object frame = XCAR (tail); 3929 if (FRAME_X_P (XFRAME (XCAR (tail))))
3915 Widget menu_bar = XFRAME (frame)->output_data.x->menubar_widget; 3930 {
3916 3931 Lisp_Object frame = XCAR (tail);
3917 if (menu_bar && xlwmenu_window_p (menu_bar, window)) 3932 Widget menu_bar = XFRAME (frame)->output_data.x->menubar_widget;
3918 return menu_bar; 3933
3934 if (menu_bar && xlwmenu_window_p (menu_bar, window))
3935 return menu_bar;
3936 }
3919 } 3937 }
3920 3938
3921 return NULL; 3939 return NULL;
3922 } 3940 }
3923 3941
8025 8043
8026 /* No need to call XDestroyIC.. */ 8044 /* No need to call XDestroyIC.. */
8027 FOR_EACH_FRAME (tail, frame) 8045 FOR_EACH_FRAME (tail, frame)
8028 { 8046 {
8029 struct frame *f = XFRAME (frame); 8047 struct frame *f = XFRAME (frame);
8030 if (FRAME_X_DISPLAY_INFO (f) == dpyinfo) 8048 if (FRAME_X_P (f) && FRAME_X_DISPLAY_INFO (f) == dpyinfo)
8031 { 8049 {
8032 FRAME_XIC (f) = NULL; 8050 FRAME_XIC (f) = NULL;
8033 if (FRAME_XIC_FONTSET (f)) 8051 if (FRAME_XIC_FONTSET (f))
8034 { 8052 {
8035 XFreeFontSet (FRAME_X_DISPLAY (f), FRAME_XIC_FONTSET (f)); 8053 XFreeFontSet (FRAME_X_DISPLAY (f), FRAME_XIC_FONTSET (f));
8128 BLOCK_INPUT; 8146 BLOCK_INPUT;
8129 FOR_EACH_FRAME (tail, frame) 8147 FOR_EACH_FRAME (tail, frame)
8130 { 8148 {
8131 struct frame *f = XFRAME (frame); 8149 struct frame *f = XFRAME (frame);
8132 8150
8133 if (FRAME_X_DISPLAY_INFO (f) == xim_inst->dpyinfo) 8151 if (FRAME_X_P (f)
8152 && FRAME_X_DISPLAY_INFO (f) == xim_inst->dpyinfo)
8134 if (FRAME_XIC (f) == NULL) 8153 if (FRAME_XIC (f) == NULL)
8135 { 8154 {
8136 create_frame_xic (f); 8155 create_frame_xic (f);
8137 if (FRAME_XIC_STYLE (f) & XIMStatusArea) 8156 if (FRAME_XIC_STYLE (f) & XIMStatusArea)
8138 xic_set_statusarea (f); 8157 xic_set_statusarea (f);
10799 /* Set up use of X before we make the first connection. */ 10818 /* Set up use of X before we make the first connection. */
10800 10819
10801 extern frame_parm_handler x_frame_parm_handlers[]; 10820 extern frame_parm_handler x_frame_parm_handlers[];
10802 10821
10803 static struct redisplay_interface x_redisplay_interface = 10822 static struct redisplay_interface x_redisplay_interface =
10804 { 10823 {
10805 x_frame_parm_handlers, 10824 x_frame_parm_handlers,
10806 x_produce_glyphs, 10825 x_produce_glyphs,
10807 x_write_glyphs, 10826 x_write_glyphs,
10808 x_insert_glyphs, 10827 x_insert_glyphs,
10809 x_clear_end_of_line, 10828 x_clear_end_of_line,
10810 x_scroll_run, 10829 x_scroll_run,
10811 x_after_update_window_line, 10830 x_after_update_window_line,
10812 x_update_window_begin, 10831 x_update_window_begin,
10813 x_update_window_end, 10832 x_update_window_end,
10814 x_cursor_to, 10833 x_cursor_to,
10815 x_flush, 10834 x_flush,
10816 #ifndef XFlush 10835 #ifndef XFlush
10817 x_flush, 10836 x_flush,
10818 #else 10837 #else
10819 0, /* flush_display_optional */ 10838 0, /* flush_display_optional */
10820 #endif 10839 #endif
10821 x_clear_window_mouse_face, 10840 x_clear_window_mouse_face,
10822 x_get_glyph_overhangs, 10841 x_get_glyph_overhangs,
10823 x_fix_overlapping_area, 10842 x_fix_overlapping_area,
10824 x_draw_fringe_bitmap, 10843 x_draw_fringe_bitmap,
10825 x_per_char_metric, 10844 x_per_char_metric,
10826 x_encode_char, 10845 x_encode_char,
10827 x_compute_glyph_string_overhangs, 10846 x_compute_glyph_string_overhangs,
10828 x_draw_glyph_string, 10847 x_draw_glyph_string,
10829 x_define_frame_cursor, 10848 x_define_frame_cursor,
10830 x_clear_frame_area, 10849 x_clear_frame_area,
10831 x_draw_window_cursor, 10850 x_draw_window_cursor,
10832 x_draw_vertical_window_border, 10851 x_draw_vertical_window_border,
10833 x_shift_glyphs_for_insert 10852 x_shift_glyphs_for_insert
10834 }; 10853 };
10835 10854
10836 void 10855 void
10837 x_initialize () 10856 x_initialize ()
10838 { 10857 {
10839 rif = &x_redisplay_interface;
10840
10841 clear_frame_hook = x_clear_frame; 10858 clear_frame_hook = x_clear_frame;
10842 ins_del_lines_hook = x_ins_del_lines; 10859 ins_del_lines_hook = x_ins_del_lines;
10843 delete_glyphs_hook = x_delete_glyphs; 10860 delete_glyphs_hook = x_delete_glyphs;
10844 ring_bell_hook = XTring_bell; 10861 ring_bell_hook = XTring_bell;
10845 reset_terminal_modes_hook = XTreset_terminal_modes; 10862 reset_terminal_modes_hook = XTreset_terminal_modes;
10855 set_vertical_scroll_bar_hook = XTset_vertical_scroll_bar; 10872 set_vertical_scroll_bar_hook = XTset_vertical_scroll_bar;
10856 condemn_scroll_bars_hook = XTcondemn_scroll_bars; 10873 condemn_scroll_bars_hook = XTcondemn_scroll_bars;
10857 redeem_scroll_bar_hook = XTredeem_scroll_bar; 10874 redeem_scroll_bar_hook = XTredeem_scroll_bar;
10858 judge_scroll_bars_hook = XTjudge_scroll_bars; 10875 judge_scroll_bars_hook = XTjudge_scroll_bars;
10859 10876
10860 TERMINAL_SCROLL_REGION_OK (CURRENT_TERMINAL ()) = 1; /* we'll scroll partial frames */ 10877 x_display_method.rif = &x_redisplay_interface;
10861 TERMINAL_CHAR_INS_DEL_OK (CURRENT_TERMINAL ()) = 1; 10878 x_display_method.scroll_region_ok = 1; /* We'll scroll partial frames. */
10862 TERMINAL_LINE_INS_DEL_OK (CURRENT_TERMINAL ()) = 1; /* we'll just blt 'em */ 10879 x_display_method.char_ins_del_ok = 1;
10863 TERMINAL_FAST_CLEAR_END_OF_LINE (CURRENT_TERMINAL ()) = 1; /* X does this well */ 10880 x_display_method.line_ins_del_ok = 1; /* We'll just blt 'em. */
10864 TERMINAL_MEMORY_BELOW_FRAME (CURRENT_TERMINAL ()) = 0; /* we don't remember what 10881 x_display_method.fast_clear_end_of_line = 1; /* X does this well. */
10865 scrolls off the 10882 x_display_method.memory_below_frame = 0; /* We don't remember what scrolls off the
10866 bottom */ 10883 bottom. */
10867 baud_rate = 19200; 10884 baud_rate = 19200;
10868 10885
10869 x_noop_count = 0; 10886 x_noop_count = 0;
10870 last_tool_bar_item = -1; 10887 last_tool_bar_item = -1;
10871 any_help_event_p = 0; 10888 any_help_event_p = 0;