Forbid negative value for area size 83/15183/1
authorKazumasa Mitsunari <knimitz@witz-inc.co.jp>
Sun, 8 Jul 2018 01:35:15 +0000 (10:35 +0900)
committerKazumasa Mitsunari <knimitz@witz-inc.co.jp>
Tue, 10 Jul 2018 13:30:40 +0000 (22:30 +0900)
It is not intuitive to set negative value as size.
So forbit negative value.

Change-Id: I49480653284158b6d1bfcb22a71d9882ed958518
Signed-off-by: Kazumasa Mitsunari <knimitz@witz-inc.co.jp>
src/db/areas.db
src/layers.cpp

index 6c79bbf..03ddfe4 100644 (file)
@@ -5,8 +5,8 @@
             "rect": {
                 "x": 0,
                 "y": 0,
-                "w": -1,
-                "h": -1
+                "w": 1080,
+                "h": 1920
             }
         },
         {
@@ -14,8 +14,8 @@
             "rect": {
                 "x": 0,
                 "y": 218,
-                "w": -1,
-                "h": -433
+                "w": 1080,
+                "h": 1488
             }
         },
         {
@@ -23,7 +23,7 @@
             "rect": {
                 "x": 0,
                 "y": 218,
-                "w": -1,
+                "w": 1080,
                 "h": 744
             }
         },
@@ -32,7 +32,7 @@
             "rect": {
                 "x": 0,
                 "y": 962,
-                "w": -1,
+                "w": 1080,
                 "h": 744
             }
         },
@@ -41,7 +41,7 @@
             "rect": {
                 "x": 0,
                 "y": 962,
-                "w": -1,
+                "w": 1080,
                 "h": 744
             }
         },
@@ -50,8 +50,8 @@
             "rect": {
                 "x": 0,
                 "y": 218,
-                "w": -1,
-                "h": -433
+                "w": 1080,
+                "h": 1488
             }
         },
         {
@@ -59,7 +59,7 @@
             "rect": {
                 "x": 0,
                 "y": 218,
-                "w": -1,
+                "w": 1080,
                 "h": 744
             }
         },
@@ -68,7 +68,7 @@
             "rect": {
                 "x": 0,
                 "y": 962,
-                "w": -1,
+                "w": 1080,
                 "h": 744
             }
         },
@@ -77,8 +77,8 @@
             "rect": {
                 "x": 0,
                 "y": 218,
-                "w": -1,
-                "h": -433
+                "w": 1080,
+                "h": 1488
             }
         }
     ]
index 6ffb4e2..f73daf2 100644 (file)
@@ -184,19 +184,6 @@ json layer_map::to_json() const
 void layer_map::setupArea(int output_w, int output_h)
 {
     compositor::rect rct;
-    for (auto &i : this->area2size)
-    {
-        rct = i.second;
-
-        // less-than-0 values refer to MAX + 1 - $VALUE
-        // e.g. MAX is either screen width or height
-        if(rct.w < 0)
-            rct.w = output_w + 1 + rct.w;
-        if(rct.h < 0)
-            rct.h = output_h + 1 + rct.h;
-
-        i.second = rct;
-    }
 
     rct = this->area2size["normal.full"];
     this->area2size["normalfull"] = rct;
@@ -308,8 +295,8 @@ const char* layer_map::kDefaultAreaDb = "{ \
             \"rect\": { \
                 \"x\": 0, \
                 \"y\": 0, \
-                \"w\": -1, \
-                \"h\": -1 \
+                \"w\": 1080, \
+                \"h\": 1920 \
             } \
         }, \
         { \
@@ -317,8 +304,8 @@ const char* layer_map::kDefaultAreaDb = "{ \
             \"rect\": { \
                 \"x\": 0, \
                 \"y\": 218, \
-                \"w\": -1, \
-                \"h\": -433 \
+                \"w\": 1080, \
+                \"h\": 1488 \
             } \
         }, \
         { \
@@ -326,7 +313,7 @@ const char* layer_map::kDefaultAreaDb = "{ \
             \"rect\": { \
                 \"x\": 0, \
                 \"y\": 218, \
-                \"w\": -1, \
+                \"w\": 1080, \
                 \"h\": 744 \
             } \
         }, \
@@ -335,7 +322,7 @@ const char* layer_map::kDefaultAreaDb = "{ \
             \"rect\": { \
                 \"x\": 0, \
                 \"y\": 962, \
-                \"w\": -1, \
+                \"w\": 1080, \
                 \"h\": 744 \
             } \
         }, \
@@ -344,7 +331,7 @@ const char* layer_map::kDefaultAreaDb = "{ \
             \"rect\": { \
                 \"x\": 0, \
                 \"y\": 962, \
-                \"w\": -1, \
+                \"w\": 1080, \
                 \"h\": 744 \
             } \
         }, \
@@ -353,8 +340,8 @@ const char* layer_map::kDefaultAreaDb = "{ \
             \"rect\": { \
                 \"x\": 0, \
                 \"y\": 218, \
-                \"w\": -1, \
-                \"h\": -433 \
+                \"w\": 1080, \
+                \"h\": 1488 \
             } \
         }, \
         { \
@@ -362,7 +349,7 @@ const char* layer_map::kDefaultAreaDb = "{ \
             \"rect\": { \
                 \"x\": 0, \
                 \"y\": 218, \
-                \"w\": -1, \
+                \"w\": 1080, \
                 \"h\": 744 \
             } \
         }, \
@@ -371,7 +358,7 @@ const char* layer_map::kDefaultAreaDb = "{ \
             \"rect\": { \
                 \"x\": 0, \
                 \"y\": 962, \
-                \"w\": -1, \
+                \"w\": 1080, \
                 \"h\": 744 \
             } \
         }, \
@@ -380,8 +367,8 @@ const char* layer_map::kDefaultAreaDb = "{ \
             \"rect\": { \
                 \"x\": 0, \
                 \"y\": 218, \
-                \"w\": -1, \
-                \"h\": -433 \
+                \"w\": 1080, \
+                \"h\": 1488 \
             } \
         } \
     ] \