Пример #1
0
static void sanalyzer_cleanup(void)
{
	if(window)
	{
		gtk_widget_destroy(window);
	}
	if(gc)
	{
		gdk_gc_unref(gc);
		gc = NULL;
	}
	if(bg_pixmap)
	{
		gdk_pixmap_unref(bg_pixmap);
		bg_pixmap = NULL;
	}
	if(draw_pixmap)
	{
		gdk_pixmap_unref(draw_pixmap);
		draw_pixmap = NULL;
	}
	if(bar)
	{
		gdk_pixmap_unref(bar);
		bar = NULL;
	}
}
Пример #2
0
static gboolean gonna_hide(gpointer data) {
	beforehiding--;

	if (beforehiding == 0) {
		static char source_data[] = { 0 };
		static char mask_data[] = { 0 };

		GdkCursor *cursor;
 		GdkPixmap *source, *mask;
		GdkColor fg = { 0, 65535, 65535, 65535 };
		GdkColor bg = { 0, 0, 0, 0 };
 
		source = gdk_bitmap_create_from_data(NULL, source_data, 1, 1);
		mask = gdk_bitmap_create_from_data(NULL, mask_data, 1, 1);
		cursor = gdk_cursor_new_from_pixmap(source, mask, &fg, &bg, 1, 1);
		gdk_pixmap_unref(source);
		gdk_pixmap_unref(mask);

		gdk_window_set_cursor(GTK_WIDGET(data)->window, cursor);

		return FALSE;
	} else {
		return TRUE;
	}
}
Пример #3
0
/* {EV_PIXMAP_IMP}.set_size */
void F1202_17204 (EIF_REFERENCE Current, EIF_INTEGER_32 arg1, EIF_INTEGER_32 arg2)
{
	GTCX
	EIF_POINTER loc1 = (EIF_POINTER) 0;
	EIF_POINTER loc2 = (EIF_POINTER) 0;
	EIF_INTEGER_32 loc3 = (EIF_INTEGER_32) 0;
	EIF_INTEGER_32 loc4 = (EIF_INTEGER_32) 0;
	EIF_POINTER loc5 = (EIF_POINTER) 0;
	EIF_POINTER loc6 = (EIF_POINTER) 0;
	EIF_POINTER loc7 = (EIF_POINTER) 0;
	EIF_POINTER tp1;
	EIF_INTEGER_32 ti4_1;
	RTLD;
	
	RTLI(1);
	RTLR(0,Current);
	
	RTGC;
	loc3 = F1202_17199(Current);
	loc4 = F1202_17200(Current);
	if ((EIF_BOOLEAN) ((EIF_BOOLEAN)(loc3 != arg1) || (EIF_BOOLEAN)(loc4 != arg2))) {
		tp1 = *(EIF_POINTER *)(Current+ _PTROFF_46_11_12_3_0_5_);
		loc1 = (EIF_POINTER) gdk_pixmap_ref((GdkPixmap*) tp1);
		if ((EIF_BOOLEAN)(*(EIF_POINTER *)(Current+ _PTROFF_46_11_12_3_0_4_) != loc7)) {
			tp1 = *(EIF_POINTER *)(Current+ _PTROFF_46_11_12_3_0_4_);
			loc2 = (EIF_POINTER) gdk_pixmap_ref((GdkPixmap*) tp1);
		}
		tp1 = (EIF_POINTER) NULL;
		ti4_1 = *(EIF_INTEGER_32 *)(RTCV(RTOSCF(14148,F1079_14148,(Current)))+ _LNGOFF_49_16_0_19_);
		tp1 = (EIF_POINTER) gdk_pixmap_new((GdkWindow*) tp1, (gint) arg1, (gint) arg2, (gint) ti4_1);
		*(EIF_POINTER *)(Current+ _PTROFF_46_11_12_3_0_5_) = (EIF_POINTER) tp1;
		F1198_17038(Current, ((EIF_INTEGER_32) 0L), ((EIF_INTEGER_32) 0L), arg1, arg2);
		tp1 = *(EIF_POINTER *)(Current+ _PTROFF_46_11_12_3_0_5_);
		loc5 = (EIF_POINTER) gdk_gc_new((GdkWindow*) tp1);
		gdk_gc_set_clip_mask((GdkGC*) loc5, (GdkBitmap*) loc2);
		gdk_gc_set_clip_origin((GdkGC*) loc5, (gint) ((EIF_INTEGER_32) 0L), (gint) ((EIF_INTEGER_32) 0L));
		tp1 = *(EIF_POINTER *)(Current+ _PTROFF_46_11_12_3_0_5_);
		gdk_draw_drawable((GdkDrawable*) tp1, (GdkGC*) loc5, (GdkDrawable*) loc1, (gint) ((EIF_INTEGER_32) 0L), (gint) ((EIF_INTEGER_32) 0L), (gint) ((EIF_INTEGER_32) 0L), (gint) ((EIF_INTEGER_32) 0L), (gint) loc3, (gint) loc4);
		gdk_gc_unref((GdkGC*) loc5);
		gdk_pixmap_unref((GdkPixmap*) loc1);
		if ((EIF_BOOLEAN)(loc2 != loc7)) {
			tp1 = (EIF_POINTER) NULL;
			tp1 = (EIF_POINTER) gdk_pixmap_new((GdkWindow*) tp1, (gint) arg1, (gint) arg2, (gint) ((EIF_INTEGER_32) 1L));
			*(EIF_POINTER *)(Current+ _PTROFF_46_11_12_3_0_4_) = (EIF_POINTER) tp1;
			tp1 = *(EIF_POINTER *)(Current+ _PTROFF_46_11_12_3_0_4_);
			loc6 = (EIF_POINTER) gdk_gc_new((GdkWindow*) tp1);
			tp1 = RTOSCF(17072,F1198_17072,(Current));
			gdk_gc_set_foreground((GdkGC*) loc6, (GdkColor*) tp1);
			tp1 = *(EIF_POINTER *)(Current+ _PTROFF_46_11_12_3_0_4_);
			gdk_draw_rectangle((GdkDrawable*) tp1, (GdkGC*) loc6, (gint) ((EIF_INTEGER_32) 1L), (gint) ((EIF_INTEGER_32) 0L), (gint) ((EIF_INTEGER_32) 0L), (gint) arg1, (gint) arg2);
			tp1 = *(EIF_POINTER *)(Current+ _PTROFF_46_11_12_3_0_4_);
			gdk_draw_drawable((GdkDrawable*) tp1, (GdkGC*) loc6, (GdkDrawable*) loc2, (gint) ((EIF_INTEGER_32) 0L), (gint) ((EIF_INTEGER_32) 0L), (gint) ((EIF_INTEGER_32) 0L), (gint) ((EIF_INTEGER_32) 0L), (gint) loc3, (gint) loc4);
			gdk_gc_unref((GdkGC*) loc6);
			gdk_pixmap_unref((GdkPixmap*) loc2);
		}
		F1202_17215(Current, *(EIF_POINTER *)(Current+ _PTROFF_46_11_12_3_0_5_), *(EIF_POINTER *)(Current+ _PTROFF_46_11_12_3_0_4_));
	}
	RTLE;
}
Пример #4
0
//! Free all malloc()d stuff
void board_free ()
{
	int i;
	if (pieces)
	{
		/* It may be the case that the latter half of pieces[] is a copy
		   of the first half */
		for (i=0; i<num_pieces; i++)
		{
			if (pieces[i] == pieces[i + num_pieces])
				pieces[i] = NULL;
			if (piece_masks[i] == piece_masks[i + num_pieces])
				piece_masks[i] = NULL;
		}
		for (i=0; i<2*num_pieces; i++)
		{
			if (pieces[i]) 
			{
				gdk_pixmap_unref (pieces[i]);
				pieces[i] = NULL;
			}
			if (piece_masks[i]) 
			{
				gdk_pixmap_unref (piece_masks[i]);
				piece_masks[i] = NULL;
			}
		}
		free (pieces);
		free (piece_masks);
		pieces = NULL;
		piece_masks = NULL;
	}
	if (board_bgimage)
	{
		free (board_bgimage);
		board_bgimage = NULL;
	}
	if (board_rowbox_real)
	{
		gtk_widget_destroy (board_rowbox_real);
		board_rowbox_real = NULL;
	}
	if (board_colbox_real)
	{
		gtk_widget_destroy (board_colbox_real);
		board_colbox_real = NULL;
	}
}
Пример #5
0
int
main(int argc,char **argv)
{
  int i;

  for(i=0;i<24;i++)
    hourly[i]=0;
  for(i=0;i<7;i++)
    weekly[i]=0;
  for(i=0;i<256;i++)
    nsrc[i]=i;

  time_cons[0]=0;
  time_cons[1]=0;
  useridx=ispidx=0;

  gtk_init(&argc,&argv);
  gdk_rgb_init();
  load_log();
  create_loglist();
  update_list();

  make_resume();

  gtk_main();

  g_list_free(users);
  g_list_free(isps);
  for(i=0;i<3;i++)
    gdk_pixmap_unref(iconmap[i]);

  free_log();
  return 0;
}
Пример #6
0
static gboolean configure_cb(GtkWidget *area, GdkEventConfigure *event)
{
	// if pixmap was already allocated - free it 
	if (back_buffer)
		gdk_pixmap_unref(back_buffer);

	// allocating back pixmap 
	back_buffer = gdk_pixmap_new(
					area->window,
					area->allocation.width,
					area->allocation.height,
					-1
	);

	if (!back_buffer)
		g_error(
			"gdk_pixmap_new(%p, %d,%d, -1) failed.\n",
			area,
			area->allocation.width,area->allocation.height
		);

	// filling all pixmap with black color 
	gdk_draw_rectangle(
				back_buffer,
				area->style->black_gc,
				TRUE,
				0,0, -1,-1
	);

	return TRUE;
}
Пример #7
0
//! Redraws the exposed area of the board
gboolean board_redraw (GtkWidget *widget, GdkEventExpose *event)
{
	int x, y;
	int xmin = 0, ymin = 0, xmax = board_wid, ymax = board_heit;
	if (!opt_game)
	{
		GdkPixmap *splash_pixmap;
		splash_pixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL, 
				gdk_colormap_get_system (), NULL, NULL, splash_xpm);
		gdk_draw_pixmap ((GdkDrawable *)board_area->window, 
				board_area->style->bg_gc[GTK_STATE_NORMAL],
				(GdkDrawable *)splash_pixmap, 
				0, 0, 0, 0, -1, -1);
		gdk_pixmap_unref (splash_pixmap);
		return TRUE;
	}
	if (event)
	{
		xmin = event->area.x / cell_size;
		ymin = event->area.y / cell_size;
		xmax = (event->area.x + event->area.width) / cell_size + 1;
		ymax = (event->area.y + event->area.height) / cell_size + 1;
		if (ymin < 0) ymin = 0;
		if (xmax > board_wid) xmax = board_wid;
		if (ymax > board_heit) ymax = board_heit;
	}
	for (x=xmin; x<xmax; x++)
		for (y=ymin; y<ymax; y++)
				board_refresh_cell_real (
						state_board_flipped ? board_wid - 1 - x : x, 
						state_board_flipped ? y : (board_heit - 1 - y), 
						x, y);
	return TRUE;
}
static gint
configure_event (GtkWidget *widget, GdkEventConfigure *e, C2NetworkTraffic *nt)
{
	if (!nt->blue)
	{
		GdkColor blue = { 0, 0, 0, 0xffff };
		GdkColor red = { 0, 0xffff, 0, 0 };

		gdk_color_alloc (gdk_colormap_get_system (), &blue);
		gdk_color_alloc (gdk_colormap_get_system (), &red);

		nt->blue = gdk_gc_new (GTK_WIDGET (nt)->window);
		nt->red = gdk_gc_new (GTK_WIDGET (nt)->window);

		gdk_gc_set_foreground (nt->blue, &blue);
		gdk_gc_set_foreground (nt->red, &red);
	}
	
	if (nt->pixmap)
		gdk_pixmap_unref (nt->pixmap);

	nt->pixmap = gdk_pixmap_new (widget->window, widget->allocation.width,
							 widget->allocation.height, -1);
	
	return TRUE;
}
Пример #9
0
gint
ggv_histogram_configure_cb (GtkWidget *w, GdkEventExpose *event,
  PluginInstance *inst)
{
  ggvisd *ggv = ggvisFromInst (inst);
  dissimd *D = ggv->dissim;
  ggobid *gg = inst->gg;
  gboolean retval = true;

  if (ggv == NULL)  /*-- too early to configure --*/
    return retval;
  if (w->allocation.width < 2 || w->allocation.height < 2)
    return retval;

  if (D->pix != NULL)
    gdk_pixmap_unref (D->pix);
  D->pix = gdk_pixmap_new (w->window,
    w->allocation.width, w->allocation.height, -1);
  histogram_pixmap_clear (ggv, gg);

  if (ggv->Dtarget.nrows == 0 || ggv->Dtarget.ncols == 0)
    return retval;  /*-- too early to figure out the histogram bins --*/

  histogram_bins_reset (ggv);
  if (D->nbins > 0) {
    histogram_make (ggv);
    histogram_draw (ggv, gg);
  }

  gtk_widget_queue_draw (w);

  return retval;
}
Пример #10
0
void histo_drawing_destroy(histoDrawing_t *drawing)
{
  g_info("histo_drawing_destroy %p", drawing);

  /* Free the colors */
  GdkColormap* colormap = gdk_colormap_get_system();

  gdk_colormap_free_colors(colormap, histo_drawing_colors, NUM_COLORS);
  
  // Do not unref here, histoDrawing_t destroyed by it's widget.
  //g_object_unref( G_OBJECT(drawing->drawing_area));
  if(drawing->gc != NULL)
    gdk_gc_unref(drawing->gc);
  
  g_object_unref(drawing->pango_layout);
  if(drawing->dotted_gc != NULL) gdk_gc_unref(drawing->dotted_gc);
  if(drawing->ruler_gc_butt != NULL) gdk_gc_unref(drawing->ruler_gc_butt);
  if(drawing->ruler_gc_round != NULL) gdk_gc_unref(drawing->ruler_gc_round);

  //added for histogram
  if(drawing->pixmap)
        gdk_pixmap_unref(drawing->pixmap);
  g_free(drawing);
  g_info("histo_drawing_destroy end");
}
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);
}
/*-----------------------------------------------------------------------------------*/
static gint
configure_event(GtkWidget *widget, GdkEventConfigure *event)
{
  if(ctk_gtksim_pixmap != NULL) {
    gdk_pixmap_unref(ctk_gtksim_pixmap);
  }
  
    ctk_gtksim_pixmap = gdk_pixmap_new(widget->window,
			  widget->allocation.width,
			  widget->allocation.height,
			    -1);

  if(ctk_gtksim_pixmap == NULL) {
    printf("gdk_pixmap_new == NULL\n");
    exit(1);
  }
  gdk_draw_rectangle(ctk_gtksim_pixmap,
		     widget->style->white_gc,
		     TRUE,
		     0, 0,
		     widget->allocation.width,
		     widget->allocation.height);
  
  return TRUE;
}
Пример #13
0
void
x_tile_destroy()
{
    int i;
    if (tmp_img) {
	gdk_image_destroy(tmp_img);
	tmp_img = NULL;
    }
    if (tile_pixmap) {
	gdk_pixmap_unref(tile_pixmap);
	tile_pixmap = NULL;
    }
    if (tmp_pixbuf) {
	gdk_pixbuf_unref(tmp_pixbuf);
	tmp_pixbuf = NULL;
    }
    if (tile_pixbuf) {
	gdk_pixbuf_unref(tile_pixbuf);
	tile_pixbuf = NULL;
    }
    if (tile_transp) {
	for(i = 0; i < total_tiles_used; i++)
	    free(tile_transp[i].data);
	free(tile_transp);
	tile_transp = NULL;
    }
    if (tile_image) {
	gdk_image_destroy(tile_image);
	tile_image = NULL;
    }
#ifdef GTK_PROXY
    free(GTK_glyph2tile);
    GTK_glyph2tile = (short *)0;
#endif
}
Пример #14
0
static GtkWidget * AddMenuCheckItem(GtkWidget *window1, const char * immagine_xpm, GtkWidget* Menu,const char* label, gboolean state, int Number)
{
    GtkWidget * Label = NULL;
    GtkWidget * Pixmap = NULL;
    GtkWidget * hbox = NULL;
    GtkWidget * Item = NULL;

    GdkPixmap *PixmapIcon = NULL;
    GdkColor transparent;
    GdkBitmap *MaskIcon = NULL;

    PixmapIcon = gdk_pixmap_create_from_xpm_d (window1->window, &MaskIcon, &transparent,(gchar **)immagine_xpm );
    Pixmap = gtk_pixmap_new (PixmapIcon, MaskIcon);
    gdk_pixmap_unref (PixmapIcon);

    Item=gtk_check_menu_item_new();
    Label = gtk_label_new (label);

    hbox = gtk_hbox_new (FALSE, 8);
    gtk_box_pack_start (GTK_BOX (hbox), Pixmap, FALSE, FALSE, 0);
    gtk_box_pack_start (GTK_BOX (hbox), Label, FALSE, FALSE, 0);
    gtk_container_add (GTK_CONTAINER (Item), hbox);

    gtk_menu_append( GTK_MENU( Menu ),Item );

    gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(Item),state);
    gtk_signal_connect_object( GTK_OBJECT(Item),"activate",
                               GTK_SIGNAL_FUNC(ActivateMenuItem),(gpointer)Number );
    gtk_menu_item_right_justify (GTK_MENU_ITEM (Item));
    gtk_widget_show_all(Item);

    return Item;
}
Пример #15
0
/* passe en mode color, decharge le pixmap (mais pas le nom) */
void tansetcolormode(GdkColor *acolor, int gcnbr){

  GdkPixmap *pixmap;
  GdkGC *gc;
  GdkColor *pcolor;
  GdkColormap *syscmap;

  gc = tabgc[gcnbr];
  pcolor = &colortab[gcnbr];
  syscmap = gdk_colormap_get_system();

  if (tabcolalloc[gcnbr])
    gdk_colormap_free_colors (syscmap, pcolor, 1);

  if ( gcnbr>=PXSTART && gcnbr<PXSTART+PXNBR ){
    tabpxpixmode[gcnbr] = FALSE;
    if ( (pixmap = tabpxpx[gcnbr])!=NULL ){
      tabpxpx[gcnbr] = NULL;
      gdk_pixmap_unref(pixmap);
    }
  }

  pcolor->red = acolor->red;
  pcolor->green = acolor->green;
  pcolor->blue = acolor->blue;
  tabcolalloc[gcnbr] = gdk_colormap_alloc_color (syscmap, pcolor, FALSE, TRUE);
  gdk_gc_set_fill (gc, GDK_SOLID);
  gdk_gc_set_foreground (gc, pcolor);

}
Пример #16
0
/*
 * CreateWidgetFromXpm
 *
 * Using the window information and the string with the icon color/data, 
 * create a widget that represents the data.  Once done, this widget can
 * be added to buttons or other container widgets.
 */
