Fix {Set,Toggle}ScreenVariable.

These functions were marked as pure, but weren't actually pure
functions, since the scope they update can change. This change
has them return objects, which are pure.