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:
parent
aaa9670dd1
commit
91919f4514
@ -470,7 +470,7 @@ bool wxGetFrameExtents(GdkWindow* window, int* left, int* right, int* top, int*
|
||||
Atom type;
|
||||
int format;
|
||||
gulong nitems, bytes_after;
|
||||
guchar* data;
|
||||
guchar* data = NULL;
|
||||
Status status = XGetWindowProperty(
|
||||
GDK_DISPLAY_XDISPLAY(display),
|
||||
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;
|
||||
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;
|
||||
if (left) *left = int(p[0]);
|
||||
if (right) *right = int(p[1]);
|
||||
if (top) *top = int(p[2]);
|
||||
if (bottom) *bottom = int(p[3]);
|
||||
if (left) *left = int(p[0]) / scale;
|
||||
if (right) *right = int(p[1]) / scale;
|
||||
if (top) *top = int(p[2]) / scale;
|
||||
if (bottom) *bottom = int(p[3]) / scale;
|
||||
}
|
||||
if (data)
|
||||
XFree(data);
|
||||
|
Loading…
Reference in New Issue
Block a user