What's wrong with my button callback
- From: kadil <ksadil bigpond net au>
- To: gtk-app-devel-list gnome org
- Subject: What's wrong with my button callback
- Date: Thu, 29 Jun 2006 19:49:43 +1000
I used glade to "build" some a simple app. Why does my
on_button1_clicked callback segfault. The very same function call works
in the expose event.
Thanks,
Kim
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gtk/gtk.h>
#include "callbacks.h"
#include "interface.h"
#include "support.h"
static GdkPixmap *pixmap = NULL;
GtkWidget *drawingarea1;
void
on_button1_clicked (GtkButton *button,
gpointer user_data)
{
gdk_draw_rectangle(pixmap, drawingarea1->style->black_gc,TRUE,50,
50,99, 88);
}
gboolean
on_drawingarea1_expose_event (GtkWidget *widget,
GdkEventExpose *event,
gpointer user_data)
{
gdk_draw_drawable(widget->window, widget->style->fg_gc[GTK_WIDGET_STATE
(widget)], pixmap, event->area.x, event->area.y, event->area.x,
event->area.y, event->area.width, event->area.height);
return FALSE;
}
gboolean
on_drawingarea1_configure_event (GtkWidget *widget,
GdkEventConfigure *event,
gpointer user_data)
{
if (pixmap)
g_object_unref (pixmap);
pixmap = gdk_pixmap_new (widget->window, widget->allocation.width,
widget->allocation.height,-1);
gdk_draw_rectangle (pixmap, widget->style->white_gc, TRUE, 0, 0,
widget->allocation.width, widget->allocation.height);
gdk_draw_rectangle(pixmap, widget->style->black_gc,TRUE,0, 0,99, 88);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]