mirror of
https://github.com/gryf/wmaker.git
synced 2026-01-06 13:54:12 +01:00
Initial update from my source tree. For 0.52.0
This commit is contained in:
@@ -4,14 +4,13 @@ AUTOMAKE_OPTIONS = no-dependencies
|
||||
|
||||
lib_LTLIBRARIES = libwraster.la
|
||||
|
||||
libwraster_la_LDFLAGS = -version-info 2:0:1
|
||||
libwraster_la_LDFLAGS = -version-info 2:1:1
|
||||
|
||||
bin_SCRIPTS = get-wraster-flags
|
||||
|
||||
noinst_PROGRAMS = testgrad testdraw view
|
||||
|
||||
EXTRA_DIST = test.png tile.xpm ballot_box.xpm
|
||||
|
||||
include_HEADERS = wraster.h
|
||||
|
||||
libwraster_la_SOURCES = \
|
||||
|
||||
@@ -91,14 +91,13 @@ AUTOMAKE_OPTIONS = no-dependencies
|
||||
|
||||
lib_LTLIBRARIES = libwraster.la
|
||||
|
||||
libwraster_la_LDFLAGS = -version-info 2:0:1
|
||||
libwraster_la_LDFLAGS = -version-info 2:1:1
|
||||
|
||||
bin_SCRIPTS = get-wraster-flags
|
||||
|
||||
noinst_PROGRAMS = testgrad testdraw view
|
||||
|
||||
EXTRA_DIST = test.png tile.xpm ballot_box.xpm
|
||||
|
||||
include_HEADERS = wraster.h
|
||||
|
||||
libwraster_la_SOURCES = raster.c draw.c color.c load.c save.c gradient.c xpixmap.c convert.c context.c misc.c scale.c convolve.c nxpm.c xpm.c xutil.c ppm.c png.c jpeg.c tiff.c gif.c
|
||||
@@ -165,7 +164,7 @@ Makefile.in NEWS TODO alloca.c configure.in
|
||||
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
TAR = gtar
|
||||
GZIP_ENV = --best
|
||||
SOURCES = $(libwraster_la_SOURCES) $(testgrad_SOURCES) $(testdraw_SOURCES) $(view_SOURCES)
|
||||
OBJECTS = $(libwraster_la_OBJECTS) $(testgrad_OBJECTS) $(testdraw_OBJECTS) $(view_OBJECTS)
|
||||
|
||||
@@ -39,8 +39,8 @@
|
||||
#define RLRASTER_H_
|
||||
|
||||
|
||||
/* version of the header for the library: 0.13 */
|
||||
#define WRASTER_HEADER_VERSION 13
|
||||
/* version of the header for the library: 0.14 */
|
||||
#define WRASTER_HEADER_VERSION 14
|
||||
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
@@ -381,12 +381,15 @@ int RConvertImageMask(RContext *context, RImage *image, Pixmap *pixmap,
|
||||
RXImage *RCreateXImage(RContext *context, int depth,
|
||||
unsigned width, unsigned height);
|
||||
|
||||
RXImage *RGetXImage(RContext *context, Drawable d, int x, int y,
|
||||
unsigned width, unsigned height);
|
||||
|
||||
void RDestroyXImage(RContext *context, RXImage *ximage);
|
||||
|
||||
void RPutXImage(RContext *context, Drawable d, GC gc, RXImage *ximage,
|
||||
int src_x, int src_y, int dest_x, int dest_y,
|
||||
int src_x, int src_y, int dest_x, int dest_y,
|
||||
unsigned width, unsigned height);
|
||||
|
||||
|
||||
/* do not free the returned string! */
|
||||
const char *RMessageForError(int errorCode);
|
||||
|
||||
|
||||
@@ -171,6 +171,7 @@ RDestroyXImage(RContext *context, RXImage *rximage)
|
||||
free(rximage);
|
||||
#else /* XSHM */
|
||||
if (rximage->is_shared) {
|
||||
XSync(context->dpy, False);
|
||||
XShmDetach(context->dpy, &rximage->info);
|
||||
XDestroyImage(rximage->image);
|
||||
if (shmdt(rximage->info.shmaddr) < 0)
|
||||
@@ -184,6 +185,66 @@ RDestroyXImage(RContext *context, RXImage *rximage)
|
||||
}
|
||||
|
||||
|
||||
static unsigned
|
||||
getDepth(Display *dpy, Drawable d)
|
||||
{
|
||||
Window w;
|
||||
int foo;
|
||||
unsigned bar;
|
||||
unsigned depth;
|
||||
|
||||
XGetGeometry(dpy, d, &w, &foo, &foo, &bar, &bar, &bar, &depth);
|
||||
|
||||
return depth;
|
||||
}
|
||||
|
||||
|
||||
|
||||
RXImage*
|
||||
RGetXImage(RContext *context, Drawable d, int x, int y,
|
||||
unsigned width, unsigned height)
|
||||
{
|
||||
RXImage *ximg = NULL;
|
||||
|
||||
#ifdef XSHM
|
||||
if (context->attribs->use_shared_memory && 0) {
|
||||
ximg = RCreateXImage(context, getDepth(context->dpy, d),
|
||||
width, height);
|
||||
|
||||
if (ximg && !ximg->is_shared) {
|
||||
RDestroyXImage(context, ximg);
|
||||
ximg = NULL;
|
||||
}
|
||||
if (ximg) {
|
||||
XShmGetImage(context->dpy, d, ximg->image, x, y, AllPlanes);
|
||||
}
|
||||
}
|
||||
if (!ximg) {
|
||||
ximg = malloc(sizeof(RXImage));
|
||||
if (!ximg) {
|
||||
RErrorCode = RERR_NOMEMORY;
|
||||
return NULL;
|
||||
}
|
||||
ximg->is_shared = 0;
|
||||
ximg->image = XGetImage(context->dpy, d, x, y, width, height,
|
||||
AllPlanes, ZPixmap);
|
||||
}
|
||||
return ximg;
|
||||
#else /* !XSHM */
|
||||
ximg = malloc(sizeof(RXImage));
|
||||
if (!ximg) {
|
||||
RErrorCode = RERR_NOMEMORY;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ximg->image = XGetImage(context->dpy, d, x, y, width, height,
|
||||
AllPlanes, ZPixmap);
|
||||
|
||||
return ximg;
|
||||
#endif /* !XSHM */
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
RPutXImage(RContext *context, Drawable d, GC gc, RXImage *ximage, int src_x,
|
||||
int src_y, int dest_x, int dest_y,
|
||||
|
||||
Reference in New Issue
Block a user