aboutsummaryrefslogtreecommitdiff
path: root/generic/tkZinc.c
diff options
context:
space:
mode:
authorlecoanet2003-04-24 14:08:09 +0000
committerlecoanet2003-04-24 14:08:09 +0000
commitb6dfef155807e63d0c855dc2825252c647c302ae (patch)
tree39628393af26b67d2f6771d3688649b9cc51dfdb /generic/tkZinc.c
parent7b596acc974c6611f1b5cecb2ac95576da7debd7 (diff)
downloadtkzinc-b6dfef155807e63d0c855dc2825252c647c302ae.zip
tkzinc-b6dfef155807e63d0c855dc2825252c647c302ae.tar.gz
tkzinc-b6dfef155807e63d0c855dc2825252c647c302ae.tar.bz2
tkzinc-b6dfef155807e63d0c855dc2825252c647c302ae.tar.xz
Corrected glu.h include.
wi->flags was not properly inited (too late). Added max_tex_size with a default value of 64. Shut up some warnings (some not so harmless). Moved the ZnGetTexFont after the window mapping is in effect. The same for glGetIntegerv.
Diffstat (limited to 'generic/tkZinc.c')
-rw-r--r--generic/tkZinc.c43
1 files changed, 24 insertions, 19 deletions
diff --git a/generic/tkZinc.c b/generic/tkZinc.c
index 4f5e7a3..4ed4a4f 100644
--- a/generic/tkZinc.c
+++ b/generic/tkZinc.c
@@ -57,7 +57,7 @@ static const char * const zinc_version = "zinc-version-" VERSION;
#ifndef _WIN32
#include "perfos.h"
#endif
-#include "libtess/glu.h"
+#include "glu.h"
#include <ctype.h>
#include <stdlib.h>
@@ -666,6 +666,10 @@ ZincObjCmd(ClientData client_data, /* Main window associated with
wi->interp = interp;
wi->dpy = Tk_Display(tkwin);
wi->screen = Tk_Screen(tkwin);
+ wi->flags = 0;
+ wi->render = 0;
+ wi->real_top = None;
+
ASSIGN(wi->flags, ZN_HAS_GL, has_gl);
#if defined(SHAPE) && !defined(_WIN32)
@@ -676,8 +680,6 @@ ZincObjCmd(ClientData client_data, /* Main window associated with
CLEAR(wi->flags, ZN_HAS_X_SHAPE);
wi->reshape = wi->full_reshape = False;
#endif
- wi->render = 0;
- wi->real_top = None;
#ifdef PTK
wi->cmd = Lang_CreateWidget(interp, tkwin, (Tcl_CmdProc *) WidgetObjCmd,
@@ -687,7 +689,6 @@ ZincObjCmd(ClientData client_data, /* Main window associated with
wi->cmd = Tcl_CreateObjCommand(interp, Tk_PathName(tkwin), WidgetObjCmd,
(ClientData) wi, CmdDeleted);
#endif
- wi->flags = 0;
wi->binding_table = 0;
wi->fore_color = NULL;
wi->back_color = NULL;
@@ -705,6 +706,7 @@ ZincObjCmd(ClientData client_data, /* Main window associated with
wi->font_tfi = NULL;
wi->map_font_tfi = NULL;
wi->gl_context = NULL;
+ wi->max_tex_size = 64; /* Minimum value is always valid */
# ifndef _WIN32
wi->gl_visual = NULL;
# endif
@@ -2173,10 +2175,10 @@ SetOrigin(ZnWInfo *wi,
* be sure to adjust only by full increments.
*/
if (wi->confine && (wi->region != NULL)) {
- left = x_origin - wi->scroll_xo;
- right = wi->scroll_xc - (x_origin + Tk_Width(wi->win));
- top = y_origin - wi->scroll_yo;
- bottom = wi->scroll_yc - (y_origin + Tk_Height(wi->win));
+ left = (int) (x_origin - wi->scroll_xo);
+ right = (int) (wi->scroll_xc - (x_origin + Tk_Width(wi->win)));
+ top = (int) (y_origin - wi->scroll_yo);
+ bottom = (int) (wi->scroll_yc - (y_origin + Tk_Height(wi->win)));
if ((left < 0) && (right > 0)) {
delta = (right > -left) ? -left : right;
if (wi->x_scroll_incr > 0) {
@@ -2316,8 +2318,8 @@ UpdateScrollbars(ZnWInfo *wi)
if (y_scroll_cmd != NULL) {
Tcl_Preserve((ClientData) y_scroll_cmd);
}
- x_origin = wi->origin.x;
- y_origin = wi->origin.y;
+ x_origin = (int) wi->origin.x;
+ y_origin = (int) wi->origin.y;
width = Tk_Width(wi->win);
height = Tk_Height(wi->win);
scroll_xo = wi->scroll_xo;
@@ -4756,7 +4758,7 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
}
for (j = 0; j < item->class->num_parts; j++) {
Tk_DeleteAllBindings(wi->binding_table,
- (ClientData) EncodeItemPart(item, -(j+2)));
+ (ClientData) EncodeItemPart(item, -(int)(j+2)));
}
}
ZnITEM.DestroyItem(item);
@@ -5464,18 +5466,12 @@ Configure(Tcl_Interp *interp,/* Used for error reporting. */
ZnFreeTexFont(wi->font_tfi);
wi->font_tfi = NULL;
}
- if (wi->render) {
- wi->font_tfi = ZnGetTexFont(wi, wi->font);
- }
}
if (CONFIG_PROBE(MAP_TEXT_FONT_SPEC) || !wi->map_font_tfi) {
if (wi->map_font_tfi) {
ZnFreeTexFont(wi->map_font_tfi);
wi->map_font_tfi = NULL;
}
- if (wi->render) {
- wi->map_font_tfi = ZnGetTexFont(wi, wi->map_text_font);
- }
}
#endif
@@ -5742,13 +5738,23 @@ Event(ClientData client_data, /* Information about widget. */
SET(wi->flags, ZN_REALIZED);
if (wi->render) {
#ifdef GL
- GLfloat r[2];
+ GLfloat r[2]; /* Min, Max */
+ GLint i[1];
ZnGLMakeCurrent(wi);
glGetFloatv(ZN_GL_LINE_WIDTH_RANGE, r);
wi->max_line_width = r[1];
glGetFloatv(ZN_GL_POINT_SIZE_RANGE, r);
wi->max_point_width = r[1];
+ glGetIntegerv(GL_MAX_TEXTURE_SIZE, i);
+ wi->max_tex_size = (unsigned int) i[0];
+
+ if (!wi->font_tfi) {
+ wi->font_tfi = ZnGetTexFont(wi, wi->font);
+ }
+ if (wi->map_font_tfi) {
+ wi->map_font_tfi = ZnGetTexFont(wi, wi->map_text_font);
+ }
if (ISSET(wi->flags, ZN_PRINT_CONFIG)) {
fprintf(stderr, "OpenGL version %s\n",
@@ -7202,7 +7208,6 @@ Redisplay(ClientData client_data) /* Information about the widget. */
do {
/*
* Update the items.
- * NOTE: See above.
*/
Update(wi);