GtkWidget *CreateWidgetFromXpm (GtkWidget *window, gchar **xpm_data)
{
  // got this code from Xmps
    GdkColormap *colormap;
    GdkPixmap *gdkpixmap;
    GdkBitmap *mask;
    GtkWidget *pixmap;

    colormap = gtk_widget_get_colormap(window);
    gdkpixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL, colormap, &mask,
						       NULL, xpm_data);
    if (gdkpixmap == NULL) {
      printf("Error\n");
      return (NULL);
    }
#ifdef HAVE_GTK_2_0
    pixmap = gtk_image_new_from_pixmap(gdkpixmap, mask);
#else
    pixmap = gtk_pixmap_new (gdkpixmap, mask);
    gdk_pixmap_unref (gdkpixmap);
    gdk_bitmap_unref (mask);
#endif
    gtk_widget_show(pixmap);
    return pixmap;
}
Пример #17
0
GtkWidget * AddSubMenu( GtkWidget *window1, const char * immagine_xpm, GtkWidget * Menu,const char * label )
{
    GtkWidget * Label = NULL;
    GtkWidget * Pixmap = NULL;
    GtkWidget * hbox = NULL;
    GtkWidget * Item = NULL;
    GtkWidget * SubItem = NULL;
    GdkPixmap * PixmapIcon = NULL;
    GdkColor transparent;
    GdkBitmap * MaskIcon = NULL;

    PixmapIcon = gdk_pixmap_create_from_xpm_d (window1->window, &MaskIcon, &transparent,(gchar **)immagine_xpm);
    Pixmap = gtk_pixmap_new (PixmapIcon, MaskIcon);
    gdk_pixmap_unref (PixmapIcon);

    SubItem=gtk_menu_item_new();
    Item=gtk_menu_new();
    Label = gtk_label_new (label);

    hbox = gtk_hbox_new (FALSE, 8);
    gtk_box_pack_start (GTK_BOX (hbox), Pixmap, FALSE, FALSE, 0);
    gtk_box_pack_start (GTK_BOX (hbox), Label, FALSE, FALSE, 0);
    gtk_container_add (GTK_CONTAINER (SubItem), hbox);

    gtk_menu_append( GTK_MENU( Menu ),SubItem );
    gtk_menu_item_set_submenu( GTK_MENU_ITEM( SubItem ),Item );

    gtk_widget_show_all( SubItem );
    return Item;
}
Пример #18
0
static void
gimv_zalbum_clear (GimvZList *list)
{
   GimvZAlbumCell *cell;
   gint i;

   g_return_if_fail (list);

   for (i = 0; i < list->cell_count; i++) {
      cell = GIMV_ZLIST_CELL_FROM_INDEX (list, i);
      g_free ((gpointer) cell->name);
      if (cell->ipix)
         gdk_pixmap_unref (cell->ipix);
      cell->ipix = NULL;

      if (cell->user_data && cell->destroy)
         cell->destroy (cell->user_data);
      cell->destroy = NULL;
      cell->user_data = NULL;

      g_free (cell);
   }

   GIMV_ZALBUM (list)->len = 0;
}
Пример #19
0
/**
 * Grab the keyboard and mouse for the display. The mouse cursor is hidden and
 * moved to the centre of the window.
 *
 * @param win The window receiving the grab
 * @return TRUE if the grab was successful, FALSE on failure.
 */
