X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcontrol.c;h=31ec61cc7617679ce22037abbc0986835fffee12;hb=b38189d375ff492f1b4090efc728770e4900c1e0;hp=b268f36f26eab7063bf4622c2da7ef3453e518c7;hpb=8702b5773dec7d09e7a0702e78bdb1616dd955f4;p=geometrycompositor.git diff --git a/source/control.c b/source/control.c index b268f36..31ec61c 100644 --- a/source/control.c +++ b/source/control.c @@ -32,10 +32,10 @@ typedef struct InteractiveView static unsigned short frustum_indices[] = { 2, 1, 3, 0, 1, 0xFFFF, 3, 4, 2, 0, 4, 0xFFFF }; static float view_matrix[] = { - 0.70711f, 0.40825f, -0.57735f, 0.0f, - 0.0f, 0.81650f, 0.57735f, 0.0f, - 0.70711f, -0.40725f, 0.57735f, 0.0f, - -0.2f, 0.0f, -2.5f, 1.0f + 0.70711f, 0.23570f, -0.66667f, 0.0f, + 0.0f, 0.94281f, 0.33333f, 0.0f, + 0.70711f, -0.23570f, 0.66667f, 0.0f, + -0.2f, 0.0f, -2.0f, 1.0f }; static float projection_matrix[] = { @@ -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; @@ -436,9 +447,6 @@ int interactive(Display *display, GeometryCorrection *corrections, GeometryCorre case Expose: repaint = 1; break; - default: - printf("event %d\n", event.type); - break; } if(repaint) @@ -488,11 +496,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)