Add flag checking for osd_onscreen variable