*/}}
1
0
Prechádzať zdrojové kódy

Per monitor dpi aware

YimingWu 10 mesiacov pred
rodič
commit
392b529a95
2 zmenil súbory, kde vykonal 32 pridanie a 8 odobranie
  1. 31 7
      la_kernel.c
  2. 1 1
      lagui-config.cmake

+ 31 - 7
la_kernel.c

@@ -48,6 +48,7 @@
 #ifdef _WIN32
 #include <GL/wglew.h>
 #include <GL/wgl.h>
+#include <shellscalingapi.h>
 #endif
 
 LA MAIN;
@@ -286,7 +287,7 @@ void la_OpenWacomWinTab(HWND hwnd){
 
 	assert(glogContext.lcOptions & CXO_SYSTEM);
 	wsprintf(glogContext.lcName, "PrsTest Digitizing %p", MAIN.hinstance);
-	glogContext.lcOptions |= CXO_MESSAGES;
+	glogContext.lcOptions |= CXO_MESSAGES|CXO_CSRMESSAGES;
 	glogContext.lcPktData = PACKETDATA;
 	glogContext.lcPktMode = PACKETMODE;
 	glogContext.lcMoveMask = PACKETDATA;
@@ -301,15 +302,36 @@ void la_OpenWacomWinTab(HWND hwnd){
     AXIS tabletPressure = { 0 };
     gpWTInfoA(WTI_DEVICES, DVC_NPRESSURE, &tabletPressure); MAIN.WinTabMaxPenPressure = tabletPressure.axMax + 1;
 
-	glogContext.lcInOrgX = 0;
-	glogContext.lcInOrgY = 0;
-	glogContext.lcInExtX = TabletX.axMax;
-	glogContext.lcInExtY = TabletY.axMax;
-
-	glogContext.lcOutOrgX = GetSystemMetrics(SM_XVIRTUALSCREEN);
+    //glogContext.lcInOrgX = 0;
+	//glogContext.lcInOrgY = 0;
+	//glogContext.lcInExtX = TabletX.axMax;
+	//glogContext.lcInExtY = TabletY.axMax;
+
+    gpWTInfoA(WTI_DEFSYSCTX, CTX_INORGX, &glogContext.lcInOrgX);
+    gpWTInfoA(WTI_DEFSYSCTX, CTX_INORGY, &glogContext.lcInOrgY);
+    gpWTInfoA(WTI_DEFSYSCTX, CTX_INEXTX, &glogContext.lcInExtX);
+    gpWTInfoA(WTI_DEFSYSCTX, CTX_INEXTY, &glogContext.lcInExtY);
+    gpWTInfoA(WTI_DEFSYSCTX, CTX_OUTORGX, &glogContext.lcOutOrgX);
+    gpWTInfoA(WTI_DEFSYSCTX, CTX_OUTORGY, &glogContext.lcOutOrgY);
+    gpWTInfoA(WTI_DEFSYSCTX, CTX_OUTEXTX, &glogContext.lcOutExtX);
+    gpWTInfoA(WTI_DEFSYSCTX, CTX_OUTEXTY, &glogContext.lcOutExtY);
+    gpWTInfoA(WTI_DEFSYSCTX, CTX_SYSORGX, &glogContext.lcSysOrgX);
+    gpWTInfoA(WTI_DEFSYSCTX, CTX_SYSORGY, &glogContext.lcSysOrgY);
+    gpWTInfoA(WTI_DEFSYSCTX, CTX_SYSEXTX, &glogContext.lcSysExtX);
+    gpWTInfoA(WTI_DEFSYSCTX, CTX_SYSEXTY, &glogContext.lcSysExtY);
+    //printf("%d %d\n", glogContext.lcInOrgX, glogContext.lcInOrgY);
+    //printf("%d %d\n", glogContext.lcInExtX, glogContext.lcInExtY);
+    //printf("%d %d\n", glogContext.lcOutOrgX, glogContext.lcOutOrgY);
+    //printf("%d %d\n", glogContext.lcOutExtX, glogContext.lcOutExtY);
+    //printf("%d %d\n", glogContext.lcSysOrgX, glogContext.lcSysOrgY);
+    //printf("%d %d\n", glogContext.lcSysExtX, glogContext.lcSysExtY);
+
+    glogContext.lcOutOrgX = GetSystemMetrics(SM_XVIRTUALSCREEN);
 	glogContext.lcOutOrgY = GetSystemMetrics(SM_YVIRTUALSCREEN);
 	glogContext.lcOutExtX = GetSystemMetrics(SM_CXVIRTUALSCREEN); //SM_CXSCREEN);
 	glogContext.lcOutExtY = -GetSystemMetrics(SM_CYVIRTUALSCREEN);	// lower left to upper left. SM_CYSCREEN);
+    //printf("%d %d\n", glogContext.lcOutOrgX, glogContext.lcOutOrgY);
+    //printf("%d %d\n", glogContext.lcOutExtX, glogContext.lcOutExtY);
 
 	hctx = gpWTOpenA(hwnd, &glogContext, FALSE);
 
@@ -1039,6 +1061,8 @@ int laGetReadyWith(laInitArguments* ia){
 #ifdef _WIN32
     logPrintNew("Initializing LaGUI...\n");
 
+    SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE);
+
     setlocale(LC_ALL, "zh_CN.utf8");
 
     MAIN.hinstance = GetModuleHandle(NULL);

+ 1 - 1
lagui-config.cmake

@@ -80,7 +80,7 @@ elseif (CMAKE_SYSTEM_NAME MATCHES "Windows")
         ${FREETYPE_LIBRARIES}
         ${CMAKE_DL_LIBS}
         Threads::Threads
-        lagui shlwapi
+        lagui shlwapi Shcore
         CACHE INTERNAL "LaGUI shared libs"
     )
     set(LAGUI_INCLUDE_DIRS_ALL