force drawing area expose on button click
- From: Scott Rubin <slr2777 cs rit edu>
- To: gtk-app-devel-list gnome org
- Subject: force drawing area expose on button click
- Date: Mon, 16 Feb 2004 12:34:51 -0500
Hi,
I'm working on a project for a class and I'm using gtkglext and
gtk+-2.0. I was previously doing the program in glut, but I needed to
add gui elements. Mostly this project has been a huge success, and I am
very pleased with the results. However, I have come across one problem.
Presently I have it coded so the map and unmap events are linked to
callbacks in such a way that during the idle state the following are
called repeatedly.
gdk_window_invalidate_rect (widget->window, &widget->allocation, FALSE);
gdk_window_process_updates (widget->window, FALSE);
This works great, but it uses 100% of the cpu. Since my program has no
animation there is really no need to redraw the area all the time.
My gui has a large number of buttons and keyboard inputs and such. What
I would like to do is force the drawing area to expose whenever the user
clicks a button or presses a key on the keyboard. Of course the
redrawing should occur after the button's usual function.
My problem is that if I do something like this:
g_signal_connect_after( G_OBJECT (button), "clicked", G_CALLBACK (redraw), NULL );
Then the widget argument to the redraw callback function will be button
and not drawing_area. In order to call invalidate_rect and
process_updates I need to access the drawing_area, which seems to only
be possible if the signal is connected to the drawing area itself. I
also tried passing pointers to the drawing_area in the data field, but I
think I may have done it wrong.
To put it simply. How can I force the expose event to happen on the
drawing_area widget whenever a clicked event is signaled on one of my
button widgets. Thanks.
-Scott
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]