Fix saving/restoring TLW position on HiDPI X11 display with GTK+3
X11 frame extents need to be converted to GTK+ "logical" units
This commit is contained in:
@@ -470,7 +470,7 @@ bool wxGetFrameExtents(GdkWindow* window, int* left, int* right, int* top, int*
|
|||||||
Atom type;
|
Atom type;
|
||||||
int format;
|
int format;
|
||||||
gulong nitems, bytes_after;
|
gulong nitems, bytes_after;
|
||||||
guchar* data;
|
guchar* data = NULL;
|
||||||
Status status = XGetWindowProperty(
|
Status status = XGetWindowProperty(
|
||||||
GDK_DISPLAY_XDISPLAY(display),
|
GDK_DISPLAY_XDISPLAY(display),
|
||||||
GDK_WINDOW_XID(window),
|
GDK_WINDOW_XID(window),
|
||||||
@@ -480,11 +480,17 @@ bool wxGetFrameExtents(GdkWindow* window, int* left, int* right, int* top, int*
|
|||||||
const bool success = status == Success && data && nitems == 4;
|
const bool success = status == Success && data && nitems == 4;
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
|
// We need to convert the X11 physical extents to GTK+ "logical" units
|
||||||
|
int scale = 1;
|
||||||
|
#if GTK_CHECK_VERSION(3,10,0)
|
||||||
|
if (wx_is_at_least_gtk3(10))
|
||||||
|
scale = gdk_window_get_scale_factor(window);
|
||||||
|
#endif
|
||||||
long* p = (long*)data;
|
long* p = (long*)data;
|
||||||
if (left) *left = int(p[0]);
|
if (left) *left = int(p[0]) / scale;
|
||||||
if (right) *right = int(p[1]);
|
if (right) *right = int(p[1]) / scale;
|
||||||
if (top) *top = int(p[2]);
|
if (top) *top = int(p[2]) / scale;
|
||||||
if (bottom) *bottom = int(p[3]);
|
if (bottom) *bottom = int(p[3]) / scale;
|
||||||
}
|
}
|
||||||
if (data)
|
if (data)
|
||||||
XFree(data);
|
XFree(data);
|
||||||
|
Reference in New Issue
Block a user