diff --git a/melonDS.cbp b/melonDS.cbp
index 38291874..81cc0b1c 100644
--- a/melonDS.cbp
+++ b/melonDS.cbp
@@ -26,12 +26,14 @@
+
-
+
+
@@ -61,6 +63,8 @@
+
+
@@ -89,6 +93,8 @@
+
+
diff --git a/src/libui_sdl/libui/windows/areadraw.cpp b/src/libui_sdl/libui/windows/areadraw.cpp
index 0bdf58a7..a9ad4772 100644
--- a/src/libui_sdl/libui/windows/areadraw.cpp
+++ b/src/libui_sdl/libui/windows/areadraw.cpp
@@ -26,6 +26,16 @@ static HRESULT doPaint(uiArea *a, ID2D1RenderTarget *rt, RECT *clip)
rt->BeginDraw();
+ {
+ float dpi_x, dpi_y;
+ D2D1_MATRIX_3X2_F dm;
+ rt->GetDpi(&dpi_x, &dpi_y);
+ ZeroMemory(&dm, sizeof (D2D1_MATRIX_3X2_F));
+ dm._11 = 96.f/dpi_x;
+ dm._22 = 96.f/dpi_y;
+ rt->SetTransform(&dm);
+ }
+
if (a->scrolling) {
ZeroMemory(&scrollTransform, sizeof (D2D1_MATRIX_3X2_F));
scrollTransform._11 = 1;
diff --git a/src/libui_sdl/libui/windows/areaevents.cpp b/src/libui_sdl/libui/windows/areaevents.cpp
index 842f2d72..d65b11d3 100644
--- a/src/libui_sdl/libui/windows/areaevents.cpp
+++ b/src/libui_sdl/libui/windows/areaevents.cpp
@@ -101,7 +101,7 @@ static void areaMouseEvent(uiArea *a, int down, int up, WPARAM wParam, LPARAM l
xpix = (double) GET_X_LPARAM(lParam);
ypix = (double) GET_Y_LPARAM(lParam);
// these are in pixels; we need points
- pixelsToDIP(a, &xpix, &ypix);
+ //pixelsToDIP(a, &xpix, &ypix);
me.X = xpix;
me.Y = ypix;
if (a->scrolling) {
diff --git a/src/libui_sdl/libui/windows/areautil.cpp b/src/libui_sdl/libui/windows/areautil.cpp
index 9dc72fbb..212ea422 100644
--- a/src/libui_sdl/libui/windows/areautil.cpp
+++ b/src/libui_sdl/libui/windows/areautil.cpp
@@ -14,6 +14,7 @@ void loadAreaSize(uiArea *a, ID2D1RenderTarget *rt, double *width, double *heigh
size = realGetSize(rt);
*width = size.width;
*height = size.height;
+ dipToPixels(a, width, height);
}
}
diff --git a/src/libui_sdl/libui/windows/draw.cpp b/src/libui_sdl/libui/windows/draw.cpp
index 65f25354..11a777de 100644
--- a/src/libui_sdl/libui/windows/draw.cpp
+++ b/src/libui_sdl/libui/windows/draw.cpp
@@ -560,6 +560,13 @@ void uiDrawBitmapDraw(uiDrawContext* c, uiDrawBitmap* bmp, uiRect* srcrect, uiRe
D2D_RECT_F _srcrect = D2D1::RectF(srcrect->X, srcrect->Y, srcrect->X+srcrect->Width, srcrect->Y+srcrect->Height);
D2D_RECT_F _dstrect = D2D1::RectF(dstrect->X, dstrect->Y, dstrect->X+dstrect->Width, dstrect->Y+dstrect->Height);
+ float dpix, dpiy;
+ c->rt->GetDpi(&dpix, &dpiy);
+ _srcrect.left = (_srcrect.left * 96.0f) / dpix;
+ _srcrect.top = (_srcrect.top * 96.0f) / dpiy;
+ _srcrect.right = (_srcrect.right * 96.0f) / dpix;
+ _srcrect.bottom = (_srcrect.bottom * 96.0f) / dpiy;
+
c->rt->DrawBitmap(bmp->bmp, &_dstrect, 1.0f, filter ? D2D1_BITMAP_INTERPOLATION_MODE_LINEAR : D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR, &_srcrect);
}
diff --git a/src/libui_sdl/libui/windows/init.cpp b/src/libui_sdl/libui/windows/init.cpp
index 22874165..5b4fe1d0 100644
--- a/src/libui_sdl/libui/windows/init.cpp
+++ b/src/libui_sdl/libui/windows/init.cpp
@@ -70,7 +70,7 @@ const char *uiInit(uiInitOptions *o)
if ((si.dwFlags & STARTF_USESHOWWINDOW) != 0)
nCmdShow = si.wShowWindow;
- // LONGTERM set DPI awareness
+ SetProcessDPIAware();
hDefaultIcon = LoadIconW(NULL, IDI_APPLICATION);
if (hDefaultIcon == NULL)