X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fcontrol%2Funimotion.c;h=c4195e20e012fc106424506ee22316fd37501849;hb=6ee1e193fd896ab9a4729fde14f009d9ce629815;hp=afcc7a32c1c1a31a0c5c1d879585251c5658e066;hpb=3305b049e7f587b23359a1c9047fb5763d19c1dc;p=vlc diff --git a/modules/control/unimotion.c b/modules/control/unimotion.c index afcc7a32c1..c4195e20e0 100644 --- a/modules/control/unimotion.c +++ b/modules/control/unimotion.c @@ -251,28 +251,28 @@ int read_sms_raw(int type, int *x, int *y, int *z) int read_sms(int type, int *x, int *y, int *z) { int _x, _y, _z; - int xoff, yoff, zoff; - Boolean ok; + int xoff, yoff, zoff; + Boolean ok; int ret; - + ret = read_sms_raw(type, &_x, &_y, &_z); if ( !ret ) return 0; - static CFStringRef app = CFSTR("com.ramsayl.UniMotion"); - static CFStringRef xoffstr = CFSTR("x_offset"); - static CFStringRef yoffstr = CFSTR("y_offset"); - static CFStringRef zoffstr = CFSTR("z_offset"); - xoff = CFPreferencesGetAppIntegerValue(xoffstr, app, &ok); - if ( ok ) _x += xoff; - yoff = CFPreferencesGetAppIntegerValue(yoffstr, app, &ok); - if ( ok ) _y += yoff; - zoff = CFPreferencesGetAppIntegerValue(zoffstr, app, &ok); - if ( ok ) _z += zoff; - - *x = _x; - *y = _y; - *z = _z; + static CFStringRef app = CFSTR("com.ramsayl.UniMotion"); + static CFStringRef xoffstr = CFSTR("x_offset"); + static CFStringRef yoffstr = CFSTR("y_offset"); + static CFStringRef zoffstr = CFSTR("z_offset"); + xoff = CFPreferencesGetAppIntegerValue(xoffstr, app, &ok); + if ( ok ) _x += xoff; + yoff = CFPreferencesGetAppIntegerValue(yoffstr, app, &ok); + if ( ok ) _y += yoff; + zoff = CFPreferencesGetAppIntegerValue(zoffstr, app, &ok); + if ( ok ) _z += zoff; + + *x = _x; + *y = _y; + *z = _z; return ret; } @@ -280,29 +280,29 @@ int read_sms(int type, int *x, int *y, int *z) int read_sms_real(int type, double *x, double *y, double *z) { int _x, _y, _z; - int xscale, yscale, zscale; + int xscale, yscale, zscale; int ret; - Boolean ok; - + Boolean ok; + ret = read_sms_raw(type, &_x, &_y, &_z); if ( !ret ) return 0; - static CFStringRef app = CFSTR("com.ramsayl.UniMotion"); - static CFStringRef xscalestr = CFSTR("x_scale"); - static CFStringRef yscalestr = CFSTR("y_scale"); - static CFStringRef zscalestr = CFSTR("z_scale"); - xscale = CFPreferencesGetAppIntegerValue(xscalestr, app, &ok); - if ( !ok ) return 0; - yscale = CFPreferencesGetAppIntegerValue(yscalestr, app, &ok); - if ( !ok ) return 0; - zscale = CFPreferencesGetAppIntegerValue(zscalestr, app, &ok); - if ( !ok ) return 0; - + static CFStringRef app = CFSTR("com.ramsayl.UniMotion"); + static CFStringRef xscalestr = CFSTR("x_scale"); + static CFStringRef yscalestr = CFSTR("y_scale"); + static CFStringRef zscalestr = CFSTR("z_scale"); + xscale = CFPreferencesGetAppIntegerValue(xscalestr, app, &ok); + if ( !ok ) return 0; + yscale = CFPreferencesGetAppIntegerValue(yscalestr, app, &ok); + if ( !ok ) return 0; + zscale = CFPreferencesGetAppIntegerValue(zscalestr, app, &ok); + if ( !ok ) return 0; + *x = _x / (double)xscale; *y = _y / (double)yscale; *z = _z / (double)zscale; - + return 1; }