mirror of https://github.com/GNOME/gimp.git
Merge from stable: On Win32 (with no X11), don't include <X11/Xlib.h>. (Do
2003-07-27 Tor Lillqvist <tml@iki.fi> * plug-ins/common/xpm.c: Merge from stable: On Win32 (with no X11), don't include <X11/Xlib.h>. (Do include <X11/xpm.h>, though, as such a file is provided by the libXpm-noX package.) (parse_colors): If XPM_NO_X (Win32), use GDK to parse color names.
This commit is contained in:
parent
8ed4e82cb9
commit
f62a884ea1
|
@ -6,6 +6,11 @@
|
||||||
the _destroy entries). The files where these are defined go in
|
the _destroy entries). The files where these are defined go in
|
||||||
libgimp, not libgimpui (see Makefile.am). Sort the .def files.
|
libgimp, not libgimpui (see Makefile.am). Sort the .def files.
|
||||||
|
|
||||||
|
* plug-ins/common/xpm.c: Merge from stable: On Win32 (with no
|
||||||
|
X11), don't include <X11/Xlib.h>. (Do include <X11/xpm.h>, though,
|
||||||
|
as such a file is provided by the libXpm-noX package.)
|
||||||
|
(parse_colors): If XPM_NO_X (Win32), use GDK to parse color names.
|
||||||
|
|
||||||
2003-07-26 Tor Lillqvist <tml@iki.fi>
|
2003-07-26 Tor Lillqvist <tml@iki.fi>
|
||||||
|
|
||||||
* plug-ins/libgck/gck/Makefile.am: Use -no-undefined on Windows.
|
* plug-ins/libgck/gck/Makefile.am: Use -no-undefined on Windows.
|
||||||
|
|
|
@ -46,11 +46,19 @@ Previous...Inherited code from Ray Lehtiniemi, who inherited it from S & P.
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <X11/Xlib.h>
|
|
||||||
#include <X11/xpm.h>
|
|
||||||
|
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
|
||||||
|
#ifdef GDK_WINDOWING_WIN32
|
||||||
|
#ifndef XPM_NO_X
|
||||||
|
#define XPM_NO_X
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#include <X11/Xlib.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <X11/xpm.h>
|
||||||
|
|
||||||
#include <libgimp/gimp.h>
|
#include <libgimp/gimp.h>
|
||||||
#include <libgimp/gimpui.h>
|
#include <libgimp/gimpui.h>
|
||||||
|
|
||||||
|
@ -361,15 +369,19 @@ load_image (const gchar *filename)
|
||||||
static guchar*
|
static guchar*
|
||||||
parse_colors (XpmImage *xpm_image)
|
parse_colors (XpmImage *xpm_image)
|
||||||
{
|
{
|
||||||
|
#ifndef XPM_NO_X
|
||||||
Display *display;
|
Display *display;
|
||||||
Colormap colormap;
|
Colormap colormap;
|
||||||
|
#endif
|
||||||
gint i, j;
|
gint i, j;
|
||||||
guchar *cmap;
|
guchar *cmap;
|
||||||
|
|
||||||
|
#ifndef XPM_NO_X
|
||||||
/* open the display and get the default color map */
|
/* open the display and get the default color map */
|
||||||
display = XOpenDisplay (NULL);
|
display = XOpenDisplay (NULL);
|
||||||
colormap = DefaultColormap (display, DefaultScreen (display));
|
colormap = DefaultColormap (display, DefaultScreen (display));
|
||||||
|
#endif
|
||||||
|
|
||||||
/* alloc a buffer to hold the parsed colors */
|
/* alloc a buffer to hold the parsed colors */
|
||||||
cmap = g_new0 (guchar, 4 * xpm_image->ncolors);
|
cmap = g_new0 (guchar, 4 * xpm_image->ncolors);
|
||||||
|
|
||||||
|
@ -378,7 +390,11 @@ parse_colors (XpmImage *xpm_image)
|
||||||
{
|
{
|
||||||
gchar *colorspec = "None";
|
gchar *colorspec = "None";
|
||||||
XpmColor *xpm_color;
|
XpmColor *xpm_color;
|
||||||
|
#ifndef XPM_NO_X
|
||||||
XColor xcolor;
|
XColor xcolor;
|
||||||
|
#else
|
||||||
|
GdkColor xcolor;
|
||||||
|
#endif
|
||||||
|
|
||||||
xpm_color = &(xpm_image->colorTable[i]);
|
xpm_color = &(xpm_image->colorTable[i]);
|
||||||
|
|
||||||
|
@ -396,7 +412,11 @@ parse_colors (XpmImage *xpm_image)
|
||||||
g_new will memset the buffer to zeros */
|
g_new will memset the buffer to zeros */
|
||||||
if (strcmp (colorspec, "None") != 0)
|
if (strcmp (colorspec, "None") != 0)
|
||||||
{
|
{
|
||||||
|
#ifndef XPM_NO_X
|
||||||
XParseColor (display, colormap, colorspec, &xcolor);
|
XParseColor (display, colormap, colorspec, &xcolor);
|
||||||
|
#else
|
||||||
|
gdk_color_parse (colorspec, &xcolor);
|
||||||
|
#endif
|
||||||
cmap[j++] = xcolor.red >> 8;
|
cmap[j++] = xcolor.red >> 8;
|
||||||
cmap[j++] = xcolor.green >> 8;
|
cmap[j++] = xcolor.green >> 8;
|
||||||
cmap[j++] = xcolor.blue >> 8;
|
cmap[j++] = xcolor.blue >> 8;
|
||||||
|
@ -407,9 +427,9 @@ parse_colors (XpmImage *xpm_image)
|
||||||
j += 4;
|
j += 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#ifndef XPM_NO_X
|
||||||
XCloseDisplay (display);
|
XCloseDisplay (display);
|
||||||
|
#endif
|
||||||
return cmap;
|
return cmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue