diff options
Diffstat (limited to 'xorg-server/hw/xwin/winconfig.c')
-rw-r--r-- | xorg-server/hw/xwin/winconfig.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/xorg-server/hw/xwin/winconfig.c b/xorg-server/hw/xwin/winconfig.c index afdf6926e..fffd3e813 100644 --- a/xorg-server/hw/xwin/winconfig.c +++ b/xorg-server/hw/xwin/winconfig.c @@ -670,6 +670,18 @@ winSetRealOption (pointer optlist, const char *name, double deflt) deflt = o.value.realnum;
return deflt;
}
+
+double
+winSetPercentOption (pointer optlist, const char *name, double deflt)
+{
+ OptionInfoRec o;
+
+ o.name = name;
+ o.type = OPTV_PERCENT;
+ if (ParseOptionValue (-1, optlist, &o))
+ deflt = o.value.realnum;
+ return deflt;
+}
#endif
@@ -842,6 +854,31 @@ ParseOptionValue (int scrnIndex, pointer options, OptionInfoPtr p) p->found = FALSE;
}
break;
+ case OPTV_PERCENT:
+ if (*s == '\0')
+ {
+ winDrvMsg (scrnIndex, X_WARNING,
+ "Option \"%s\" requires a percent value\n",
+ p->name);
+ p->found = FALSE;
+ }
+ else
+ {
+ double percent = strtod (s, &end);
+
+ if (end != s && winNameCompare (end, "%"))
+ {
+ p->found = TRUE;
+ p->value.realnum = percent;
+ }
+ else
+ {
+ winDrvMsg (scrnIndex, X_WARNING,
+ "Option \"%s\" requires a frequency value\n",
+ p->name);
+ p->found = FALSE;
+ }
+ }
case OPTV_FREQ:
if (*s == '\0')
{
|