aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJan Djärv2010-11-04 13:37:17 +0100
committerJan Djärv2010-11-04 13:37:17 +0100
commit31887d45e8c5cf28b1e85f76a0aba40186f7f1a5 (patch)
tree72177bfc6b3e790c79fe1d050c6780daec74f1db /src
parent69ee5b0fd692a0280fe6955efe064bcadc3759a3 (diff)
downloademacs-31887d45e8c5cf28b1e85f76a0aba40186f7f1a5.tar.gz
emacs-31887d45e8c5cf28b1e85f76a0aba40186f7f1a5.zip
* xfns.c (x_real_positions): Only use _NET_FRAME_EXTENTS if our
parent is the root window. Check this after traversing window tree.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog3
-rw-r--r--src/xfns.c72
2 files changed, 33 insertions, 42 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index a1a049c66c1..a16e35df108 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,8 @@
12010-11-04 Jan Djärv <jan.h.d@swipnet.se> 12010-11-04 Jan Djärv <jan.h.d@swipnet.se>
2 2
3 * xfns.c (x_real_positions): Only use _NET_FRAME_EXTENTS if our
4 parent is the root window. Check this after traversing window tree.
5
3 * xterm.c (x_term_init): Initialize Xatom_net_frame_extents. 6 * xterm.c (x_term_init): Initialize Xatom_net_frame_extents.
4 7
5 * xterm.h (struct x_display_info): Xatom_net_frame_extents is new. 8 * xterm.h (struct x_display_info): Xatom_net_frame_extents is new.
diff --git a/src/xfns.c b/src/xfns.c
index c07ea49e663..635264ea862 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -532,7 +532,7 @@ x_real_positions (f, xptr, yptr)
532 int win_x, win_y, outer_x, outer_y; 532 int win_x, win_y, outer_x, outer_y;
533 int real_x = 0, real_y = 0; 533 int real_x = 0, real_y = 0;
534 int had_errors = 0; 534 int had_errors = 0;
535 Window win; 535 Window win = f->output_data.x->parent_desc;
536 Atom actual_type; 536 Atom actual_type;
537 unsigned long actual_size, bytes_remaining; 537 unsigned long actual_size, bytes_remaining;
538 int i, rc, actual_format; 538 int i, rc, actual_format;
@@ -546,47 +546,7 @@ x_real_positions (f, xptr, yptr)
546 546
547 x_catch_errors (dpy); 547 x_catch_errors (dpy);
548 548
549 win = FRAME_OUTER_WINDOW (f); 549 if (win == dpyinfo->root_window)
550 /* Try _NET_FRAME_EXTENTS first. */
551 rc = XGetWindowProperty (dpy, win, dpyinfo->Xatom_net_frame_extents,
552 0, max_len, False, target_type,
553 &actual_type, &actual_format, &actual_size,
554 &bytes_remaining, &tmp_data);
555
556 if (rc == Success && actual_type == target_type && !x_had_errors_p (dpy)
557 && actual_size == 4 && actual_format == 32)
558 {
559 int ign;
560 Window rootw;
561
562 XGetGeometry (FRAME_X_DISPLAY (f), win,
563 &rootw, &real_x, &real_y, &ign, &ign, &ign, &ign);
564 long *fe = (long *)tmp_data;
565
566 FRAME_X_OUTPUT (f)->x_pixels_outer_diff = fe[0];
567 FRAME_X_OUTPUT (f)->y_pixels_outer_diff = fe[2];
568 *xptr = real_x - fe[0];
569 *yptr = real_y - fe[2];
570
571 if (FRAME_X_WINDOW (f) != win)
572 {
573 XGetGeometry (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
574 &rootw, &real_x, &real_y, &ign, &ign, &ign, &ign);
575
576 f->x_pixels_diff = real_x;
577 f->y_pixels_diff = real_y;
578 }
579
580 if (tmp_data) XFree (tmp_data);
581 x_uncatch_errors ();
582 UNBLOCK_INPUT;
583 return;
584 }
585
586 if (tmp_data) XFree (tmp_data);
587
588 win = f->output_data.x->parent_desc;
589 if (win == FRAME_X_DISPLAY_INFO (f)->root_window)
590 win = FRAME_OUTER_WINDOW (f); 550 win = FRAME_OUTER_WINDOW (f);
591 551
592 /* This loop traverses up the containment tree until we hit the root 552 /* This loop traverses up the containment tree until we hit the root
@@ -671,6 +631,34 @@ x_real_positions (f, xptr, yptr)
671 had_errors = x_had_errors_p (FRAME_X_DISPLAY (f)); 631 had_errors = x_had_errors_p (FRAME_X_DISPLAY (f));
672 } 632 }
673 633
634
635 if (dpyinfo->root_window == f->output_data.x->parent_desc)
636 {
637 /* Try _NET_FRAME_EXTENTS if our parent is the root window. */
638 rc = XGetWindowProperty (dpy, win, dpyinfo->Xatom_net_frame_extents,
639 0, max_len, False, target_type,
640 &actual_type, &actual_format, &actual_size,
641 &bytes_remaining, &tmp_data);
642
643 if (rc == Success && actual_type == target_type && !x_had_errors_p (dpy)
644 && actual_size == 4 && actual_format == 32)
645 {
646 int ign;
647 Window rootw;
648
649 XGetGeometry (FRAME_X_DISPLAY (f), win,
650 &rootw, &real_x, &real_y, &ign, &ign, &ign, &ign);
651 long *fe = (long *)tmp_data;
652
653 outer_x = -fe[0];
654 outer_y = -fe[2];
655 real_x -= fe[0];
656 real_y -= fe[2];
657 }
658 }
659
660 if (tmp_data) XFree (tmp_data);
661
674 x_uncatch_errors (); 662 x_uncatch_errors ();
675 663
676 UNBLOCK_INPUT; 664 UNBLOCK_INPUT;