Re: Need help with gdk_draw_*



	I thought it was something along these lines. But, from the tutorial, I
got the impression that gtk_widget_show() already does the realizing and
mapping, as stated in another e-mail by Tim Janik. This is why I put the
call to gdk_draw after the call to gtk_widget_show(). From what you say I
gather that gtk_widget_show() doesn't do the realizing and mapping, rather
the call to gtk_main().
	I tried Tim Janik's suggestion of adding a gdk_flush() right after the
gdk_draw but it didn't help. Only after I set up the expose_event handler
and drew from there did everything work.
	
	To strengthen the claim that gtk_widget_show() already realizes the
window, I tried moving the call to gdk_draw to _before_ gtk_widget_show()
and sure enough I got the expected 'window == NULL' error message.

	To conclude, I simply don't understand what I am doing wrong.
gtk_widget_show() realizes and maps the widget, I even flush the output
queue with gdk_flush() and still it doesn't work, _but_ implement the
drawing as an expose_event handler and everything is fine - this seems to
be a bug. Are you suggesting that there is no way to draw on Gtk widgets
from outside an expose_event handler?


	Yoav


-----------------------------

Owen Taylor wrote

-----------------------------

This is a sort of a classic problem. You can't draw on a window
until is realized (the X window is created) and it is mapped
(The window is drawn on the screen) The easiest way to do
this is to do your drawing in an expose handler. (That way,
it will also be redrawn if the window is hidden and then revealed)


(Also, you should compile GTK with --enable-debug. You would get
a warning that mainwin->window is NULL here)


Regards,
Owen



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]