Mercurial > emacs
diff 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 |
line wrap: on
line diff
--- a/src/xfns.c Tue Nov 09 10:29:37 2010 +0000 +++ b/src/xfns.c Tue Nov 09 15:07:10 2010 -0500 @@ -519,12 +519,20 @@ int real_x = 0, real_y = 0; int had_errors = 0; Window win = f->output_data.x->parent_desc; + Atom actual_type; + unsigned long actual_size, bytes_remaining; + int i, rc, actual_format; + struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); + long max_len = 400; + Display *dpy = FRAME_X_DISPLAY (f); + unsigned char *tmp_data = NULL; + Atom target_type = XA_CARDINAL; BLOCK_INPUT; - x_catch_errors (FRAME_X_DISPLAY (f)); - - if (win == FRAME_X_DISPLAY_INFO (f)->root_window) + x_catch_errors (dpy); + + if (win == dpyinfo->root_window) win = FRAME_OUTER_WINDOW (f); /* This loop traverses up the containment tree until we hit the root @@ -609,6 +617,33 @@ had_errors = x_had_errors_p (FRAME_X_DISPLAY (f)); } + + if (dpyinfo->root_window == f->output_data.x->parent_desc) + { + /* Try _NET_FRAME_EXTENTS if our parent is the root window. */ + rc = XGetWindowProperty (dpy, win, dpyinfo->Xatom_net_frame_extents, + 0, max_len, False, target_type, + &actual_type, &actual_format, &actual_size, + &bytes_remaining, &tmp_data); + + if (rc == Success && actual_type == target_type && !x_had_errors_p (dpy) + && actual_size == 4 && actual_format == 32) + { + int ign; + Window rootw; + long *fe = (long *)tmp_data; + + XGetGeometry (FRAME_X_DISPLAY (f), win, + &rootw, &real_x, &real_y, &ign, &ign, &ign, &ign); + outer_x = -fe[0]; + outer_y = -fe[2]; + real_x -= fe[0]; + real_y -= fe[2]; + } + } + + if (tmp_data) XFree (tmp_data); + x_uncatch_errors (); UNBLOCK_INPUT;