diff options
| author | Richard M. Stallman | 1997-07-26 01:43:07 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1997-07-26 01:43:07 +0000 |
| commit | bf7253f4a221e7bb8b1cded91d65253d45ef6c40 (patch) | |
| tree | b960dfd04a194a67a3148cdbb13545075d84ee78 | |
| parent | f3216838e86b1e40c72b34ce538894ac33c10e77 (diff) | |
| download | emacs-bf7253f4a221e7bb8b1cded91d65253d45ef6c40.tar.gz emacs-bf7253f4a221e7bb8b1cded91d65253d45ef6c40.zip | |
(dumpglyphs): Check the dimension of FONT while
setting `byte1' and `byte2' members of *CP.
(XTread_socket): Trap the BadMatch error that can occur
after a XSetInputFocus if window is not visible.
| -rw-r--r-- | src/xterm.c | 37 |
1 files changed, 28 insertions, 9 deletions
diff --git a/src/xterm.c b/src/xterm.c index 573f939d836..b79a32954c8 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -733,7 +733,12 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp) | |||
| 733 | ccl->reg[0] = charset; | 733 | ccl->reg[0] = charset; |
| 734 | ccl->reg[1] = cp->byte2; | 734 | ccl->reg[1] = cp->byte2; |
| 735 | ccl_driver (ccl, NULL, NULL, 0, 0, NULL); | 735 | ccl_driver (ccl, NULL, NULL, 0, 0, NULL); |
| 736 | cp->byte2 = ccl->reg[1]; | 736 | /* We assume that MSBs are appropriately |
| 737 | set/reset by CCL program. */ | ||
| 738 | if (font->max_byte1 == 0) /* 1-byte font */ | ||
| 739 | cp->byte2 = ccl->reg[1]; | ||
| 740 | else | ||
| 741 | cp->byte1 = ccl->reg[1], cp->byte2 = ccl->reg[2]; | ||
| 737 | } | 742 | } |
| 738 | else | 743 | else |
| 739 | for (cp = x_2byte_buffer; cp < x_2byte_buffer + len; cp++) | 744 | for (cp = x_2byte_buffer; cp < x_2byte_buffer + len; cp++) |
| @@ -741,7 +746,12 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground, cmpcharp) | |||
| 741 | ccl->reg[0] = charset; | 746 | ccl->reg[0] = charset; |
| 742 | ccl->reg[1] = cp->byte1, ccl->reg[2] = cp->byte2; | 747 | ccl->reg[1] = cp->byte1, ccl->reg[2] = cp->byte2; |
| 743 | ccl_driver (ccl, NULL, NULL, 0, 0, NULL); | 748 | ccl_driver (ccl, NULL, NULL, 0, 0, NULL); |
| 744 | cp->byte1 = ccl->reg[1], cp->byte2 = ccl->reg[2]; | 749 | /* We assume that MSBs are appropriately |
| 750 | set/reset by CCL program. */ | ||
| 751 | if (font->max_byte1 == 0) /* 1-byte font */ | ||
| 752 | cp->byte2 = ccl->reg[1]; | ||
| 753 | else | ||
| 754 | cp->byte1 = ccl->reg[1], cp->byte2 = ccl->reg[2]; | ||
| 745 | } | 755 | } |
| 746 | } | 756 | } |
| 747 | else if (fontp->encoding[charset]) | 757 | else if (fontp->encoding[charset]) |
| @@ -3825,19 +3835,28 @@ XTread_socket (sd, bufp, numchars, expected) | |||
| 3825 | could be the shell widget window | 3835 | could be the shell widget window |
| 3826 | if the frame has no title bar. */ | 3836 | if the frame has no title bar. */ |
| 3827 | f = x_any_window_to_frame (dpyinfo, event.xclient.window); | 3837 | f = x_any_window_to_frame (dpyinfo, event.xclient.window); |
| 3828 | /* Since we set WM_TAKE_FOCUS, we must call | ||
| 3829 | XSetInputFocus explicitly. But not if f is null, | ||
| 3830 | since that might be an event for a deleted frame. */ | ||
| 3831 | #ifdef HAVE_X_I18N | 3838 | #ifdef HAVE_X_I18N |
| 3832 | /* Not quite sure this is needed -pd */ | 3839 | /* Not quite sure this is needed -pd */ |
| 3833 | if (f && FRAME_XIC (f)) | 3840 | if (f && FRAME_XIC (f)) |
| 3834 | XSetICFocus (FRAME_XIC (f)); | 3841 | XSetICFocus (FRAME_XIC (f)); |
| 3835 | #endif | 3842 | #endif |
| 3843 | /* Since we set WM_TAKE_FOCUS, we must call | ||
| 3844 | XSetInputFocus explicitly. But not if f is null, | ||
| 3845 | since that might be an event for a deleted frame. */ | ||
| 3836 | if (f) | 3846 | if (f) |
| 3837 | XSetInputFocus (event.xclient.display, | 3847 | { |
| 3838 | event.xclient.window, | 3848 | Display *d = event.xclient.display; |
| 3839 | RevertToPointerRoot, | 3849 | /* Catch and ignore errors, in case window has been |
| 3840 | event.xclient.data.l[1]); | 3850 | iconified by a window manager such as GWM. */ |
| 3851 | int count = x_catch_errors (d); | ||
| 3852 | XSetInputFocus (d, event.xclient.window, | ||
| 3853 | RevertToPointerRoot, | ||
| 3854 | event.xclient.data.l[1]); | ||
| 3855 | /* This is needed to detect the error | ||
| 3856 | if there is an error. */ | ||
| 3857 | XSync (d, False); | ||
| 3858 | x_uncatch_errors (d, count); | ||
| 3859 | } | ||
| 3841 | /* Not certain about handling scroll bars here */ | 3860 | /* Not certain about handling scroll bars here */ |
| 3842 | } | 3861 | } |
| 3843 | else if (event.xclient.data.l[0] | 3862 | else if (event.xclient.data.l[0] |