comparison src/frame-x.c @ 108:360340f9fd5f r20-1b6

Import from CVS: tag r20-1b6
author cvs
date Mon, 13 Aug 2007 09:18:39 +0200
parents cf808b4c4290
children 0132846995bd
comparison
equal deleted inserted replaced
107:523141596bda 108:360340f9fd5f
2198 Window emacs_window; 2198 Window emacs_window;
2199 XWindowChanges xwc; 2199 XWindowChanges xwc;
2200 unsigned int flags; 2200 unsigned int flags;
2201 Display *display = DEVICE_X_DISPLAY (XDEVICE (f->device)); 2201 Display *display = DEVICE_X_DISPLAY (XDEVICE (f->device));
2202 2202
2203 if (f->visible || force) 2203 if (FRAME_VISIBLE_P(f) || force)
2204 { 2204 {
2205 emacs_window = XtWindow (FRAME_X_SHELL_WIDGET (f)); 2205 emacs_window = XtWindow (FRAME_X_SHELL_WIDGET (f));
2206 /* first raises all the dialog boxes, then put emacs just below the 2206 /* first raises all the dialog boxes, then put emacs just below the
2207 * bottom most dialog box */ 2207 * bottom most dialog box */
2208 bottom_dialog = lw_raise_all_pop_up_widgets (); 2208 bottom_dialog = lw_raise_all_pop_up_widgets ();
2237 { 2237 {
2238 Display *display = DEVICE_X_DISPLAY (XDEVICE (f->device)); 2238 Display *display = DEVICE_X_DISPLAY (XDEVICE (f->device));
2239 XWindowChanges xwc; 2239 XWindowChanges xwc;
2240 unsigned int flags; 2240 unsigned int flags;
2241 2241
2242 if (f->visible) 2242 if (FRAME_VISIBLE_P(f))
2243 { 2243 {
2244 xwc.stack_mode = Below; 2244 xwc.stack_mode = Below;
2245 flags = CWStackMode; 2245 flags = CWStackMode;
2246 if (!XReconfigureWMWindow (display, XtWindow (FRAME_X_SHELL_WIDGET (f)), 2246 if (!XReconfigureWMWindow (display, XtWindow (FRAME_X_SHELL_WIDGET (f)),
2247 DefaultScreen (display), flags, &xwc)) 2247 DefaultScreen (display), flags, &xwc))
2253 static void 2253 static void
2254 x_make_frame_visible (struct frame *f) 2254 x_make_frame_visible (struct frame *f)
2255 { 2255 {
2256 Display *display = DEVICE_X_DISPLAY (XDEVICE (f->device)); 2256 Display *display = DEVICE_X_DISPLAY (XDEVICE (f->device));
2257 2257
2258 if (!f->visible) 2258 if (!FRAME_VISIBLE_P(f))
2259 XMapRaised (display, XtWindow (FRAME_X_SHELL_WIDGET (f))); 2259 XMapRaised (display, XtWindow (FRAME_X_SHELL_WIDGET (f)));
2260 else 2260 else
2261 x_raise_frame_1 (f, 0); 2261 x_raise_frame_1 (f, 0);
2262 } 2262 }
2263 2263
2265 static void 2265 static void
2266 x_make_frame_invisible (struct frame *f) 2266 x_make_frame_invisible (struct frame *f)
2267 { 2267 {
2268 Display *display = DEVICE_X_DISPLAY (XDEVICE (f->device)); 2268 Display *display = DEVICE_X_DISPLAY (XDEVICE (f->device));
2269 2269
2270 if (!f->visible) 2270 if (!FRAME_VISIBLE_P(f))
2271 return; 2271 return;
2272 2272
2273 if (!XWithdrawWindow (display, 2273 if (!XWithdrawWindow (display,
2274 XtWindow (FRAME_X_SHELL_WIDGET (f)), 2274 XtWindow (FRAME_X_SHELL_WIDGET (f)),
2275 DefaultScreen (display))) 2275 DefaultScreen (display)))
2281 { 2281 {
2282 Display *display = DEVICE_X_DISPLAY (XDEVICE (f->device)); 2282 Display *display = DEVICE_X_DISPLAY (XDEVICE (f->device));
2283 XWindowAttributes xwa; 2283 XWindowAttributes xwa;
2284 int result; 2284 int result;
2285 2285
2286 /* JV:
2287 This is bad, very bad :-(
2288 It is not compatible with our tristate visible and
2289 it should never ever change the visibility for us, this leads to
2290 the frame-freeze problem under fvwm because with the pager
2291
2292 Mappedness != Viewability != Visibility != Emacs f->visible
2293
2294 This first unequalness is the reason for the frame freezing problem
2295 under fvwm (it happens when the frame is another fvwm-page)
2296
2297 The second unequalness happen when it is on the same fvwm-page
2298 but in an invisible part of the visible screen.
2299
2300 For now we just return the XEmacs internal value --- which might not be up
2301 to date. Is that a problem? ---. Otherwise we should
2302 use async visibility like in standard Emacs.
2303 */
2304
2305 #if 0
2286 if (!XGetWindowAttributes (display, 2306 if (!XGetWindowAttributes (display,
2287 XtWindow (FRAME_X_SHELL_WIDGET (f)), 2307 XtWindow (FRAME_X_SHELL_WIDGET (f)),
2288 &xwa)) 2308 &xwa))
2289 result = 0; 2309 result = 0;
2290 else 2310 else
2291 result = xwa.map_state == IsViewable; 2311 result = xwa.map_state == IsViewable;
2292 2312 /* In this implementation it should at least be != IsUnmapped
2313 JV */
2314
2293 f->visible = result; 2315 f->visible = result;
2294 return result; 2316 return result;
2317 #endif
2318
2319 return f->visible;
2295 } 2320 }
2296 2321
2297 static int 2322 static int
2298 x_frame_totally_visible_p (struct frame *f) 2323 x_frame_totally_visible_p (struct frame *f)
2299 { 2324 {
2318 static void 2343 static void
2319 x_focus_on_frame (struct frame *f) 2344 x_focus_on_frame (struct frame *f)
2320 { 2345 {
2321 XWindowAttributes xwa; 2346 XWindowAttributes xwa;
2322 Widget shell_widget; 2347 Widget shell_widget;
2348 int viewable;
2323 2349
2324 assert (FRAME_X_P (f)); 2350 assert (FRAME_X_P (f));
2325 2351
2326 shell_widget = FRAME_X_SHELL_WIDGET (f); 2352 shell_widget = FRAME_X_SHELL_WIDGET (f);
2327 if (!XtWindow (shell_widget)) 2353 if (!XtWindow (shell_widget))
2341 */ 2367 */
2342 XGrabServer (XtDisplay (shell_widget)); 2368 XGrabServer (XtDisplay (shell_widget));
2343 if (XGetWindowAttributes (XtDisplay (shell_widget), 2369 if (XGetWindowAttributes (XtDisplay (shell_widget),
2344 XtWindow (shell_widget), 2370 XtWindow (shell_widget),
2345 &xwa)) 2371 &xwa))
2346 f->visible = xwa.map_state == IsViewable; 2372 /* JV: it is bad to change the visibility like this, so we don't for the
2373 moment, at least change_frame_visibility should be called
2374 Note also that under fvwm a frame can me Viewable (and thus Mapped)
2375 but still X-invisible
2376 f->visible = xwa.map_state == IsViewable; */
2377 viewable = xwa.map_state == IsViewable;
2378
2347 2379
2348 if (f->visible) 2380 if (viewable)
2349 { 2381 {
2350 Window focus; 2382 Window focus;
2351 int revert_to; 2383 int revert_to;
2352 XGetInputFocus (XtDisplay (shell_widget), &focus, &revert_to); 2384 XGetInputFocus (XtDisplay (shell_widget), &focus, &revert_to);
2353 /* Don't explicitly set the focus on this window unless the focus 2385 /* Don't explicitly set the focus on this window unless the focus