diff options
| author | Jim Blandy | 1992-08-29 03:31:07 +0000 |
|---|---|---|
| committer | Jim Blandy | 1992-08-29 03:31:07 +0000 |
| commit | c118dd0617ec2a39c4d699b284c25297ca4a20c5 (patch) | |
| tree | ebb88b63063c5d00bc17d0c25943605431ed81b1 /src | |
| parent | b631f17789edc259104f18aa5f340ab70787f9bb (diff) | |
| download | emacs-c118dd0617ec2a39c4d699b284c25297ca4a20c5.tar.gz emacs-c118dd0617ec2a39c4d699b284c25297ca4a20c5.zip | |
* xterm.c (x_make_frame_invisible): Don't forget to check the
return value of XWithdrawWindow; it could indicate that the window
wasn't successfully redrawn.
* xterm.c (x_make_frame_invisible): Use XWithdrawWindow when
available [HAVE_X11R4]; send the UnmapNotify event when
appropriate [HAVE_X11]; just unmap the window if that's all that's
needed [not HAVE_X11].
* xterm.c (x_set_text_property): Removed; it's only called from
one place. Who wants *another* layer of indirection?
* xterm.c: Use the FRAME_X_WINDOW macro, for readability.
* xterm.c (x_death_handler): Renamed to x_connection_closed.
(x_term_init): Use x_connection_closed as the SIGPIPE handler.
* xterm.c (acceptable_x_error_p, x_handler_error_gracefully,
x_error_handler): Removed; you can't catch X errors this way,
since you can't perform X operations from within an X error
handler, and even though we call error, we're still within an X
error handler.
(x_error_quitter, x_error_catcher): New functions, for panicking
on and catching X protocol errors.
(x_caught_error_message): Buffer for caught X errors.
(x_catch_errors, x_check_errors, x_uncatch_errors): New functions
for catching errors.
(x_term_init): Set the error handler to x_error_quitter, rather
than x_error_handler.
* xterm.c (x_death_handler): Renamed to x_connection_closed.
(x_term_init): Use x_connection_closed as the SIGPIPE handler.
* xterm.c (acceptable_x_error_p, x_handler_error_gracefully,
x_error_handler): Removed; you can't catch X errors this way,
since you can't perform X operations from within an X error
handler, and even though we call error, we're still within an X
error handler.
(x_error_quitter, x_error_catcher): New functions, for panicking
on and catching X protocol errors.
(x_caught_error_message): Buffer for caught X errors.
(x_catch_errors, x_check_errors, x_uncatch_errors): New functions
for catching errors.
(x_term_init): Set the error handler to x_error_quitter, rather
than x_error_handler.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 777 |
1 files changed, 297 insertions, 480 deletions
diff --git a/src/xterm.c b/src/xterm.c index 8ff17c4601c..abedef39efc 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -43,29 +43,29 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| 43 | In some systems loading it twice is suicidal. */ | 43 | In some systems loading it twice is suicidal. */ |
| 44 | #ifndef makedev | 44 | #ifndef makedev |
| 45 | #include <sys/types.h> | 45 | #include <sys/types.h> |
| 46 | #endif | 46 | #endif /* makedev */ |
| 47 | #endif | 47 | #endif /* USG */ |
| 48 | 48 | ||
| 49 | #ifdef BSD | 49 | #ifdef BSD |
| 50 | #include <sys/ioctl.h> | 50 | #include <sys/ioctl.h> |
| 51 | #include <strings.h> | 51 | #include <strings.h> |
| 52 | #else | 52 | #else /* ! defined (BSD) */ |
| 53 | #include <sys/termio.h> | 53 | #include <sys/termio.h> |
| 54 | #include <string.h> | 54 | #include <string.h> |
| 55 | #endif | 55 | #endif /* ! defined (BSD) */ |
| 56 | 56 | ||
| 57 | /* Allow m- file to inhibit use of FIONREAD. */ | 57 | /* Allow m- file to inhibit use of FIONREAD. */ |
| 58 | #ifdef BROKEN_FIONREAD | 58 | #ifdef BROKEN_FIONREAD |
| 59 | #undef FIONREAD | 59 | #undef FIONREAD |
| 60 | #endif | 60 | #endif /* ! defined (BROKEN_FIONREAD) */ |
| 61 | 61 | ||
| 62 | /* We are unable to use interrupts if FIONREAD is not available, | 62 | /* We are unable to use interrupts if FIONREAD is not available, |
| 63 | so flush SIGIO so we won't try. */ | 63 | so flush SIGIO so we won't try. */ |
| 64 | #ifndef FIONREAD | 64 | #ifndef FIONREAD |
| 65 | #ifdef SIGIO | 65 | #ifdef SIGIO |
| 66 | #undef SIGIO | 66 | #undef SIGIO |
| 67 | #endif | 67 | #endif /* ! defined (SIGIO) */ |
| 68 | #endif | 68 | #endif /* FIONREAD */ |
| 69 | 69 | ||
| 70 | #include "systime.h" | 70 | #include "systime.h" |
| 71 | 71 | ||
| @@ -84,7 +84,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| 84 | #if 0 | 84 | #if 0 |
| 85 | #include "sink.h" | 85 | #include "sink.h" |
| 86 | #include "sinkmask.h" | 86 | #include "sinkmask.h" |
| 87 | #endif | 87 | #endif /* ! 0 */ |
| 88 | #include "gnu.h" | 88 | #include "gnu.h" |
| 89 | #include "frame.h" | 89 | #include "frame.h" |
| 90 | #include "disptab.h" | 90 | #include "disptab.h" |
| @@ -92,10 +92,10 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ | |||
| 92 | 92 | ||
| 93 | #ifdef HAVE_X11 | 93 | #ifdef HAVE_X11 |
| 94 | #define XMapWindow XMapRaised /* Raise them when mapping. */ | 94 | #define XMapWindow XMapRaised /* Raise them when mapping. */ |
| 95 | #else | 95 | #else /* ! defined (HAVE_X11) */ |
| 96 | #include <X/Xkeyboard.h> | 96 | #include <X/Xkeyboard.h> |
| 97 | /*#include <X/Xproto.h> */ | 97 | /*#include <X/Xproto.h> */ |
| 98 | #endif /* HAVE_X11 */ | 98 | #endif /* ! defined (HAVE_X11) */ |
| 99 | 99 | ||
| 100 | /* For sending Meta-characters. Do we need this? */ | 100 | /* For sending Meta-characters. Do we need this? */ |
| 101 | #define METABIT 0200 | 101 | #define METABIT 0200 |
| @@ -123,7 +123,7 @@ static struct event_queue x_expose_queue; | |||
| 123 | are copied into this queue for later processing. */ | 123 | are copied into this queue for later processing. */ |
| 124 | 124 | ||
| 125 | struct event_queue x_mouse_queue; | 125 | struct event_queue x_mouse_queue; |
| 126 | #endif | 126 | #endif /* HAVE_X11 */ |
| 127 | 127 | ||
| 128 | /* Nonzero after BLOCK_INPUT; prevents input events from being | 128 | /* Nonzero after BLOCK_INPUT; prevents input events from being |
| 129 | processed until later. */ | 129 | processed until later. */ |
| @@ -132,7 +132,7 @@ int x_input_blocked; | |||
| 132 | 132 | ||
| 133 | #if defined (SIGIO) && defined (FIONREAD) | 133 | #if defined (SIGIO) && defined (FIONREAD) |
| 134 | int BLOCK_INPUT_mask; | 134 | int BLOCK_INPUT_mask; |
| 135 | #endif | 135 | #endif /* ! defined (SIGIO) && defined (FIONREAD) */ |
| 136 | 136 | ||
| 137 | /* Nonzero if input events came in while x_input_blocked was nonzero. | 137 | /* Nonzero if input events came in while x_input_blocked was nonzero. |
| 138 | UNBLOCK_INPUT checks for this. */ | 138 | UNBLOCK_INPUT checks for this. */ |
| @@ -215,7 +215,7 @@ extern Window requestor_window; | |||
| 215 | /* Nonzero enables some debugging for the X interface code. */ | 215 | /* Nonzero enables some debugging for the X interface code. */ |
| 216 | extern int _Xdebug; | 216 | extern int _Xdebug; |
| 217 | 217 | ||
| 218 | #else /* X10 stuff */ | 218 | #else /* ! defined (HAVE_X11) */ |
| 219 | 219 | ||
| 220 | /* Bit patterns for the mouse cursor. */ | 220 | /* Bit patterns for the mouse cursor. */ |
| 221 | 221 | ||
| @@ -235,7 +235,7 @@ static short grey_bits[] = { | |||
| 235 | 0x0005, 0x000a, 0x0005, 0x000a}; | 235 | 0x0005, 0x000a, 0x0005, 0x000a}; |
| 236 | 236 | ||
| 237 | static Pixmap GreyPixmap = 0; | 237 | static Pixmap GreyPixmap = 0; |
| 238 | #endif /* X10 stuff */ | 238 | #endif /* ! defined (HAVE_X11) */ |
| 239 | 239 | ||
| 240 | /* From time to time we get info on an Emacs window, here. */ | 240 | /* From time to time we get info on an Emacs window, here. */ |
| 241 | 241 | ||
| @@ -253,66 +253,11 @@ static void flashback (); | |||
| 253 | 253 | ||
| 254 | #ifndef HAVE_X11 | 254 | #ifndef HAVE_X11 |
| 255 | static void dumpqueue (); | 255 | static void dumpqueue (); |
| 256 | #endif | 256 | #endif /* HAVE_X11 */ |
| 257 | 257 | ||
| 258 | void dumpborder (); | 258 | void dumpborder (); |
| 259 | static int XTcursor_to (); | 259 | static int XTcursor_to (); |
| 260 | static int XTclear_end_of_line (); | 260 | static int XTclear_end_of_line (); |
| 261 | |||
| 262 | /* R3/R4 compatibility stuff. Rah. */ | ||
| 263 | |||
| 264 | |||
| 265 | /* Set the property PROPERTY on the window displaying FRAME to VALUE. | ||
| 266 | VALUE must be a string. | ||
| 267 | |||
| 268 | We use this function instead of XSetWMName and XStoreName, since | ||
| 269 | the former isn't present in R3, while the latter isn't likely to | ||
| 270 | stay around. XChangeProperty, however, is likely to be around. | ||
| 271 | |||
| 272 | I have no idea if this is the right thing to do. Someone who is more | ||
| 273 | hip on how X is supposed to work should let us know if this is wrong. */ | ||
| 274 | |||
| 275 | x_set_text_property (f, property, value) | ||
| 276 | FRAME_PTR f; | ||
| 277 | Atom property; | ||
| 278 | Lisp_Object value; | ||
| 279 | { | ||
| 280 | BLOCK_INPUT; | ||
| 281 | |||
| 282 | #ifdef HAVE_X11R4 | ||
| 283 | { | ||
| 284 | XTextProperty text; | ||
| 285 | text.value = XSTRING (value)->data; | ||
| 286 | text.encoding = XA_STRING; | ||
| 287 | text.format = 8; | ||
| 288 | text.nitems = XSTRING (value)->size; | ||
| 289 | switch (property) | ||
| 290 | { | ||
| 291 | case XA_WM_NAME: | ||
| 292 | XSetWMName (x_current_display, f->display.x->window_desc, &text); | ||
| 293 | break; | ||
| 294 | case XA_WM_ICON_NAME: | ||
| 295 | XSetWMIconName (x_current_display, f->display.x->window_desc, &text); | ||
| 296 | break; | ||
| 297 | default: | ||
| 298 | /* If you want to use this function, you have to make sure it supports | ||
| 299 | the atoms you want! Dummy. */ | ||
| 300 | abort (); | ||
| 301 | } | ||
| 302 | } | ||
| 303 | #else | ||
| 304 | XChangeProperty (x_current_display, | ||
| 305 | f->display.x->window_desc, | ||
| 306 | prop, | ||
| 307 | XA_STRING, /* type */ | ||
| 308 | 8, /* format */ | ||
| 309 | PropModeReplace, /* mode */ | ||
| 310 | XSTRING (value)->data, | ||
| 311 | XSTRING (value)->size); | ||
| 312 | #endif | ||
| 313 | |||
| 314 | UNBLOCK_INPUT; | ||
| 315 | } | ||
| 316 | 261 | ||
| 317 | 262 | ||
| 318 | /* These hooks are called by update_frame at the beginning and end | 263 | /* These hooks are called by update_frame at the beginning and end |
| @@ -340,7 +285,7 @@ XTupdate_begin (f) | |||
| 340 | BLOCK_INPUT; | 285 | BLOCK_INPUT; |
| 341 | #ifndef HAVE_X11 | 286 | #ifndef HAVE_X11 |
| 342 | dumpqueue (); | 287 | dumpqueue (); |
| 343 | #endif | 288 | #endif /* HAVE_X11 */ |
| 344 | UNBLOCK_INPUT; | 289 | UNBLOCK_INPUT; |
| 345 | } | 290 | } |
| 346 | 291 | ||
| @@ -359,7 +304,7 @@ XTupdate_end (f) | |||
| 359 | BLOCK_INPUT; | 304 | BLOCK_INPUT; |
| 360 | #ifndef HAVE_X11 | 305 | #ifndef HAVE_X11 |
| 361 | dumpqueue (); | 306 | dumpqueue (); |
| 362 | #endif | 307 | #endif /* HAVE_X11 */ |
| 363 | adjust_scrollbars (f); | 308 | adjust_scrollbars (f); |
| 364 | x_do_pending_expose (); | 309 | x_do_pending_expose (); |
| 365 | 310 | ||
| @@ -450,7 +395,7 @@ dumpglyphs (f, left, top, gp, n, hl, font) | |||
| 450 | FONT_TYPE *font; | 395 | FONT_TYPE *font; |
| 451 | { | 396 | { |
| 452 | register int len; | 397 | register int len; |
| 453 | Window window = f->display.x->window_desc; | 398 | Window window = FRAME_X_WINDOW (f); |
| 454 | GC drawing_gc = (hl == 2 ? f->display.x->cursor_gc | 399 | GC drawing_gc = (hl == 2 ? f->display.x->cursor_gc |
| 455 | : (hl ? f->display.x->reverse_gc | 400 | : (hl ? f->display.x->reverse_gc |
| 456 | : f->display.x->normal_gc)); | 401 | : f->display.x->normal_gc)); |
| @@ -481,7 +426,7 @@ dumpglyphs (f, left, top, gp, n, hl, font) | |||
| 481 | register char *cp; /* Steps through buf[]. */ | 426 | register char *cp; /* Steps through buf[]. */ |
| 482 | register int tlen = GLYPH_TABLE_LENGTH; | 427 | register int tlen = GLYPH_TABLE_LENGTH; |
| 483 | register Lisp_Object *tbase = GLYPH_TABLE_BASE; | 428 | register Lisp_Object *tbase = GLYPH_TABLE_BASE; |
| 484 | Window window = f->display.x->window_desc; | 429 | Window window = FRAME_X_WINDOW (f); |
| 485 | int cursor_pixel = f->display.x->cursor_pixel; | 430 | int cursor_pixel = f->display.x->cursor_pixel; |
| 486 | int fg_pixel = f->display.x->foreground_pixel; | 431 | int fg_pixel = f->display.x->foreground_pixel; |
| 487 | int bg_pixel = f->display.x->background_pixel; | 432 | int bg_pixel = f->display.x->background_pixel; |
| @@ -531,7 +476,7 @@ dumpglyphs (f, left, top, gp, n, hl, font) | |||
| 531 | ? GC_cursor | 476 | ? GC_cursor |
| 532 | : (hl ? GC_reverse : GC_normal)), | 477 | : (hl ? GC_reverse : GC_normal)), |
| 533 | left, top + FONT_BASE (font), buf, len); | 478 | left, top + FONT_BASE (font), buf, len); |
| 534 | #else | 479 | #else /* ! defined (HAVE_X11) */ |
| 535 | XText (window, left, top, | 480 | XText (window, left, top, |
| 536 | buf, | 481 | buf, |
| 537 | len, | 482 | len, |
| @@ -541,26 +486,26 @@ dumpglyphs (f, left, top, gp, n, hl, font) | |||
| 541 | : hl ? bg_pixel : fg_pixel), | 486 | : hl ? bg_pixel : fg_pixel), |
| 542 | (hl == 2 ? cursor_pixel | 487 | (hl == 2 ? cursor_pixel |
| 543 | : hl ? fg_pixel : bg_pixel)); | 488 | : hl ? fg_pixel : bg_pixel)); |
| 544 | #endif /* HAVE_X11 */ | 489 | #endif /* ! defined (HAVE_X11) */ |
| 545 | } | 490 | } |
| 546 | else | 491 | else |
| 547 | { | 492 | { |
| 548 | #ifdef HAVE_X11 | 493 | #ifdef HAVE_X11 |
| 549 | if (FACE_IS_FONT (cf)) | 494 | if (FACE_IS_FONT (cf)) |
| 550 | XDrawImageString (x_current_display, f->display.x->window_desc, | 495 | XDrawImageString (x_current_display, FRAME_X_WINDOW (f), |
| 551 | FACE_GC (cf), | 496 | FACE_GC (cf), |
| 552 | left, top + FONT_BASE (FACE_FONT (cf)), | 497 | left, top + FONT_BASE (FACE_FONT (cf)), |
| 553 | buf, len); | 498 | buf, len); |
| 554 | else if (FACE_IS_IMAGE (cf)) | 499 | else if (FACE_IS_IMAGE (cf)) |
| 555 | XCopyPlane (x_current_display, FACE_IMAGE (cf), | 500 | XCopyPlane (x_current_display, FACE_IMAGE (cf), |
| 556 | f->display.x->window_desc, | 501 | FRAME_X_WINDOW (f), |
| 557 | f->display.x->normal_gc, | 502 | f->display.x->normal_gc, |
| 558 | 0, 0, | 503 | 0, 0, |
| 559 | FACE_IMAGE_WIDTH (cf), | 504 | FACE_IMAGE_WIDTH (cf), |
| 560 | FACE_IMAGE_HEIGHT (cf), left, top); | 505 | FACE_IMAGE_HEIGHT (cf), left, top); |
| 561 | else | 506 | else |
| 562 | abort (); | 507 | abort (); |
| 563 | #else | 508 | #else /* ! defined (HAVE_X11) */ |
| 564 | register struct face *fp = x_face_table[cf]; | 509 | register struct face *fp = x_face_table[cf]; |
| 565 | 510 | ||
| 566 | XText (window, left, top, | 511 | XText (window, left, top, |
| @@ -572,12 +517,12 @@ dumpglyphs (f, left, top, gp, n, hl, font) | |||
| 572 | : hl ? fp->bg : fp->fg), | 517 | : hl ? fp->bg : fp->fg), |
| 573 | (hl == 2 ? cursor_pixel | 518 | (hl == 2 ? cursor_pixel |
| 574 | : hl ? fp->fg : fp->bg)); | 519 | : hl ? fp->fg : fp->bg)); |
| 575 | #endif /* HAVE_X11 */ | 520 | #endif /* ! defined (HAVE_X11) */ |
| 576 | } | 521 | } |
| 577 | left += len * FONT_WIDTH (font); | 522 | left += len * FONT_WIDTH (font); |
| 578 | } | 523 | } |
| 579 | } | 524 | } |
| 580 | #endif | 525 | #endif /* ! 0 */ |
| 581 | 526 | ||
| 582 | /* Output some text at the nominal frame cursor position, | 527 | /* Output some text at the nominal frame cursor position, |
| 583 | advancing the cursor over the text. | 528 | advancing the cursor over the text. |
| @@ -663,7 +608,7 @@ XTclear_end_of_line (first_unused) | |||
| 663 | f->phys_cursor_x = -1; | 608 | f->phys_cursor_x = -1; |
| 664 | 609 | ||
| 665 | #ifdef HAVE_X11 | 610 | #ifdef HAVE_X11 |
| 666 | XClearArea (x_current_display, f->display.x->window_desc, | 611 | XClearArea (x_current_display, FRAME_X_WINDOW (f), |
| 667 | curs_x * FONT_WIDTH (f->display.x->font) | 612 | curs_x * FONT_WIDTH (f->display.x->font) |
| 668 | + f->display.x->internal_border_width, | 613 | + f->display.x->internal_border_width, |
| 669 | curs_y * FONT_HEIGHT (f->display.x->font) | 614 | curs_y * FONT_HEIGHT (f->display.x->font) |
| @@ -671,14 +616,14 @@ XTclear_end_of_line (first_unused) | |||
| 671 | FONT_WIDTH (f->display.x->font) * (first_unused - curs_x), | 616 | FONT_WIDTH (f->display.x->font) * (first_unused - curs_x), |
| 672 | FONT_HEIGHT (f->display.x->font), False); | 617 | FONT_HEIGHT (f->display.x->font), False); |
| 673 | 618 | ||
| 674 | #else | 619 | #else /* ! defined (HAVE_X11) */ |
| 675 | XPixSet (f->display.x->window_desc, | 620 | XPixSet (FRAME_X_WINDOW (f), |
| 676 | curs_x * FONT_WIDTH (f->display.x->font) + f->display.x->internal_border_width, | 621 | curs_x * FONT_WIDTH (f->display.x->font) + f->display.x->internal_border_width, |
| 677 | curs_y * FONT_HEIGHT (f->display.x->font) + f->display.x->internal_border_width, | 622 | curs_y * FONT_HEIGHT (f->display.x->font) + f->display.x->internal_border_width, |
| 678 | FONT_WIDTH (f->display.x->font) * (first_unused - curs_x), | 623 | FONT_WIDTH (f->display.x->font) * (first_unused - curs_x), |
| 679 | FONT_HEIGHT (f->display.x->font), | 624 | FONT_HEIGHT (f->display.x->font), |
| 680 | f->display.x->background_pixel); | 625 | f->display.x->background_pixel); |
| 681 | #endif /* HAVE_X11 */ | 626 | #endif /* ! defined (HAVE_X11) */ |
| 682 | 627 | ||
| 683 | UNBLOCK_INPUT; | 628 | UNBLOCK_INPUT; |
| 684 | } | 629 | } |
| @@ -697,10 +642,10 @@ XTclear_frame () | |||
| 697 | curs_y = 0; | 642 | curs_y = 0; |
| 698 | 643 | ||
| 699 | BLOCK_INPUT; | 644 | BLOCK_INPUT; |
| 700 | XClear (f->display.x->window_desc); | 645 | XClear (FRAME_X_WINDOW (f)); |
| 701 | #ifndef HAVE_X11 | 646 | #ifndef HAVE_X11 |
| 702 | dumpborder (f, 0); | 647 | dumpborder (f, 0); |
| 703 | #endif | 648 | #endif /* HAVE_X11 */ |
| 704 | XFlushQueue (); | 649 | XFlushQueue (); |
| 705 | UNBLOCK_INPUT; | 650 | UNBLOCK_INPUT; |
| 706 | } | 651 | } |
| @@ -724,15 +669,15 @@ XTflash (f) | |||
| 724 | for (i = f->height * FONT_HEIGHT (f->display.x->font) - 10; | 669 | for (i = f->height * FONT_HEIGHT (f->display.x->font) - 10; |
| 725 | i >= 0; | 670 | i >= 0; |
| 726 | i -= 100) /* Should be NO LOWER than 75 for speed reasons. */ | 671 | i -= 100) /* Should be NO LOWER than 75 for speed reasons. */ |
| 727 | XFillRectangle (x_current_display, f->display.x->window_desc, | 672 | XFillRectangle (x_current_display, FRAME_X_WINDOW (f), |
| 728 | f->display.x->cursor_gc, | 673 | f->display.x->cursor_gc, |
| 729 | 0, i, f->width * FONT_WIDTH (f->display.x->font) | 674 | 0, i, f->width * FONT_WIDTH (f->display.x->font) |
| 730 | + 2 * f->display.x->internal_border_width, 25); | 675 | + 2 * f->display.x->internal_border_width, 25); |
| 731 | #endif | 676 | #endif /* ! 0 */ |
| 732 | 677 | ||
| 733 | x = (f->width * FONT_WIDTH (f->display.x->font)) / 4; | 678 | x = (f->width * FONT_WIDTH (f->display.x->font)) / 4; |
| 734 | y = (f->height * FONT_HEIGHT (f->display.x->font)) / 4; | 679 | y = (f->height * FONT_HEIGHT (f->display.x->font)) / 4; |
| 735 | XFillRectangle (x_current_display, f->display.x->window_desc, | 680 | XFillRectangle (x_current_display, FRAME_X_WINDOW (f), |
| 736 | f->display.x->cursor_gc, | 681 | f->display.x->cursor_gc, |
| 737 | x, y, 2 * x, 2 * y); | 682 | x, y, 2 * x, 2 * y); |
| 738 | dumpglyphs (f, (x + f->display.x->internal_border_width), | 683 | dumpglyphs (f, (x + f->display.x->internal_border_width), |
| @@ -740,15 +685,15 @@ XTflash (f) | |||
| 740 | &active_frame->glyphs[(f->height / 4) + 1][(f->width / 4)], | 685 | &active_frame->glyphs[(f->height / 4) + 1][(f->width / 4)], |
| 741 | 1, 0, f->display.x->font); | 686 | 1, 0, f->display.x->font); |
| 742 | 687 | ||
| 743 | #else /* X10 */ | 688 | #else /* ! defined (HAVE_X11) */ |
| 744 | for (i = f->height * FONT_HEIGHT (f->display.x->font) - 10; | 689 | for (i = f->height * FONT_HEIGHT (f->display.x->font) - 10; |
| 745 | i >= 0; | 690 | i >= 0; |
| 746 | i -= 50) | 691 | i -= 50) |
| 747 | XPixFill (f->display.x->window_desc, 0, i, | 692 | XPixFill (FRAME_X_WINDOW (f), 0, i, |
| 748 | f->width * FONT_WIDTH (f->display.x->font) | 693 | f->width * FONT_WIDTH (f->display.x->font) |
| 749 | + 2 * f->display.x->internal_border_width, 10, | 694 | + 2 * f->display.x->internal_border_width, 10, |
| 750 | WHITE_PIX_DEFAULT, ClipModeClipped, GXinvert, AllPlanes); | 695 | WHITE_PIX_DEFAULT, ClipModeClipped, GXinvert, AllPlanes); |
| 751 | #endif /* X10 */ | 696 | #endif /* ! defined (HAVE_X11) */ |
| 752 | 697 | ||
| 753 | XFlushQueue (); | 698 | XFlushQueue (); |
| 754 | UNBLOCK_INPUT; | 699 | UNBLOCK_INPUT; |
| @@ -764,7 +709,7 @@ x_invert_frame (f) | |||
| 764 | unsigned long pix_temp; | 709 | unsigned long pix_temp; |
| 765 | 710 | ||
| 766 | x_display_cursor (f, 0); | 711 | x_display_cursor (f, 0); |
| 767 | XClearWindow (x_current_display, f->display.x->window_desc); | 712 | XClearWindow (x_current_display, FRAME_X_WINDOW (f)); |
| 768 | temp = f->display.x->normal_gc; | 713 | temp = f->display.x->normal_gc; |
| 769 | f->display.x->normal_gc = f->display.x->reverse_gc; | 714 | f->display.x->normal_gc = f->display.x->reverse_gc; |
| 770 | f->display.x->reverse_gc = temp; | 715 | f->display.x->reverse_gc = temp; |
| @@ -772,7 +717,7 @@ x_invert_frame (f) | |||
| 772 | f->display.x->foreground_pixel = f->display.x->background_pixel; | 717 | f->display.x->foreground_pixel = f->display.x->background_pixel; |
| 773 | f->display.x->background_pixel = pix_temp; | 718 | f->display.x->background_pixel = pix_temp; |
| 774 | 719 | ||
| 775 | XSetWindowBackground (x_current_display, f->display.x->window_desc, | 720 | XSetWindowBackground (x_current_display, FRAME_X_WINDOW (f), |
| 776 | f->display.x->background_pixel); | 721 | f->display.x->background_pixel); |
| 777 | if (f->display.x->background_pixel == f->display.x->cursor_pixel) | 722 | if (f->display.x->background_pixel == f->display.x->cursor_pixel) |
| 778 | { | 723 | { |
| @@ -783,23 +728,23 @@ x_invert_frame (f) | |||
| 783 | f->display.x->background_pixel); | 728 | f->display.x->background_pixel); |
| 784 | } | 729 | } |
| 785 | redraw_frame (f); | 730 | redraw_frame (f); |
| 786 | #endif /* X11 */ | 731 | #endif /* ! defined (HAVE_X11) */ |
| 787 | } | 732 | } |
| 788 | 733 | ||
| 789 | /* Make audible bell. */ | 734 | /* Make audible bell. */ |
| 790 | 735 | ||
| 791 | #ifdef HAVE_X11 | 736 | #ifdef HAVE_X11 |
| 792 | #define XRINGBELL XBell(x_current_display, 0) | 737 | #define XRINGBELL XBell(x_current_display, 0) |
| 793 | #else | 738 | #else /* ! defined (HAVE_X11) */ |
| 794 | #define XRINGBELL XFeep(0); | 739 | #define XRINGBELL XFeep(0); |
| 795 | #endif | 740 | #endif /* ! defined (HAVE_X11) */ |
| 796 | 741 | ||
| 797 | XTring_bell () | 742 | XTring_bell () |
| 798 | { | 743 | { |
| 799 | if (visible_bell) | 744 | if (visible_bell) |
| 800 | #if 0 | 745 | #if 0 |
| 801 | XTflash (selected_frame); | 746 | XTflash (selected_frame); |
| 802 | #endif | 747 | #endif /* ! 0 */ |
| 803 | { | 748 | { |
| 804 | x_invert_frame (selected_frame); | 749 | x_invert_frame (selected_frame); |
| 805 | x_invert_frame (selected_frame); | 750 | x_invert_frame (selected_frame); |
| @@ -871,19 +816,19 @@ stufflines (n) | |||
| 871 | 816 | ||
| 872 | #ifndef HAVE_X11 | 817 | #ifndef HAVE_X11 |
| 873 | dumpqueue (); | 818 | dumpqueue (); |
| 874 | #endif | 819 | #endif /* HAVE_X11 */ |
| 875 | 820 | ||
| 876 | if ((length > 0) && (newtop <= flexlines)) | 821 | if ((length > 0) && (newtop <= flexlines)) |
| 877 | { | 822 | { |
| 878 | #ifdef HAVE_X11 | 823 | #ifdef HAVE_X11 |
| 879 | XCopyArea (x_current_display, f->display.x->window_desc, | 824 | XCopyArea (x_current_display, FRAME_X_WINDOW (f), |
| 880 | f->display.x->window_desc, f->display.x->normal_gc, | 825 | FRAME_X_WINDOW (f), f->display.x->normal_gc, |
| 881 | intborder, topregion * FONT_HEIGHT (f->display.x->font) + intborder, | 826 | intborder, topregion * FONT_HEIGHT (f->display.x->font) + intborder, |
| 882 | f->width * FONT_WIDTH (f->display.x->font), | 827 | f->width * FONT_WIDTH (f->display.x->font), |
| 883 | length * FONT_HEIGHT (f->display.x->font), intborder, | 828 | length * FONT_HEIGHT (f->display.x->font), intborder, |
| 884 | newtop * FONT_HEIGHT (f->display.x->font) + intborder); | 829 | newtop * FONT_HEIGHT (f->display.x->font) + intborder); |
| 885 | #else | 830 | #else /* ! defined (HAVE_X11) */ |
| 886 | XMoveArea (f->display.x->window_desc, | 831 | XMoveArea (FRAME_X_WINDOW (f), |
| 887 | intborder, topregion * FONT_HEIGHT (f->display.x->font) + intborder, | 832 | intborder, topregion * FONT_HEIGHT (f->display.x->font) + intborder, |
| 888 | intborder, newtop * FONT_HEIGHT (f->display.x->font) + intborder, | 833 | intborder, newtop * FONT_HEIGHT (f->display.x->font) + intborder, |
| 889 | f->width * FONT_WIDTH (f->display.x->font), | 834 | f->width * FONT_WIDTH (f->display.x->font), |
| @@ -893,7 +838,7 @@ stufflines (n) | |||
| 893 | We can't let it wait because further i/d operations | 838 | We can't let it wait because further i/d operations |
| 894 | may want to copy this area to another area. */ | 839 | may want to copy this area to another area. */ |
| 895 | x_read_exposes (); | 840 | x_read_exposes (); |
| 896 | #endif /* HAVE_X11 */ | 841 | #endif /* ! defined (HAVE_X11) */ |
| 897 | } | 842 | } |
| 898 | 843 | ||
| 899 | newtop = min (newtop, (flexlines - 1)); | 844 | newtop = min (newtop, (flexlines - 1)); |
| @@ -901,18 +846,18 @@ stufflines (n) | |||
| 901 | if (length > 0) | 846 | if (length > 0) |
| 902 | { | 847 | { |
| 903 | #ifdef HAVE_X11 | 848 | #ifdef HAVE_X11 |
| 904 | XClearArea (x_current_display, f->display.x->window_desc, intborder, | 849 | XClearArea (x_current_display, FRAME_X_WINDOW (f), intborder, |
| 905 | topregion * FONT_HEIGHT (f->display.x->font) + intborder, | 850 | topregion * FONT_HEIGHT (f->display.x->font) + intborder, |
| 906 | f->width * FONT_WIDTH (f->display.x->font), | 851 | f->width * FONT_WIDTH (f->display.x->font), |
| 907 | n * FONT_HEIGHT (f->display.x->font), False); | 852 | n * FONT_HEIGHT (f->display.x->font), False); |
| 908 | #else | 853 | #else /* ! defined (HAVE_X11) */ |
| 909 | XPixSet (f->display.x->window_desc, | 854 | XPixSet (FRAME_X_WINDOW (f), |
| 910 | intborder, | 855 | intborder, |
| 911 | topregion * FONT_HEIGHT (f->display.x->font) + intborder, | 856 | topregion * FONT_HEIGHT (f->display.x->font) + intborder, |
| 912 | f->width * FONT_WIDTH (f->display.x->font), | 857 | f->width * FONT_WIDTH (f->display.x->font), |
| 913 | n * FONT_HEIGHT (f->display.x->font), | 858 | n * FONT_HEIGHT (f->display.x->font), |
| 914 | f->display.x->background_pixel); | 859 | f->display.x->background_pixel); |
| 915 | #endif /* HAVE_X11 */ | 860 | #endif /* ! defined (HAVE_X11) */ |
| 916 | } | 861 | } |
| 917 | } | 862 | } |
| 918 | 863 | ||
| @@ -932,43 +877,43 @@ scraplines (n) | |||
| 932 | 877 | ||
| 933 | #ifndef HAVE_X11 | 878 | #ifndef HAVE_X11 |
| 934 | dumpqueue (); | 879 | dumpqueue (); |
| 935 | #endif | 880 | #endif /* HAVE_X11 */ |
| 936 | 881 | ||
| 937 | if ((curs_y + n) >= flexlines) | 882 | if ((curs_y + n) >= flexlines) |
| 938 | { | 883 | { |
| 939 | if (flexlines >= (curs_y + 1)) | 884 | if (flexlines >= (curs_y + 1)) |
| 940 | { | 885 | { |
| 941 | #ifdef HAVE_X11 | 886 | #ifdef HAVE_X11 |
| 942 | XClearArea (x_current_display, f->display.x->window_desc, intborder, | 887 | XClearArea (x_current_display, FRAME_X_WINDOW (f), intborder, |
| 943 | curs_y * FONT_HEIGHT (f->display.x->font) + intborder, | 888 | curs_y * FONT_HEIGHT (f->display.x->font) + intborder, |
| 944 | f->width * FONT_WIDTH (f->display.x->font), | 889 | f->width * FONT_WIDTH (f->display.x->font), |
| 945 | (flexlines - curs_y) * FONT_HEIGHT (f->display.x->font), False); | 890 | (flexlines - curs_y) * FONT_HEIGHT (f->display.x->font), False); |
| 946 | #else | 891 | #else /* ! defined (HAVE_X11) */ |
| 947 | XPixSet (f->display.x->window_desc, | 892 | XPixSet (FRAME_X_WINDOW (f), |
| 948 | intborder, curs_y * FONT_HEIGHT (f->display.x->font) + intborder, | 893 | intborder, curs_y * FONT_HEIGHT (f->display.x->font) + intborder, |
| 949 | f->width * FONT_WIDTH (f->display.x->font), | 894 | f->width * FONT_WIDTH (f->display.x->font), |
| 950 | (flexlines - curs_y) * FONT_HEIGHT (f->display.x->font), | 895 | (flexlines - curs_y) * FONT_HEIGHT (f->display.x->font), |
| 951 | f->display.x->background_pixel); | 896 | f->display.x->background_pixel); |
| 952 | #endif /* HAVE_X11 */ | 897 | #endif /* ! defined (HAVE_X11) */ |
| 953 | } | 898 | } |
| 954 | } | 899 | } |
| 955 | else | 900 | else |
| 956 | { | 901 | { |
| 957 | #ifdef HAVE_X11 | 902 | #ifdef HAVE_X11 |
| 958 | XCopyArea (x_current_display, f->display.x->window_desc, | 903 | XCopyArea (x_current_display, FRAME_X_WINDOW (f), |
| 959 | f->display.x->window_desc, f->display.x->normal_gc, | 904 | FRAME_X_WINDOW (f), f->display.x->normal_gc, |
| 960 | intborder, | 905 | intborder, |
| 961 | (curs_y + n) * FONT_HEIGHT (f->display.x->font) + intborder, | 906 | (curs_y + n) * FONT_HEIGHT (f->display.x->font) + intborder, |
| 962 | f->width * FONT_WIDTH (f->display.x->font), | 907 | f->width * FONT_WIDTH (f->display.x->font), |
| 963 | (flexlines - (curs_y + n)) * FONT_HEIGHT (f->display.x->font), | 908 | (flexlines - (curs_y + n)) * FONT_HEIGHT (f->display.x->font), |
| 964 | intborder, curs_y * FONT_HEIGHT (f->display.x->font) + intborder); | 909 | intborder, curs_y * FONT_HEIGHT (f->display.x->font) + intborder); |
| 965 | XClearArea (x_current_display, f->display.x->window_desc, | 910 | XClearArea (x_current_display, FRAME_X_WINDOW (f), |
| 966 | intborder, | 911 | intborder, |
| 967 | (flexlines - n) * FONT_HEIGHT (f->display.x->font) + intborder, | 912 | (flexlines - n) * FONT_HEIGHT (f->display.x->font) + intborder, |
| 968 | f->width * FONT_WIDTH (f->display.x->font), | 913 | f->width * FONT_WIDTH (f->display.x->font), |
| 969 | n * FONT_HEIGHT (f->display.x->font), False); | 914 | n * FONT_HEIGHT (f->display.x->font), False); |
| 970 | #else | 915 | #else /* ! defined (HAVE_X11) */ |
| 971 | XMoveArea (f->display.x->window_desc, | 916 | XMoveArea (FRAME_X_WINDOW (f), |
| 972 | intborder, | 917 | intborder, |
| 973 | (curs_y + n) * FONT_HEIGHT (f->display.x->font) + intborder, | 918 | (curs_y + n) * FONT_HEIGHT (f->display.x->font) + intborder, |
| 974 | intborder, curs_y * FONT_HEIGHT (f->display.x->font) + intborder, | 919 | intborder, curs_y * FONT_HEIGHT (f->display.x->font) + intborder, |
| @@ -979,11 +924,11 @@ scraplines (n) | |||
| 979 | We can't let it wait because further i/d operations | 924 | We can't let it wait because further i/d operations |
| 980 | may want to copy this area to another area. */ | 925 | may want to copy this area to another area. */ |
| 981 | x_read_exposes (); | 926 | x_read_exposes (); |
| 982 | XPixSet (f->display.x->window_desc, intborder, | 927 | XPixSet (FRAME_X_WINDOW (f), intborder, |
| 983 | (flexlines - n) * FONT_HEIGHT (f->display.x->font) + intborder, | 928 | (flexlines - n) * FONT_HEIGHT (f->display.x->font) + intborder, |
| 984 | f->width * FONT_WIDTH (f->display.x->font), | 929 | f->width * FONT_WIDTH (f->display.x->font), |
| 985 | n * FONT_HEIGHT (f->display.x->font), f->display.x->background_pixel); | 930 | n * FONT_HEIGHT (f->display.x->font), f->display.x->background_pixel); |
| 986 | #endif /* HAVE_X11 */ | 931 | #endif /* ! defined (HAVE_X11) */ |
| 987 | } | 932 | } |
| 988 | } | 933 | } |
| 989 | 934 | ||
| @@ -1044,7 +989,7 @@ dumprectangle (f, left, top, cols, rows) | |||
| 1044 | || bottom > f->height * FONT_HEIGHT (f->display.x->font) | 989 | || bottom > f->height * FONT_HEIGHT (f->display.x->font) |
| 1045 | || right > f->width * FONT_WIDTH (f->display.x->font)) | 990 | || right > f->width * FONT_WIDTH (f->display.x->font)) |
| 1046 | dumpborder (f, 0); | 991 | dumpborder (f, 0); |
| 1047 | #endif /* HAVE_X11 */ | 992 | #endif /* HAVE_X11 /* Window manger does this for X11. */ */ |
| 1048 | 993 | ||
| 1049 | /* Convert rectangle edges in pixels to edges in chars. | 994 | /* Convert rectangle edges in pixels to edges in chars. |
| 1050 | Round down for left and top, up for right and bottom. */ | 995 | Round down for left and top, up for right and bottom. */ |
| @@ -1125,7 +1070,7 @@ dumpqueue () | |||
| 1125 | } | 1070 | } |
| 1126 | XFlushQueue (); | 1071 | XFlushQueue (); |
| 1127 | } | 1072 | } |
| 1128 | #endif | 1073 | #endif /* HAVE_X11 */ |
| 1129 | 1074 | ||
| 1130 | /* Process all expose events that are pending. | 1075 | /* Process all expose events that are pending. |
| 1131 | Redraws the cursor if necessary on any frame that | 1076 | Redraws the cursor if necessary on any frame that |
| @@ -1160,7 +1105,7 @@ x_do_pending_expose () | |||
| 1160 | intborder = f->display.x->internal_border_width; | 1105 | intborder = f->display.x->internal_border_width; |
| 1161 | 1106 | ||
| 1162 | clear_cursor (f); | 1107 | clear_cursor (f); |
| 1163 | XGetWindowInfo (f->display.x->window_desc, &windowinfo); | 1108 | XGetWindowInfo (FRAME_X_WINDOW (f), &windowinfo); |
| 1164 | temp_width = ((windowinfo.width - 2 * intborder | 1109 | temp_width = ((windowinfo.width - 2 * intborder |
| 1165 | - f->display.x->v_scrollbar_width) | 1110 | - f->display.x->v_scrollbar_width) |
| 1166 | / FONT_WIDTH (f->display.x->font)); | 1111 | / FONT_WIDTH (f->display.x->font)); |
| @@ -1178,7 +1123,7 @@ x_do_pending_expose () | |||
| 1178 | dumprectangle (f, 0, 0, PIXEL_WIDTH (f), PIXEL_HEIGHT (f)); | 1123 | dumprectangle (f, 0, 0, PIXEL_WIDTH (f), PIXEL_HEIGHT (f)); |
| 1179 | #if 0 | 1124 | #if 0 |
| 1180 | dumpborder (f, 0); | 1125 | dumpborder (f, 0); |
| 1181 | #endif | 1126 | #endif /* ! 0 */ |
| 1182 | f->display.x->needs_exposure = 0; | 1127 | f->display.x->needs_exposure = 0; |
| 1183 | if (updating_frame != f) | 1128 | if (updating_frame != f) |
| 1184 | x_display_cursor (f, 1); | 1129 | x_display_cursor (f, 1); |
| @@ -1190,9 +1135,9 @@ x_do_pending_expose () | |||
| 1190 | for various windows. */ | 1135 | for various windows. */ |
| 1191 | #ifdef HAVE_X11 | 1136 | #ifdef HAVE_X11 |
| 1192 | ; | 1137 | ; |
| 1193 | #else | 1138 | #else /* ! defined (HAVE_X11) */ |
| 1194 | dumpqueue (); | 1139 | dumpqueue (); |
| 1195 | #endif | 1140 | #endif /* ! defined (HAVE_X11) */ |
| 1196 | } | 1141 | } |
| 1197 | 1142 | ||
| 1198 | #ifdef HAVE_X11 | 1143 | #ifdef HAVE_X11 |
| @@ -1201,7 +1146,7 @@ frame_highlight (frame) | |||
| 1201 | struct frame *frame; | 1146 | struct frame *frame; |
| 1202 | { | 1147 | { |
| 1203 | if (! EQ (Vx_no_window_manager, Qnil)) | 1148 | if (! EQ (Vx_no_window_manager, Qnil)) |
| 1204 | XSetWindowBorder (x_current_display, frame->display.x->window_desc, | 1149 | XSetWindowBorder (x_current_display, FRAME_X_WINDOW (frame), |
| 1205 | frame->display.x->border_pixel); | 1150 | frame->display.x->border_pixel); |
| 1206 | x_display_cursor (frame, 1); | 1151 | x_display_cursor (frame, 1); |
| 1207 | } | 1152 | } |
| @@ -1211,11 +1156,11 @@ frame_unhighlight (frame) | |||
| 1211 | struct frame *frame; | 1156 | struct frame *frame; |
| 1212 | { | 1157 | { |
| 1213 | if (! EQ (Vx_no_window_manager, Qnil)) | 1158 | if (! EQ (Vx_no_window_manager, Qnil)) |
| 1214 | XSetWindowBorderPixmap (x_current_display, frame->display.x->window_desc, | 1159 | XSetWindowBorderPixmap (x_current_display, FRAME_X_WINDOW (frame), |
| 1215 | frame->display.x->border_tile); | 1160 | frame->display.x->border_tile); |
| 1216 | x_display_cursor (frame, 1); | 1161 | x_display_cursor (frame, 1); |
| 1217 | } | 1162 | } |
| 1218 | #else /* X10 */ | 1163 | #else /* ! defined (HAVE_X11) */ |
| 1219 | /* Dump the border-emphasis of frame F. | 1164 | /* Dump the border-emphasis of frame F. |
| 1220 | If F is selected, this is a lining of the same color as the border, | 1165 | If F is selected, this is a lining of the same color as the border, |
| 1221 | just within the border, occupying a portion of the internal border. | 1166 | just within the border, occupying a portion of the internal border. |
| @@ -1248,17 +1193,17 @@ dumpborder (f, always) | |||
| 1248 | pixel = f->display.x->border_pixel; | 1193 | pixel = f->display.x->border_pixel; |
| 1249 | } | 1194 | } |
| 1250 | 1195 | ||
| 1251 | XPixSet (f->display.x->window_desc, 0, 0, width, thickness, pixel); | 1196 | XPixSet (FRAME_X_WINDOW (f), 0, 0, width, thickness, pixel); |
| 1252 | XPixSet (f->display.x->window_desc, 0, 0, thickness, height, pixel); | 1197 | XPixSet (FRAME_X_WINDOW (f), 0, 0, thickness, height, pixel); |
| 1253 | XPixSet (f->display.x->window_desc, 0, height - thickness, width, | 1198 | XPixSet (FRAME_X_WINDOW (f), 0, height - thickness, width, |
| 1254 | thickness, pixel); | 1199 | thickness, pixel); |
| 1255 | XPixSet (f->display.x->window_desc, width - thickness, 0, thickness, | 1200 | XPixSet (FRAME_X_WINDOW (f), width - thickness, 0, thickness, |
| 1256 | height, pixel); | 1201 | height, pixel); |
| 1257 | 1202 | ||
| 1258 | if (always) | 1203 | if (always) |
| 1259 | x_display_cursor (f, 1); | 1204 | x_display_cursor (f, 1); |
| 1260 | } | 1205 | } |
| 1261 | #endif /* X10 */ | 1206 | #endif /* ! defined (HAVE_X11) */ |
| 1262 | 1207 | ||
| 1263 | static void XTframe_rehighlight (); | 1208 | static void XTframe_rehighlight (); |
| 1264 | 1209 | ||
| @@ -1290,7 +1235,7 @@ x_new_focus_frame (frame) | |||
| 1290 | Lisp_Frame, selected_frame); | 1235 | Lisp_Frame, selected_frame); |
| 1291 | Fselect_window (selected_frame->selected_window); | 1236 | Fselect_window (selected_frame->selected_window); |
| 1292 | choose_minibuf_frame (); | 1237 | choose_minibuf_frame (); |
| 1293 | #endif | 1238 | #endif /* ! 0 */ |
| 1294 | 1239 | ||
| 1295 | if (x_focus_frame && x_focus_frame->auto_raise) | 1240 | if (x_focus_frame && x_focus_frame->auto_raise) |
| 1296 | x_raise_frame (x_focus_frame); | 1241 | x_raise_frame (x_focus_frame); |
| @@ -1374,7 +1319,7 @@ notice_mouse_movement (result, motion_event, f, window_type, part) | |||
| 1374 | result->kind = no_event; | 1319 | result->kind = no_event; |
| 1375 | 1320 | ||
| 1376 | if (XQueryPointer (x_current_display, | 1321 | if (XQueryPointer (x_current_display, |
| 1377 | f->display.x->window_desc, | 1322 | FRAME_X_WINDOW (f), |
| 1378 | &root_window, &w, | 1323 | &root_window, &w, |
| 1379 | &root_x, &root_y, &pix_x, &pix_y, | 1324 | &root_x, &root_y, &pix_x, &pix_y, |
| 1380 | &keys_and_buttons) | 1325 | &keys_and_buttons) |
| @@ -1384,7 +1329,7 @@ notice_mouse_movement (result, motion_event, f, window_type, part) | |||
| 1384 | #if 0 | 1329 | #if 0 |
| 1385 | if (w == None) /* Mouse no longer in window. */ | 1330 | if (w == None) /* Mouse no longer in window. */ |
| 1386 | return Qnil; | 1331 | return Qnil; |
| 1387 | #endif | 1332 | #endif /* ! 0 */ |
| 1388 | 1333 | ||
| 1389 | pixel_to_glyph_translation (f, pix_x, pix_y, &x, &y); | 1334 | pixel_to_glyph_translation (f, pix_x, pix_y, &x, &y); |
| 1390 | if (x == x_mouse_x && y == x_mouse_y) | 1335 | if (x == x_mouse_x && y == x_mouse_y) |
| @@ -1432,7 +1377,7 @@ notice_mouse_movement (result, motion_event, f, window_type, part) | |||
| 1432 | 1377 | ||
| 1433 | return; | 1378 | return; |
| 1434 | } | 1379 | } |
| 1435 | #endif | 1380 | #endif /* ! 0 */ |
| 1436 | 1381 | ||
| 1437 | 1382 | ||
| 1438 | /* Mouse clicks and mouse movement. Rah. */ | 1383 | /* Mouse clicks and mouse movement. Rah. */ |
| @@ -1669,7 +1614,7 @@ XTmouse_position (f, x, y, time) | |||
| 1669 | so we start with the root window XQueryPointer has given us and | 1614 | so we start with the root window XQueryPointer has given us and |
| 1670 | start again. */ | 1615 | start again. */ |
| 1671 | 1616 | ||
| 1672 | guess = selected_frame->display.x->window_desc; | 1617 | guess = FRAME_X_WINDOW (selected_frame); |
| 1673 | for (;;) | 1618 | for (;;) |
| 1674 | if (XQueryPointer (d, guess, &root, &child, | 1619 | if (XQueryPointer (d, guess, &root, &child, |
| 1675 | &dummy, &dummy, &ix, &iy, (unsigned int *) &dummy)) | 1620 | &dummy, &dummy, &ix, &iy, (unsigned int *) &dummy)) |
| @@ -1708,49 +1653,10 @@ XTmouse_position (f, x, y, time) | |||
| 1708 | UNBLOCK_INPUT; | 1653 | UNBLOCK_INPUT; |
| 1709 | } | 1654 | } |
| 1710 | 1655 | ||
| 1711 | 1656 | #else /* ! defined (HAVE_X11) */ | |
| 1712 | static char *events[] = | ||
| 1713 | { | ||
| 1714 | "0: ERROR!", | ||
| 1715 | "1: REPLY", | ||
| 1716 | "KeyPress", | ||
| 1717 | "KeyRelease", | ||
| 1718 | "ButtonPress", | ||
| 1719 | "ButtonRelease", | ||
| 1720 | "MotionNotify", | ||
| 1721 | "EnterNotify", | ||
| 1722 | "LeaveNotify", | ||
| 1723 | "FocusIn", | ||
| 1724 | "FocusOut", | ||
| 1725 | "KeymapNotify", | ||
| 1726 | "Expose", | ||
| 1727 | "GraphicsExpose", | ||
| 1728 | "NoExpose", | ||
| 1729 | "VisibilityNotify", | ||
| 1730 | "CreateNotify", | ||
| 1731 | "DestroyNotify", | ||
| 1732 | "UnmapNotify", | ||
| 1733 | "MapNotify", | ||
| 1734 | "MapRequest", | ||
| 1735 | "ReparentNotify", | ||
| 1736 | "ConfigureNotify", | ||
| 1737 | "ConfigureRequest", | ||
| 1738 | "GravityNotify", | ||
| 1739 | "ResizeRequest", | ||
| 1740 | "CirculateNotify", | ||
| 1741 | "CirculateRequest", | ||
| 1742 | "PropertyNotify", | ||
| 1743 | "SelectionClear", | ||
| 1744 | "SelectionRequest", | ||
| 1745 | "SelectionNotify", | ||
| 1746 | "ColormapNotify", | ||
| 1747 | "ClientMessage", | ||
| 1748 | "MappingNotify", | ||
| 1749 | "LASTEvent" | ||
| 1750 | }; | ||
| 1751 | #else /* X10 */ | ||
| 1752 | #define XEvent XKeyPressedEvent | 1657 | #define XEvent XKeyPressedEvent |
| 1753 | #endif /* HAVE_X11 */ | 1658 | #endif /* ! defined (HAVE_X11) */ |
| 1659 | |||
| 1754 | 1660 | ||
| 1755 | /* Timestamp of enter window event. This is only used by XTread_socket, | 1661 | /* Timestamp of enter window event. This is only used by XTread_socket, |
| 1756 | but we have to put it out here, since static variables within functions | 1662 | but we have to put it out here, since static variables within functions |
| @@ -1817,7 +1723,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 1817 | FIOSNBIO is ignored, and instead of signalling EWOULDBLOCK, | 1723 | FIOSNBIO is ignored, and instead of signalling EWOULDBLOCK, |
| 1818 | a read returns 0, which Xlib interprets as equivalent to EPIPE. */ | 1724 | a read returns 0, which Xlib interprets as equivalent to EPIPE. */ |
| 1819 | fcntl (fileno (stdin), F_SETFL, 0); | 1725 | fcntl (fileno (stdin), F_SETFL, 0); |
| 1820 | #endif | 1726 | #endif /* ! defined (FIOSNBIO) */ |
| 1821 | 1727 | ||
| 1822 | #ifndef SIGIO | 1728 | #ifndef SIGIO |
| 1823 | #ifndef HAVE_SELECT | 1729 | #ifndef HAVE_SELECT |
| @@ -1828,8 +1734,8 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 1828 | XPeekEvent (XDISPLAY &event); | 1734 | XPeekEvent (XDISPLAY &event); |
| 1829 | read_alarm_should_throw = 0; | 1735 | read_alarm_should_throw = 0; |
| 1830 | } | 1736 | } |
| 1831 | #endif | 1737 | #endif /* HAVE_SELECT */ |
| 1832 | #endif | 1738 | #endif /* SIGIO */ |
| 1833 | 1739 | ||
| 1834 | while (XStuffPending () != 0) | 1740 | while (XStuffPending () != 0) |
| 1835 | { | 1741 | { |
| @@ -1931,7 +1837,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 1931 | source area was completely | 1837 | source area was completely |
| 1932 | available */ | 1838 | available */ |
| 1933 | break; | 1839 | break; |
| 1934 | #else /* not HAVE_X11 */ | 1840 | #else /* ! defined (HAVE_X11) */ |
| 1935 | case ExposeWindow: | 1841 | case ExposeWindow: |
| 1936 | if (event.subwindow != 0) | 1842 | if (event.subwindow != 0) |
| 1937 | break; /* duplicate event */ | 1843 | break; /* duplicate event */ |
| @@ -1941,7 +1847,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 1941 | refreshicon (f); | 1847 | refreshicon (f); |
| 1942 | f->iconified = 1; | 1848 | f->iconified = 1; |
| 1943 | } | 1849 | } |
| 1944 | if (event.window == f->display.x->window_desc) | 1850 | if (event.window == FRAME_X_WINDOW (f)) |
| 1945 | { | 1851 | { |
| 1946 | /* Say must check all windows' needs_exposure flags. */ | 1852 | /* Say must check all windows' needs_exposure flags. */ |
| 1947 | expose_all_windows = 1; | 1853 | expose_all_windows = 1; |
| @@ -1977,7 +1883,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 1977 | /* This should happen only when we are expecting it, | 1883 | /* This should happen only when we are expecting it, |
| 1978 | in x_read_exposes. */ | 1884 | in x_read_exposes. */ |
| 1979 | abort (); | 1885 | abort (); |
| 1980 | #endif /* not HAVE_X11 */ | 1886 | #endif /* ! defined (HAVE_X11) */ |
| 1981 | 1887 | ||
| 1982 | #ifdef HAVE_X11 | 1888 | #ifdef HAVE_X11 |
| 1983 | case UnmapNotify: | 1889 | case UnmapNotify: |
| @@ -2014,15 +1920,15 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 2014 | case VisibilityNotify: | 1920 | case VisibilityNotify: |
| 2015 | break; | 1921 | break; |
| 2016 | 1922 | ||
| 2017 | #else | 1923 | #else /* ! defined (HAVE_X11) */ |
| 2018 | case UnmapWindow: | 1924 | case UnmapWindow: |
| 2019 | f = x_window_to_frame (event.window); | 1925 | f = x_window_to_frame (event.window); |
| 2020 | if (event.window == f->display.x->icon_desc) | 1926 | if (event.window == f->display.x->icon_desc) |
| 2021 | f->iconified = 0; | 1927 | f->iconified = 0; |
| 2022 | if (event.window == f->display.x->window_desc) | 1928 | if (event.window == FRAME_X_WINDOW (f)) |
| 2023 | f->visible = 0; | 1929 | f->visible = 0; |
| 2024 | break; | 1930 | break; |
| 2025 | #endif /* HAVE_X11 */ | 1931 | #endif /* ! defined (HAVE_X11) */ |
| 2026 | 1932 | ||
| 2027 | #ifdef HAVE_X11 | 1933 | #ifdef HAVE_X11 |
| 2028 | case KeyPress: | 1934 | case KeyPress: |
| @@ -2099,7 +2005,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 2099 | } | 2005 | } |
| 2100 | } | 2006 | } |
| 2101 | break; | 2007 | break; |
| 2102 | #else | 2008 | #else /* ! defined (HAVE_X11) */ |
| 2103 | case KeyPressed: | 2009 | case KeyPressed: |
| 2104 | { | 2010 | { |
| 2105 | register char *where_mapping; | 2011 | register char *where_mapping; |
| @@ -2146,7 +2052,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 2146 | } | 2052 | } |
| 2147 | } | 2053 | } |
| 2148 | break; | 2054 | break; |
| 2149 | #endif /* HAVE_X11 */ | 2055 | #endif /* ! defined (HAVE_X11) */ |
| 2150 | 2056 | ||
| 2151 | #ifdef HAVE_X11 | 2057 | #ifdef HAVE_X11 |
| 2152 | case EnterNotify: | 2058 | case EnterNotify: |
| @@ -2176,7 +2082,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 2176 | notice_mouse_movement (&emacs_event, | 2082 | notice_mouse_movement (&emacs_event, |
| 2177 | event.xmotion, f, scrollbar_window, | 2083 | event.xmotion, f, scrollbar_window, |
| 2178 | part); | 2084 | part); |
| 2179 | #endif | 2085 | #endif /* ! 0 */ |
| 2180 | 2086 | ||
| 2181 | #if 0 | 2087 | #if 0 |
| 2182 | if (! EQ (Vx_send_mouse_movement_events, Qnil) | 2088 | if (! EQ (Vx_send_mouse_movement_events, Qnil) |
| @@ -2188,14 +2094,14 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 2188 | count++; | 2094 | count++; |
| 2189 | numchars--; | 2095 | numchars--; |
| 2190 | } | 2096 | } |
| 2191 | #endif | 2097 | #endif /* ! 0 */ |
| 2192 | } | 2098 | } |
| 2193 | else if (f == x_focus_frame) | 2099 | else if (f == x_focus_frame) |
| 2194 | x_new_focus_frame (0); | 2100 | x_new_focus_frame (0); |
| 2195 | #if 0 | 2101 | #if 0 |
| 2196 | else if (f = x_window_to_frame (event.xcrossing.window)) | 2102 | else if (f = x_window_to_frame (event.xcrossing.window)) |
| 2197 | x_mouse_frame = f; | 2103 | x_mouse_frame = f; |
| 2198 | #endif | 2104 | #endif /* ! 0 */ |
| 2199 | 2105 | ||
| 2200 | break; | 2106 | break; |
| 2201 | 2107 | ||
| @@ -2225,7 +2131,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 2225 | x_new_focus_frame (0); | 2131 | x_new_focus_frame (0); |
| 2226 | break; | 2132 | break; |
| 2227 | 2133 | ||
| 2228 | #else /* not HAVE_X11 */ | 2134 | #else /* ! defined (HAVE_X11) */ |
| 2229 | 2135 | ||
| 2230 | case EnterWindow: | 2136 | case EnterWindow: |
| 2231 | if ((event.detail & 0xFF) == 1) | 2137 | if ((event.detail & 0xFF) == 1) |
| @@ -2251,7 +2157,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 2251 | if (x_focus_frame == 0 | 2157 | if (x_focus_frame == 0 |
| 2252 | && x_input_frame != 0 | 2158 | && x_input_frame != 0 |
| 2253 | && x_input_frame == x_window_to_frame (event.window) | 2159 | && x_input_frame == x_window_to_frame (event.window) |
| 2254 | && event.window == x_input_frame->display.x->window_desc) | 2160 | && event.window == FRAME_X_WINDOW (x_input_frame)) |
| 2255 | { | 2161 | { |
| 2256 | f = x_input_frame; | 2162 | f = x_input_frame; |
| 2257 | x_input_frame = 0; | 2163 | x_input_frame = 0; |
| @@ -2259,7 +2165,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 2259 | frame_unhighlight (f); | 2165 | frame_unhighlight (f); |
| 2260 | } | 2166 | } |
| 2261 | break; | 2167 | break; |
| 2262 | #endif /* not HAVE_X11 */ | 2168 | #endif /* ! defined (HAVE_X11) */ |
| 2263 | 2169 | ||
| 2264 | #ifdef HAVE_X11 | 2170 | #ifdef HAVE_X11 |
| 2265 | case MotionNotify: | 2171 | case MotionNotify: |
| @@ -2273,7 +2179,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 2273 | { | 2179 | { |
| 2274 | What should go here? | 2180 | What should go here? |
| 2275 | } | 2181 | } |
| 2276 | #endif | 2182 | #endif /* ! 0 */ |
| 2277 | } | 2183 | } |
| 2278 | break; | 2184 | break; |
| 2279 | 2185 | ||
| @@ -2349,7 +2255,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 2349 | } | 2255 | } |
| 2350 | break; | 2256 | break; |
| 2351 | 2257 | ||
| 2352 | #else /* not HAVE_X11 */ | 2258 | #else /* ! defined (HAVE_X11) */ |
| 2353 | case ButtonPressed: | 2259 | case ButtonPressed: |
| 2354 | case ButtonReleased: | 2260 | case ButtonReleased: |
| 2355 | f = x_window_to_frame (event.window); | 2261 | f = x_window_to_frame (event.window); |
| @@ -2360,10 +2266,10 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 2360 | x_make_frame_visible (f); | 2266 | x_make_frame_visible (f); |
| 2361 | 2267 | ||
| 2362 | if (warp_mouse_on_deiconify) | 2268 | if (warp_mouse_on_deiconify) |
| 2363 | XWarpMouse (f->display.x->window_desc, 10, 10); | 2269 | XWarpMouse (FRAME_X_WINDOW (f), 10, 10); |
| 2364 | break; | 2270 | break; |
| 2365 | } | 2271 | } |
| 2366 | if (event.window == f->display.x->window_desc) | 2272 | if (event.window == FRAME_X_WINDOW (f)) |
| 2367 | { | 2273 | { |
| 2368 | if (f->auto_raise) | 2274 | if (f->auto_raise) |
| 2369 | x_raise_frame (f); | 2275 | x_raise_frame (f); |
| @@ -2388,7 +2294,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 2388 | numchars -= 2; | 2294 | numchars -= 2; |
| 2389 | } | 2295 | } |
| 2390 | break; | 2296 | break; |
| 2391 | #endif /* not HAVE_X11 */ | 2297 | #endif /* ! defined (HAVE_X11) */ |
| 2392 | 2298 | ||
| 2393 | #ifdef HAVE_X11 | 2299 | #ifdef HAVE_X11 |
| 2394 | 2300 | ||
| @@ -2397,7 +2303,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 2397 | case CirculateRequest: | 2303 | case CirculateRequest: |
| 2398 | break; | 2304 | break; |
| 2399 | 2305 | ||
| 2400 | #endif /* HAVE_X11 */ | 2306 | #endif /* ! defined (HAVE_X11) */ |
| 2401 | 2307 | ||
| 2402 | case MappingNotify: | 2308 | case MappingNotify: |
| 2403 | if (event.xmapping.request == MappingKeyboard) | 2309 | if (event.xmapping.request == MappingKeyboard) |
| @@ -2427,8 +2333,8 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 2427 | && !XStuffPending ()) | 2333 | && !XStuffPending ()) |
| 2428 | kill (getpid (), SIGHUP); | 2334 | kill (getpid (), SIGHUP); |
| 2429 | } | 2335 | } |
| 2430 | #endif /* HAVE_SELECT */ | 2336 | #endif /* ! defined (HAVE_SELECT) */ |
| 2431 | #endif | 2337 | #endif /* ! 0 */ |
| 2432 | 2338 | ||
| 2433 | if (updating_frame == 0) | 2339 | if (updating_frame == 0) |
| 2434 | x_do_pending_expose (); | 2340 | x_do_pending_expose (); |
| @@ -2464,7 +2370,7 @@ x_read_exposes () | |||
| 2464 | refreshicon (f); | 2370 | refreshicon (f); |
| 2465 | break; | 2371 | break; |
| 2466 | } | 2372 | } |
| 2467 | if (event.window == f->display.x->window_desc) | 2373 | if (event.window == FRAME_X_WINDOW (f)) |
| 2468 | { | 2374 | { |
| 2469 | expose_all_windows = 1; | 2375 | expose_all_windows = 1; |
| 2470 | f->display.x->needs_exposure = 1; | 2376 | f->display.x->needs_exposure = 1; |
| @@ -2518,26 +2424,26 @@ x_draw_box (f) | |||
| 2518 | 2424 | ||
| 2519 | #ifdef HAVE_X11 | 2425 | #ifdef HAVE_X11 |
| 2520 | /* Perhaps we should subtract 1 from width and height... */ | 2426 | /* Perhaps we should subtract 1 from width and height... */ |
| 2521 | XDrawRectangle (x_current_display, f->display.x->window_desc, | 2427 | XDrawRectangle (x_current_display, FRAME_X_WINDOW (f), |
| 2522 | f->display.x->cursor_gc, | 2428 | f->display.x->cursor_gc, |
| 2523 | left, top, width - 1, height - 1); | 2429 | left, top, width - 1, height - 1); |
| 2524 | #else | 2430 | #else /* ! defined (HAVE_X11) */ |
| 2525 | XPixSet (f->display.x->window_desc, | 2431 | XPixSet (FRAME_X_WINDOW (f), |
| 2526 | left, top, width, 1, | 2432 | left, top, width, 1, |
| 2527 | f->display.x->cursor_pixel); | 2433 | f->display.x->cursor_pixel); |
| 2528 | 2434 | ||
| 2529 | XPixSet (f->display.x->window_desc, | 2435 | XPixSet (FRAME_X_WINDOW (f), |
| 2530 | left, top, 1, height, | 2436 | left, top, 1, height, |
| 2531 | f->display.x->cursor_pixel); | 2437 | f->display.x->cursor_pixel); |
| 2532 | 2438 | ||
| 2533 | XPixSet (f->display.x->window_desc, | 2439 | XPixSet (FRAME_X_WINDOW (f), |
| 2534 | left+width-1, top, 1, height, | 2440 | left+width-1, top, 1, height, |
| 2535 | f->display.x->cursor_pixel); | 2441 | f->display.x->cursor_pixel); |
| 2536 | 2442 | ||
| 2537 | XPixSet (f->display.x->window_desc, | 2443 | XPixSet (FRAME_X_WINDOW (f), |
| 2538 | left, top+height-1, width, 1, | 2444 | left, top+height-1, width, 1, |
| 2539 | f->display.x->cursor_pixel); | 2445 | f->display.x->cursor_pixel); |
| 2540 | #endif /* HAVE_X11 */ | 2446 | #endif /* ! defined (HAVE_X11) */ |
| 2541 | } | 2447 | } |
| 2542 | 2448 | ||
| 2543 | /* Clear the cursor of frame F to background color, | 2449 | /* Clear the cursor of frame F to background color, |
| @@ -2558,20 +2464,20 @@ clear_cursor (f) | |||
| 2558 | #ifdef HAVE_X11 | 2464 | #ifdef HAVE_X11 |
| 2559 | x_display_cursor (f, 0); | 2465 | x_display_cursor (f, 0); |
| 2560 | #if 0 | 2466 | #if 0 |
| 2561 | XClearArea (x_current_display, f->display.x->window_desc, | 2467 | XClearArea (x_current_display, FRAME_X_WINDOW (f), |
| 2562 | f->phys_cursor_x * FONT_WIDTH (f->display.x->font) | 2468 | f->phys_cursor_x * FONT_WIDTH (f->display.x->font) |
| 2563 | + f->display.x->internal_border_width, | 2469 | + f->display.x->internal_border_width, |
| 2564 | f->phys_cursor_y * FONT_HEIGHT (f->display.x->font) | 2470 | f->phys_cursor_y * FONT_HEIGHT (f->display.x->font) |
| 2565 | + f->display.x->internal_border_width, | 2471 | + f->display.x->internal_border_width, |
| 2566 | FONT_WIDTH (f->display.x->font) + 1, FONT_HEIGHT (f->display.x->font) + 1, False); | 2472 | FONT_WIDTH (f->display.x->font) + 1, FONT_HEIGHT (f->display.x->font) + 1, False); |
| 2567 | #endif | 2473 | #endif /* ! 0 */ |
| 2568 | #else | 2474 | #else /* ! defined (HAVE_X11) */ |
| 2569 | XPixSet (f->display.x->window_desc, | 2475 | XPixSet (FRAME_X_WINDOW (f), |
| 2570 | f->phys_cursor_x * FONT_WIDTH (f->display.x->font) + f->display.x->internal_border_width, | 2476 | f->phys_cursor_x * FONT_WIDTH (f->display.x->font) + f->display.x->internal_border_width, |
| 2571 | f->phys_cursor_y * FONT_HEIGHT (f->display.x->font) + f->display.x->internal_border_width, | 2477 | f->phys_cursor_y * FONT_HEIGHT (f->display.x->font) + f->display.x->internal_border_width, |
| 2572 | FONT_WIDTH (f->display.x->font), FONT_HEIGHT (f->display.x->font), | 2478 | FONT_WIDTH (f->display.x->font), FONT_HEIGHT (f->display.x->font), |
| 2573 | f->display.x->background_pixel); | 2479 | f->display.x->background_pixel); |
| 2574 | #endif /* HAVE_X11 */ | 2480 | #endif /* ! defined (HAVE_X11) */ |
| 2575 | f->phys_cursor_x = -1; | 2481 | f->phys_cursor_x = -1; |
| 2576 | } | 2482 | } |
| 2577 | 2483 | ||
| @@ -2599,7 +2505,7 @@ x_display_bar_cursor (f, on) | |||
| 2599 | + f->display.x->internal_border_width - 1; | 2505 | + f->display.x->internal_border_width - 1; |
| 2600 | y2 = y1 + FONT_HEIGHT (f->display.x->font) + 1; | 2506 | y2 = y1 + FONT_HEIGHT (f->display.x->font) + 1; |
| 2601 | 2507 | ||
| 2602 | XDrawLine (x_current_display, f->display.x->window_desc, | 2508 | XDrawLine (x_current_display, FRAME_X_WINDOW (f), |
| 2603 | f->display.x->reverse_gc, x1, y1, x1, y2); | 2509 | f->display.x->reverse_gc, x1, y1, x1, y2); |
| 2604 | 2510 | ||
| 2605 | f->phys_cursor_x = phys_x = -1; | 2511 | f->phys_cursor_x = phys_x = -1; |
| @@ -2613,15 +2519,15 @@ x_display_bar_cursor (f, on) | |||
| 2613 | + f->display.x->internal_border_width - 1; | 2519 | + f->display.x->internal_border_width - 1; |
| 2614 | y2 = y1 + FONT_HEIGHT (f->display.x->font) + 1; | 2520 | y2 = y1 + FONT_HEIGHT (f->display.x->font) + 1; |
| 2615 | 2521 | ||
| 2616 | XDrawLine (x_current_display, f->display.x->window_desc, | 2522 | XDrawLine (x_current_display, FRAME_X_WINDOW (f), |
| 2617 | f->display.x->cursor_gc, x1, y1, x1, y2); | 2523 | f->display.x->cursor_gc, x1, y1, x1, y2); |
| 2618 | 2524 | ||
| 2619 | f->phys_cursor_x = f->cursor_x; | 2525 | f->phys_cursor_x = f->cursor_x; |
| 2620 | f->phys_cursor_y = f->cursor_y; | 2526 | f->phys_cursor_y = f->cursor_y; |
| 2621 | } | 2527 | } |
| 2622 | #else /* X10 */ | 2528 | #else /* ! defined (HAVE_X11) */ |
| 2623 | Give it up, dude. | 2529 | Give it up, dude. |
| 2624 | #endif /* X10 */ | 2530 | #endif /* ! defined (HAVE_X11) */ |
| 2625 | } | 2531 | } |
| 2626 | 2532 | ||
| 2627 | 2533 | ||
| @@ -2743,7 +2649,7 @@ refreshicon (f) | |||
| 2743 | { | 2649 | { |
| 2744 | #ifdef HAVE_X11 | 2650 | #ifdef HAVE_X11 |
| 2745 | /* Normally, the window manager handles this function. */ | 2651 | /* Normally, the window manager handles this function. */ |
| 2746 | #else | 2652 | #else /* ! defined (HAVE_X11) */ |
| 2747 | int mask; | 2653 | int mask; |
| 2748 | 2654 | ||
| 2749 | if (f->display.x->icon_bitmap_flag) | 2655 | if (f->display.x->icon_bitmap_flag) |
| @@ -2772,7 +2678,7 @@ refreshicon (f) | |||
| 2772 | BLACK_PIX_DEFAULT, WHITE_PIX_DEFAULT); | 2678 | BLACK_PIX_DEFAULT, WHITE_PIX_DEFAULT); |
| 2773 | } | 2679 | } |
| 2774 | XFlushQueue (); | 2680 | XFlushQueue (); |
| 2775 | #endif /* HAVE_X11 */ | 2681 | #endif /* ! defined (HAVE_X11) */ |
| 2776 | } | 2682 | } |
| 2777 | 2683 | ||
| 2778 | /* Make the x-window of frame F use the kitchen-sink icon | 2684 | /* Make the x-window of frame F use the kitchen-sink icon |
| @@ -2785,7 +2691,7 @@ x_bitmap_icon (f) | |||
| 2785 | int mask; | 2691 | int mask; |
| 2786 | Window icon_window; | 2692 | Window icon_window; |
| 2787 | 2693 | ||
| 2788 | if (f->display.x->window_desc == 0) | 2694 | if (FRAME_X_WINDOW (f) == 0) |
| 2789 | return 1; | 2695 | return 1; |
| 2790 | 2696 | ||
| 2791 | #ifdef HAVE_X11 | 2697 | #ifdef HAVE_X11 |
| @@ -2793,14 +2699,14 @@ x_bitmap_icon (f) | |||
| 2793 | XFreePixmap (x_current_display, icon_bitmap); | 2699 | XFreePixmap (x_current_display, icon_bitmap); |
| 2794 | 2700 | ||
| 2795 | icon_bitmap = | 2701 | icon_bitmap = |
| 2796 | XCreateBitmapFromData (x_current_display, f->display.x->window_desc, | 2702 | XCreateBitmapFromData (x_current_display, FRAME_X_WINDOW (f), |
| 2797 | gnu_bits, gnu_width, gnu_height); | 2703 | gnu_bits, gnu_width, gnu_height); |
| 2798 | x_wm_set_icon_pixmap (f, icon_bitmap); | 2704 | x_wm_set_icon_pixmap (f, icon_bitmap); |
| 2799 | f->display.x->icon_bitmap_flag = 1; | 2705 | f->display.x->icon_bitmap_flag = 1; |
| 2800 | #else | 2706 | #else /* ! defined (HAVE_X11) */ |
| 2801 | if (f->display.x->icon_desc) | 2707 | if (f->display.x->icon_desc) |
| 2802 | { | 2708 | { |
| 2803 | XClearIconWindow (f->display.x->window_desc); | 2709 | XClearIconWindow (FRAME_X_WINDOW (f)); |
| 2804 | XDestroyWindow (f->display.x->icon_desc); | 2710 | XDestroyWindow (f->display.x->icon_desc); |
| 2805 | } | 2711 | } |
| 2806 | 2712 | ||
| @@ -2811,7 +2717,7 @@ x_bitmap_icon (f) | |||
| 2811 | if (icon_window == 0) | 2717 | if (icon_window == 0) |
| 2812 | return 1; | 2718 | return 1; |
| 2813 | 2719 | ||
| 2814 | XSetIconWindow (f->display.x->window_desc, icon_window); | 2720 | XSetIconWindow (FRAME_X_WINDOW (f), icon_window); |
| 2815 | XSelectInput (icon_window, ExposeWindow | UnmapWindow); | 2721 | XSelectInput (icon_window, ExposeWindow | UnmapWindow); |
| 2816 | 2722 | ||
| 2817 | f->display.x->icon_desc = icon_window; | 2723 | f->display.x->icon_desc = icon_window; |
| @@ -2820,7 +2726,7 @@ x_bitmap_icon (f) | |||
| 2820 | if (icon_bitmap == 0) | 2726 | if (icon_bitmap == 0) |
| 2821 | icon_bitmap | 2727 | icon_bitmap |
| 2822 | = XStoreBitmap (sink_mask_width, sink_mask_height, sink_mask_bits); | 2728 | = XStoreBitmap (sink_mask_width, sink_mask_height, sink_mask_bits); |
| 2823 | #endif /* HAVE_X11 */ | 2729 | #endif /* ! defined (HAVE_X11) */ |
| 2824 | 2730 | ||
| 2825 | return 0; | 2731 | return 0; |
| 2826 | } | 2732 | } |
| @@ -2842,14 +2748,14 @@ x_text_icon (f, icon_name) | |||
| 2842 | 2748 | ||
| 2843 | #ifndef WhitePixel | 2749 | #ifndef WhitePixel |
| 2844 | #define WhitePixel 1 | 2750 | #define WhitePixel 1 |
| 2845 | #endif | 2751 | #endif /* WhitePixel */ |
| 2846 | 2752 | ||
| 2847 | #ifndef BlackPixel | 2753 | #ifndef BlackPixel |
| 2848 | #define BlackPixel 0 | 2754 | #define BlackPixel 0 |
| 2849 | #endif | 2755 | #endif /* BlackPixel */ |
| 2850 | #endif /* not HAVE_X11 */ | 2756 | #endif /* HAVE_X11 */ |
| 2851 | 2757 | ||
| 2852 | if (f->display.x->window_desc == 0) | 2758 | if (FRAME_X_WINDOW (f) == 0) |
| 2853 | return 1; | 2759 | return 1; |
| 2854 | 2760 | ||
| 2855 | if (icon_font_info == 0) | 2761 | if (icon_font_info == 0) |
| @@ -2865,15 +2771,15 @@ x_text_icon (f, icon_name) | |||
| 2865 | if (! f->display.x->icon_label) | 2771 | if (! f->display.x->icon_label) |
| 2866 | f->display.x->icon_label = " *emacs* "; | 2772 | f->display.x->icon_label = " *emacs* "; |
| 2867 | 2773 | ||
| 2868 | XSetIconName (x_current_display, f->display.x->window_desc, | 2774 | XSetIconName (x_current_display, FRAME_X_WINDOW (f), |
| 2869 | (char *) f->display.x->icon_label); | 2775 | (char *) f->display.x->icon_label); |
| 2870 | 2776 | ||
| 2871 | f->display.x->icon_bitmap_flag = 0; | 2777 | f->display.x->icon_bitmap_flag = 0; |
| 2872 | x_wm_set_icon_pixmap (f, 0); | 2778 | x_wm_set_icon_pixmap (f, 0); |
| 2873 | #else | 2779 | #else /* ! defined (HAVE_X11) */ |
| 2874 | if (f->display.x->icon_desc) | 2780 | if (f->display.x->icon_desc) |
| 2875 | { | 2781 | { |
| 2876 | XClearIconWindow (XDISPLAY f->display.x->window_desc); | 2782 | XClearIconWindow (XDISPLAY FRAME_X_WINDOW (f)); |
| 2877 | XDestroyWindow (XDISPLAY f->display.x->icon_desc); | 2783 | XDestroyWindow (XDISPLAY f->display.x->icon_desc); |
| 2878 | } | 2784 | } |
| 2879 | 2785 | ||
| @@ -2893,13 +2799,13 @@ x_text_icon (f, icon_name) | |||
| 2893 | if (icon_window == 0) | 2799 | if (icon_window == 0) |
| 2894 | return 1; | 2800 | return 1; |
| 2895 | 2801 | ||
| 2896 | XSetIconWindow (f->display.x->window_desc, icon_window); | 2802 | XSetIconWindow (FRAME_X_WINDOW (f), icon_window); |
| 2897 | XSelectInput (icon_window, ExposeWindow | ExposeRegion | UnmapWindow | ButtonPressed); | 2803 | XSelectInput (icon_window, ExposeWindow | ExposeRegion | UnmapWindow | ButtonPressed); |
| 2898 | 2804 | ||
| 2899 | f->display.x->icon_desc = icon_window; | 2805 | f->display.x->icon_desc = icon_window; |
| 2900 | f->display.x->icon_bitmap_flag = 0; | 2806 | f->display.x->icon_bitmap_flag = 0; |
| 2901 | f->display.x->icon_label = 0; | 2807 | f->display.x->icon_label = 0; |
| 2902 | #endif /* HAVE_X11 */ | 2808 | #endif /* ! defined (HAVE_X11) */ |
| 2903 | 2809 | ||
| 2904 | return 0; | 2810 | return 0; |
| 2905 | } | 2811 | } |
| @@ -2907,12 +2813,10 @@ x_text_icon (f, icon_name) | |||
| 2907 | /* Handling X errors. */ | 2813 | /* Handling X errors. */ |
| 2908 | 2814 | ||
| 2909 | /* A handler for SIGPIPE, when it occurs on the X server's connection. | 2815 | /* A handler for SIGPIPE, when it occurs on the X server's connection. |
| 2910 | This basically does an orderly shutdown of Emacs. The arg to | 2816 | This basically does an orderly shutdown of Emacs. */ |
| 2911 | Fkill_emacs is an exit status value and also prevents any | ||
| 2912 | questions. */ | ||
| 2913 | 2817 | ||
| 2914 | static SIGTYPE | 2818 | static SIGTYPE |
| 2915 | x_death_handler () | 2819 | x_connection_closed () |
| 2916 | { | 2820 | { |
| 2917 | if (_Xdebug) | 2821 | if (_Xdebug) |
| 2918 | abort (); | 2822 | abort (); |
| @@ -2920,195 +2824,95 @@ x_death_handler () | |||
| 2920 | Fkill_emacs (make_number (70)); | 2824 | Fkill_emacs (make_number (70)); |
| 2921 | } | 2825 | } |
| 2922 | 2826 | ||
| 2923 | static char *x_proto_requests[] = | 2827 | /* An X error handler which prints an error message and then kills Emacs. |
| 2924 | { | 2828 | This is what's normally installed as Xlib's handler for protocol and |
| 2925 | "CreateWindow", | 2829 | I/O errors. */ |
| 2926 | "ChangeWindowAttributes", | 2830 | static int |
| 2927 | "GetWindowAttributes", | 2831 | x_error_quitter (display, error) |
| 2928 | "DestroyWindow", | 2832 | Display *display; |
| 2929 | "DestroySubwindows", | 2833 | XErrorEvent *error; |
| 2930 | "ChangeSaveSet", | 2834 | { |
| 2931 | "ReparentWindow", | 2835 | char buf[256]; |
| 2932 | "MapWindow", | ||
| 2933 | "MapSubwindows", | ||
| 2934 | "UnmapWindow", | ||
| 2935 | "UnmapSubwindows", | ||
| 2936 | "ConfigureWindow", | ||
| 2937 | "CirculateWindow", | ||
| 2938 | "GetGeometry", | ||
| 2939 | "QueryTree", | ||
| 2940 | "InternAtom", | ||
| 2941 | "GetAtomName", | ||
| 2942 | "ChangeProperty", | ||
| 2943 | "DeleteProperty", | ||
| 2944 | "GetProperty", | ||
| 2945 | "ListProperties", | ||
| 2946 | "SetSelectionOwner", | ||
| 2947 | "GetSelectionOwner", | ||
| 2948 | "ConvertSelection", | ||
| 2949 | "SendEvent", | ||
| 2950 | "GrabPointer", | ||
| 2951 | "UngrabPointer", | ||
| 2952 | "GrabButton", | ||
| 2953 | "UngrabButton", | ||
| 2954 | "ChangeActivePointerGrab", | ||
| 2955 | "GrabKeyboard", | ||
| 2956 | "UngrabKeyboard", | ||
| 2957 | "GrabKey", | ||
| 2958 | "UngrabKey", | ||
| 2959 | "AllowEvents", | ||
| 2960 | "GrabServer", | ||
| 2961 | "UngrabServer", | ||
| 2962 | "QueryPointer", | ||
| 2963 | "GetMotionEvents", | ||
| 2964 | "TranslateCoords", | ||
| 2965 | "WarpPointer", | ||
| 2966 | "SetInputFocus", | ||
| 2967 | "GetInputFocus", | ||
| 2968 | "QueryKeymap", | ||
| 2969 | "OpenFont", | ||
| 2970 | "CloseFont", | ||
| 2971 | "QueryFont", | ||
| 2972 | "QueryTextExtents", | ||
| 2973 | "ListFonts", | ||
| 2974 | "ListFontsWithInfo", | ||
| 2975 | "SetFontPath", | ||
| 2976 | "GetFontPath", | ||
| 2977 | "CreatePixmap", | ||
| 2978 | "FreePixmap", | ||
| 2979 | "CreateGC", | ||
| 2980 | "ChangeGC", | ||
| 2981 | "CopyGC", | ||
| 2982 | "SetDashes", | ||
| 2983 | "SetClipRectangles", | ||
| 2984 | "FreeGC", | ||
| 2985 | "ClearArea", | ||
| 2986 | "CopyArea", | ||
| 2987 | "CopyPlane", | ||
| 2988 | "PolyPoint", | ||
| 2989 | "PolyLine", | ||
| 2990 | "PolySegment", | ||
| 2991 | "PolyRectangle", | ||
| 2992 | "PolyArc", | ||
| 2993 | "FillPoly", | ||
| 2994 | "PolyFillRectangle", | ||
| 2995 | "PolyFillArc", | ||
| 2996 | "PutImage", | ||
| 2997 | "GetImage", | ||
| 2998 | "PolyText", | ||
| 2999 | "PolyText", | ||
| 3000 | "ImageText", | ||
| 3001 | "ImageText", | ||
| 3002 | "CreateColormap", | ||
| 3003 | "FreeColormap", | ||
| 3004 | "CopyColormapAndFree", | ||
| 3005 | "InstallColormap", | ||
| 3006 | "UninstallColormap", | ||
| 3007 | "ListInstalledColormaps", | ||
| 3008 | "AllocColor", | ||
| 3009 | "AllocNamedColor", | ||
| 3010 | "AllocColorCells", | ||
| 3011 | "AllocColorPlanes", | ||
| 3012 | "FreeColors", | ||
| 3013 | "StoreColors", | ||
| 3014 | "StoreNamedColor", | ||
| 3015 | "QueryColors", | ||
| 3016 | "LookupColor", | ||
| 3017 | "CreateCursor", | ||
| 3018 | "CreateGlyphCursor", | ||
| 3019 | "FreeCursor", | ||
| 3020 | "RecolorCursor", | ||
| 3021 | "QueryBestSize", | ||
| 3022 | "QueryExtension", | ||
| 3023 | "ListExtensions", | ||
| 3024 | "ChangeKeyboardMapping", | ||
| 3025 | "GetKeyboardMapping", | ||
| 3026 | "ChangeKeyboardControl", | ||
| 3027 | "GetKeyboardControl", | ||
| 3028 | "Bell", | ||
| 3029 | "ChangePointerControl", | ||
| 3030 | "GetPointerControl", | ||
| 3031 | "SetScreenSaver", | ||
| 3032 | "GetScreenSaver", | ||
| 3033 | "ChangeHosts", | ||
| 3034 | "ListHosts", | ||
| 3035 | "SetAccessControl", | ||
| 3036 | "SetCloseDownMode", | ||
| 3037 | "KillClient", | ||
| 3038 | "RotateProperties", | ||
| 3039 | "ForceScreenSaver", | ||
| 3040 | "SetPointerMapping", | ||
| 3041 | "GetPointerMapping", | ||
| 3042 | "SetModifierMapping", | ||
| 3043 | "GetModifierMapping", | ||
| 3044 | "NoOperation" | ||
| 3045 | }; | ||
| 3046 | 2836 | ||
| 3047 | /* 94 is the code for X_CreateGlyphCursor. The idea is that we | 2837 | /* Note that there is no real way portable across R3/R4 to get the |
| 3048 | probably shouldn't let a bad mouse cursor request crash Emacs. | 2838 | original error handler. */ |
| 3049 | You'd think we could #include <X11/Xproto.h> and use a symbolic | ||
| 3050 | constant for this, but that's been commented out above; perhaps | ||
| 3051 | that file is not available on all systems. */ | ||
| 3052 | #define acceptable_x_error_p(type) ((type) == 94) | ||
| 3053 | 2839 | ||
| 3054 | x_handle_error_gracefully (event) | 2840 | XGetErrorText (display, error->error_code, buf, sizeof (buf)); |
| 3055 | XErrorEvent *event; | 2841 | fprintf (stderr, "X protocol error: %s on protocol request %d\n", |
| 3056 | { | 2842 | buf, error->request_code); |
| 3057 | char error_ptr[128]; | ||
| 3058 | char *proto_ptr = x_proto_requests[event->request_code]; | ||
| 3059 | char str[128]; | ||
| 3060 | 2843 | ||
| 3061 | XGetErrorText (x_current_display, event->error_code, error_ptr, 128); | 2844 | x_connection_closed (); |
| 3062 | sprintf (str, "X Protocol Error: %s on request: %s", error_ptr, proto_ptr); | ||
| 3063 | TOTALLY_UNBLOCK_INPUT; | ||
| 3064 | error (str); | ||
| 3065 | } | 2845 | } |
| 3066 | 2846 | ||
| 3067 | #if 0 | 2847 | /* A buffer for storing X error messages. */ |
| 3068 | extern int x_selection_alloc_error; | 2848 | static char (*x_caught_error_message)[200]; |
| 3069 | extern int x_converting_selection; | 2849 | |
| 3070 | #endif | 2850 | /* An X error handler which stores the error message in |
| 3071 | 2851 | x_caught_error_message. This is what's installed when | |
| 3072 | /* Handle X Errors. If the error is not traumatic, | 2852 | x_catch_errors is in effect. */ |
| 3073 | just call error (). Otherwise print a (hopefully) interesting | 2853 | static int |
| 3074 | message and quit. */ | 2854 | x_error_catcher (display, error) |
| 3075 | x_error_handler (disp, event) | 2855 | Display *display; |
| 3076 | Display *disp; | 2856 | XErrorEvent *error; |
| 3077 | #ifdef HAVE_X11 | 2857 | { |
| 3078 | XErrorEvent *event; | 2858 | XGetErrorText (display, error->error_code, |
| 2859 | *x_caught_error_message, sizeof (*x_caught_error_message)); | ||
| 2860 | } | ||
| 2861 | |||
| 2862 | |||
| 2863 | /* Begin trapping X errors. | ||
| 3079 | 2864 | ||
| 3080 | #define XlibDisplayIOError (1L << 0) | 2865 | After calling this function, X protocol errors no longer cause |
| 2866 | Emacs to exit; instead, they are recorded in x_cfc_error_message. | ||
| 3081 | 2867 | ||
| 3082 | #else | 2868 | Calling x_check_errors signals an Emacs error if an X error has |
| 3083 | struct _XErrorEvent *event; | 2869 | occurred since the last call to x_catch_errors or x_check_errors. |
| 3084 | #endif | 2870 | |
| 2871 | Calling x_uncatch_errors resumes the normal error handling. */ | ||
| 2872 | |||
| 2873 | void x_catch_errors(), x_check_errors (), x_uncatch_errors (); | ||
| 2874 | |||
| 2875 | void | ||
| 2876 | x_catch_errors () | ||
| 3085 | { | 2877 | { |
| 3086 | /* Here we use the standard X handlers. */ | 2878 | /* Make sure any errors from previous requests have been dealt with. */ |
| 2879 | XSync (x_current_display, False); | ||
| 3087 | 2880 | ||
| 3088 | BLOCK_INPUT; | 2881 | /* Set up the error buffer. */ |
| 3089 | if (event && event->type == 0) /* 0 is the XError Event type. */ | 2882 | x_caught_error_message = |
| 3090 | { | 2883 | (char (*)[]) xmalloc (sizeof (*x_caught_error_message)); |
| 3091 | #if 0 | ||
| 3092 | #ifdef HAVE_X11 | ||
| 3093 | if (event->request_code == BadAlloc && x_converting_selection) | ||
| 3094 | x_selection_alloc_error = 1; | ||
| 3095 | else | ||
| 3096 | #endif | ||
| 3097 | #endif | ||
| 3098 | if (acceptable_x_error_p (event->request_code)) | ||
| 3099 | x_handle_error_gracefully (event); | ||
| 3100 | } | ||
| 3101 | 2884 | ||
| 3102 | { | 2885 | /* Install our little error handler. */ |
| 3103 | char message[80]; | 2886 | XHandleError (x_error_catcher); |
| 2887 | } | ||
| 3104 | 2888 | ||
| 3105 | XGetErrorText (disp, event->error_code, message, sizeof (message)); | 2889 | /* If any X protocol errors have arrived since the last call to |
| 3106 | fprintf (stderr, "Fatal X error:\n%s\n", message); | 2890 | x_catch_errors or x_check_errors, signal an Emacs error using |
| 3107 | } | 2891 | sprintf (a buffer, FORMAT, the x error message text) as the text. */ |
| 2892 | void | ||
| 2893 | x_check_errors (format) | ||
| 2894 | char *format; | ||
| 2895 | { | ||
| 2896 | /* Make sure to catch any errors incurred so far. */ | ||
| 2897 | XSync (x_current_display, False); | ||
| 3108 | 2898 | ||
| 3109 | UNBLOCK_INPUT; | 2899 | if ((*x_caught_error_message)[0]) |
| 2900 | { | ||
| 2901 | char buf[256]; | ||
| 2902 | |||
| 2903 | sprintf (buf, format, *x_caught_error_message); | ||
| 2904 | free (x_caught_error_message); | ||
| 3110 | 2905 | ||
| 3111 | x_death_handler (); | 2906 | x_uncatch_errors (); |
| 2907 | error (buf); | ||
| 2908 | } | ||
| 2909 | } | ||
| 2910 | |||
| 2911 | void | ||
| 2912 | x_uncatch_errors () | ||
| 2913 | { | ||
| 2914 | free (x_caught_error_message); | ||
| 2915 | XHandleError (x_error_quitter); | ||
| 3112 | } | 2916 | } |
| 3113 | 2917 | ||
| 3114 | #if 0 | 2918 | #if 0 |
| @@ -3117,7 +2921,7 @@ x_trace_wire () | |||
| 3117 | { | 2921 | { |
| 3118 | fprintf (stderr, "Lib call: %d\n", ++x_wire_count); | 2922 | fprintf (stderr, "Lib call: %d\n", ++x_wire_count); |
| 3119 | } | 2923 | } |
| 3120 | #endif | 2924 | #endif /* ! 0 */ |
| 3121 | 2925 | ||
| 3122 | 2926 | ||
| 3123 | /* Set the font of the x-window specified by frame F | 2927 | /* Set the font of the x-window specified by frame F |
| @@ -3212,7 +3016,7 @@ x_new_font (f, fontname) | |||
| 3212 | XFreeFontInfo (font_names, font_info, n_matching_fonts); | 3016 | XFreeFontInfo (font_names, font_info, n_matching_fonts); |
| 3213 | 3017 | ||
| 3214 | /* Now make the frame display the given font. */ | 3018 | /* Now make the frame display the given font. */ |
| 3215 | if (f->display.x->window_desc != 0) | 3019 | if (FRAME_X_WINDOW (f) != 0) |
| 3216 | { | 3020 | { |
| 3217 | XSetFont (x_current_display, f->display.x->normal_gc, | 3021 | XSetFont (x_current_display, f->display.x->normal_gc, |
| 3218 | f->display.x->font->fid); | 3022 | f->display.x->font->fid); |
| @@ -3226,7 +3030,7 @@ x_new_font (f, fontname) | |||
| 3226 | 3030 | ||
| 3227 | return 0; | 3031 | return 0; |
| 3228 | } | 3032 | } |
| 3229 | #else | 3033 | #else /* ! defined (HAVE_X11) */ |
| 3230 | x_new_font (f, newname) | 3034 | x_new_font (f, newname) |
| 3231 | struct frame *f; | 3035 | struct frame *f; |
| 3232 | register char *newname; | 3036 | register char *newname; |
| @@ -3243,12 +3047,12 @@ x_new_font (f, newname) | |||
| 3243 | 3047 | ||
| 3244 | f->display.x->font = temp; | 3048 | f->display.x->font = temp; |
| 3245 | 3049 | ||
| 3246 | if (f->display.x->window_desc != 0) | 3050 | if (FRAME_X_WINDOW (f) != 0) |
| 3247 | x_set_window_size (f, f->width, f->height); | 3051 | x_set_window_size (f, f->width, f->height); |
| 3248 | 3052 | ||
| 3249 | return 0; | 3053 | return 0; |
| 3250 | } | 3054 | } |
| 3251 | #endif | 3055 | #endif /* ! defined (HAVE_X11) */ |
| 3252 | 3056 | ||
| 3253 | x_calc_absolute_position (f) | 3057 | x_calc_absolute_position (f) |
| 3254 | struct frame *f; | 3058 | struct frame *f; |
| @@ -3261,10 +3065,10 @@ x_calc_absolute_position (f) | |||
| 3261 | if (f->display.x->top_pos < 0) | 3065 | if (f->display.x->top_pos < 0) |
| 3262 | f->display.x->top_pos | 3066 | f->display.x->top_pos |
| 3263 | = XINT (x_screen_height) - PIXEL_HEIGHT (f) + f->display.x->top_pos; | 3067 | = XINT (x_screen_height) - PIXEL_HEIGHT (f) + f->display.x->top_pos; |
| 3264 | #else /* X10 */ | 3068 | #else /* ! defined (HAVE_X11) */ |
| 3265 | WINDOWINFO_TYPE parentinfo; | 3069 | WINDOWINFO_TYPE parentinfo; |
| 3266 | 3070 | ||
| 3267 | XGetWindowInfo (f->display.x->window_desc, &parentinfo); | 3071 | XGetWindowInfo (FRAME_X_WINDOW (f), &parentinfo); |
| 3268 | 3072 | ||
| 3269 | if (f->display.x->left_pos < 0) | 3073 | if (f->display.x->left_pos < 0) |
| 3270 | f->display.x->left_pos = parentinfo.width + (f->display.x->left_pos + 1) | 3074 | f->display.x->left_pos = parentinfo.width + (f->display.x->left_pos + 1) |
| @@ -3273,7 +3077,7 @@ x_calc_absolute_position (f) | |||
| 3273 | if (f->display.x->top_pos < 0) | 3077 | if (f->display.x->top_pos < 0) |
| 3274 | f->display.x->top_pos = parentinfo.height + (f->display.x->top_pos + 1) | 3078 | f->display.x->top_pos = parentinfo.height + (f->display.x->top_pos + 1) |
| 3275 | - PIXEL_HEIGHT (f) - 2 * f->display.x->internal_border_width; | 3079 | - PIXEL_HEIGHT (f) - 2 * f->display.x->internal_border_width; |
| 3276 | #endif /* X10 */ | 3080 | #endif /* ! defined (HAVE_X11) */ |
| 3277 | } | 3081 | } |
| 3278 | 3082 | ||
| 3279 | x_set_offset (f, xoff, yoff) | 3083 | x_set_offset (f, xoff, yoff) |
| @@ -3285,11 +3089,11 @@ x_set_offset (f, xoff, yoff) | |||
| 3285 | x_calc_absolute_position (f); | 3089 | x_calc_absolute_position (f); |
| 3286 | 3090 | ||
| 3287 | BLOCK_INPUT; | 3091 | BLOCK_INPUT; |
| 3288 | XMoveWindow (XDISPLAY f->display.x->window_desc, | 3092 | XMoveWindow (XDISPLAY FRAME_X_WINDOW (f), |
| 3289 | f->display.x->left_pos, f->display.x->top_pos); | 3093 | f->display.x->left_pos, f->display.x->top_pos); |
| 3290 | #ifdef HAVE_X11 | 3094 | #ifdef HAVE_X11 |
| 3291 | x_wm_set_size_hint (f, 0); | 3095 | x_wm_set_size_hint (f, 0); |
| 3292 | #endif | 3096 | #endif /* ! defined (HAVE_X11) */ |
| 3293 | UNBLOCK_INPUT; | 3097 | UNBLOCK_INPUT; |
| 3294 | } | 3098 | } |
| 3295 | 3099 | ||
| @@ -3313,8 +3117,8 @@ x_set_window_size (f, cols, rows) | |||
| 3313 | 3117 | ||
| 3314 | #ifdef HAVE_X11 | 3118 | #ifdef HAVE_X11 |
| 3315 | x_wm_set_size_hint (f, 0); | 3119 | x_wm_set_size_hint (f, 0); |
| 3316 | #endif /* HAVE_X11 */ | 3120 | #endif /* ! defined (HAVE_X11) */ |
| 3317 | XChangeWindowSize (f->display.x->window_desc, pixelwidth, pixelheight); | 3121 | XChangeWindowSize (FRAME_X_WINDOW (f), pixelwidth, pixelheight); |
| 3318 | 3122 | ||
| 3319 | /* Now, strictly speaking, we can't be sure that this is accurate, | 3123 | /* Now, strictly speaking, we can't be sure that this is accurate, |
| 3320 | but the window manager will get around to dealing with the size | 3124 | but the window manager will get around to dealing with the size |
| @@ -3334,11 +3138,11 @@ x_set_resize_hint (f) | |||
| 3334 | struct frame *f; | 3138 | struct frame *f; |
| 3335 | { | 3139 | { |
| 3336 | 3140 | ||
| 3337 | XSetResizeHint (f->display.x->window_desc, 2 * f->display.x->internal_border_width, | 3141 | XSetResizeHint (FRAME_X_WINDOW (f), 2 * f->display.x->internal_border_width, |
| 3338 | 2 * f->display.x->internal_border_width, | 3142 | 2 * f->display.x->internal_border_width, |
| 3339 | FONT_WIDTH (f->display.x->font), FONT_HEIGHT (f->display.x->font)); | 3143 | FONT_WIDTH (f->display.x->font), FONT_HEIGHT (f->display.x->font)); |
| 3340 | } | 3144 | } |
| 3341 | #endif /* not HAVE_X11 */ | 3145 | #endif /* HAVE_X11 */ |
| 3342 | 3146 | ||
| 3343 | 3147 | ||
| 3344 | x_set_mouse_position (f, x, y) | 3148 | x_set_mouse_position (f, x, y) |
| @@ -3372,7 +3176,7 @@ x_set_mouse_position (f, x, y) | |||
| 3372 | x_mouse_x = x; | 3176 | x_mouse_x = x; |
| 3373 | x_mouse_y = y; | 3177 | x_mouse_y = y; |
| 3374 | 3178 | ||
| 3375 | XWarpMousePointer (f->display.x->window_desc, pix_x, pix_y); | 3179 | XWarpMousePointer (FRAME_X_WINDOW (f), pix_x, pix_y); |
| 3376 | UNBLOCK_INPUT; | 3180 | UNBLOCK_INPUT; |
| 3377 | } | 3181 | } |
| 3378 | 3182 | ||
| @@ -3385,9 +3189,9 @@ x_focus_on_frame (f) | |||
| 3385 | /* I don't think that the ICCCM allows programs to do things like this | 3189 | /* I don't think that the ICCCM allows programs to do things like this |
| 3386 | without the interaction of the window manager. Whatever you end up | 3190 | without the interaction of the window manager. Whatever you end up |
| 3387 | doing with this code, do it to x_unfocus_frame too. */ | 3191 | doing with this code, do it to x_unfocus_frame too. */ |
| 3388 | XSetInputFocus (x_current_display, f->display.x->window_desc, | 3192 | XSetInputFocus (x_current_display, FRAME_X_WINDOW (f), |
| 3389 | RevertToPointerRoot, CurrentTime); | 3193 | RevertToPointerRoot, CurrentTime); |
| 3390 | #endif | 3194 | #endif /* ! 0 */ |
| 3391 | } | 3195 | } |
| 3392 | 3196 | ||
| 3393 | x_unfocus_frame (f) | 3197 | x_unfocus_frame (f) |
| @@ -3398,10 +3202,10 @@ x_unfocus_frame (f) | |||
| 3398 | if (x_focus_frame == f) | 3202 | if (x_focus_frame == f) |
| 3399 | XSetInputFocus (x_current_display, PointerRoot, | 3203 | XSetInputFocus (x_current_display, PointerRoot, |
| 3400 | RevertToPointerRoot, CurrentTime); | 3204 | RevertToPointerRoot, CurrentTime); |
| 3401 | #endif | 3205 | #endif /* ! 0 */ |
| 3402 | } | 3206 | } |
| 3403 | 3207 | ||
| 3404 | #endif | 3208 | #endif /* ! defined (HAVE_X11) */ |
| 3405 | 3209 | ||
| 3406 | /* Raise frame F. */ | 3210 | /* Raise frame F. */ |
| 3407 | 3211 | ||
| @@ -3411,7 +3215,7 @@ x_raise_frame (f) | |||
| 3411 | if (f->visible) | 3215 | if (f->visible) |
| 3412 | { | 3216 | { |
| 3413 | BLOCK_INPUT; | 3217 | BLOCK_INPUT; |
| 3414 | XRaiseWindow (XDISPLAY f->display.x->window_desc); | 3218 | XRaiseWindow (XDISPLAY FRAME_X_WINDOW (f)); |
| 3415 | XFlushQueue (); | 3219 | XFlushQueue (); |
| 3416 | UNBLOCK_INPUT; | 3220 | UNBLOCK_INPUT; |
| 3417 | } | 3221 | } |
| @@ -3425,7 +3229,7 @@ x_lower_frame (f) | |||
| 3425 | if (f->visible) | 3229 | if (f->visible) |
| 3426 | { | 3230 | { |
| 3427 | BLOCK_INPUT; | 3231 | BLOCK_INPUT; |
| 3428 | XLowerWindow (XDISPLAY f->display.x->window_desc); | 3232 | XLowerWindow (XDISPLAY FRAME_X_WINDOW (f)); |
| 3429 | XFlushQueue (); | 3233 | XFlushQueue (); |
| 3430 | UNBLOCK_INPUT; | 3234 | UNBLOCK_INPUT; |
| 3431 | } | 3235 | } |
| @@ -3446,11 +3250,11 @@ x_make_frame_visible (f) | |||
| 3446 | if (! EQ (Vx_no_window_manager, Qt)) | 3250 | if (! EQ (Vx_no_window_manager, Qt)) |
| 3447 | x_wm_set_window_state (f, NormalState); | 3251 | x_wm_set_window_state (f, NormalState); |
| 3448 | 3252 | ||
| 3449 | XMapWindow (XDISPLAY f->display.x->window_desc); | 3253 | XMapWindow (XDISPLAY FRAME_X_WINDOW (f)); |
| 3450 | if (f->display.x->v_scrollbar != 0 || f->display.x->h_scrollbar != 0) | 3254 | if (f->display.x->v_scrollbar != 0 || f->display.x->h_scrollbar != 0) |
| 3451 | XMapSubwindows (x_current_display, f->display.x->window_desc); | 3255 | XMapSubwindows (x_current_display, FRAME_X_WINDOW (f)); |
| 3452 | #else | 3256 | #else /* ! defined (HAVE_X11) */ |
| 3453 | XMapWindow (XDISPLAY f->display.x->window_desc); | 3257 | XMapWindow (XDISPLAY FRAME_X_WINDOW (f)); |
| 3454 | if (f->display.x->icon_desc != 0) | 3258 | if (f->display.x->icon_desc != 0) |
| 3455 | XUnmapWindow (f->display.x->icon_desc); | 3259 | XUnmapWindow (f->display.x->icon_desc); |
| 3456 | 3260 | ||
| @@ -3460,7 +3264,7 @@ x_make_frame_visible (f) | |||
| 3460 | 3264 | ||
| 3461 | /* NOTE: this may cause problems for the first frame. */ | 3265 | /* NOTE: this may cause problems for the first frame. */ |
| 3462 | XTcursor_to (0, 0); | 3266 | XTcursor_to (0, 0); |
| 3463 | #endif /* not HAVE_X11 */ | 3267 | #endif /* ! defined (HAVE_X11) */ |
| 3464 | } | 3268 | } |
| 3465 | 3269 | ||
| 3466 | XFlushQueue (); | 3270 | XFlushQueue (); |
| @@ -3479,18 +3283,26 @@ x_make_frame_invisible (f) | |||
| 3479 | return; | 3283 | return; |
| 3480 | 3284 | ||
| 3481 | BLOCK_INPUT; | 3285 | BLOCK_INPUT; |
| 3286 | |||
| 3287 | #ifdef HAVE_X11R4 | ||
| 3288 | |||
| 3289 | if (! XWithdrawWindow (x_current_display, FRAME_X_WINDOW (f), | ||
| 3290 | DefaultScreen (x_current_display))) | ||
| 3291 | { | ||
| 3292 | UNBLOCK_INPUT_RESIGNAL; | ||
| 3293 | error ("can't notify window manager of window withdrawl"); | ||
| 3294 | } | ||
| 3295 | |||
| 3296 | #else /* ! defined (HAVE_X11R4) */ | ||
| 3482 | #ifdef HAVE_X11 | 3297 | #ifdef HAVE_X11 |
| 3483 | /* It would be nice if we didn't have to be backward compatible with | ||
| 3484 | very old versions of X, because then we could use the | ||
| 3485 | XWithdrawWindow function in R4 instead of writing it out ourselves. */ | ||
| 3486 | 3298 | ||
| 3487 | /* Tell the window manager what we've done. */ | 3299 | /* Tell the window manager what we're going to do. */ |
| 3488 | if (! EQ (Vx_no_window_manager, Qt)) | 3300 | if (! EQ (Vx_no_window_manager, Qt)) |
| 3489 | { | 3301 | { |
| 3490 | XEvent unmap; | 3302 | XEvent unmap; |
| 3491 | 3303 | ||
| 3492 | unmap.xunmap.type = UnmapNotify; | 3304 | unmap.xunmap.type = UnmapNotify; |
| 3493 | unmap.xunmap.window = f->display.x->window_desc; | 3305 | unmap.xunmap.window = FRAME_X_WINDOW (f); |
| 3494 | unmap.xunmap.event = DefaultRootWindow (x_current_display); | 3306 | unmap.xunmap.event = DefaultRootWindow (x_current_display); |
| 3495 | unmap.xunmap.from_configure = False; | 3307 | unmap.xunmap.from_configure = False; |
| 3496 | if (! XSendEvent (x_current_display, | 3308 | if (! XSendEvent (x_current_display, |
| @@ -3505,14 +3317,17 @@ x_make_frame_invisible (f) | |||
| 3505 | } | 3317 | } |
| 3506 | 3318 | ||
| 3507 | /* Unmap the window ourselves. Cheeky! */ | 3319 | /* Unmap the window ourselves. Cheeky! */ |
| 3508 | XUnmapWindow (x_current_display, f->display.x->window_desc); | 3320 | XUnmapWindow (x_current_display, FRAME_X_WINDOW (f)); |
| 3509 | #else | 3321 | |
| 3510 | XUnmapWindow (XDISPLAY f->display.x->window_desc); | 3322 | #else /* ! defined (HAVE_X11) */ |
| 3511 | 3323 | ||
| 3324 | XUnmapWindow (FRAME_X_WINDOW (f)); | ||
| 3512 | f->visible = 0; /* Handled by the UnMap event for X11 */ | 3325 | f->visible = 0; /* Handled by the UnMap event for X11 */ |
| 3513 | if (f->display.x->icon_desc != 0) | 3326 | if (f->display.x->icon_desc != 0) |
| 3514 | XUnmapWindow (XDISPLAY f->display.x->icon_desc); | 3327 | XUnmapWindow (f->display.x->icon_desc); |
| 3515 | #endif /* not HAVE_X11 */ | 3328 | |
| 3329 | #endif /* ! defined (HAVE_X11) */ | ||
| 3330 | #endif /* ! defined (HAVE_X11R4) */ | ||
| 3516 | 3331 | ||
| 3517 | XFlushQueue (); | 3332 | XFlushQueue (); |
| 3518 | UNBLOCK_INPUT; | 3333 | UNBLOCK_INPUT; |
| @@ -3542,7 +3357,7 @@ x_iconify_frame (f) | |||
| 3542 | { | 3357 | { |
| 3543 | XEvent message; | 3358 | XEvent message; |
| 3544 | 3359 | ||
| 3545 | message.xclient.window = f->display.x->window_desc; | 3360 | message.xclient.window = FRAME_X_WINDOW (f); |
| 3546 | message.xclient.type = ClientMessage; | 3361 | message.xclient.type = ClientMessage; |
| 3547 | message.xclient.message_type = Xatom_wm_change_state; | 3362 | message.xclient.message_type = Xatom_wm_change_state; |
| 3548 | message.xclient.format = 32; | 3363 | message.xclient.format = 32; |
| @@ -3564,8 +3379,8 @@ x_iconify_frame (f) | |||
| 3564 | x_wm_set_window_state (f, IconicState); | 3379 | x_wm_set_window_state (f, IconicState); |
| 3565 | 3380 | ||
| 3566 | f->iconified = 1; | 3381 | f->iconified = 1; |
| 3567 | #else /* X10 */ | 3382 | #else /* ! defined (HAVE_X11) */ |
| 3568 | XUnmapWindow (XDISPLAY f->display.x->window_desc); | 3383 | XUnmapWindow (XDISPLAY FRAME_X_WINDOW (f)); |
| 3569 | 3384 | ||
| 3570 | f->visible = 0; /* Handled in the UnMap event for X11. */ | 3385 | f->visible = 0; /* Handled in the UnMap event for X11. */ |
| 3571 | if (f->display.x->icon_desc != 0) | 3386 | if (f->display.x->icon_desc != 0) |
| @@ -3573,7 +3388,7 @@ x_iconify_frame (f) | |||
| 3573 | XMapWindow (XDISPLAY f->display.x->icon_desc); | 3388 | XMapWindow (XDISPLAY f->display.x->icon_desc); |
| 3574 | refreshicon (f); | 3389 | refreshicon (f); |
| 3575 | } | 3390 | } |
| 3576 | #endif /* X10 */ | 3391 | #endif /* ! defined (HAVE_X11) */ |
| 3577 | 3392 | ||
| 3578 | XFlushQueue (); | 3393 | XFlushQueue (); |
| 3579 | UNBLOCK_INPUT; | 3394 | UNBLOCK_INPUT; |
| @@ -3673,7 +3488,7 @@ mouse_event_pending_p () | |||
| 3673 | { | 3488 | { |
| 3674 | return queue_event_count (&x_mouse_queue); | 3489 | return queue_event_count (&x_mouse_queue); |
| 3675 | } | 3490 | } |
| 3676 | #endif | 3491 | #endif /* HAVE_X11 */ |
| 3677 | 3492 | ||
| 3678 | #ifdef HAVE_X11 | 3493 | #ifdef HAVE_X11 |
| 3679 | 3494 | ||
| @@ -3682,7 +3497,7 @@ x_wm_set_size_hint (f, prompting) | |||
| 3682 | long prompting; | 3497 | long prompting; |
| 3683 | { | 3498 | { |
| 3684 | XSizeHints size_hints; | 3499 | XSizeHints size_hints; |
| 3685 | Window window = f->display.x->window_desc; | 3500 | Window window = FRAME_X_WINDOW (f); |
| 3686 | 3501 | ||
| 3687 | size_hints.flags = PResizeInc | PMinSize | PMaxSize; | 3502 | size_hints.flags = PResizeInc | PMinSize | PMaxSize; |
| 3688 | 3503 | ||
| @@ -3737,7 +3552,7 @@ x_wm_set_window_state (f, state) | |||
| 3737 | struct frame *f; | 3552 | struct frame *f; |
| 3738 | int state; | 3553 | int state; |
| 3739 | { | 3554 | { |
| 3740 | Window window = f->display.x->window_desc; | 3555 | Window window = FRAME_X_WINDOW (f); |
| 3741 | 3556 | ||
| 3742 | f->display.x->wm_hints.flags |= StateHint; | 3557 | f->display.x->wm_hints.flags |= StateHint; |
| 3743 | f->display.x->wm_hints.initial_state = state; | 3558 | f->display.x->wm_hints.initial_state = state; |
| @@ -3749,7 +3564,7 @@ x_wm_set_icon_pixmap (f, icon_pixmap) | |||
| 3749 | struct frame *f; | 3564 | struct frame *f; |
| 3750 | Pixmap icon_pixmap; | 3565 | Pixmap icon_pixmap; |
| 3751 | { | 3566 | { |
| 3752 | Window window = f->display.x->window_desc; | 3567 | Window window = FRAME_X_WINDOW (f); |
| 3753 | 3568 | ||
| 3754 | f->display.x->wm_hints.flags |= IconPixmapHint; | 3569 | f->display.x->wm_hints.flags |= IconPixmapHint; |
| 3755 | f->display.x->wm_hints.icon_pixmap = icon_pixmap ? icon_pixmap : None; | 3570 | f->display.x->wm_hints.icon_pixmap = icon_pixmap ? icon_pixmap : None; |
| @@ -3761,7 +3576,7 @@ x_wm_set_icon_position (f, icon_x, icon_y) | |||
| 3761 | struct frame *f; | 3576 | struct frame *f; |
| 3762 | int icon_x, icon_y; | 3577 | int icon_x, icon_y; |
| 3763 | { | 3578 | { |
| 3764 | Window window = f->display.x->window_desc; | 3579 | Window window = FRAME_X_WINDOW (f); |
| 3765 | 3580 | ||
| 3766 | f->display.x->wm_hints.flags |= IconPositionHint; | 3581 | f->display.x->wm_hints.flags |= IconPositionHint; |
| 3767 | f->display.x->wm_hints.icon_x = icon_x; | 3582 | f->display.x->wm_hints.icon_x = icon_x; |
| @@ -3779,7 +3594,7 @@ x_term_init (display_name) | |||
| 3779 | char *defaultvalue; | 3594 | char *defaultvalue; |
| 3780 | #ifdef F_SETOWN | 3595 | #ifdef F_SETOWN |
| 3781 | extern int old_fcntl_owner; | 3596 | extern int old_fcntl_owner; |
| 3782 | #endif | 3597 | #endif /* ! defined (F_SETOWN) */ |
| 3783 | 3598 | ||
| 3784 | x_focus_frame = x_highlight_frame = 0; | 3599 | x_focus_frame = x_highlight_frame = 0; |
| 3785 | 3600 | ||
| @@ -3796,7 +3611,7 @@ x_term_init (display_name) | |||
| 3796 | 3611 | ||
| 3797 | #if 0 | 3612 | #if 0 |
| 3798 | XSetAfterFunction (x_current_display, x_trace_wire); | 3613 | XSetAfterFunction (x_current_display, x_trace_wire); |
| 3799 | #endif | 3614 | #endif /* ! 0 */ |
| 3800 | 3615 | ||
| 3801 | invocation_name = Ffile_name_nondirectory (Fcar (Vcommand_line_args)); | 3616 | invocation_name = Ffile_name_nondirectory (Fcar (Vcommand_line_args)); |
| 3802 | 3617 | ||
| @@ -3832,22 +3647,22 @@ x_term_init (display_name) | |||
| 3832 | ConnectionNumber (x_current_display) = 0; /* Looks a little strange? | 3647 | ConnectionNumber (x_current_display) = 0; /* Looks a little strange? |
| 3833 | * check the def of the macro; | 3648 | * check the def of the macro; |
| 3834 | * it is a genuine lvalue */ | 3649 | * it is a genuine lvalue */ |
| 3835 | #endif /* not SYSV_STREAMS */ | 3650 | #endif /* SYSV_STREAMS */ |
| 3836 | 3651 | ||
| 3837 | #endif /* HAVE_X11 */ | 3652 | #endif /* ! defined (HAVE_X11) */ |
| 3838 | 3653 | ||
| 3839 | #ifdef F_SETOWN | 3654 | #ifdef F_SETOWN |
| 3840 | old_fcntl_owner = fcntl (0, F_GETOWN, 0); | 3655 | old_fcntl_owner = fcntl (0, F_GETOWN, 0); |
| 3841 | #ifdef F_SETOWN_SOCK_NEG | 3656 | #ifdef F_SETOWN_SOCK_NEG |
| 3842 | fcntl (0, F_SETOWN, -getpid ()); /* stdin is a socket here */ | 3657 | fcntl (0, F_SETOWN, -getpid ()); /* stdin is a socket here */ |
| 3843 | #else | 3658 | #else /* ! defined (F_SETOWN_SOCK_NEG) */ |
| 3844 | fcntl (0, F_SETOWN, getpid ()); | 3659 | fcntl (0, F_SETOWN, getpid ()); |
| 3845 | #endif /* F_SETOWN_SOCK_NEG */ | 3660 | #endif /* ! defined (F_SETOWN_SOCK_NEG) */ |
| 3846 | #endif /* F_SETOWN */ | 3661 | #endif /* ! defined (F_SETOWN) */ |
| 3847 | 3662 | ||
| 3848 | #ifdef SIGIO | 3663 | #ifdef SIGIO |
| 3849 | init_sigio (); | 3664 | init_sigio (); |
| 3850 | #endif | 3665 | #endif /* ! defined (SIGIO) */ |
| 3851 | 3666 | ||
| 3852 | /* Must use interrupt input because we cannot otherwise | 3667 | /* Must use interrupt input because we cannot otherwise |
| 3853 | arrange for C-g to be noticed immediately. | 3668 | arrange for C-g to be noticed immediately. |
| @@ -3883,15 +3698,17 @@ x_term_init (display_name) | |||
| 3883 | off the bottom */ | 3698 | off the bottom */ |
| 3884 | baud_rate = 19200; | 3699 | baud_rate = 19200; |
| 3885 | 3700 | ||
| 3886 | XHandleError (x_error_handler); | 3701 | /* Note that there is no real way portable across R3/R4 to get the |
| 3887 | XHandleIOError (x_error_handler); | 3702 | original error handler. */ |
| 3703 | XHandleError (x_error_quitter); | ||
| 3704 | XHandleIOError (x_error_quitter); | ||
| 3888 | 3705 | ||
| 3889 | /* Disable Window Change signals; they are handled by X events. */ | 3706 | /* Disable Window Change signals; they are handled by X events. */ |
| 3890 | #ifdef SIGWINCH | 3707 | #ifdef SIGWINCH |
| 3891 | signal (SIGWINCH, SIG_DFL); | 3708 | signal (SIGWINCH, SIG_DFL); |
| 3892 | #endif /* SIGWINCH */ | 3709 | #endif /* ! defined (SIGWINCH) */ |
| 3893 | 3710 | ||
| 3894 | signal (SIGPIPE, x_death_handler); | 3711 | signal (SIGPIPE, x_connection_closed); |
| 3895 | } | 3712 | } |
| 3896 | 3713 | ||
| 3897 | void | 3714 | void |
| @@ -3900,5 +3717,5 @@ syms_of_xterm () | |||
| 3900 | staticpro (&invocation_name); | 3717 | staticpro (&invocation_name); |
| 3901 | invocation_name = Qnil; | 3718 | invocation_name = Qnil; |
| 3902 | } | 3719 | } |
| 3903 | #endif /* HAVE_X11 */ | 3720 | #endif /* ! defined (HAVE_X11) */ |
| 3904 | #endif /* HAVE_X_WINDOWS */ | 3721 | #endif /* ! defined (HAVE_X_WINDOWS) */ |