• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Drawing to the screen itself via GTK

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

Kibokun

Member
Joined
Mar 7, 2006
I'm trying to figure out a way using GTK+ (or any GNOME windowing toolkit module) to draw directly to the screen, not bound by a widget. For the simplest of effects, I just want to make the entire screen flash red and fade back to a normal R value, but I don't quite understand what I'd need to use to do this as all the drawing functions I've found have been for drawing to a drawable object. Any information / guides / tips would be helpful. I'm writing this in C, by the way.

Thanks!
 
I'm trying to figure out a way using GTK+ (or any GNOME windowing toolkit module) to draw directly to the screen, not bound by a widget. For the simplest of effects, I just want to make the entire screen flash red and fade back to a normal R value, but I don't quite understand what I'd need to use to do this as all the drawing functions I've found have been for drawing to a drawable object. Any information / guides / tips would be helpful. I'm writing this in C, by the way.

Thanks!

You mean draw to the entire screen and not just your application window? Can't be done like that. You either need your program window to fill up the entire screen, or you need to use X to write directly to the screen buffer.
 
hmm, that's annoying. My team doesn't really have time to learn Xlib for this project. Does GDK offer any sort of medium between xlib and GTK? I've been reading up on GDKScreens and modifying ColorMaps, but I don't know if this is the way it should be done.

A compromise we've been talking about is making a GTK widget that isn't attached to a window somehow. Or maybe making a GTK window that's transparent so only things drawn to it appear? I will have to fiddle I guess.

Thanks!
 
I haven't done any GTK programming, but I'd imagine all widgets have to be attached to a window. What I think I'd do in your situation (again, without having done any GTK before) is to create a new window just for this effect. This new window would be set to have no decoration (title bar, minimize/restore/close buttons, etc) and fill the screen. Then draw either directly to the window or to a widget filling the window.

A window without decoration looks like nothing more than the widget contained (or background graphics if you can directly draw to a window) and should work well unless you're planning on doing something more complex...

JigPu
 
Back