Ejemplo n.º 1
0
void WebBrowserObject::BrowserSnapshot(const char *fname)
{
    int width, height;
    char *c, *buf = 0;
    GdkColormap *cmap = gdk_colormap_get_system();
    gdk_drawable_get_size(GDK_DRAWABLE(mozilla->window), &width, &height);
    GdkPixbuf *pix = gdk_pixbuf_get_from_drawable(0, GDK_DRAWABLE(mozilla->window), cmap, 0, 0, 0, 0, width, height);
    if (pix) {
       if (!fname) {
           buf = strdup(location ? location : "lmboxweb");
           buf = (char*)realloc(buf, strlen(buf) + 16);
           fname = buf;
           if ((c = strrchr(buf, '/'))) {
               //fname = c + 1;
           }
           if ((c = strrchr(fname, '.'))) {
               *c = 0;
           }
           strcat((char*)fname, ".png");
       }
       gdk_pixbuf_save (pix, fname, "png", NULL, NULL);
       gdk_pixbuf_unref(pix);
       printf("Webbrowser snapshot %s\n",fname);
    }
    gdk_colormap_unref(cmap);
    lmbox_free(buf);
}
Ejemplo n.º 2
0
int
clip_GTK_WIDGETGETCOLORMAP(ClipMachine * cm)
{
	C_widget *cwid = _fetch_cw_arg(cm);
	GdkColormap *colormap;
	C_object *ccmap;
	CHECKCWID(cwid,GTK_IS_WIDGET);
	colormap = gtk_widget_get_colormap(cwid->widget);

	if (colormap)
	{
		ccmap = _register_object(cm,colormap,GDK_TYPE_COLORMAP,NULL,
			(coDestructor)gdk_object_colormap_destructor);
		if (ccmap)
		{
			ccmap->ref_count = 1;
			//ccmap->ref_count ++;
			//gdk_colormap_ref(colormap);
			_clip_mclone(cm,RETPTR(cm),&ccmap->obj);
		}
		else
			gdk_colormap_unref(colormap);
	}

	return 0;
err:
	return 1;
}
JNIEXPORT void JNICALL
Java_gnu_java_awt_peer_gtk_GdkGraphics_dispose
  (JNIEnv *env, jobject obj)
{
  struct graphics *g;

  
  g = (struct graphics *) NSA_DEL_PTR (env, obj);

  if (!g) return;		/* dispose has been called more than once */
  
  gdk_threads_enter ();
  XFlush (GDK_DISPLAY ());

  gdk_gc_destroy (g->gc);

  if (GDK_STABLE_IS_PIXMAP (g->drawable))
    gdk_pixmap_unref (g->drawable);
  else /* GDK_IS_WINDOW (g->drawable) */
    gdk_window_unref (g->drawable);

  gdk_colormap_unref (g->cm);

  gdk_threads_leave ();


  free (g);
}
Ejemplo n.º 4
0
void Colormap::decref() const
{
    if ( m_obj )
        gdk_colormap_unref( (GdkColormap*) m_obj );
}
Ejemplo n.º 5
0
void
sys_kill (void)
{
    gdk_colormap_unref (color_map);
    color_map = 0;
}