gboolean video_window_grab_display( main_window_t win )
{
    GdkWindow *gdkwin = win->video->window;
    GdkColor color = { 0,0,0,0 };
    char bytes[32]; /* 16 * 16 / 8 */
    memset(bytes, 0, 32);
    GdkPixmap *pixmap = gdk_bitmap_create_from_data(NULL, bytes, 16, 16);
    GdkCursor *cursor = gdk_cursor_new_from_pixmap(pixmap, pixmap, &color, &color, 16, 16);
    gdk_pixmap_unref(pixmap);

    gboolean success =
        gdk_pointer_grab( gdkwin, FALSE, 
                GDK_POINTER_MOTION_MASK|GDK_BUTTON_PRESS_MASK|GDK_BUTTON_RELEASE_MASK, 
                gdkwin, cursor, GDK_CURRENT_TIME ) == GDK_GRAB_SUCCESS;
    gdk_cursor_unref(cursor);
    if( success ) {
        success = gdk_keyboard_grab( gdkwin, FALSE, GDK_CURRENT_TIME ) == GDK_GRAB_SUCCESS;
        if( !success ) {
            gdk_pointer_ungrab(GDK_CURRENT_TIME);
        }
    }
    win->is_grabbed = success;
    main_window_set_running(win, dreamcast_is_running());
    return success;
}
Пример #20
0
/* logo_remove */
static void _logo_remove(Logo * logo, GdkWindow * window)
{
	size_t i;

	for(i = 0; i < logo->windows_cnt; i++)
		if(logo->windows[i].window == window)
		{
			logo->windows[i].window = NULL;
			if(logo->windows[i].frame != NULL)
				g_object_unref(logo->windows[i].frame);
			logo->windows[i].frame = NULL;
#if GTK_CHECK_VERSION(3, 0, 0)
			if(logo->windows[i].cairo != NULL)
				cairo_destroy(logo->windows[i].cairo);
			logo->windows[i].cairo = NULL;
#else
			if(logo->windows[i].pixmap != NULL)
				gdk_pixmap_unref(logo->windows[i].pixmap);
			logo->windows[i].pixmap = NULL;
#endif
		}
	/* FIXME reorganize the array and free memory */
	for(i = 0; i < logo->windows_cnt; i++)
		if(logo->windows[i].window != NULL)
			break;
	if(i == logo->windows_cnt)
	{
		/* there are no windows left */
		_logo_stop(logo);
		free(logo->windows);
		logo->windows = NULL;
		logo->windows_cnt = 0;
	}
}
Пример #21
0
static void
thumbview_thumbs_do (ThumbLoader * tl)
{
    GdkPixmap *pixmap = NULL;
    GdkBitmap *mask = NULL;
    gfloat  status;

    if (tl == NULL)
	return;

    if (thumbview->thumbs_stop)
	return;

    thumb_loader_to_pixmap (tl, &pixmap, &mask);
    zalbum_set_pixmap (ZALBUM (thumbview->album),
		       thumbview->thumbs_count, pixmap, mask);
    if (pixmap)
	gdk_pixmap_unref (pixmap);

    if (mask)
	gdk_bitmap_unref (mask);

    status =
	(gfloat) thumbview->thumbs_count / ZALBUM (thumbview->album)->len;

    thumbview_thumbs_progressbar (status);
}
Пример #22
0
/* Create a new backing pixmap of the appropriate size */
static gint graph_configure_event(GtkWidget *widget, GdkEventConfigure *event,
				  gpointer data) {
  graph_priv_t *priv = g_object_get_data(G_OBJECT(data), "priv");
  g_assert(priv);

  if(priv->pixmap) {
    int width, height;
    gdk_drawable_get_size(priv->pixmap, &width, &height);

    if((width != widget->allocation.width) ||
       (height != widget->allocation.height)) {
      gdk_pixmap_unref(priv->pixmap);
      priv->pixmap = NULL;
    }
  }
  
  if(!priv->pixmap) {
    priv->pixmap = gdk_pixmap_new(widget->window,
				  widget->allocation.width,
				  widget->allocation.height,
				  -1);

    graph_draw(GTK_WIDGET(data));
  }

  return TRUE;
}
Пример #23
0
/*
 * Standard Gtk+ function
 */
