How, where and when is the menu cursor drawn?

Here's what I've been able to figure out by myself about the structure of a window...

tone is a bitmap that is the blue background

contents is a bitmap that contains the contents of the window, like HP gauges and text

cursor_rect is (I assume) a Rect that contains the area that is lit up by the cursor

Tone and contents I have a good handle on, but I can't seem to find anything about how the cursor works - most importantly when in the frame update process it's drawn. There doesn't seem to be any calls to draw it in the code I can see. Is it drawn before the tone? After tone but before contents? It's certainly not the last thing to be drawn, as items in contents will overwrite it when contents is drawn.

I'd like to be able to draw the cursor on top of contents instead of below, since I'm drawing some solid images into contents and they overlap it.

sdsDnMW.jpg


(example: the character is part of the contents bitmap, drawn to it right before the text was. She moves as the cursor moves. The cursor is behind her. It looks bad.)

If I have to I can disable the cursor and code my own, but that seems like it'll mean reprogramming every window a bit and I don't especially feel like that... (I guess I will though)

So where is the call to draw the cursor, and does anyone know what it is so I can call it at a different time in the frame rendering process?

Original thread: https://forums.rpgmakerweb.com/threads/how-where-and-when-is-the-menu-cursor-drawn.17243/