Re: GTK+ applications start slowly due to pango coverage loop?

2008-02-10 Thread Behdad Esfahbod
On Sun, 2008-02-10 at 14:09 +0800, Bin Chen wrote:
> 
> But seems in earlier version this doesn't happen, any suggestions?

Then exactly point us to the first version that has the problem and I'll
be more than happy to look into it.


> Thanks.
> Bin
-- 
behdad
http://behdad.org/

"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
-- Benjamin Franklin, 1759

___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


GTK+ 2.12.6 and wimp

2008-02-10 Thread Bastiaan Veelo
Hi,

I installed version 2.12.6 on Windows according to 
http://www.gtk.org/download-windows.html, but I cannot get the wimp 
theme enigne to load -- all is in the default GTK theme. The archives 
have been unpacked in the same directory, and the bin subdirectory has 
been added to the PATH environment variable.

Oddly, libwimp.dll is in lib/gtk-2.0/2.10.0/engines. Adding that 
directory to PATH does not help, neither does renaming 2.10.0 to 2.12.6.

Have I overseen a configuration step, or is there something wrong with 
the current windows build?

Thanks,
Bastiaan.
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Using a GSource to dispatch camera images to display in a GUI

2008-02-10 Thread Luis Menina
Hi all,

I'm currently hacking on a system that can analyse images coming from a
camera (on the fly), or from a pre-recorded set of images
(pos-analysis). I want to be able to use either source transparently.
But as I don't know how much time the pre-recorded images will take to
process, I'd like to have the processing be asynchronous.

Given these requirements, I thought of using GSource, because an image
arrival would be seen like an asynchronous event source. So, I'm
currently doing a small GUI application, but I have problems displaying
the images provided by the camera source. Note that in a non-GUI
application, everything works, and I'm able to save every image on the
hard disk for post analysis.

Currently, I'm doing everything in the main loop (there's no other
thread), but the results are bad. Either the GUI freezes and the other
controls are not drawn (as if too much time was spent processing the
camera source events), or if I lower the acquisition period, I only get
3 or 4 frames incompletely drawn.

Maybe I'm not using GSource as I should, but I couldn't find much
documentation on it. Especially since I'm using it with no file
descriptor to poll. I read the glib code for timeout sources, and could
not find something I'm doing wrong. So if someone could give me some
hints on how I may be using it in a bad way, or tell me if my approach
and choice of GSource was a good one, it would be very appreciated.

Here is the code for the caera event source, and for the GUI app.

Thanks in advance.

/*
* camera-source.c
**/
static GSourceFuncs
camera_source_funcs =
{
  camera_source_prepare,
  camera_source_check,
  camera_source_dispatch,
  NULL
};

GSource *
camera_source_new(CamDevice *camdev)
{
  GSource *source = g_source_new(&camera_source_funcs,
  sizeof(CameraSource));
  CameraSource* self = CAMERASOURCE(source);
  self->device = camdev;
  self->pixbuf = NULL;
  self->frame_number = -1;

  return source;
}

inline void
camera_source_free(gpointer source)
{
  if (source != NULL)
  {
  CameraSource *self = source;
  if (self->pixbuf != NULL)
  g_object_unref(self->pixbuf);
  g_free(self);
  }
}

static gboolean
camera_source_prepare (GSource *source,
  gint *timeout)
{
  CamDevice *camdev;
  g_assert(source != NULL);

  camdev = CAMERASOURCE(source)->device;
  *timeout = ACQUISITION_PERIOD; /* milisecondes */
  camdevice_request_image(camdev);
  return FALSE;
}

static gboolean
camera_source_check (GSource *source)
{
  CameraSource *self;
  gboolean result;
  g_assert(source != NULL);

  self = CAMERASOURCE(source);
  result = camdevice_get_pending_image(self->device, &self->pixbuf);
  /* camdevice_get_pending_image returns FALSE if no image is ready,
  as I had to workaround the implementation of the 3rd part vendor
  of the camera which only proposes a blocking, synchronous API to
  get images */
  self->frame_number++;

  return result;

}

static gboolean
camera_source_dispatch (GSource *source,
  GSourceFunc callback,
  gpointer user_data)
{
  g_assert(source != NULL);

  if (!callback)
  {
  g_warning("No callback defined.\n"
  "Call g_source_set_callback");
  return FALSE;
  }

  if (callback(user_data))
  return TRUE;

  return FALSE;
}



/**
* gt-dif.c
***/
#include "camdevice.h"/* for CamDevice */
#include "camera-source.h"/* for CameraSource */


static void
on_quit (gpointer user_data)
{
  gtk_main_quit ();
}

static gboolean
on_image_received (gpointer data)
{
  GtkWidget *da = data;
  g_assert (da != NULL);
  g_debug (G_STRFUNC);
  gdk_window_invalidate_rect (da->window,
  &da->allocation,
  FALSE);
  return TRUE;
}

gboolean
on_drawing_area_expose_event (GtkWidget *widget,
  GdkEventExpose *event,
  gpointer data)
{
  CameraSource *camsrc = data;
  g_assert (camsrc != NULL);
  g_debug ("%s : expose-event", G_STRFUNC);

  if (camsrc->pixbuf == NULL)
  return FALSE;

  gdk_draw_pixbuf (widget->window,
  widget->style->fg_gc[GTK_WIDGET_STATE (widget)],
  camsrc->pixbuf,
  0, 0, 0, 0,
  -1, -1,
  GDK_RGB_DITHER_NONE,
  0, 0);
  return TRUE;
}

static GPtrArray*
recorder_autodetect_sources (