corrections[i].monitor_name = (char *)malloc(namelen+1);
strcpy(corrections[i].monitor_name, name_ptr);
corrections[i].monitor_name = (char *)malloc(namelen+1);
strcpy(corrections[i].monitor_name, name_ptr);
- corrections[i].keystone_vertical = values[i*4]/4096.0f;
- corrections[i].cylinder_depth = values[i*4+1]/4096.0f;
- corrections[i].vertical_center = values[i*4+2]/4096.0f;
- corrections[i].perspective = values[i*4+3]/4096.0f;
+ corrections[i].keystone_vertical = values[i*5]/4096.0f;
+ corrections[i].curvature_type = values[i*5+1];
+ corrections[i].curvature_depth = values[i*5+2]/4096.0f;
+ corrections[i].vertical_center = values[i*5+3]/4096.0f;
+ corrections[i].perspective = values[i*5+4]/4096.0f;
name_ptr = names;
for(i=0; i<ncorrections; ++i)
{
strcpy(name_ptr, corrections[i].monitor_name);
name_ptr += strlen(name_ptr)+1;
name_ptr = names;
for(i=0; i<ncorrections; ++i)
{
strcpy(name_ptr, corrections[i].monitor_name);
name_ptr += strlen(name_ptr)+1;
- values[i*4] = corrections[i].keystone_vertical*4096;
- values[i*4+1] = corrections[i].cylinder_depth*4096;
- values[i*4+2] = corrections[i].vertical_center*4096;
- values[i*4+3] = corrections[i].perspective*4096;
+ values[i*5] = corrections[i].keystone_vertical*4096;
+ values[i*5+1] = corrections[i].curvature_type;
+ values[i*5+2] = corrections[i].curvature_depth*4096;
+ values[i*5+3] = corrections[i].vertical_center*4096;
+ values[i*5+4] = corrections[i].perspective*4096;
}
root = DefaultRootWindow(display);
monitors_atom = XInternAtom(display, "_MSP_GEOMETRY_CORRECTION_MONITORS", False);
correction_atom = XInternAtom(display, "_MSP_GEOMETRY_CORRECTION", False);
XChangeProperty(display, root, monitors_atom, XA_STRING, 8, PropModeReplace, (unsigned char *)names, total_len+ncorrections-1);
}
root = DefaultRootWindow(display);
monitors_atom = XInternAtom(display, "_MSP_GEOMETRY_CORRECTION_MONITORS", False);
correction_atom = XInternAtom(display, "_MSP_GEOMETRY_CORRECTION", False);
XChangeProperty(display, root, monitors_atom, XA_STRING, 8, PropModeReplace, (unsigned char *)names, total_len+ncorrections-1);
- XChangeProperty(display, root, correction_atom, XA_INTEGER, 16, PropModeReplace, (unsigned char *)values, ncorrections*4);
+ XChangeProperty(display, root, correction_atom, XA_INTEGER, 16, PropModeReplace, (unsigned char *)values, ncorrections*5);
- fprintf(stderr, "Usage: %s <monitor> [<keystone> <cylinder> <vcenter> <perspective>]\n", argv[0]);
+ fprintf(stderr, "Usage: %s <monitor> [<keystone> <curvature> <depth> <vcenter> <perspective>]\n", argv[0]);
strcpy(corrections[i].monitor_name, argv[1]);
corrections[i+1].monitor_name = NULL;
corrections[i].keystone_vertical = 0.0f;
strcpy(corrections[i].monitor_name, argv[1]);
corrections[i+1].monitor_name = NULL;
corrections[i].keystone_vertical = 0.0f;
corrections[i].vertical_center = 0.5f;
corrections[i].perspective = 1.0f;
}
if(argc==2)
interactive(display, corrections, &corrections[i]);
corrections[i].vertical_center = 0.5f;
corrections[i].perspective = 1.0f;
}
if(argc==2)
interactive(display, corrections, &corrections[i]);
+ if(!strcmp(argv[3], "cylindrical"))
+ corrections[i].curvature_type = 1;
+ else if(!strcmp(argv[3], "spherical"))
+ corrections[i].curvature_type = 2;
+ else
+ {
+ fprintf(stderr, "Invalid curvature\n");
+ return 1;
+ }
- corrections[i].cylinder_depth = strtod(argv[3], NULL);
- corrections[i].vertical_center = strtod(argv[4], NULL);
- corrections[i].perspective = strtod(argv[5], NULL);
+ corrections[i].curvature_depth = strtod(argv[4], NULL);
+ corrections[i].vertical_center = strtod(argv[5], NULL);
+ corrections[i].perspective = strtod(argv[6], NULL);