Browse Source

the monitor at position (0, 0) is now allways the first monitor

Kolja Strohm 2 years ago
parent
commit
0d33f3c25e
1 changed files with 9 additions and 5 deletions
  1. 9 5
      Bildschirm.cpp

+ 9 - 5
Bildschirm.cpp

@@ -343,7 +343,14 @@ int MonitorEnum(HMONITOR m, HDC dc, LPRECT r, LPARAM p)
     mon->breite = r->right - r->left;
     mon->height = r->bottom - r->top;
     mon->name = info.szDevice;
-    ((Array<Monitor*>*)p)->add(mon);
+    if (mon->x == 0 && mon->y == 0)
+    {
+        ((Array<Monitor*>*)p)->add(mon, 0);
+    }
+    else
+    {
+        ((Array<Monitor*>*)p)->add(mon);
+    }
     return 1;
 }
 
@@ -364,12 +371,9 @@ Monitor Framework::getMonitor(int id)
     int anz = monitore->getEintragAnzahl();
     Monitor result;
     result.existiert = 0;
+    result = *monitore->get(id);
     for (Monitor* m : *monitore)
     {
-        if (m->name.istGleich(dispDev.DeviceName))
-        {
-            result = *m;
-        }
         delete m;
     }
     monitore->release();