aboutsummaryrefslogtreecommitdiffstats
path: root/src/xterm.c
diff options
context:
space:
mode:
authorRichard M. Stallman1995-04-14 03:58:51 +0000
committerRichard M. Stallman1995-04-14 03:58:51 +0000
commit2d7fc7e8f9f019d01a4f02ad28fb6b9abc8404dc (patch)
tree4dd8043b042e740b9eca3a75af011ce4b725ab5c /src/xterm.c
parent5b43bbf747606e25a84accf8a8470f906a9e7359 (diff)
downloademacs-2d7fc7e8f9f019d01a4f02ad28fb6b9abc8404dc.tar.gz
emacs-2d7fc7e8f9f019d01a4f02ad28fb6b9abc8404dc.zip
(x_term_init): Call XtSetLanguageProc only if HAVE_X11XTR6.
(XTread_socket): Pass dpyinfo to popup_get_selection. (XTread_socket): For ConfigureNotify, combine the USE_X_TOOLKIT and non-toolkit cases, which provides some things that were missing in the former.
Diffstat (limited to 'src/xterm.c')
-rw-r--r--src/xterm.c97
1 files changed, 46 insertions, 51 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 6cd793e6152..bf633dd982c 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -249,6 +249,8 @@ static void do_line_dance ();
249static int XTcursor_to (); 249static int XTcursor_to ();
250static int XTclear_end_of_line (); 250static int XTclear_end_of_line ();
251static int x_io_error_quitter (); 251static int x_io_error_quitter ();
252void x_catch_errors ();
253void x_uncatch_errors ();
252 254
253/* Return the struct x_display_info corresponding to DPY. */ 255/* Return the struct x_display_info corresponding to DPY. */
254 256
@@ -2178,13 +2180,14 @@ static struct scroll_bar *x_window_to_scroll_bar ();
2178static void x_scroll_bar_report_motion (); 2180static void x_scroll_bar_report_motion ();
2179 2181
2180/* Return the current position of the mouse. 2182/* Return the current position of the mouse.
2183 *fp should be a frame which indicates which display to ask about.
2181 2184
2182 If the mouse movement started in a scroll bar, set *f, *bar_window, 2185 If the mouse movement started in a scroll bar, set *fp, *bar_window,
2183 and *part to the frame, window, and scroll bar part that the mouse 2186 and *part to the frame, window, and scroll bar part that the mouse
2184 is over. Set *x and *y to the portion and whole of the mouse's 2187 is over. Set *x and *y to the portion and whole of the mouse's
2185 position on the scroll bar. 2188 position on the scroll bar.
2186 2189
2187 If the mouse movement started elsewhere, set *f to the frame the 2190 If the mouse movement started elsewhere, set *fp to the frame the
2188 mouse is on, *bar_window to nil, and *x and *y to the character cell 2191 mouse is on, *bar_window to nil, and *x and *y to the character cell
2189 the mouse is over. 2192 the mouse is over.
2190 2193
@@ -2254,6 +2257,12 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time)
2254 2257
2255 win = root; 2258 win = root;
2256 2259
2260 /* XTranslateCoordinates can get errors if the window
2261 structure is changing at the same time this function
2262 is running. So at least we must not crash from them. */
2263
2264 x_catch_errors (FRAME_X_DISPLAY (*fp));
2265
2257 if (FRAME_X_DISPLAY_INFO (*fp)->grabbed && last_mouse_frame 2266 if (FRAME_X_DISPLAY_INFO (*fp)->grabbed && last_mouse_frame
2258 && FRAME_LIVE_P (last_mouse_frame)) 2267 && FRAME_LIVE_P (last_mouse_frame))
2259 { 2268 {
@@ -2309,6 +2318,11 @@ XTmouse_position (fp, insist, bar_window, part, x, y, time)
2309 f1 = x_any_window_to_frame (FRAME_X_DISPLAY_INFO (*fp), win); 2318 f1 = x_any_window_to_frame (FRAME_X_DISPLAY_INFO (*fp), win);
2310 } 2319 }
2311 2320
2321 if (x_had_errors_p (FRAME_X_DISPLAY (*fp)))
2322 f1 = 0;
2323
2324 x_uncatch_errors (FRAME_X_DISPLAY (*fp));
2325
2312 /* If not, is it one of our scroll bars? */ 2326 /* If not, is it one of our scroll bars? */
2313 if (! f1) 2327 if (! f1)
2314 { 2328 {
@@ -3784,55 +3798,17 @@ XTread_socket (sd, bufp, numchars, waitp, expected)
3784 3798
3785 case ConfigureNotify: 3799 case ConfigureNotify:
3786 f = x_any_window_to_frame (dpyinfo, event.xconfigure.window); 3800 f = x_any_window_to_frame (dpyinfo, event.xconfigure.window);
3787#ifdef USE_X_TOOLKIT
3788 if (f 3801 if (f
3789#if 0 3802#ifdef USE_X_TOOLKIT
3790 && ! event.xconfigure.send_event 3803 && (event.xconfigure.window == XtWindow (f->display.x->widget))
3791#endif 3804#endif
3792 && (event.xconfigure.window == XtWindow (f->display.x->widget))) 3805 )
3793 { 3806 {
3794 Window win, child; 3807#ifndef USE_X_TOOLKIT
3795 int win_x, win_y; 3808 /* In the toolkit version, change_frame_size
3796 3809 is called by the code that handles resizing
3797 /* Find the position of the outside upper-left corner of 3810 of the EmacsFrame widget. */
3798 the window, in the root coordinate system. Don't
3799 refer to the parent window here; we may be processing
3800 this event after the window manager has changed our
3801 parent, but before we have reached the ReparentNotify. */
3802 XTranslateCoordinates (FRAME_X_DISPLAY (f),
3803
3804 /* From-window, to-window. */
3805 XtWindow (f->display.x->widget),
3806 FRAME_X_DISPLAY_INFO (f)->root_window,
3807
3808 /* From-position, to-position. */
3809 -event.xconfigure.border_width,
3810 -event.xconfigure.border_width,
3811 &win_x, &win_y,
3812
3813 /* Child of win. */
3814 &child);
3815 event.xconfigure.x = win_x;
3816 event.xconfigure.y = win_y;
3817
3818 f->display.x->pixel_width = event.xconfigure.width;
3819 f->display.x->pixel_height = event.xconfigure.height;
3820 f->display.x->left_pos = event.xconfigure.x;
3821 f->display.x->top_pos = event.xconfigure.y;
3822 3811
3823 /* What we have now is the position of Emacs's own window.
3824 Convert that to the position of the window manager window. */
3825 {
3826 int x, y;
3827 x_real_positions (f, &x, &y);
3828 f->display.x->left_pos = x;
3829 f->display.x->top_pos = y;
3830 }
3831 }
3832 goto OTHER;
3833#else /* not USE_X_TOOLKIT */
3834 if (f)
3835 {
3836 int rows = PIXEL_TO_CHAR_HEIGHT (f, event.xconfigure.height); 3812 int rows = PIXEL_TO_CHAR_HEIGHT (f, event.xconfigure.height);
3837 int columns = PIXEL_TO_CHAR_WIDTH (f, event.xconfigure.width); 3813 int columns = PIXEL_TO_CHAR_WIDTH (f, event.xconfigure.width);
3838 3814
@@ -3847,8 +3823,15 @@ XTread_socket (sd, bufp, numchars, waitp, expected)
3847 change_frame_size (f, rows, columns, 0, 1); 3823 change_frame_size (f, rows, columns, 0, 1);
3848 SET_FRAME_GARBAGED (f); 3824 SET_FRAME_GARBAGED (f);
3849 } 3825 }
3826#endif
3850 3827
3851 if (! event.xconfigure.send_event) 3828 /* Formerly, in the USE_X_TOOLKIT version,
3829 we did not test send_event here. */
3830 if (1
3831#ifndef USE_X_TOOLKIT
3832 && ! event.xconfigure.send_event
3833#endif
3834 )
3852 { 3835 {
3853 Window win, child; 3836 Window win, child;
3854 int win_x, win_y; 3837 int win_x, win_y;
@@ -3861,7 +3844,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected)
3861 XTranslateCoordinates (FRAME_X_DISPLAY (f), 3844 XTranslateCoordinates (FRAME_X_DISPLAY (f),
3862 3845
3863 /* From-window, to-window. */ 3846 /* From-window, to-window. */
3864 f->display.x->window_desc, 3847 event.xconfigure.window,
3865 FRAME_X_DISPLAY_INFO (f)->root_window, 3848 FRAME_X_DISPLAY_INFO (f)->root_window,
3866 3849
3867 /* From-position, to-position. */ 3850 /* From-position, to-position. */
@@ -3887,6 +3870,9 @@ XTread_socket (sd, bufp, numchars, waitp, expected)
3887 x_real_positions (f, &x, &y); 3870 x_real_positions (f, &x, &y);
3888 f->display.x->left_pos = x; 3871 f->display.x->left_pos = x;
3889 f->display.x->top_pos = y; 3872 f->display.x->top_pos = y;
3873 /* Formerly we did not do this in the USE_X_TOOLKIT
3874 version. Let's try making them the same. */
3875/* #ifndef USE_X_TOOLKIT */
3890 if (y != event.xconfigure.y) 3876 if (y != event.xconfigure.y)
3891 { 3877 {
3892 /* Since the WM decorations come below top_pos now, 3878 /* Since the WM decorations come below top_pos now,
@@ -3894,10 +3880,14 @@ XTread_socket (sd, bufp, numchars, waitp, expected)
3894 f->display.x->win_gravity = NorthWestGravity; 3880 f->display.x->win_gravity = NorthWestGravity;
3895 x_wm_set_size_hint (f, 0, 0); 3881 x_wm_set_size_hint (f, 0, 0);
3896 } 3882 }
3883/* #endif */
3897 } 3884 }
3898 } 3885 }
3899#endif /* not USE_X_TOOLKIT */ 3886#ifdef USE_X_TOOLKIT
3887 goto OTHER;
3888#else
3900 break; 3889 break;
3890#endif
3901 3891
3902 case ButtonPress: 3892 case ButtonPress:
3903 case ButtonRelease: 3893 case ButtonRelease:
@@ -5585,7 +5575,12 @@ x_term_init (display_name, xrm_option, resource_name)
5585 } 5575 }
5586 5576
5587#ifdef USE_X_TOOLKIT 5577#ifdef USE_X_TOOLKIT
5588#ifdef HAVE_X11R5 5578 /* weiner@footloose.sps.mot.com reports that this causes
5579 errors with X11R5:
5580 X protocol error: BadAtom (invalid Atom parameter)
5581 on protocol request 18skiloaf.
5582 So let's not use it until R6. */
5583#ifdef HAVE_X11XTR6
5589 XtSetLanguageProc (NULL, NULL, NULL); 5584 XtSetLanguageProc (NULL, NULL, NULL);
5590#endif 5585#endif
5591 5586