unsigned char *tmp_data = NULL;
Atom target_type = XA_CARDINAL;
unsigned int ow IF_LINT (= 0), oh IF_LINT (= 0);
+ unsigned int fw, fh;
block_input ();
unsigned int tmp_nchildren;
int success;
- success = XQueryTree (FRAME_X_DISPLAY (f), win, &rootw,
+ success = XQueryTree (dpy, win, &rootw,
&wm_window, &tmp_children, &tmp_nchildren);
- had_errors = x_had_errors_p (FRAME_X_DISPLAY (f));
+ had_errors = x_had_errors_p (dpy);
/* Don't free tmp_children if XQueryTree failed. */
if (! success)
Window child, rootw;
/* Get the real coordinates for the WM window upper left corner */
- XGetGeometry (FRAME_X_DISPLAY (f), win,
+ XGetGeometry (dpy, win,
&rootw, &real_x, &real_y, &ow, &oh, &bw, &ign);
if (outer_border)
| ----------------- v y
| | our window
*/
- XTranslateCoordinates (FRAME_X_DISPLAY (f),
+ XTranslateCoordinates (dpy,
/* From-window, to-window. */
FRAME_DISPLAY_INFO (f)->root_window,
FRAME_X_WINDOW (f),
/* From-position, to-position. */
- real_x, real_y, &win_x, &win_y,
+ 0, 0, &win_x, &win_y,
/* Child of win. */
&child);
+ win_x += real_x;
+ win_y += real_y;
+
if (FRAME_X_WINDOW (f) == FRAME_OUTER_WINDOW (f))
{
outer_x = win_x;
}
else
{
- XTranslateCoordinates (FRAME_X_DISPLAY (f),
+ XTranslateCoordinates (dpy,
/* From-window, to-window. */
FRAME_DISPLAY_INFO (f)->root_window,
FRAME_OUTER_WINDOW (f),
/* From-position, to-position. */
- real_x, real_y, &outer_x, &outer_y,
+ 0, 0, &outer_x, &outer_y,
/* Child of win. */
&child);
+
+ outer_x += real_x;
+ outer_y += real_y;
}
- had_errors = x_had_errors_p (FRAME_X_DISPLAY (f));
+ had_errors = x_had_errors_p (dpy);
}
if (!had_errors && dpyinfo->root_window == f->output_data.x->parent_desc)
if (tmp_data) XFree (tmp_data);
}
+ if (right_offset_x || bottom_offset_y)
+ {
+ int xy_ign;
+ unsigned int ign;
+ Window rootw;
+
+ XGetGeometry (dpy, FRAME_OUTER_WINDOW (f),
+ &rootw, &xy_ign, &xy_ign, &fw, &fh, &ign, &ign);
+ }
+
x_uncatch_errors ();
unblock_input ();
if (xptr) *xptr = real_x;
if (yptr) *yptr = real_y;
- if (right_offset_x || bottom_offset_y)
- {
- int xy_ign;
- unsigned int ign, fw, fh;
- Window rootw;
-
- XGetGeometry (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f),
- &rootw, &xy_ign, &xy_ign, &fw, &fh, &ign, &ign);
- if (right_offset_x) *right_offset_x = ow - fw + outer_x;
- if (bottom_offset_y) *bottom_offset_y = oh - fh + outer_y;
- }
+ if (right_offset_x) *right_offset_x = ow - fw + outer_x;
+ if (bottom_offset_y) *bottom_offset_y = oh - fh + outer_y;
}
/* Store the screen positions of frame F into XPTR and YPTR.