update RGFW (fixes xdnd bug)
This commit is contained in:
parent
0760667cbb
commit
2998c0c70d
38
src/external/RGFW.h
vendored
38
src/external/RGFW.h
vendored
|
|
@ -516,7 +516,7 @@ typedef RGFW_ENUM(u8, RGFW_event_types) {
|
||||||
char name[128]; /*!< monitor name */
|
char name[128]; /*!< monitor name */
|
||||||
RGFW_rect rect; /*!< monitor Workarea */
|
RGFW_rect rect; /*!< monitor Workarea */
|
||||||
float scaleX, scaleY; /*!< monitor content scale*/
|
float scaleX, scaleY; /*!< monitor content scale*/
|
||||||
float physW, physH; /*!< monitor physical size */
|
float physW, physH; /*!< monitor physical size in inches*/
|
||||||
} RGFW_monitor;
|
} RGFW_monitor;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -2969,6 +2969,7 @@ Start of Linux / Unix defines
|
||||||
|
|
||||||
xdnd.source = E.xclient.data.l[0];
|
xdnd.source = E.xclient.data.l[0];
|
||||||
xdnd.version = E.xclient.data.l[1] >> 24;
|
xdnd.version = E.xclient.data.l[1] >> 24;
|
||||||
|
|
||||||
xdnd.format = None;
|
xdnd.format = None;
|
||||||
|
|
||||||
if (xdnd.version > 5)
|
if (xdnd.version > 5)
|
||||||
|
|
@ -3157,6 +3158,8 @@ Start of Linux / Unix defines
|
||||||
XFree(data);
|
XFree(data);
|
||||||
|
|
||||||
if (xdnd.version >= 2) {
|
if (xdnd.version >= 2) {
|
||||||
|
XEvent reply = { ClientMessage };
|
||||||
|
reply.xclient.format = 32;
|
||||||
reply.xclient.message_type = XdndFinished;
|
reply.xclient.message_type = XdndFinished;
|
||||||
reply.xclient.data.l[1] = result;
|
reply.xclient.data.l[1] = result;
|
||||||
reply.xclient.data.l[2] = XdndActionCopy;
|
reply.xclient.data.l[2] = XdndActionCopy;
|
||||||
|
|
@ -3759,8 +3762,8 @@ Start of Linux / Unix defines
|
||||||
RGFW_area size = RGFW_getScreenSize();
|
RGFW_area size = RGFW_getScreenSize();
|
||||||
|
|
||||||
monitor.rect = RGFW_RECT(0, 0, size.w, size.h);
|
monitor.rect = RGFW_RECT(0, 0, size.w, size.h);
|
||||||
monitor.physW = DisplayWidthMM(display, screen);
|
monitor.physW = DisplayWidthMM(display, screen) / 25.4;
|
||||||
monitor.physH = DisplayHeightMM(display, screen);
|
monitor.physH = DisplayHeightMM(display, screen) / 25.4;
|
||||||
|
|
||||||
XGetSystemContentScale(display, &monitor.scaleX, &monitor.scaleY);
|
XGetSystemContentScale(display, &monitor.scaleX, &monitor.scaleY);
|
||||||
XRRScreenResources* sr = XRRGetScreenResourcesCurrent(display, RootWindow(display, screen));
|
XRRScreenResources* sr = XRRGetScreenResourcesCurrent(display, RootWindow(display, screen));
|
||||||
|
|
@ -3773,8 +3776,8 @@ Start of Linux / Unix defines
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ci == NULL) {
|
if (ci == NULL) {
|
||||||
float dpi_width = round((double)monitor.rect.w/(((double)monitor.physW)/25.4));
|
float dpi_width = round((double)monitor.rect.w/(double)monitor.physW);
|
||||||
float dpi_height = round((double)monitor.rect.h/(((double)monitor.physH)/25.4));
|
float dpi_height = round((double)monitor.rect.h/(double)monitor.physH);
|
||||||
|
|
||||||
monitor.scaleX = (float) (dpi_width) / (float) 96;
|
monitor.scaleX = (float) (dpi_width) / (float) 96;
|
||||||
monitor.scaleY = (float) (dpi_height) / (float) 96;
|
monitor.scaleY = (float) (dpi_height) / (float) 96;
|
||||||
|
|
@ -3784,16 +3787,16 @@ Start of Linux / Unix defines
|
||||||
}
|
}
|
||||||
|
|
||||||
XRROutputInfo* info = XRRGetOutputInfo (display, sr, sr->outputs[screen]);
|
XRROutputInfo* info = XRRGetOutputInfo (display, sr, sr->outputs[screen]);
|
||||||
monitor.physW = info->mm_width;
|
monitor.physW = info->mm_width / 25.4;
|
||||||
monitor.physH = info->mm_height;
|
monitor.physH = info->mm_height / 25.4;
|
||||||
|
|
||||||
monitor.rect.x = ci->x;
|
monitor.rect.x = ci->x;
|
||||||
monitor.rect.y = ci->y;
|
monitor.rect.y = ci->y;
|
||||||
monitor.rect.w = ci->width;
|
monitor.rect.w = ci->width;
|
||||||
monitor.rect.h = ci->height;
|
monitor.rect.h = ci->height;
|
||||||
|
|
||||||
float dpi_width = round((double)monitor.rect.w/(((double)monitor.physW)/25.4));
|
float dpi_width = round((double)monitor.rect.w/(double)monitor.physW);
|
||||||
float dpi_height = round((double)monitor.rect.h/(((double)monitor.physH)/25.4));
|
float dpi_height = round((double)monitor.rect.h/(double)monitor.physH);
|
||||||
|
|
||||||
monitor.scaleX = (float) (dpi_width) / (float) 96;
|
monitor.scaleX = (float) (dpi_width) / (float) 96;
|
||||||
monitor.scaleY = (float) (dpi_height) / (float) 96;
|
monitor.scaleY = (float) (dpi_height) / (float) 96;
|
||||||
|
|
@ -8101,11 +8104,20 @@ RGFW_UNUSED(win); /*!< if buffer rendering is not being used */
|
||||||
monitor.rect = RGFW_RECT((int) bounds.origin.x, (int) bounds.origin.y, (int) bounds.size.width, (int) bounds.size.height);
|
monitor.rect = RGFW_RECT((int) bounds.origin.x, (int) bounds.origin.y, (int) bounds.size.width, (int) bounds.size.height);
|
||||||
|
|
||||||
CGSize screenSizeMM = CGDisplayScreenSize(display);
|
CGSize screenSizeMM = CGDisplayScreenSize(display);
|
||||||
monitor.physW = screenSizeMM.width;
|
monitor.physW = (float)screenSizeMM.width / 25.4f;
|
||||||
monitor.physH = screenSizeMM.height;
|
monitor.physH = (float)screenSizeMM.height / 25.4f;
|
||||||
|
|
||||||
monitor.scaleX = ((monitor.rect.w / (screenSizeMM.width / 25.4)) / 96) + 0.25;
|
float dpi_width = round((double)monitor.rect.w/(double)monitor.physW);
|
||||||
monitor.scaleY = ((monitor.rect.h / (screenSizeMM.height / 25.4)) / 96) + 0.25;
|
float dpi_height = round((double)monitor.rect.h/(double)monitor.physH);
|
||||||
|
|
||||||
|
monitor.scaleX = (float) (dpi_width) / (float) 96;
|
||||||
|
monitor.scaleY = (float) (dpi_height) / (float) 96;
|
||||||
|
|
||||||
|
if (isinf(monitor.scaleX) || (monitor.scaleX > 1 && monitor.scaleX < 1.1))
|
||||||
|
monitor.scaleX = 1;
|
||||||
|
|
||||||
|
if (isinf(monitor.scaleY) || (monitor.scaleY > 1 && monitor.scaleY < 1.1))
|
||||||
|
monitor.scaleY = 1;
|
||||||
|
|
||||||
return monitor;
|
return monitor;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user