static void Dw_gtk_viewport_destroy (GtkObject *object)
{
   GtkDwViewport *viewport;

   viewport = GTK_DW_VIEWPORT (object);

   if (viewport->back_pixmap)
      gdk_pixmap_unref (viewport->back_pixmap);
   if (viewport->child)
      gtk_object_destroy (GTK_OBJECT (viewport->child));
   if (viewport->draw_resize_idle_id != 0)
      gtk_idle_remove (viewport->draw_resize_idle_id);
   if (viewport->anchor_idle_id != 0)
      gtk_idle_remove (viewport->anchor_idle_id);
   g_free (viewport->anchor);

   g_hash_table_foreach_remove (viewport->anchors_table,
                                Dw_gtk_viewport_destroy_anchor, NULL);
   g_hash_table_destroy (viewport->anchors_table);

   g_free (viewport->draw_areas);

   a_Findtext_state_destroy (viewport->findtext_state);
   a_Selection_free (viewport->selection);

   GTK_OBJECT_CLASS(parent_class)->destroy (object);
}
Пример #24
0
static void gtk_plot_gdk_draw_pixmap                (GtkPlotPC *pc,
                                                     GdkPixmap *pixmap,
                                                     GdkBitmap *mask,
                                                     gint xsrc, gint ysrc,
                                                     gint xdest, gint ydest,
                                                     gint width,
                                                     gint height,
                                                     gdouble scale_x, 
                                                     gdouble scale_y)
{
  GdkGC *gc;
  GdkPixmap *new_pixmap;
  GdkBitmap *new_mask = NULL;

  if(!GTK_PLOT_GDK(pc)->drawable) return;
  if(!GTK_PLOT_GDK(pc)->window) return;
  if(!GTK_PLOT_GDK(pc)->gc) return;

  gc = GTK_PLOT_GDK(pc)->gc;

  if(!gc) return;

  new_pixmap = scale_pixmap(GTK_PLOT_GDK(pc)->window, pixmap, scale_x, scale_y);
  
  if(mask)
    new_mask = scale_bitmap(GTK_PLOT_GDK(pc)->window, mask, scale_x, scale_y);

  gtk_plot_pc_clip_mask(pc, xdest, ydest, new_mask);
  gdk_draw_pixmap(GTK_PLOT_GDK(pc)->drawable, gc, new_pixmap,
                  xsrc, ysrc, xdest, ydest, width*scale_x, height*scale_y);
  gtk_plot_pc_clip_mask(pc, xdest, ydest, NULL);

  if(new_mask) gdk_bitmap_unref(new_mask);
  gdk_pixmap_unref(new_pixmap);
}
Пример #25
0
void GtkPaintContext::updatePixmap(GtkWidget *area, int w, int h) {
	if ((myPixmap != 0) && ((myWidth != w) || (myHeight != h))) {
		gdk_pixmap_unref(myPixmap);
		myPixmap = 0;
		if (myTextGC != 0) {
			gdk_gc_unref(myTextGC);
			gdk_gc_unref(myFillGC);
			gdk_gc_unref(myBackGC);
			myTextGC = 0;
			myFillGC = 0;
			myBackGC = 0;
		}
	}

	if (myPixmap == 0) {
		myWidth = w;
		myHeight = h;
		myPixmap = gdk_pixmap_new(area->window, myWidth, myHeight, gdk_drawable_get_depth(area->window));
	}

	if (myTextGC == 0) {
		myTextGC = gdk_gc_new(myPixmap);
		myFillGC = gdk_gc_new(myPixmap);
		myBackGC = gdk_gc_new(myPixmap);
	}

	if (myContext == 0) {
		myContext = gtk_widget_get_pango_context(area);
		if (myFontDescription != 0) {
			myAnalysis.font = pango_context_load_font(myContext, myFontDescription);
			myAnalysis.shape_engine = pango_font_find_shaper(myAnalysis.font, 0, 0);
		}
	}
}
Пример #26
0
void
gimv_zalbum_set_pixmap (GimvZAlbum *album, guint idx,
                        GdkPixmap *pixmap, GdkBitmap *mask)
{
   GimvZAlbumCell *cell;

   g_return_if_fail (GIMV_IS_ZALBUM (album));

   cell = GIMV_ZLIST_CELL_FROM_INDEX(album, idx);

   g_return_if_fail (cell);

   if (cell->ipix)
      gdk_pixmap_unref (cell->ipix);
   cell->ipix  = NULL;
   cell->imask = NULL;

   if (!pixmap) return;

   cell->ipix  = gdk_pixmap_ref (pixmap);
   if (mask) cell->imask = gdk_bitmap_ref (mask);

   if (cell->ipix) {
      gimv_zalbum_update_max_cell_size (album, cell);

      if (!gimv_zlist_update_cell_size(GIMV_ZLIST(album), (gpointer) cell))
         gimv_zlist_draw_cell (GIMV_ZLIST(album), idx);
   }
}
Пример #27
0
gboolean
ghid_port_drawing_area_configure_event_cb (GtkWidget * widget,
					   GdkEventConfigure * ev,
					   GHidPort * out)
{
  static gboolean first_time_done;

  HideCrosshair (TRUE);
  gport->width = ev->width;
  gport->height = ev->height;

  if (gport->pixmap)
    gdk_pixmap_unref (gport->pixmap);

  gport->pixmap = gdk_pixmap_new (widget->window,
				  gport->width, gport->height, -1);
  gport->drawable = gport->pixmap;

  if (!first_time_done)
    {
      gport->colormap = gtk_widget_get_colormap (gport->top_window);
      gport->bg_gc = gdk_gc_new (gport->drawable);
      if (gdk_color_parse (Settings.BackgroundColor, &gport->bg_color))
	gdk_color_alloc (gport->colormap, &gport->bg_color);
      else
	gdk_color_white (gport->colormap, &gport->bg_color);
      gdk_gc_set_foreground (gport->bg_gc, &gport->bg_color);

      gport->offlimits_gc = gdk_gc_new (gport->drawable);
      if (gdk_color_parse (Settings.OffLimitColor, &gport->offlimits_color))
	gdk_color_alloc (gport->colormap, &gport->offlimits_color);
      else
	gdk_color_white (gport->colormap, &gport->offlimits_color);
      gdk_gc_set_foreground (gport->offlimits_gc, &gport->offlimits_color);
      first_time_done = TRUE;
      PCBChanged (0, NULL, 0, 0);
    }
  if (gport->mask)
    {
      gdk_pixmap_unref (gport->mask);
      gport->mask = gdk_pixmap_new (0, gport->width, gport->height, 1);
    }
  ghid_port_ranges_scale (FALSE);
  ghid_invalidate_all ();
  RestoreCrosshair (TRUE);
  return 0;
}
Пример #28
0
gint
wgra_configure(GtkWidget *widget,GdkEventConfigure *ee,gpointer data)
{
  GdkGC *mygc;
  int x,y,cx,xs;
  int i,v;
  long max;
  float fac;
  GdkFont *fn;

  if (wcanvas!=NULL)
    gdk_pixmap_unref(wcanvas);

  mygc=gdk_gc_new(widget->window);

  wcanvas=gdk_pixmap_new(widget->window,x=widget->allocation.width,
			 y=widget->allocation.height,-1);
  gdk_draw_rectangle(wcanvas,widget->style->white_gc,TRUE,0,0,x,y);
  gdk_draw_rectangle(wcanvas,widget->style->black_gc,FALSE,0,0,x-1,y-1);

  max=0;
  for(i=0;i<7;i++)
    if (weekly[i]>max)
      max=weekly[i];

  if (!max) max=1;
  fac=((float)(y-18-16))/((float)max);

  cx=1;
  xs=(x-2)/7;
  fn=gdk_font_load("-*-helvetica-medium-r-*-*-8-*-*-*-*-*-*-*");
  for (i=0;i<7;i++) {
    v=(int)(((float)weekly[i])*fac);
    gdk_rgb_gc_set_foreground(mygc,0xc0c0c0);
    gdk_draw_line(wcanvas,mygc,cx,1,cx,y-2);
    gdk_rgb_gc_set_foreground(mygc,0x004080);
    gdk_draw_rectangle(wcanvas,mygc,TRUE,cx,y-18-v,xs,v);
    gdk_rgb_gc_set_foreground(mygc,0x000000);
    gdk_draw_string(wcanvas,fn,mygc,cx,y-6,wdays[i]);
    cx+=xs;
  }

  gdk_draw_line(wcanvas,widget->style->black_gc,0,y-18,x-1,y-18);

  gdk_rgb_gc_set_foreground(mygc,0xffffff);
  gdk_draw_rectangle(wcanvas,mygc,TRUE,0,0,23*4,13);
  gdk_rgb_gc_set_foreground(mygc,0x000000);
  gdk_draw_rectangle(wcanvas,mygc,FALSE,0,0,23*4,13);

  gdk_font_unref(fn);
  fn=gdk_font_load("-*-helvetica-medium-r-*-*-10-*-*-*-*-*-*-*");

  gdk_draw_string(wcanvas,fn,mygc,5,10,"weekday summary");

  gdk_font_unref(fn);
  gdk_gc_destroy(mygc);

  return FALSE;
}
Пример #29
0
 static void release_pixmaps(void)
 {
	if(pixmap_terminal)
	{
		gdk_pixmap_unref(pixmap_terminal);
		pixmap_terminal = NULL;
	}

	if(get_cursor_pixmap())
	{
		gdk_pixmap_unref(get_cursor_pixmap());
		pixmap_cursor = NULL;
	}

	oia_release_pixmaps();

 }
Пример #30
0
int
hide_cursor (GtkWindow* window)
{
  GdkCursor* cursor;
  GdkPixmap* source, *mask;
  GdkColor fg = { 0, 0, 0, 0 }; /* Transparent. */
  GdkColor bg = { 0, 0, 0, 0 }; /* Transparent. */  

  source = gdk_bitmap_create_from_data (NULL, cursor1_bits,
					cursor1_width, cursor1_height);
  mask = gdk_bitmap_create_from_data (NULL, cursor1mask_bits,
				      cursor1_width, cursor1_height);
  cursor = gdk_cursor_new_from_pixmap (source, mask, &fg, &bg, 8, 8);
  gdk_pixmap_unref (source);
  gdk_pixmap_unref (mask);   
  gdk_window_set_cursor (((GtkWidget*)window)->window, cursor);
}