diff options
| author | Richard M. Stallman | 1994-04-20 08:51:06 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-04-20 08:51:06 +0000 |
| commit | 5627c40e58b927f3337342d3b6d576647faee3d8 (patch) | |
| tree | 5bc991553579996acb63f1063ae814d91f1860b8 /src | |
| parent | abdced835c1e53a3c790da04e42d07264d2bd100 (diff) | |
| download | emacs-5627c40e58b927f3337342d3b6d576647faee3d8.tar.gz emacs-5627c40e58b927f3337342d3b6d576647faee3d8.zip | |
(XTread_socket, case ClientMessage): Use x_window_to_frame unconditionally.
(x_make_frame_invisible): Explicitly clear visible and
iconified flags, as well as the async flags.
(XTread_socket): Call XSetInputFocus.
(x_make_frame_invisible) [USE_X_TOOLKIT]: Use XtPopdown.
(XTread_socket): Call _XEditResCheckMessages only if HAVE_X11R5.
Diffstat (limited to 'src')
| -rw-r--r-- | src/xterm.c | 54 |
1 files changed, 33 insertions, 21 deletions
diff --git a/src/xterm.c b/src/xterm.c index 90358bee117..e7ac474b339 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -95,6 +95,7 @@ extern void _XEditResCheckMessages (); | |||
| 95 | 95 | ||
| 96 | #ifndef USE_X_TOOLKIT | 96 | #ifndef USE_X_TOOLKIT |
| 97 | #define x_any_window_to_frame x_window_to_frame | 97 | #define x_any_window_to_frame x_window_to_frame |
| 98 | #define x_top_window_to_frame x_window_to_frame | ||
| 98 | #endif | 99 | #endif |
| 99 | 100 | ||
| 100 | #ifdef HAVE_X11 | 101 | #ifdef HAVE_X11 |
| @@ -3398,14 +3399,18 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 3398 | { | 3399 | { |
| 3399 | if (event.xclient.data.l[0] == Xatom_wm_take_focus) | 3400 | if (event.xclient.data.l[0] == Xatom_wm_take_focus) |
| 3400 | { | 3401 | { |
| 3401 | #ifdef USE_X_TOOLKIT | ||
| 3402 | /* f = x_any_window_to_frame (event.xclient.window); */ | ||
| 3403 | f = x_window_to_frame (event.xclient.window); | ||
| 3404 | #else | ||
| 3405 | f = x_window_to_frame (event.xclient.window); | 3402 | f = x_window_to_frame (event.xclient.window); |
| 3406 | #endif | 3403 | #if 0 /* x_focus_on_frame is a no-op anyway. */ |
| 3407 | if (f) | 3404 | if (f) |
| 3408 | x_focus_on_frame (f); | 3405 | x_focus_on_frame (f); |
| 3406 | else | ||
| 3407 | #endif | ||
| 3408 | /* Since we set WM_TAKE_FOCUS, we must call | ||
| 3409 | XSetInputFocus explicitly. */ | ||
| 3410 | XSetInputFocus (event.xclient.display, | ||
| 3411 | event.xclient.window, | ||
| 3412 | RevertToPointerRoot, | ||
| 3413 | event.xclient.data.l[1]); | ||
| 3409 | /* Not certain about handling scroll bars here */ | 3414 | /* Not certain about handling scroll bars here */ |
| 3410 | } | 3415 | } |
| 3411 | else if (event.xclient.data.l[0] == Xatom_wm_save_yourself) | 3416 | else if (event.xclient.data.l[0] == Xatom_wm_save_yourself) |
| @@ -3454,13 +3459,13 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 3454 | f->display.x->top_pos = new_y; | 3459 | f->display.x->top_pos = new_y; |
| 3455 | } | 3460 | } |
| 3456 | } | 3461 | } |
| 3457 | #ifdef USE_X_TOOLKIT | 3462 | #if defined (USE_X_TOOLKIT) && defined (HAVE_X11R5) |
| 3458 | else if (event.xclient.message_type == Xatom_editres_name) | 3463 | else if (event.xclient.message_type == Xatom_editres_name) |
| 3459 | { | 3464 | { |
| 3460 | struct frame *f = x_any_window_to_frame (event.xclient.window); | 3465 | struct frame *f = x_any_window_to_frame (event.xclient.window); |
| 3461 | _XEditResCheckMessages (f->display.x->widget, NULL, &event, NULL); | 3466 | _XEditResCheckMessages (f->display.x->widget, NULL, &event, NULL); |
| 3462 | } | 3467 | } |
| 3463 | #endif /* USE_X_TOOLKIT */ | 3468 | #endif /* USE_X_TOOLKIT and HAVE_X11R5 */ |
| 3464 | } | 3469 | } |
| 3465 | break; | 3470 | break; |
| 3466 | 3471 | ||
| @@ -3687,10 +3692,10 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 3687 | disabled; you don't want to spend time updating a | 3692 | disabled; you don't want to spend time updating a |
| 3688 | display that won't ever be seen. */ | 3693 | display that won't ever be seen. */ |
| 3689 | f->async_visible = 0; | 3694 | f->async_visible = 0; |
| 3690 | /* The window manager never makes a window invisible | 3695 | /* We can't distinguish, from the event, whether the window |
| 3691 | ("withdrawn"); all it does is switch between visible | 3696 | has become iconified or invisible. So assume, if it |
| 3692 | and iconified. Frames get into the invisible state | 3697 | was previously visible, than now it is iconified. |
| 3693 | only through x_make_frame_invisible. */ | 3698 | We depend on x_make_frame_invisible to mark it iconified. */ |
| 3694 | if (FRAME_VISIBLE_P (f) || FRAME_ICONIFIED_P (f)) | 3699 | if (FRAME_VISIBLE_P (f) || FRAME_ICONIFIED_P (f)) |
| 3695 | f->async_iconified = 1; | 3700 | f->async_iconified = 1; |
| 3696 | } | 3701 | } |
| @@ -3700,11 +3705,7 @@ XTread_socket (sd, bufp, numchars, waitp, expected) | |||
| 3700 | break; | 3705 | break; |
| 3701 | 3706 | ||
| 3702 | case MapNotify: | 3707 | case MapNotify: |
| 3703 | #ifdef USE_X_TOOLKIT | 3708 | f = x_top_window_to_frame (event.xmap.window); |
| 3704 | f = x_any_window_to_frame (event.xmap.window); | ||
| 3705 | #else /* not USE_X_TOOLKIT */ | ||
| 3706 | f = x_window_to_frame (event.xmap.window); | ||
| 3707 | #endif /* not USE_X_TOOLKIT */ | ||
| 3708 | if (f) | 3709 | if (f) |
| 3709 | { | 3710 | { |
| 3710 | f->async_visible = 1; | 3711 | f->async_visible = 1; |
| @@ -5462,24 +5463,25 @@ x_make_frame_invisible (f) | |||
| 5462 | if (x_highlight_frame == f) | 5463 | if (x_highlight_frame == f) |
| 5463 | x_highlight_frame = 0; | 5464 | x_highlight_frame = 0; |
| 5464 | 5465 | ||
| 5466 | #if 0/* This might add unreliability; I don't trust it -- rms. */ | ||
| 5465 | if (! f->async_visible && ! f->async_iconified) | 5467 | if (! f->async_visible && ! f->async_iconified) |
| 5466 | return; | 5468 | return; |
| 5469 | #endif | ||
| 5467 | 5470 | ||
| 5468 | BLOCK_INPUT; | 5471 | BLOCK_INPUT; |
| 5469 | 5472 | ||
| 5470 | #ifdef HAVE_X11R4 | 5473 | #ifdef HAVE_X11R4 |
| 5471 | 5474 | ||
| 5472 | #ifdef USE_X_TOOLKIT | 5475 | #ifdef USE_X_TOOLKIT |
| 5473 | if (! XWithdrawWindow (x_current_display, XtWindow (f->display.x->widget), | 5476 | XtPopdown (f->display.x->widget); |
| 5474 | DefaultScreen (x_current_display))) | ||
| 5475 | #else /* not USE_X_TOOLKIT */ | 5477 | #else /* not USE_X_TOOLKIT */ |
| 5476 | if (! XWithdrawWindow (x_current_display, FRAME_X_WINDOW (f), | 5478 | if (! XWithdrawWindow (x_current_display, FRAME_X_WINDOW (f), |
| 5477 | DefaultScreen (x_current_display))) | 5479 | DefaultScreen (x_current_display))) |
| 5478 | #endif /* not USE_X_TOOLKIT */ | ||
| 5479 | { | 5480 | { |
| 5480 | UNBLOCK_INPUT_RESIGNAL; | 5481 | UNBLOCK_INPUT_RESIGNAL; |
| 5481 | error ("can't notify window manager of window withdrawal"); | 5482 | error ("can't notify window manager of window withdrawal"); |
| 5482 | } | 5483 | } |
| 5484 | #endif /* not USE_X_TOOLKIT */ | ||
| 5483 | 5485 | ||
| 5484 | #else /* ! defined (HAVE_X11R4) */ | 5486 | #else /* ! defined (HAVE_X11R4) */ |
| 5485 | #ifdef HAVE_X11 | 5487 | #ifdef HAVE_X11 |
| @@ -5517,14 +5519,24 @@ x_make_frame_invisible (f) | |||
| 5517 | #else /* ! defined (HAVE_X11) */ | 5519 | #else /* ! defined (HAVE_X11) */ |
| 5518 | 5520 | ||
| 5519 | XUnmapWindow (FRAME_X_WINDOW (f)); | 5521 | XUnmapWindow (FRAME_X_WINDOW (f)); |
| 5520 | f->async_visible = 0; /* Handled by the UnMap event for X11 */ | ||
| 5521 | if (f->display.x->icon_desc != 0) | 5522 | if (f->display.x->icon_desc != 0) |
| 5522 | XUnmapWindow (f->display.x->icon_desc); | 5523 | XUnmapWindow (f->display.x->icon_desc); |
| 5523 | 5524 | ||
| 5524 | #endif /* ! defined (HAVE_X11) */ | 5525 | #endif /* ! defined (HAVE_X11) */ |
| 5525 | #endif /* ! defined (HAVE_X11R4) */ | 5526 | #endif /* ! defined (HAVE_X11R4) */ |
| 5526 | 5527 | ||
| 5527 | XFlushQueue (); | 5528 | /* We can't distinguish this from iconification |
| 5529 | just by the event that we get from the server. | ||
| 5530 | So we can't win using the usual strategy of letting | ||
| 5531 | FRAME_SAMPLE_VISIBILITY set this. So do it by hand, | ||
| 5532 | and synchronize with the server to make sure we agree. */ | ||
| 5533 | f->visible = 0; | ||
| 5534 | FRAME_ICONIFIED_P (f) = 0; | ||
| 5535 | f->async_visible = 0; | ||
| 5536 | f->async_iconified = 0; | ||
| 5537 | |||
| 5538 | x_sync (); | ||
| 5539 | |||
| 5528 | UNBLOCK_INPUT; | 5540 | UNBLOCK_INPUT; |
| 5529 | } | 5541 | } |
| 5530 | 5542 | ||