Commit 5d43e5ba authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

made multi-head safe. The whole tree compiles with GDK_MULTIHEAD_SAFE now.

2003-10-31  Sven Neumann  <sven@gimp.org>

	* plug-ins/common/wmf.c: made multi-head safe. The whole tree
	compiles with GDK_MULTIHEAD_SAFE now.
parent 93dadb8a
2003-10-31 Sven Neumann <sven@gimp.org>
* plug-ins/common/wmf.c: made multi-head safe.
2003-10-31 Sven Neumann <sven@gimp.org> 2003-10-31 Sven Neumann <sven@gimp.org>
* tools/gimp-remote.c: made multi-head safe. Let GTK+ parse the * tools/gimp-remote.c: made multi-head safe. Let GTK+ parse the
...@@ -429,7 +429,7 @@ typedef struct _GdiCommentRecord ...@@ -429,7 +429,7 @@ typedef struct _GdiCommentRecord
DWORD Size; /* Total size of the record in WORDs */ DWORD Size; /* Total size of the record in WORDs */
DWORD SizeOfData; /* Size of comment data in bytes */ DWORD SizeOfData; /* Size of comment data in bytes */
#if DOCUMENTATION_ONLY_ILLEGAL_C #if DOCUMENTATION_ONLY_ILLEGAL_C
BYTE Data[]; /* Comment data */ BYTE Data[]; /* Comment data */
#endif #endif
} GDICOMMENTRECORD; } GDICOMMENTRECORD;
...@@ -451,7 +451,7 @@ typedef struct _GdiCommentBeginGroup ...@@ -451,7 +451,7 @@ typedef struct _GdiCommentBeginGroup
LONG BoundsRight; /* Right side of bounding rectangle */ LONG BoundsRight; /* Right side of bounding rectangle */
LONG BoundsTop; /* Top side of bounding rectangle */ LONG BoundsTop; /* Top side of bounding rectangle */
LONG BoundsBottom; /* Bottom side of bounding rectangle */ LONG BoundsBottom; /* Bottom side of bounding rectangle */
DWORD SizeOfDescrip; /* Number of characters in the description */ DWORD SizeOfDescrip; /* Number of characters in the description */
} GDICOMMENTBEGINGROUP; } GDICOMMENTBEGINGROUP;
typedef struct _GdiCommentEndGroup typedef struct _GdiCommentEndGroup
...@@ -837,7 +837,7 @@ query (void) ...@@ -837,7 +837,7 @@ query (void)
GIMP_PLUGIN, GIMP_PLUGIN,
G_N_ELEMENTS (load_setargs_args), 0, G_N_ELEMENTS (load_setargs_args), 0,
load_setargs_args, NULL); load_setargs_args, NULL);
gimp_register_magic_load_handler ("file_wmf_load", gimp_register_magic_load_handler ("file_wmf_load",
"wmf,apm", "wmf,apm",
"", "",
...@@ -875,7 +875,7 @@ run (const gchar *name, ...@@ -875,7 +875,7 @@ run (const gchar *name,
if (!load_dialog (param[1].data.d_string)) if (!load_dialog (param[1].data.d_string))
status = GIMP_PDB_CANCEL; status = GIMP_PDB_CANCEL;
break; break;
case GIMP_RUN_NONINTERACTIVE: case GIMP_RUN_NONINTERACTIVE:
case GIMP_RUN_WITH_LAST_VALS: case GIMP_RUN_WITH_LAST_VALS:
gimp_get_data ("file_wmf_load", &load_vals); gimp_get_data ("file_wmf_load", &load_vals);
...@@ -887,13 +887,13 @@ run (const gchar *name, ...@@ -887,13 +887,13 @@ run (const gchar *name,
if (status == GIMP_PDB_SUCCESS) if (status == GIMP_PDB_SUCCESS)
{ {
check_load_vals (); check_load_vals ();
image_ID = load_image (param[1].data.d_string); image_ID = load_image (param[1].data.d_string);
if (image_ID != -1) if (image_ID != -1)
{ {
gimp_set_data ("file_wmf_load", &load_vals, sizeof (load_vals)); gimp_set_data ("file_wmf_load", &load_vals, sizeof (load_vals));
*nreturn_vals = 2; *nreturn_vals = 2;
values[1].type = GIMP_PDB_IMAGE; values[1].type = GIMP_PDB_IMAGE;
values[1].data.d_image = image_ID; values[1].data.d_image = image_ID;
...@@ -968,7 +968,7 @@ make_canvas (OrgAndExt *window, ...@@ -968,7 +968,7 @@ make_canvas (OrgAndExt *window,
} }
canvas->scalex = canvas->scaley = load_vals.scale; canvas->scalex = canvas->scaley = load_vals.scale;
if (!viewport->valid) if (!viewport->valid)
{ {
#ifdef DEBUG #ifdef DEBUG
...@@ -981,18 +981,18 @@ make_canvas (OrgAndExt *window, ...@@ -981,18 +981,18 @@ make_canvas (OrgAndExt *window,
} }
#ifdef DEBUG #ifdef DEBUG
g_print ("make_canvas: w: (%d,%d)--(%d,%d), vp: (%d,%d)--(%d,%d)\n", g_print ("make_canvas: w: (%d,%d)--(%d,%d), vp: (%d,%d)--(%d,%d)\n",
window->org_x, window->org_y, window->org_x + window->ext_x, window->org_y + window->ext_y, window->org_x, window->org_y, window->org_x + window->ext_x, window->org_y + window->ext_y,
viewport->org_x, viewport->org_y, viewport->org_x, viewport->org_y,
viewport->org_x + viewport->ext_x, viewport->org_y + viewport->ext_y); viewport->org_x + viewport->ext_x, viewport->org_y + viewport->ext_y);
#endif #endif
canvas->colormap = gdk_colormap_get_system (); canvas->colormap = gdk_screen_get_system_colormap (gdk_screen_get_default ());
canvas->width = viewport->ext_x; canvas->width = viewport->ext_x;
canvas->height = viewport->ext_y; canvas->height = viewport->ext_y;
canvas->pixmap = gdk_pixmap_new (NULL, viewport->ext_x, viewport->ext_y, canvas->pixmap = gdk_pixmap_new (NULL, viewport->ext_x, viewport->ext_y,
gdk_visual_get_system ()->depth); gdk_colormap_get_visual (canvas->colormap)->depth);
canvas->dc.gc = gdk_gc_new (canvas->pixmap); canvas->dc.gc = gdk_gc_new (canvas->pixmap);
...@@ -1504,7 +1504,7 @@ load_image (const gchar *filename) ...@@ -1504,7 +1504,7 @@ load_image (const gchar *filename)
case PS_INSIDEFRAME: case PS_INSIDEFRAME:
objp->u.pen.style = GDK_LINE_SOLID; objp->u.pen.style = GDK_LINE_SOLID;
break; break;
case PS_DASH: case PS_DASH:
case PS_DOT: case PS_DOT:
case PS_DASHDOT: case PS_DASHDOT:
...@@ -1538,7 +1538,7 @@ load_image (const gchar *filename) ...@@ -1538,7 +1538,7 @@ load_image (const gchar *filename)
"???"))), "???"))),
objp->u.pen.color.red, objp->u.pen.color.red,
objp->u.pen.color.green, objp->u.pen.color.green,
objp->u.pen.color.blue); objp->u.pen.color.blue);
#endif #endif
if (!gdk_color_alloc (canvas->colormap, &objp->u.pen.color)) if (!gdk_color_alloc (canvas->colormap, &objp->u.pen.color))
{ {
...@@ -1572,7 +1572,7 @@ load_image (const gchar *filename) ...@@ -1572,7 +1572,7 @@ load_image (const gchar *filename)
(objp->u.brush.invisible ? " invisible" : ""), (objp->u.brush.invisible ? " invisible" : ""),
objp->u.brush.color.red, objp->u.brush.color.red,
objp->u.brush.color.green, objp->u.brush.color.green,
objp->u.brush.color.blue); objp->u.brush.color.blue);
#endif #endif
if (canvas == NULL) if (canvas == NULL)
canvas = make_canvas (&window, &viewport, have_bbox, &bbox, units_per_in); canvas = make_canvas (&window, &viewport, have_bbox, &bbox, units_per_in);
...@@ -1588,7 +1588,7 @@ load_image (const gchar *filename) ...@@ -1588,7 +1588,7 @@ load_image (const gchar *filename)
objp->u.brush.hatch = GUINT16_FROM_LE (params[3]); objp->u.brush.hatch = GUINT16_FROM_LE (params[3]);
sync_record (record.Size, 4, fp); sync_record (record.Size, 4, fp);
break; break;
case DibCreatePatternBrush: case DibCreatePatternBrush:
if ((objp = new_object (OBJ_PATTERNBRUSH, objects, nobjects)) == NULL) if ((objp = new_object (OBJ_PATTERNBRUSH, objects, nobjects)) == NULL)
{ {
...@@ -1601,7 +1601,7 @@ load_image (const gchar *filename) ...@@ -1601,7 +1601,7 @@ load_image (const gchar *filename)
/* Ignored for now */ /* Ignored for now */
sync_record (record.Size, 0, fp); sync_record (record.Size, 0, fp);
break; break;
case CreatePalette: case CreatePalette:
if ((objp = new_object (OBJ_PALETTE, objects, nobjects)) == NULL) if ((objp = new_object (OBJ_PALETTE, objects, nobjects)) == NULL)
{ {
...@@ -1614,7 +1614,7 @@ load_image (const gchar *filename) ...@@ -1614,7 +1614,7 @@ load_image (const gchar *filename)
/* XXX */ /* XXX */
sync_record (record.Size, 0, fp); sync_record (record.Size, 0, fp);
break; break;
case CreateFontIndirect: case CreateFontIndirect:
if (!readparams (record.Size, 9, fp, params)) if (!readparams (record.Size, 9, fp, params))
return -1; return -1;
...@@ -1701,7 +1701,7 @@ load_image (const gchar *filename) ...@@ -1701,7 +1701,7 @@ load_image (const gchar *filename)
name2 = "courier"; name2 = "courier";
else else
name2 = name; name2 = name;
fontname = fontname =
g_strdup_printf ("-*-%s-%s-%s-%s-*-%d-*-*-*-%s-*-*-*", g_strdup_printf ("-*-%s-%s-%s-%s-*-%d-*-*-*-%s-*-*-*",
name2, name2,
(weight >= 700 ? "bold" : (weight >= 700 ? "bold" :
...@@ -1744,7 +1744,7 @@ load_image (const gchar *filename) ...@@ -1744,7 +1744,7 @@ load_image (const gchar *filename)
g_free (fontname); g_free (fontname);
} }
break; break;
case SelectObject: case SelectObject:
if (!readparams (record.Size, 1, fp, params)) if (!readparams (record.Size, 1, fp, params))
return -1; return -1;
...@@ -1862,7 +1862,7 @@ load_image (const gchar *filename) ...@@ -1862,7 +1862,7 @@ load_image (const gchar *filename)
g_free (objp); g_free (objp);
objects[k] = NULL; objects[k] = NULL;
break; break;
case MoveTo: case MoveTo:
if (!readparams (record.Size, 2, fp, params)) if (!readparams (record.Size, 2, fp, params))
return -1; return -1;
...@@ -1881,7 +1881,7 @@ load_image (const gchar *filename) ...@@ -1881,7 +1881,7 @@ load_image (const gchar *filename)
x = XMAPPAR (params[1]); x = XMAPPAR (params[1]);
y = YMAPPAR (params[0]); y = YMAPPAR (params[0]);
#ifdef DEBUG #ifdef DEBUG
g_print ("LineTo: (%d,%d)--(%d,%d)\n", g_print ("LineTo: (%d,%d)--(%d,%d)\n",
(gint) canvas->curx, (gint) canvas->cury, (gint) canvas->curx, (gint) canvas->cury,
(gint) x, (gint) y); (gint) x, (gint) y);
#endif #endif
...@@ -1912,7 +1912,7 @@ load_image (const gchar *filename) ...@@ -1912,7 +1912,7 @@ load_image (const gchar *filename)
gdk_draw_lines (canvas->pixmap, canvas->dc.gc, points, npoints); gdk_draw_lines (canvas->pixmap, canvas->dc.gc, points, npoints);
g_free (points); g_free (points);
break; break;
case Rectangle: case Rectangle:
if (!readparams (record.Size, 4, fp, params)) if (!readparams (record.Size, 4, fp, params))
return -1; return -1;
...@@ -2127,14 +2127,14 @@ load_image (const gchar *filename) ...@@ -2127,14 +2127,14 @@ load_image (const gchar *filename)
gdk_gc_set_clip_rectangle (canvas->dc.gc, NULL); gdk_gc_set_clip_rectangle (canvas->dc.gc, NULL);
sync_record (record.Size, j, fp); sync_record (record.Size, j, fp);
break; break;
case EndOfFile: case EndOfFile:
fclose (fp); fclose (fp);
gimp_progress_update (1.0); gimp_progress_update (1.0);
if (canvas->height >= 100) if (canvas->height >= 100)
gimp_progress_init (_("Transferring image")); gimp_progress_init (_("Transferring image"));
image_ID = gimp_image_new (canvas->width, canvas->height, GIMP_RGB); image_ID = gimp_image_new (canvas->width, canvas->height, GIMP_RGB);
gimp_image_set_filename (image_ID, filename); gimp_image_set_filename (image_ID, filename);
layer_ID = gimp_layer_new (image_ID, _("Background"), layer_ID = gimp_layer_new (image_ID, _("Background"),
...@@ -2149,7 +2149,7 @@ load_image (const gchar *filename) ...@@ -2149,7 +2149,7 @@ load_image (const gchar *filename)
TRUE, FALSE); TRUE, FALSE);
if (pixel_rgn.bpp != 3) if (pixel_rgn.bpp != 3)
abort (); abort ();
visual = gdk_visual_get_system (); visual = gdk_screen_get_system_visual (gdk_screen_get_default ());
switch (visual->type) switch (visual->type)
{ {
case GDK_VISUAL_PSEUDO_COLOR: case GDK_VISUAL_PSEUDO_COLOR:
...@@ -2173,7 +2173,7 @@ load_image (const gchar *filename) ...@@ -2173,7 +2173,7 @@ load_image (const gchar *filename)
pixelp++; pixelp++;
} }
} }
gimp_pixel_rgn_set_rect (&pixel_rgn, buf, 0, j, canvas->width, scanlines); gimp_pixel_rgn_set_rect (&pixel_rgn, buf, 0, j, canvas->width, scanlines);
if (canvas->height >= 100) if (canvas->height >= 100)
gimp_progress_update ((double) j / canvas->height); gimp_progress_update ((double) j / canvas->height);
...@@ -2212,7 +2212,7 @@ load_image (const gchar *filename) ...@@ -2212,7 +2212,7 @@ load_image (const gchar *filename)
rshift = visual->red_shift; rshift = visual->red_shift;
gshift = visual->green_shift; gshift = visual->green_shift;
bshift = visual->blue_shift; bshift = visual->blue_shift;
if ((image->depth > 8 && image->bpp == 1) if ((image->depth > 8 && image->bpp == 1)
|| image->bpp > 4) || image->bpp > 4)
{ {
...@@ -2268,7 +2268,7 @@ load_image (const gchar *filename) ...@@ -2268,7 +2268,7 @@ load_image (const gchar *filename)
else else
for (k = 0; k < image->bpp; k++) for (k = 0; k < image->bpp; k++)
pixel |= (pixelp[image->bpp - k - 1] << (k*8)); pixel |= (pixelp[image->bpp - k - 1] << (k*8));
*bufp++ = rtbl[(pixel & rmask) >> rshift]; *bufp++ = rtbl[(pixel & rmask) >> rshift];
*bufp++ = gtbl[(pixel & gmask) >> gshift]; *bufp++ = gtbl[(pixel & gmask) >> gshift];
*bufp++ = btbl[(pixel & bmask) >> bshift]; *bufp++ = btbl[(pixel & bmask) >> bshift];
...@@ -2293,7 +2293,7 @@ load_image (const gchar *filename) ...@@ -2293,7 +2293,7 @@ load_image (const gchar *filename)
return -1; return -1;
} }
gimp_drawable_flush (drawable); gimp_drawable_flush (drawable);
return image_ID; return image_ID;
default: default:
...@@ -2327,7 +2327,7 @@ readparams (DWORD size, ...@@ -2327,7 +2327,7 @@ readparams (DWORD size,
if (size != 0) if (size != 0)
{ {
nwords = GUINT32_FROM_LE (size) - WORDSIZE_WMFRECORD; nwords = GUINT32_FROM_LE (size) - WORDSIZE_WMFRECORD;
if (nwords < nparams) if (nwords < nparams)
{ {
fclose (fp); fclose (fp);
...@@ -2342,7 +2342,7 @@ readparams (DWORD size, ...@@ -2342,7 +2342,7 @@ readparams (DWORD size,
g_message ("Too large record?"); g_message ("Too large record?");
return 0; return 0;
} }
if (nparams > 0 && !ReadOK (fp, params, nparams * sizeof (WORD))) if (nparams > 0 && !ReadOK (fp, params, nparams * sizeof (WORD)))
{ {
fclose (fp); fclose (fp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment