Mercurial > emacs
comparison src/xterm.c @ 313:ac18f34e3e33
*** empty log message ***
author | Jim Blandy <jimb@redhat.com> |
---|---|
date | Wed, 03 Jul 1991 02:30:48 +0000 |
parents | 8a40ab4a424f |
children | 7f92840f8be4 |
comparison
equal
deleted
inserted
replaced
312:adba7439e87c | 313:ac18f34e3e33 |
---|---|
412 Window window = s->display.x->window_desc; | 412 Window window = s->display.x->window_desc; |
413 GC drawing_gc = (hl == 2 ? s->display.x->cursor_gc | 413 GC drawing_gc = (hl == 2 ? s->display.x->cursor_gc |
414 : (hl ? s->display.x->reverse_gc | 414 : (hl ? s->display.x->reverse_gc |
415 : s->display.x->normal_gc)); | 415 : s->display.x->normal_gc)); |
416 | 416 |
417 XDrawImageString16 (x_current_display, window, drawing_gc, | 417 if (sizeof (GLYPH) == sizeof (XChar2b)) |
418 left, top + FONT_BASE (font), (XChar2b *) gp, n); | 418 XDrawImageString16 (x_current_display, window, drawing_gc, |
419 left, top + FONT_BASE (font), (XChar2b *) gp, n); | |
420 else if (sizeof (GLYPH) == sizeof (unsigned char)) | |
421 XDrawImageString (x_current_display, window, drawing_gc, | |
422 left, top + FONT_BASE (font), (char *) gp, n); | |
423 else | |
424 /* What size of glyph ARE you using? And does X have a function to | |
425 draw them? */ | |
426 abort (); | |
419 } | 427 } |
420 | 428 |
421 #if 0 | 429 #if 0 |
422 static void | 430 static void |
423 dumpglyphs (s, left, top, gp, n, hl, font) | 431 dumpglyphs (s, left, top, gp, n, hl, font) |
1049 | 1057 |
1050 /* Turn the cursor on if we turned it off. */ | 1058 /* Turn the cursor on if we turned it off. */ |
1051 | 1059 |
1052 if (cursor_cleared) | 1060 if (cursor_cleared) |
1053 x_display_cursor (s, 1); | 1061 x_display_cursor (s, 1); |
1054 XFlushQueue (); | |
1055 } | 1062 } |
1056 | 1063 |
1057 #ifndef HAVE_X11 | 1064 #ifndef HAVE_X11 |
1058 /* Process all queued ExposeRegion events. */ | 1065 /* Process all queued ExposeRegion events. */ |
1059 | 1066 |
1250 if (x_focus_screen->auto_raise) | 1257 if (x_focus_screen->auto_raise) |
1251 x_raise_screen (x_focus_screen); | 1258 x_raise_screen (x_focus_screen); |
1252 screen_highlight (x_focus_screen); | 1259 screen_highlight (x_focus_screen); |
1253 | 1260 |
1254 /* Enqueue an event. It's kind of important not to drop these | 1261 /* Enqueue an event. It's kind of important not to drop these |
1255 events, but the event queue's fixed size is a real pain in the butt | 1262 events, but the event queue's fixed size is a real pain |
1256 anyway. */ | 1263 anyway. */ |
1257 if (buf_free > 0) | 1264 if (buf_free > 0) |
1258 { | 1265 { |
1259 bufp->kind = screen_selected; | 1266 bufp->kind = screen_selected; |
1260 bufp->screen = screen; | 1267 bufp->screen = screen; |
1895 || !(s->auto_lower) | 1902 || !(s->auto_lower) |
1896 || (event.xcrossing.time - enter_timestamp) > 500)) | 1903 || (event.xcrossing.time - enter_timestamp) > 500)) |
1897 { | 1904 { |
1898 int n = x_new_focus_screen (s, bufp, numchars); | 1905 int n = x_new_focus_screen (s, bufp, numchars); |
1899 bufp += n; | 1906 bufp += n; |
1907 count += n; | |
1900 numchars -= n; | 1908 numchars -= n; |
1901 enter_timestamp = event.xcrossing.time; | 1909 enter_timestamp = event.xcrossing.time; |
1902 } | 1910 } |
1903 #if 0 | 1911 #if 0 |
1904 else if ((s = x_window_to_scrollbar (event.xcrossing.window, | 1912 else if ((s = x_window_to_scrollbar (event.xcrossing.window, |
1932 s = x_window_to_screen (event.xfocus.window); | 1940 s = x_window_to_screen (event.xfocus.window); |
1933 if (s) | 1941 if (s) |
1934 { | 1942 { |
1935 int n = x_new_focus_screen (s, bufp, numchars); | 1943 int n = x_new_focus_screen (s, bufp, numchars); |
1936 bufp += n; | 1944 bufp += n; |
1945 count += n; | |
1937 numchars -= n; | 1946 numchars -= n; |
1938 } | 1947 } |
1939 break; | 1948 break; |
1940 | 1949 |
1941 case LeaveNotify: | 1950 case LeaveNotify: |
1942 if (event.xcrossing.detail != NotifyInferior | 1951 if (event.xcrossing.detail != NotifyInferior |
1943 && event.xcrossing.subwindow == None | 1952 && event.xcrossing.subwindow == None |
1944 && event.xcrossing.mode == NotifyNormal) | 1953 && event.xcrossing.mode == NotifyNormal) |
1945 { | 1954 { |
1946 if (event.xcrossing.focus | 1955 if (event.xcrossing.focus) |
1947 && (x_focus_screen | |
1948 == x_window_to_screen (event.xcrossing.window))) | |
1949 { | 1956 { |
1950 int n = x_new_focus_screen (0, bufp, numchars); | 1957 int n; |
1958 s = x_window_to_screen (event.xcrossing.window); | |
1959 n = x_new_focus_screen (s, bufp, numchars); | |
1951 bufp += n; | 1960 bufp += n; |
1961 count += n; | |
1952 numchars -= n; | 1962 numchars -= n; |
1953 } | 1963 } |
1954 } | 1964 } |
1955 break; | 1965 break; |
1956 | 1966 |
1958 s = x_window_to_screen (event.xfocus.window); | 1968 s = x_window_to_screen (event.xfocus.window); |
1959 if (s && s == x_focus_screen) | 1969 if (s && s == x_focus_screen) |
1960 { | 1970 { |
1961 int n = x_new_focus_screen (0, bufp, numchars); | 1971 int n = x_new_focus_screen (0, bufp, numchars); |
1962 bufp += n; | 1972 bufp += n; |
1973 count += n; | |
1963 numchars -= n; | 1974 numchars -= n; |
1964 } | 1975 } |
1965 break; | 1976 break; |
1966 | 1977 |
1967 #else /* not HAVE_X11 */ | 1978 #else /* not HAVE_X11 */ |
2516 } | 2527 } |
2517 | 2528 |
2518 if (updating_screen != s) | 2529 if (updating_screen != s) |
2519 XFlushQueue (); | 2530 XFlushQueue (); |
2520 } | 2531 } |
2521 | |
2522 #if 0 | |
2523 This code has been rewritten to use x_draw_single_glyph and draw | |
2524 box cursors successfully. Once that code is working, this can go away. | |
2525 | |
2526 /* Turn the displayed cursor of screen S on or off according to ON. | |
2527 If ON is nonzero, where to put the cursor is specified | |
2528 by S->cursor_x and S->cursor_y. */ | |
2529 | |
2530 static void | |
2531 x_display_box_cursor (s, on) | |
2532 struct screen *s; | |
2533 int on; | |
2534 { | |
2535 register struct screen_glyphs *current_screen = SCREEN_CURRENT_GLYPHS (s); | |
2536 | |
2537 if (! s->visible) | |
2538 return; | |
2539 | |
2540 /* If cursor is off and we want it off, return quickly. */ | |
2541 | |
2542 if (!on && s->phys_cursor_x < 0) | |
2543 return; | |
2544 | |
2545 /* If cursor is currently being shown and we don't want it to be | |
2546 or it is in the wrong place, erase it. */ | |
2547 | |
2548 if (s->phys_cursor_x >= 0 | |
2549 && (!on || s->phys_cursor_x != s->cursor_x | |
2550 || s->phys_cursor_y != s->cursor_y)) | |
2551 { | |
2552 /* If there is supposed to be a character there, redraw it | |
2553 in that line's normal video. */ | |
2554 if (current_screen->enable[s->phys_cursor_y] | |
2555 && s->phys_cursor_x < current_screen->used[s->phys_cursor_y]) | |
2556 dumpglyphs (s, | |
2557 (s->phys_cursor_x * FONT_WIDTH (s->display.x->font) | |
2558 + s->display.x->internal_border_width), | |
2559 (s->phys_cursor_y * FONT_HEIGHT (s->display.x->font) | |
2560 + s->display.x->internal_border_width), | |
2561 ¤t_screen->glyphs[s->phys_cursor_y][s->phys_cursor_x], | |
2562 1, current_screen->highlight[s->phys_cursor_y], | |
2563 s->display.x->font); | |
2564 /* Otherwise just erase the space. */ | |
2565 else | |
2566 #ifdef HAVE_X11 | |
2567 XClearArea (x_current_display, s->display.x->window_desc, | |
2568 s->phys_cursor_x * FONT_WIDTH (s->display.x->font) | |
2569 + s->display.x->internal_border_width, | |
2570 s->phys_cursor_y * FONT_HEIGHT (s->display.x->font) | |
2571 + s->display.x->internal_border_width, | |
2572 FONT_WIDTH (s->display.x->font), | |
2573 FONT_HEIGHT (s->display.x->font), False); | |
2574 #else | |
2575 XPixSet (s->display.x->window_desc, | |
2576 s->phys_cursor_x * FONT_WIDTH (s->display.x->font) | |
2577 + s->display.x->internal_border_width, | |
2578 s->phys_cursor_y * FONT_HEIGHT (s->display.x->font) | |
2579 + s->display.x->internal_border_width, | |
2580 FONT_WIDTH (s->display.x->font), | |
2581 FONT_HEIGHT (s->display.x->font), | |
2582 s->display.x->background_pixel); | |
2583 #endif /* HAVE_X11 */ | |
2584 | |
2585 s->phys_cursor_x = -1; | |
2586 } | |
2587 | |
2588 /* If we want to show a cursor, write it in the right place. */ | |
2589 | |
2590 if (on && s->phys_cursor_x < 0) | |
2591 { | |
2592 if (s != selected_screen || s != x_input_screen) | |
2593 x_draw_box (s); | |
2594 else if (current_screen->enable[s->cursor_y] | |
2595 && s->cursor_x < current_screen->used[s->cursor_y]) | |
2596 /* There is a character there: draw the character with | |
2597 cursor coloration. */ | |
2598 dumpglyphs (s, | |
2599 (s->cursor_x * FONT_WIDTH (s->display.x->font) | |
2600 + s->display.x->internal_border_width), | |
2601 (s->cursor_y * FONT_HEIGHT (s->display.x->font) | |
2602 + s->display.x->internal_border_width), | |
2603 ¤t_screen->glyphs[s->cursor_y][s->cursor_x], | |
2604 1, 2, s->display.x->font); | |
2605 else | |
2606 #ifdef HAVE_X11 | |
2607 { | |
2608 GLYPH space = SPACEGLYPH; | |
2609 dumpglyphs (s, | |
2610 (s->cursor_x * FONT_WIDTH (s->display.x->font) | |
2611 + s->display.x->internal_border_width), | |
2612 (s->cursor_y * FONT_HEIGHT (s->display.x->font) | |
2613 + s->display.x->internal_border_width), | |
2614 &space, 1, | |
2615 2, s->display.x->font); | |
2616 } | |
2617 #if 0 | |
2618 /* This kills the HP-BSD X11R3 server... */ | |
2619 XFillRectangle (x_current_display, s->display.x->window_desc, | |
2620 s->display.x->cursor_gc, | |
2621 s->cursor_x * FONT_WIDTH (s->display.x->font) | |
2622 + s->display.x->internal_border_width, | |
2623 s->cursor_y * FONT_HEIGHT (s->display.x->font) | |
2624 + s->display.x->internal_border_width, | |
2625 FONT_WIDTH (s->display.x->font), FONT_HEIGHT (s->display.x->font)); | |
2626 #endif | |
2627 #else | |
2628 XPixSet (s->display.x->window_desc, | |
2629 s->cursor_x * FONT_WIDTH (s->display.x->font)+s->display.x->internal_border_width, | |
2630 s->cursor_y * FONT_HEIGHT (s->display.x->font)+s->display.x->internal_border_width, | |
2631 FONT_WIDTH (s->display.x->font), FONT_HEIGHT (s->display.x->font), s->display.x->cursor_pixel); | |
2632 #endif /* HAVE_X11 */ | |
2633 | |
2634 s->phys_cursor_x = s->cursor_x; | |
2635 s->phys_cursor_y = s->cursor_y; | |
2636 } | |
2637 | |
2638 if (updating_screen != s) | |
2639 XFlushQueue (); | |
2640 } | |
2641 #endif | |
2642 | 2532 |
2643 extern Lisp_Object Vbar_cursor; | 2533 extern Lisp_Object Vbar_cursor; |
2644 | 2534 |
2645 x_display_cursor (s, on) | 2535 x_display_cursor (s, on) |
2646 struct screen *s; | 2536 struct screen *s; |