]> git.tdb.fi Git - geometrycompositor.git/commitdiff
Add a reset key to interactive control mode
authorMikko Rasa <tdb@tdb.fi>
Mon, 14 Dec 2015 22:44:55 +0000 (00:44 +0200)
committerMikko Rasa <tdb@tdb.fi>
Mon, 14 Dec 2015 22:45:05 +0000 (00:45 +0200)
source/control.c

index 533bb8093924de35b995c69ce7e06d2c6e3c82ff..64fdf569d88b65298e4ce86e7edfb942b8312202 100644 (file)
@@ -104,6 +104,15 @@ static const char *flat_fshader_src =
        "}\n";
 
 
+void reset_correction(GeometryCorrection *correction)
+{
+       correction->keystone_vertical = 0.0f;
+       correction->curvature_type = 1;
+       correction->curvature_depth = 0.0f;
+       correction->vertical_center = 0.5f;
+       correction->perspective = 1.0f;
+}
+
 GeometryCorrection *get_corrections(Display *display)
 {
        Window root;
@@ -417,6 +426,8 @@ int interactive(Display *display, GeometryCorrection *corrections, GeometryCorre
                                target->perspective -= 1.0f/16;
                        else if(keysym==XK_z)
                                target->curvature_type = target->curvature_type%2+1;
+                       else if(keysym==XK_0)
+                               reset_correction(target);
                        else
                                break;
 
@@ -488,11 +499,7 @@ int main(int argc, char **argv)
                corrections[i].monitor_name = (char *)malloc(namelen+1);
                strcpy(corrections[i].monitor_name, argv[1]);
                corrections[i+1].monitor_name = NULL;
-               corrections[i].keystone_vertical = 0.0f;
-               corrections[i].curvature_type = 1;
-               corrections[i].curvature_depth = 0.0f;
-               corrections[i].vertical_center = 0.5f;
-               corrections[i].perspective = 1.0f;
+               reset_correction(&corrections[i]);
        }
 
        if(argc==2)