pthreads + drawing area = expose event fails

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

 



I'm trying to write an app that lets me open multiple pthreaded windows
and do OpenGL in them using the GtkGLExt.  Unfortunately I'm running
into a problem getting the drawable in my expose event.

At first it was just OpenGL stuff, but when I couldn't get the
gldrawable and the glcontext I decided to reduce it to just normal Gdk
drawing and that fails as well.

I made this structure:

typedef struct
{
  GtkWidget *drawing_area;
  GdkGLConfig *glconfig;
  GdkGLContext *glcontext;
  GdkGLDrawable *gldrawable;
} glargs;

I set up the expose event like this:

  glargs *garg;
  if ((garg = (glargs *) calloc(1, sizeof(glargs))) == NULL) {
    printf("Cannot calloc gl args.\n");
    return NULL;
  }
  g_signal_connect(G_OBJECT(garg->drawing_area), "expose_event",
		   G_CALLBACK(expose_event), &garg);

But in my expose event callback, it fails:

gboolean
expose_event(GtkWidget *widget,
      GdkEventExpose   *event,
      gpointer          data)
{
  GdkDrawable *drawable;
  glargs *g1 = (glargs *) data;
  drawable =   g1->drawing_area->window;
  }
}
(grok:3095): Gdk-CRITICAL **: file gdkdraw.c: line 411
(gdk_draw_rectangle): assertion `GDK_IS_GC (gc)' failed

I have realize and configure_event callbacks that get the drawable &
context just fine.

I tested the pthread stuff with a GtkLabel and that works just fine with
a background update thread & everything.  Any ideas?

--
------------------------------------------------------------------------
Ray Clouse
STICS Lab
ray.clouse AT boeing.com			Don't fear the penguins.
clouse AT rayclouse.org
_______________________________________________

gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux