aboutsummaryrefslogtreecommitdiff
path: root/generic
diff options
context:
space:
mode:
Diffstat (limited to 'generic')
-rw-r--r--generic/tkZinc.c73
1 files changed, 43 insertions, 30 deletions
diff --git a/generic/tkZinc.c b/generic/tkZinc.c
index bd02059..21447cd 100644
--- a/generic/tkZinc.c
+++ b/generic/tkZinc.c
@@ -173,8 +173,6 @@ static Tk_ConfigSpec config_specs[] = {
"600", Tk_Offset(WidgetInfo, insert_on_time), 0},
{TK_CONFIG_PIXELS, "-insertwidth", "insertWidth", "InsertWidth",
"2", Tk_Offset(WidgetInfo, text_info.insert_width), 0},
- {TK_CONFIG_BOOLEAN, "-localrender", "localRender", "LocalRender",
- "0", Tk_Offset(WidgetInfo, local_render), 0},
{TK_CONFIG_BITMAP, "-mapdistancesymbol", "mapDistanceSymbol", "MapDistanceSymbol",
"AtcSymbol19", Tk_Offset(WidgetInfo, map_distance_symbol), TK_CONFIG_NULL_OK},
{TK_CONFIG_FONT, "-maptextfont", "mapTextFont", "MapTextFont",
@@ -188,6 +186,8 @@ static Tk_ConfigSpec config_specs[] = {
"1", Tk_Offset(WidgetInfo, pick_aperture), 0},
{TK_CONFIG_RELIEF, "-relief", "relief", "Relief",
"flat", Tk_Offset(WidgetInfo, relief), 0},
+ {TK_CONFIG_BOOLEAN, "-render", "render", "Render",
+ "0", Tk_Offset(WidgetInfo, render), 0},
{TK_CONFIG_BOOLEAN, "-reshape", "reshape", "Reshape",
"1", Tk_Offset(WidgetInfo, reshape), 0},
{TK_CONFIG_COLOR, "-selectbackground", "selectBackground", "Foreground",
@@ -234,12 +234,12 @@ static Tk_ConfigSpec config_specs[] = {
#define INSERT_OFF_TIME_SPEC 11
#define INSERT_ON_TIME_SPEC 12
#define INSERT_WIDTH_SPEC 13
-#define LOCAL_RENDER_SPEC 14
-#define MAP_DISTANCE_SYMBOL_SPEC 15
-#define MAP_TEXT_FONT_SPEC 16
-#define OVERLAP_MANAGER_SPEC 17
-#define PICK_APERTURE_SPEC 18
-#define RELIEF_SPEC 19
+#define MAP_DISTANCE_SYMBOL_SPEC 14
+#define MAP_TEXT_FONT_SPEC 15
+#define OVERLAP_MANAGER_SPEC 16
+#define PICK_APERTURE_SPEC 17
+#define RELIEF_SPEC 18
+#define RENDER_SPEC 19
#define RESHAPE_SPEC 20
#define SELECT_COLOR_SPEC 21
#define SPEED_VECTOR_LENGTH_SPEC 22
@@ -377,6 +377,7 @@ ZnNeedRedisplay(WidgetInfo *wi)
*
*----------------------------------------------------------------------
*/
+#ifdef LIBART
#ifdef SHM
void
CreateSharedImageBuffer(WidgetInfo *wi)
@@ -390,7 +391,7 @@ CreateSharedImageBuffer(WidgetInfo *wi)
wi->width, wi->height);
if (wi->draw_buffer_im == NULL) {
ZnWarning("XShmCreateImage failed, unable to use local rendering");
- wi->local_render = False;
+ wi->render = False;
}
else {
wi->x_shm_info.shmid = shmget(IPC_PRIVATE,
@@ -401,7 +402,7 @@ CreateSharedImageBuffer(WidgetInfo *wi)
XDestroyImage(wi->draw_buffer_im);
wi->draw_buffer_im = NULL;
ZnWarning("shmget failed, unable to use local rendering");
- wi->local_render = False;
+ wi->render = False;
}
else {
wi->x_shm_info.readOnly = False;
@@ -412,7 +413,7 @@ CreateSharedImageBuffer(WidgetInfo *wi)
XDestroyImage(wi->draw_buffer_im);
wi->draw_buffer_im = NULL;
ZnWarning("shmat failed, unable to use local rendering");
- wi->local_render = False;
+ wi->render = False;
}
else {
wi->buf.buf = ZnMalloc(wi->draw_buffer_im->bytes_per_line *
@@ -435,6 +436,7 @@ CreateSharedImageBuffer(WidgetInfo *wi)
}
}
#endif
+#endif
/*
@@ -506,7 +508,7 @@ ZincObjCmd(ClientData client_data, /* Main window associated with
wi->has_x_input = XQueryExtension(wi->dpy, "XInputExtension",
&major_op, &first_evt, &first_err);
wi->reshape = wi->full_reshape = True;
- wi->local_render = False;
+ wi->render = False;
wi->real_top = None;
#ifdef PTK
@@ -559,7 +561,9 @@ ZincObjCmd(ClientData client_data, /* Main window associated with
#endif
wi->gc = 0;
wi->draw_buffer = 0;
+#ifdef LIBART
wi->draw_buffer_im = 0;
+#endif
wi->events_flags = 0;
wi->pick_aperture = 0;
wi->new_item = wi->current_item = ZN_NO_ITEM;
@@ -629,12 +633,14 @@ ZincObjCmd(ClientData client_data, /* Main window associated with
/*
* Allocate double buffer pixmap/image.
*/
- if (wi->local_render) {
+ if (wi->render) {
+#ifdef LIBART
#ifdef SHM
CreateSharedImageBuffer(wi);
#endif
+#endif
}
- if (!wi->local_render) {
+ if (!wi->render) {
wi->draw_buffer = XCreatePixmap(wi->dpy, RootWindowOfScreen(wi->screen),
wi->width, wi->height, Tk_Depth(wi->win));
}
@@ -4229,11 +4235,9 @@ Configure(Tcl_Interp *interp,/* Used for error reporting. */
#define CONFIG_PROBE(offset) (ISSET(config_specs[offset].specFlags, \
TK_CONFIG_OPTION_SPECIFIED))
ZnBBox bbox;
- Visual *visual;
- int depth;
- Bool local_render;
+ Bool render;
- local_render = wi->local_render;
+ render = wi->render;
if (Tk_ConfigureWidget(interp, wi->win, config_specs, argc,
#ifdef PTK
(Tcl_Obj **) args, (char *) wi, flags) != TCL_OK) {
@@ -4243,30 +4247,34 @@ Configure(Tcl_Interp *interp,/* Used for error reporting. */
return ZN_ERROR;
}
+#ifdef LIBART
if (flags & TK_CONFIG_ARGV_ONLY) {
/*
* Do not allow modification of the rendering scheme after
* the widget creation.
*/
- wi->local_render = local_render;
+ wi->render = render;
}
else {
+ Visual *visual;
+ int depth;
/*
* Turn off local rendering if shared memory is not supported.
* or if we cannot use the chosen visual, we cannot work with
* any visuals, only true color, 16, 24, 32 bits, and perhaps 15 bits
* and direct color (to be checked).
*/
- wi->local_render = wi->local_render && wi->has_x_shm;
- if (wi->local_render) {
+ wi->render = wi->render && wi->has_x_shm;
+ if (wi->render) {
visual = Tk_Visual(wi->win);
depth = Tk_Depth(wi->win);
if (((visual->class != TrueColor) && (visual->class != DirectColor)) ||
((depth != 16) && (depth != 24) && (depth != 32))) {
- wi->local_render = False;
+ wi->render = False;
}
}
}
+#endif
/*
* Maintain the pick aperture within meaningful bounds.
@@ -4568,7 +4576,8 @@ Event(ClientData client_data, /* Information about widget. */
/*
* Reallocate the double buffer pixmap/image.
*/
- if (wi->local_render) {
+ if (wi->render) {
+#ifdef LIBART
#ifdef SHM
/* Free the image and allocate a bigger one. */
XShmDetach(wi->dpy, &wi->x_shm_info);
@@ -4579,8 +4588,9 @@ Event(ClientData client_data, /* Information about widget. */
ZnFree(wi->buf.buf);
CreateSharedImageBuffer(wi);
#endif
+#endif
}
- if (!wi->local_render) {
+ if (!wi->render) {
XFreePixmap(wi->dpy, wi->draw_buffer);
wi->draw_buffer = XCreatePixmap(wi->dpy, RootWindowOfScreen(wi->screen),
wi->width, wi->height,
@@ -5313,9 +5323,9 @@ Destroy(char *mem_ptr) /* Info about the widget. */
*/
/* Free all items. */
- printf("Remaining item count: %d\n", wi->num_items);
+ fprintf(stderr, "Item count before cleanup: %d\n", wi->num_items);
ITEM.DestroyItem(wi->top_group);
- printf("Remaining item count: %d\n", wi->num_items);
+ fprintf(stderr, "Remaining item count: %d\n", wi->num_items);
for (num = 0; num < NUM_ALPHA_STEPS; num++) {
if (wi->alpha_stipples[num] != None) {
@@ -5351,16 +5361,17 @@ Destroy(char *mem_ptr) /* Info about the widget. */
if (wi->draw_buffer) {
XFreePixmap(wi->dpy, wi->draw_buffer);
}
- if (wi->draw_buffer_im) {
+#ifdef LIBART
#ifdef SHM
+ if (wi->draw_buffer_im) {
XShmDetach(wi->dpy, &wi->x_shm_info);
XDestroyImage(wi->draw_buffer_im);
shmdt(wi->x_shm_info.shmaddr);
shmctl(wi->x_shm_info.shmid, IPC_RMID, 0);
ZnFree(wi->buf.buf);
-#endif
}
-
+#endif
+#endif
Tcl_DeleteTimerHandler(wi->blink_handler);
Tk_FreeOptions(config_specs, (char *) wi, wi->dpy, 0);
@@ -5463,11 +5474,13 @@ Redisplay(ClientData client_data) /* Information about the widget. */
AddBBoxToBBox(&merge, &wi->exposed_area);
if (!IsEmptyBBox(&merge)) {
BBox2XRect(&merge, &r);
- if (wi->local_render) {
+ if (wi->render) {
+#ifdef LIBART
#ifdef SHM
XPutImage(wi->dpy, ZnWindowId(wi->win), wi->gc, wi->draw_buffer_im,
r.x, r.y, r.x+wi->inset, r.y+wi->inset, r.width, r.height);
#endif
+#endif
}
else {
XCopyArea(wi->dpy,