--- rxvt-unicode/src/main.C 2015/09/08 07:54:58 1.398 +++ rxvt-unicode/src/main.C 2016/06/28 21:56:17 1.400 @@ -14,6 +14,7 @@ * Copyright (c) 1998-2001 Geoff Wing * - extensive modifications * Copyright (c) 2003-2014 Marc Lehmann + * Copyright (c) 2015 Emanuele Giaquinta * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -1053,6 +1054,25 @@ pix_colors[dst].set (this, rs[Rs_color + dst] = rs[Rs_color + src]); } +#ifdef SMART_RESIZE +static unsigned int +get_parent_bw (Display *dpy, Window w) +{ + int idummy; + unsigned int udummy; + Window wdummy, parent; + Window *children; + unsigned int nchildren, border_width; + + XQueryTree (dpy, w, &wdummy, &parent, &children, &nchildren); + XFree (children); + XGetGeometry (dpy, parent, &wdummy, &idummy, &idummy, + &udummy, &udummy, &border_width, &udummy); + + return border_width; +} +#endif + /* -------------------------------------------------------------------- * * - WINDOW RESIZING - * * -------------------------------------------------------------------- */ @@ -1097,8 +1117,10 @@ */ if (x1 != x || y1 != y) { - x -= x1; - y -= y1; + unsigned int border_width = get_parent_bw (dpy, parent); + + x -= x1 + border_width; + y -= y1 + border_width; } x1 = (DisplayWidth (dpy, display->screen) - old_width ) / 2;