I'm using CFbsScreenDevice to draw directly to screen. I'm in fact drawing over another application, so I can't use the direct screen access stuff that would notify me on visibility changes.
So the problem is that when another window comes atop of the window that I'm "drawing on", my directly drawn stuff stays on the newly focused window, even though I stop the drawing (the notification comes too late to stop the drawing on time).
So to fix this I'd need to invalidate the whole screen (all visible windows) on the rectangle that I'm drawing on. Unfortunately I haven't found any such working method.
I found a tip about sending EEventScreenDeviceChanged event. This however has no effect (and would be quite ugly anyway). I also can't seem to be able to send redraw events through RWsSession.
I guess that as a last resort I could draw a dummy window and hide it instantly thus forcing the window server to send the redraw events accordingly. But is there a nicer way to do this?
Edit: Bit clarification