comparison src/xfns.c @ 111449:132f2dfd549f

Merge from emacs-23
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 09 Nov 2010 15:07:10 -0500
parents 8426207480fa 3a0f0f0023d2
children 9b8b83a18b1c
comparison
equal deleted inserted replaced
111448:321fbae3e04d 111449:132f2dfd549f
517 { 517 {
518 int win_x, win_y, outer_x, outer_y; 518 int win_x, win_y, outer_x, outer_y;
519 int real_x = 0, real_y = 0; 519 int real_x = 0, real_y = 0;
520 int had_errors = 0; 520 int had_errors = 0;
521 Window win = f->output_data.x->parent_desc; 521 Window win = f->output_data.x->parent_desc;
522 Atom actual_type;
523 unsigned long actual_size, bytes_remaining;
524 int i, rc, actual_format;
525 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
526 long max_len = 400;
527 Display *dpy = FRAME_X_DISPLAY (f);
528 unsigned char *tmp_data = NULL;
529 Atom target_type = XA_CARDINAL;
522 530
523 BLOCK_INPUT; 531 BLOCK_INPUT;
524 532
525 x_catch_errors (FRAME_X_DISPLAY (f)); 533 x_catch_errors (dpy);
526 534
527 if (win == FRAME_X_DISPLAY_INFO (f)->root_window) 535 if (win == dpyinfo->root_window)
528 win = FRAME_OUTER_WINDOW (f); 536 win = FRAME_OUTER_WINDOW (f);
529 537
530 /* This loop traverses up the containment tree until we hit the root 538 /* This loop traverses up the containment tree until we hit the root
531 window. Window managers may intersect many windows between our window 539 window. Window managers may intersect many windows between our window
532 and the root window. The window we find just before the root window 540 and the root window. The window we find just before the root window
606 &child); 614 &child);
607 } 615 }
608 616
609 had_errors = x_had_errors_p (FRAME_X_DISPLAY (f)); 617 had_errors = x_had_errors_p (FRAME_X_DISPLAY (f));
610 } 618 }
619
620
621 if (dpyinfo->root_window == f->output_data.x->parent_desc)
622 {
623 /* Try _NET_FRAME_EXTENTS if our parent is the root window. */
624 rc = XGetWindowProperty (dpy, win, dpyinfo->Xatom_net_frame_extents,
625 0, max_len, False, target_type,
626 &actual_type, &actual_format, &actual_size,
627 &bytes_remaining, &tmp_data);
628
629 if (rc == Success && actual_type == target_type && !x_had_errors_p (dpy)
630 && actual_size == 4 && actual_format == 32)
631 {
632 int ign;
633 Window rootw;
634 long *fe = (long *)tmp_data;
635
636 XGetGeometry (FRAME_X_DISPLAY (f), win,
637 &rootw, &real_x, &real_y, &ign, &ign, &ign, &ign);
638 outer_x = -fe[0];
639 outer_y = -fe[2];
640 real_x -= fe[0];
641 real_y -= fe[2];
642 }
643 }
644
645 if (tmp_data) XFree (tmp_data);
611 646
612 x_uncatch_errors (); 647 x_uncatch_errors ();
613 648
614 UNBLOCK_INPUT; 649 UNBLOCK_INPUT;
615 650