X functions doesn't working in the expose-event?
- From: "Tom Liu" <tom liu flextrade com>
- To: <gtk-app-devel-list gnome org>
- Subject: X functions doesn't working in the expose-event?
- Date: Fri, 19 Dec 2003 18:07:48 -0500
Please help me to find the problem, when I use the x code to draw
something in the expose call back, the expose don't work.
The example is attatched, and the line shows up abut the rectangle will
not show automaticlly.
I need to use these x functions, to improve performance.
Thanks a lot.
------------------------------------------------------------------------
------------
#include <gtk/gtk.h>
#include "gdk/gdkx.h"
gint delete_event( GtkWidget *widget, GdkEvent *event, gpointer data
) {
gtk_main_quit ();
return FALSE;
}
static gboolean boxitm_expos_cb (GtkWidget *w,GdkEventExpose
*event,gpointer cdat)
{
GdkGC *m_gc=gdk_gc_new(w->window);
gdk_draw_line(w->window,m_gc,0,0,100,100);
XFillRectangle(GDK_DISPLAY(), GDK_WINDOW_XID(w->window),
GDK_GC_XGC(m_gc), 10,10,50,50);
g_object_unref (G_OBJECT(m_gc));
return TRUE;
}
int main( int argc, char *argv[] )
{
GtkWidget *window;
gtk_init (&argc, &argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
g_signal_connect (G_OBJECT (window), "delete_event",
G_CALLBACK (delete_event), NULL);
GtkWidget * ebox;
ebox =gtk_drawing_area_new();
g_signal_connect (G_OBJECT (ebox),
"expose-event",G_CALLBACK(boxitm_expos_cb),NULL);
gtk_container_add (GTK_CONTAINER (window), ebox);
gtk_widget_show_all (window);
gtk_main ();
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]