aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Rumney2007-05-15 22:59:04 +0000
committerJason Rumney2007-05-15 22:59:04 +0000
commit4a418b108500b954cb43d193c199988a45d72e78 (patch)
treed2f8667c1eb1d652b68583a8f571bcd30099ec50 /src
parent01014cb1a15ff40eb92278bd992809a252956e81 (diff)
downloademacs-4a418b108500b954cb43d193c199988a45d72e78.tar.gz
emacs-4a418b108500b954cb43d193c199988a45d72e78.zip
(w32_set_terminal_modes, w32_reset_terminal_modes):
Add terminal arg. (x_clear_frame, x_delete_glyphs, w32_ring_bell, x_ins_del_lines): Add frame arg. (x_delete_terminal, w32_create_terminal): New functions. (w32_term_init): Create a terminal. (w32_initialize): Move terminal specific initialization to w32_create_terminal.
Diffstat (limited to 'src')
-rw-r--r--src/w32term.c235
1 files changed, 131 insertions, 104 deletions
diff --git a/src/w32term.c b/src/w32term.c
index e7118caa0d7..75e8a8c2bdf 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -235,9 +235,9 @@ static void x_font_min_bounds P_ ((XFontStruct *, int *, int *));
235int x_compute_min_glyph_bounds P_ ((struct frame *)); 235int x_compute_min_glyph_bounds P_ ((struct frame *));
236static void x_update_end P_ ((struct frame *)); 236static void x_update_end P_ ((struct frame *));
237static void w32_frame_up_to_date P_ ((struct frame *)); 237static void w32_frame_up_to_date P_ ((struct frame *));
238static void w32_set_terminal_modes P_ ((void)); 238static void w32_set_terminal_modes P_ ((struct terminal *));
239static void w32_reset_terminal_modes P_ ((void)); 239static void w32_reset_terminal_modes P_ ((struct terminal *));
240static void x_clear_frame P_ ((void)); 240static void x_clear_frame P_ ((struct frame *));
241static void frame_highlight P_ ((struct frame *)); 241static void frame_highlight P_ ((struct frame *));
242static void frame_unhighlight P_ ((struct frame *)); 242static void frame_unhighlight P_ ((struct frame *));
243static void x_new_focus_frame P_ ((struct w32_display_info *, 243static void x_new_focus_frame P_ ((struct w32_display_info *,
@@ -801,7 +801,7 @@ w32_destroy_fringe_bitmap (which)
801 rarely happens). */ 801 rarely happens). */
802 802
803static void 803static void
804w32_set_terminal_modes (void) 804w32_set_terminal_modes (struct terminal *term)
805{ 805{
806} 806}
807 807
@@ -809,7 +809,7 @@ w32_set_terminal_modes (void)
809 the W32 windows go away, and suspending requires no action. */ 809 the W32 windows go away, and suspending requires no action. */
810 810
811static void 811static void
812w32_reset_terminal_modes (void) 812w32_reset_terminal_modes (struct terminal *term)
813{ 813{
814} 814}
815 815
@@ -2608,16 +2608,10 @@ w32_shift_glyphs_for_insert (f, x, y, width, height, shift_by)
2608 for X frames. */ 2608 for X frames. */
2609 2609
2610static void 2610static void
2611x_delete_glyphs (n) 2611x_delete_glyphs (f, n)
2612 struct frame *f;
2612 register int n; 2613 register int n;
2613{ 2614{
2614 struct frame *f;
2615
2616 if (updating_frame)
2617 f = updating_frame;
2618 else
2619 f = SELECTED_FRAME ();
2620
2621 if (! FRAME_W32_P (f)) 2615 if (! FRAME_W32_P (f))
2622 return; 2616 return;
2623 2617
@@ -2629,15 +2623,8 @@ x_delete_glyphs (n)
2629 frame. Otherwise clear the selected frame. */ 2623 frame. Otherwise clear the selected frame. */
2630 2624
2631static void 2625static void
2632x_clear_frame () 2626x_clear_frame (struct frame *f)
2633{ 2627{
2634 struct frame *f;
2635
2636 if (updating_frame)
2637 f = updating_frame;
2638 else
2639 f = SELECTED_FRAME ();
2640
2641 if (! FRAME_W32_P (f)) 2628 if (! FRAME_W32_P (f))
2642 return; 2629 return;
2643 2630
@@ -2664,18 +2651,14 @@ x_clear_frame ()
2664/* Make audible bell. */ 2651/* Make audible bell. */
2665 2652
2666static void 2653static void
2667w32_ring_bell (void) 2654w32_ring_bell (struct frame *f)
2668{ 2655{
2669 struct frame *f;
2670
2671 f = SELECTED_FRAME ();
2672
2673 BLOCK_INPUT; 2656 BLOCK_INPUT;
2674 2657
2675 if (FRAME_W32_P (f) && visible_bell) 2658 if (FRAME_W32_P (f) && visible_bell)
2676 { 2659 {
2677 int i; 2660 int i;
2678 HWND hwnd = FRAME_W32_WINDOW (SELECTED_FRAME ()); 2661 HWND hwnd = FRAME_W32_WINDOW (f);
2679 2662
2680 for (i = 0; i < 5; i++) 2663 for (i = 0; i < 5; i++)
2681 { 2664 {
@@ -2685,7 +2668,7 @@ w32_ring_bell (void)
2685 FlashWindow (hwnd, FALSE); 2668 FlashWindow (hwnd, FALSE);
2686 } 2669 }
2687 else 2670 else
2688 w32_sys_ring_bell (); 2671 w32_sys_ring_bell (f);
2689 2672
2690 UNBLOCK_INPUT; 2673 UNBLOCK_INPUT;
2691} 2674}
@@ -2712,16 +2695,10 @@ w32_set_terminal_window (n)
2712 lines or deleting -N lines at vertical position VPOS. */ 2695 lines or deleting -N lines at vertical position VPOS. */
2713 2696
2714static void 2697static void
2715x_ins_del_lines (vpos, n) 2698x_ins_del_lines (f, vpos, n)
2699 struct frame *f;
2716 int vpos, n; 2700 int vpos, n;
2717{ 2701{
2718 struct frame *f;
2719
2720 if (updating_frame)
2721 f = updating_frame;
2722 else
2723 f = SELECTED_FRAME ();
2724
2725 if (! FRAME_W32_P (f)) 2702 if (! FRAME_W32_P (f))
2726 return; 2703 return;
2727 2704
@@ -5910,14 +5887,13 @@ x_free_frame_resources (f)
5910 5887
5911 5888
5912/* Destroy the window of frame F. */ 5889/* Destroy the window of frame F. */
5913 5890void
5914x_destroy_window (f) 5891x_destroy_window (f)
5915 struct frame *f; 5892 struct frame *f;
5916{ 5893{
5917 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); 5894 struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f);
5918 5895
5919 x_free_frame_resources (f); 5896 x_free_frame_resources (f);
5920
5921 dpyinfo->reference_count--; 5897 dpyinfo->reference_count--;
5922} 5898}
5923 5899
@@ -6177,6 +6153,116 @@ w32_make_rdb (xrm_option)
6177 return buffer; 6153 return buffer;
6178} 6154}
6179 6155
6156void
6157x_flush (struct frame * f)
6158{ /* Nothing to do */ }
6159
6160
6161extern frame_parm_handler w32_frame_parm_handlers[];
6162
6163static struct redisplay_interface w32_redisplay_interface =
6164{
6165 w32_frame_parm_handlers,
6166 x_produce_glyphs,
6167 x_write_glyphs,
6168 x_insert_glyphs,
6169 x_clear_end_of_line,
6170 x_scroll_run,
6171 x_after_update_window_line,
6172 x_update_window_begin,
6173 x_update_window_end,
6174 x_cursor_to,
6175 x_flush,
6176 0, /* flush_display_optional */
6177 x_clear_window_mouse_face,
6178 w32_get_glyph_overhangs,
6179 x_fix_overlapping_area,
6180 w32_draw_fringe_bitmap,
6181 w32_define_fringe_bitmap,
6182 w32_destroy_fringe_bitmap,
6183 w32_per_char_metric,
6184 w32_encode_char,
6185 NULL, /* w32_compute_glyph_string_overhangs */
6186 x_draw_glyph_string,
6187 w32_define_frame_cursor,
6188 w32_clear_frame_area,
6189 w32_draw_window_cursor,
6190 w32_draw_vertical_window_border,
6191 w32_shift_glyphs_for_insert
6192};
6193
6194static void x_delete_terminal (struct terminal *term);
6195
6196static struct terminal *
6197w32_create_terminal (struct w32_display_info *dpyinfo)
6198{
6199 struct terminal *terminal;
6200
6201 terminal = create_terminal ();
6202
6203 terminal->type = output_w32;
6204 terminal->display_info.w32 = dpyinfo;
6205 dpyinfo->terminal = terminal;
6206
6207 /* MSVC does not type K&R functions with no arguments correctly, and
6208 so we must explicitly cast them. */
6209 terminal->clear_frame_hook = x_clear_frame;
6210 terminal->ins_del_lines_hook = x_ins_del_lines;
6211 terminal->delete_glyphs_hook = x_delete_glyphs;
6212 terminal->ring_bell_hook = w32_ring_bell;
6213 terminal->reset_terminal_modes_hook = w32_reset_terminal_modes;
6214 terminal->set_terminal_modes_hook = w32_set_terminal_modes;
6215 terminal->update_begin_hook = x_update_begin;
6216 terminal->update_end_hook = x_update_end;
6217 terminal->set_terminal_window_hook = w32_set_terminal_window;
6218 terminal->read_socket_hook = w32_read_socket;
6219 terminal->frame_up_to_date_hook = w32_frame_up_to_date;
6220 terminal->mouse_position_hook = w32_mouse_position;
6221 terminal->frame_rehighlight_hook = w32_frame_rehighlight;
6222 terminal->frame_raise_lower_hook = w32_frame_raise_lower;
6223 // terminal->fullscreen_hook = XTfullscreen_hook;
6224 terminal->set_vertical_scroll_bar_hook = w32_set_vertical_scroll_bar;
6225 terminal->condemn_scroll_bars_hook = w32_condemn_scroll_bars;
6226 terminal->redeem_scroll_bar_hook = w32_redeem_scroll_bar;
6227 terminal->judge_scroll_bars_hook = w32_judge_scroll_bars;
6228
6229 terminal->delete_frame_hook = x_destroy_window;
6230 terminal->delete_terminal_hook = x_delete_terminal;
6231
6232 terminal->rif = &w32_redisplay_interface;
6233 terminal->scroll_region_ok = 1; /* We'll scroll partial frames. */
6234 terminal->char_ins_del_ok = 1;
6235 terminal->line_ins_del_ok = 1; /* We'll just blt 'em. */
6236 terminal->fast_clear_end_of_line = 1; /* X does this well. */
6237 terminal->memory_below_frame = 0; /* We don't remember what scrolls
6238 off the bottom. */
6239
6240 return terminal;
6241}
6242
6243static void
6244x_delete_terminal (struct terminal *terminal)
6245{
6246 struct w32_display_info *dpyinfo = terminal->display_info.w32;
6247 int i;
6248
6249 /* Protect against recursive calls. Fdelete_frame in
6250 delete_terminal calls us back when it deletes our last frame. */
6251 if (terminal->deleted)
6252 return;
6253
6254 BLOCK_INPUT;
6255 /* Free the fonts in the font table. */
6256 for (i = 0; i < dpyinfo->n_fonts; i++)
6257 if (dpyinfo->font_table[i].name)
6258 {
6259 DeleteObject (((XFontStruct*)(dpyinfo->font_table[i].font))->hfont);
6260 }
6261
6262 x_delete_display (dpyinfo);
6263 UNBLOCK_INPUT;
6264}
6265
6180struct w32_display_info * 6266struct w32_display_info *
6181w32_term_init (display_name, xrm_option, resource_name) 6267w32_term_init (display_name, xrm_option, resource_name)
6182 Lisp_Object display_name; 6268 Lisp_Object display_name;
@@ -6184,6 +6270,7 @@ w32_term_init (display_name, xrm_option, resource_name)
6184 char *resource_name; 6270 char *resource_name;
6185{ 6271{
6186 struct w32_display_info *dpyinfo; 6272 struct w32_display_info *dpyinfo;
6273 struct terminal *terminal;
6187 HDC hdc; 6274 HDC hdc;
6188 6275
6189 BLOCK_INPUT; 6276 BLOCK_INPUT;
@@ -6197,6 +6284,12 @@ w32_term_init (display_name, xrm_option, resource_name)
6197 w32_initialize_display_info (display_name); 6284 w32_initialize_display_info (display_name);
6198 6285
6199 dpyinfo = &one_w32_display_info; 6286 dpyinfo = &one_w32_display_info;
6287 terminal = w32_create_terminal (dpyinfo);
6288
6289 /* Set the name of the terminal. */
6290 terminal->name = (char *) xmalloc (SBYTES (display_name) + 1);
6291 strncpy (terminal->name, SDATA (display_name), SBYTES (display_name));
6292 terminal->name[SBYTES (display_name)] = 0;
6200 6293
6201 dpyinfo->xrdb = xrm_option ? w32_make_rdb (xrm_option) : NULL; 6294 dpyinfo->xrdb = xrm_option ? w32_make_rdb (xrm_option) : NULL;
6202 6295
@@ -6257,7 +6350,6 @@ w32_term_init (display_name, xrm_option, resource_name)
6257} 6350}
6258 6351
6259/* Get rid of display DPYINFO, assuming all frames are already gone. */ 6352/* Get rid of display DPYINFO, assuming all frames are already gone. */
6260
6261void 6353void
6262x_delete_display (dpyinfo) 6354x_delete_display (dpyinfo)
6263 struct w32_display_info *dpyinfo; 6355 struct w32_display_info *dpyinfo;
@@ -6309,73 +6401,8 @@ x_delete_display (dpyinfo)
6309DWORD WINAPI w32_msg_worker (void * arg); 6401DWORD WINAPI w32_msg_worker (void * arg);
6310 6402
6311void 6403void
6312x_flush (struct frame * f)
6313{ /* Nothing to do */ }
6314
6315extern frame_parm_handler w32_frame_parm_handlers[];
6316
6317static struct redisplay_interface w32_redisplay_interface =
6318{
6319 w32_frame_parm_handlers,
6320 x_produce_glyphs,
6321 x_write_glyphs,
6322 x_insert_glyphs,
6323 x_clear_end_of_line,
6324 x_scroll_run,
6325 x_after_update_window_line,
6326 x_update_window_begin,
6327 x_update_window_end,
6328 x_cursor_to,
6329 x_flush,
6330 0, /* flush_display_optional */
6331 x_clear_window_mouse_face,
6332 w32_get_glyph_overhangs,
6333 x_fix_overlapping_area,
6334 w32_draw_fringe_bitmap,
6335 w32_define_fringe_bitmap,
6336 w32_destroy_fringe_bitmap,
6337 w32_per_char_metric,
6338 w32_encode_char,
6339 NULL, /* w32_compute_glyph_string_overhangs */
6340 x_draw_glyph_string,
6341 w32_define_frame_cursor,
6342 w32_clear_frame_area,
6343 w32_draw_window_cursor,
6344 w32_draw_vertical_window_border,
6345 w32_shift_glyphs_for_insert
6346};
6347
6348void
6349w32_initialize () 6404w32_initialize ()
6350{ 6405{
6351 rif = &w32_redisplay_interface;
6352
6353 /* MSVC does not type K&R functions with no arguments correctly, and
6354 so we must explicitly cast them. */
6355 clear_frame_hook = (void (*)(void)) x_clear_frame;
6356 ring_bell_hook = (void (*)(void)) w32_ring_bell;
6357 update_begin_hook = x_update_begin;
6358 update_end_hook = x_update_end;
6359
6360 read_socket_hook = w32_read_socket;
6361
6362 frame_up_to_date_hook = w32_frame_up_to_date;
6363
6364 mouse_position_hook = w32_mouse_position;
6365 frame_rehighlight_hook = w32_frame_rehighlight;
6366 frame_raise_lower_hook = w32_frame_raise_lower;
6367 set_vertical_scroll_bar_hook = w32_set_vertical_scroll_bar;
6368 condemn_scroll_bars_hook = w32_condemn_scroll_bars;
6369 redeem_scroll_bar_hook = w32_redeem_scroll_bar;
6370 judge_scroll_bars_hook = w32_judge_scroll_bars;
6371
6372 TTY_SCROLL_REGION_OK (CURTTY ()) = 1; /* we'll scroll partial frames */
6373 TTY_CHAR_INS_DEL_OK (CURTTY ()) = 1;
6374 TTY_LINE_INS_DEL_OK (CURTTY ()) = 1; /* we'll just blt 'em */
6375 TTY_FAST_CLEAR_END_OF_LINE (CURTTY ()) = 1; /* X does this well */
6376 TTY_MEMORY_BELOW_FRAME (CURTTY ()) = 0; /* we don't remember what
6377 scrolls off the
6378 bottom */
6379 baud_rate = 19200; 6406 baud_rate = 19200;
6380 6407
6381 w32_system_caret_hwnd = NULL; 6408 w32_system_caret_hwnd = NULL;