*/}}
Kaynağa Gözat

Windows preliminary monitor support and other fixes

YimingWu 7 ay önce
ebeveyn
işleme
1361e385a9
2 değiştirilmiş dosya ile 25 ekleme ve 1 silme
  1. 19 0
      la_kernel.c
  2. 6 1
      resources/la_operators.c

+ 19 - 0
la_kernel.c

@@ -700,6 +700,7 @@ laScreen* la_EnsureScreen(char* Name, int mmw, int mmh, int x, int y, int w, int
     strSafeSet(&s->Name,Name);
     strSafePrint(&s->Description,"%dmm x %dmm with %dx%d ~%ddpi",mmw,mmh,w,h,dpi); s->RoughDPI=dpi;
     s->x=x;s->y=y;s->w=w;s->h=h;
+    laNotifyUsers("la.user_preferences.screens");
     return s;
 }
 void la_RemoveScreen(laScreen*s){
@@ -758,7 +759,17 @@ int la_GetDPI(Window* root_win){
 }
 #endif
 #ifdef _WIN32
+typedef struct laWin32MonitorEnumData {
+    int id;
+}laWin32MonitorEnumData;
+static BOOL CALLBACK la_Win32MonitorEnum(HMONITOR hMon, HDC hdc, LPRECT lprcMonitor, LPARAM pData){
+    laWin32MonitorEnumData* data = pData; char str[32]; sprintf(str, "Display %d", data->id); data->id++;
+    laScreen* s = la_EnsureScreen(str, 0,0, lprcMonitor->left, lprcMonitor->top, lprcMonitor->right-lprcMonitor->left, lprcMonitor->bottom-lprcMonitor->top, 0);
+    return TRUE;
+}
 int la_GetDPI(HWND win){
+    laWin32MonitorEnumData data = { 0 };
+    EnumDisplayMonitors(0, 0, la_Win32MonitorEnum, (LPARAM)&data);
     return GetDpiForWindow(win);
     return 144;
 }
@@ -1695,6 +1706,10 @@ void la_CommandResizeWindow(SYSWINDOW hwnd, int x, int y, int w, int h){
     window->W = rcw.right - rcw.left;
     window->H = rcw.bottom - rcw.top;
     window->X = rcw.left; window->Y = rcw.top;
+    if (MAIN.AutoSwitchColorSpace) {
+        laScreen* s = laGetWindowScreen(window);
+        if (s) { window->OutputColorSpace = s->ColorSpace; }
+    }
 #endif
 #ifdef __linux__
     XWindowAttributes attr;
@@ -2867,6 +2882,8 @@ void la_WindowDefDraw(laWindow *w, laBoxedTheme *bt){
     laPanel *p, *NextP;
     laLayout *l = w->CurrentLayout;
 
+    if (!w->CH || !w->CW) return;
+
     la_ClearUnusedFramebuffers(w);
 
     tnsDrawToScreen();
@@ -7487,6 +7504,8 @@ LRESULT CALLBACK LA_WindowProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lp
             break;
         case SC_KEYMENU:
             return 0;
+        case SC_MINIMIZE:
+            break;
         }
         break;
     case WM_SIZE:

+ 6 - 1
resources/la_operators.c

@@ -298,8 +298,12 @@ void la_FileBrowserRebuildList(laFileBrowser *fb){
 
     if (hFind == INVALID_HANDLE_VALUE){ return; }
 
+    char buf[1024]; if (fb->FilterName[0]) { strToLower(fb->FilterName); }
     while (1) {
-        if(fb->FilterName[0] && !strcasestr(FindFileData.cFileName,fb->FilterName)){goto findnext;}
+        if (fb->FilterName[0]) {
+            strcpy(buf, FindFileData.cFileName); strToLower(buf);
+            if (!strstr(buf, fb->FilterName)) { goto findnext; }
+        }
         if (FindFileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) {
             if (FindFileData.cFileName[0] != '.') {
                 fi = memAcquireSimple(sizeof(laFileItem));
@@ -2294,6 +2298,7 @@ int OPINV_RefreshScreens(laOperator *a, laEvent *e){
     la_GetDPI(MAIN.win);
 #endif
 #ifdef _WIN32
+    la_GetDPI(MAIN.CurrentWindow);
 #endif
     return LA_FINISHED;
 }