comparison src/event-Xt.c @ 593:5fd7ba8b56e7

[xemacs-hg @ 2001-05-31 12:45:27 by ben] xemacs-faq.texi: Major rewrite. Update all MS Windows info to current. Redo section 6.1 almost completely. Incorporate sections 1 and 2 of Hrvoje's FAQ. etags.el: Fix infloop when going up to the root. s\cygwin32.h: Don't unilaterally include ntplay, but only when we're compiling with native sound (look in configure now). event-msw.c: Fix yet more problems with C-g handling. Implement debug-mswindows-events. event-stream.c, events.h, signal.c, sysdep.h: Rearrange the signal-handling code to eliminate the former spaghetti logic paths in it. Document clearly what "low-level" and "high-level" timeouts are. Rename some functions with unclear names (e.g. "...alarm...") to names that reflect what they actually do (e.g. "...async_timeout..."). Fix numerous bugs discovered in the process. console-x.h, event-Xt.c, event-msw.c, frame-x.c: Hopefully make XEmacs properly maintain the "iconified" state on frames at all times. This should fix the "can't delete a frame with C-x 5 0 when there's another iconified frame out there" bug. Put a notice in of further changes that should probably be made to clean up the frame-visibility support. (especially directed at Jan Vroonhof) lisp.h, miscplay.c: Rename SBufbyte to CBufbyte to avoid a misleading name. Eliminate UChar, which is not used anywhere and contributes no semantic info. Add a comment about the documentation-only properties of the char/unsigned char typedefs. Add SChar_Binary as an explicitly `signed' version of Char_Binary and put back the `signed' declarations in miscplay.c. alloc.c: Use char typedefs. console-msw.c, device-msw.c, dialog-msw.c, editfns.c, fileio.c, glyphs-eimage.c, menubar-msw.c, ntplay.c, objects-msw.c, realpath.c, redisplay-msw.c, select-msw.c, syswindows.h, win32.c: Eliminate numerous C++ errors. frame-msw.c: Eliminate numerous C++ errors and Mule-ize. glyphs-msw.c: Eliminate numerous C++ errors and use char typedefs. configure.in: Fix problems detecting both native and Linux sound on Cygwin when compiled with --with-msw=no. Rearrange file-coding handling a bit to avoid warning when compiling with Mule. configure.in, configure.usage, INSTALL: Document XEMACS_CC and corresponding compiler option --xemacs-compiler. Explain how to build xemacs using a C++ compiler.
author ben
date Thu, 31 May 2001 12:45:41 +0000
parents 183866b06e0b
children 373ced43e288
comparison
equal deleted inserted replaced
592:4f6ba8f1fb3d 593:5fd7ba8b56e7
1666 va_run_hook_with_args (Qmap_frame_hook, 1, frame); 1666 va_run_hook_with_args (Qmap_frame_hook, 1, frame);
1667 } 1667 }
1668 } 1668 }
1669 1669
1670 static void 1670 static void
1671 update_frame_iconify_status (struct frame *f)
1672 {
1673 f->iconified = (x_frame_window_state (f) == IconicState);
1674 }
1675
1676 static void
1671 handle_map_event (struct frame *f, XEvent *event) 1677 handle_map_event (struct frame *f, XEvent *event)
1672 { 1678 {
1673 Lisp_Object frame; 1679 Lisp_Object frame;
1674 1680
1675 XSETFRAME (frame, f); 1681 XSETFRAME (frame, f);
1682
1683 /* It seems that, given the multiplicity of window managers and X
1684 implementations, plus the fact that X was designed without
1685 window managers or icons in mind and this was then grafted on
1686 with about the skill of a drunk freshman med student attempting
1687 surgery with a rusty razor blade, we cannot treat any off
1688 MapNotify/UnmapNotify/VisibilityNotify as more than vague hints
1689 as to the actual situation.
1690
1691 So we should just query the actual status. Unfortunately, things
1692 are worse because (a) there aren't obvious ways to query some
1693 of these values (e.g. "totally visible"), and (b) there may be
1694 race conditions (see below).
1695
1696 However, according the the ICCCM, there's a specific way to
1697 ask the window manager whether the state is (a) visible,
1698 (b) iconic, (c) withdrawn. It must be one of these three.
1699 We already use this call to check for the iconified state.
1700 I'd suggest we do the same for visible (i.e. NormalState),
1701 and scrap most of the nasty code below.
1702
1703 --ben
1704 */
1705
1706 update_frame_iconify_status (f);
1707
1708 /* #### Ben suggests rewriting the code below using
1709 x_frame_window_state (f). */
1710
1676 if (event->type == MapNotify) 1711 if (event->type == MapNotify)
1677 { 1712 {
1678 XWindowAttributes xwa; 1713 XWindowAttributes xwa;
1679 1714
1680 /* Bleagh!!!!!! Apparently some window managers (e.g. MWM) 1715 /* Bleagh!!!!!! Apparently some window managers (e.g. MWM)
1689 might not be visible, and check explicitly. */ 1724 might not be visible, and check explicitly. */
1690 1725
1691 XGetWindowAttributes (event->xany.display, event->xmap.window, 1726 XGetWindowAttributes (event->xany.display, event->xmap.window,
1692 &xwa); 1727 &xwa);
1693 if (xwa.map_state != IsViewable) 1728 if (xwa.map_state != IsViewable)
1694 { 1729 return;
1695 /* Calling Fframe_iconified_p is the only way we have to
1696 correctly update FRAME_ICONIFIED_P */
1697 Fframe_iconified_p (frame);
1698 return;
1699 }
1700 1730
1701 FRAME_X_TOTALLY_VISIBLE_P (f) = 1; 1731 FRAME_X_TOTALLY_VISIBLE_P (f) = 1;
1702 #if 0 1732 #if 0
1703 /* Bleagh again!!!! We initially tried the following hack 1733 /* Bleagh again!!!! We initially tried the following hack
1704 around the MWM problem, but it turns out that TWM 1734 around the MWM problem, but it turns out that TWM
1729 } 1759 }
1730 else 1760 else
1731 { 1761 {
1732 FRAME_X_TOTALLY_VISIBLE_P (f) = 0; 1762 FRAME_X_TOTALLY_VISIBLE_P (f) = 0;
1733 change_frame_visibility (f, 0); 1763 change_frame_visibility (f, 0);
1734 /* Calling Fframe_iconified_p is the only way we have to
1735 correctly update FRAME_ICONIFIED_P */
1736 Fframe_iconified_p (frame);
1737 } 1764 }
1738 } 1765 }
1739 1766
1740 static void 1767 static void
1741 handle_client_message (struct frame *f, XEvent *event) 1768 handle_client_message (struct frame *f, XEvent *event)
1930 break; 1957 break;
1931 1958
1932 case VisibilityNotify: /* window visibility has changed */ 1959 case VisibilityNotify: /* window visibility has changed */
1933 if (event->xvisibility.window == XtWindow (FRAME_X_SHELL_WIDGET (f))) 1960 if (event->xvisibility.window == XtWindow (FRAME_X_SHELL_WIDGET (f)))
1934 { 1961 {
1962 /* See comment in handle_map_event */
1963 update_frame_iconify_status (f);
1964
1965 /* #### Ben suggests rewriting the code below using
1966 x_frame_window_state (f). */
1935 FRAME_X_TOTALLY_VISIBLE_P (f) = 1967 FRAME_X_TOTALLY_VISIBLE_P (f) =
1936 (event->xvisibility.state == VisibilityUnobscured); 1968 (event->xvisibility.state == VisibilityUnobscured);
1937 /* Note that the fvwm pager only sends VisibilityNotify when 1969 /* Note that the fvwm pager only sends VisibilityNotify when
1938 changing pages. Is this all we need to do ? JV */ 1970 changing pages. Is this all we need to do ? JV */
1939 /* Nope. We must at least trigger a redisplay here. 1971 /* Nope. We must at least trigger a redisplay here.
2985 if (pending_value & XtIMTimer) 3017 if (pending_value & XtIMTimer)
2986 return 1; 3018 return 1;
2987 } 3019 }
2988 3020
2989 /* XtAppPending() can be super-slow, esp. over a network connection. 3021 /* XtAppPending() can be super-slow, esp. over a network connection.
2990 Quantify results have indicated that in some cases the 3022 Quantify results have indicated that in some cases the call to
2991 call to detect_input_pending() completely dominates the 3023 detect_input_pending() completely dominates the running time of
2992 running time of redisplay(). Fortunately, in a SIGIO world 3024 redisplay(). Fortunately, in a SIGIO world we can more quickly
2993 we can more quickly determine whether there are any X events: 3025 determine whether there are any X events: if an event has
2994 if an event has happened since the last time we checked, then 3026 happened since the last time we checked, then a SIGIO will have
2995 a SIGIO will have happened. On a machine with broken SIGIO, 3027 happened. On a machine with broken SIGIO, we'll still be in an
2996 we'll still be in an OK state -- the sigio_happened flag 3028 OK state -- quit_check_signal_tick_count will get ticked at least
2997 will get set at least once a second, so we'll be no more than 3029 every 1/4 second, so we'll be no more than that much behind
2998 one second behind reality. (In general it's OK if we 3030 reality. (In general it's OK if we erroneously report no input
2999 erroneously report no input pending when input is actually 3031 pending when input is actually pending() -- preemption is just a
3000 pending() -- preemption is just a bit less efficient, that's 3032 bit less efficient, that's all. It's bad bad bad if you err the
3001 all. It's bad bad bad if you err the other way -- you've 3033 other way -- you've promised that `next-event' won't block but it
3002 promised that `next-event' won't block but it actually will, 3034 actually will, and some action might get delayed until the next
3003 and some action might get delayed until the next time you 3035 time you hit a key.)
3004 hit a key.)
3005 */ 3036 */
3006 3037
3007 /* quit_check_signal_tick_count is volatile so try to avoid race conditions 3038 /* quit_check_signal_tick_count is volatile so try to avoid race conditions
3008 by using a temporary variable */ 3039 by using a temporary variable */
3009 tick_count_val = quit_check_signal_tick_count; 3040 tick_count_val = quit_check_signal_tick_count;