I'm struggling to find good resources about how application rendering(as opposed to game rendering) is done.
Obviously you don't want to be updating the screen all the time for no reason. Do applications typically update the screen whenever they receive input? Do they update only the sections of the screen that have been affected?
I assume if you use the OS's api to create the default OS ui elements it handles the rendering and refreshing for you. But if you want to use something like OpenGL to do a custom ui, what are some good strategies for updating the screen and using minimal cpu?
One way of looking at deciding when and what to redraw is as a cache invalidation problem.
What's on screen is a cached version of the program state.
Sometimes the OS discards part of your window and requests a redraw by sending an event into the queue, you can also request such an event to be sent. The OS will combine multiple requests for a redraw into a single event for the combined area.
When part of the screen needs to change the widget library will request a redraw for the part of the screen that needs to change in response to the call from the user.
The blinking cursor is a special case where they use something called xor mode where you overdraw an image and it transforms the pixels you draw over. If you draw the exact same thing again you end up with the original pixels back.