aboutsummaryrefslogtreecommitdiff
path: root/generic/tkZinc.c
diff options
context:
space:
mode:
authorlecoanet2002-06-10 13:07:20 +0000
committerlecoanet2002-06-10 13:07:20 +0000
commit21fbda1bf732caa83dcda3773dbaddcb096dad40 (patch)
tree4b7e03d175589a32a8c14d19598fe87a6721065e /generic/tkZinc.c
parent0c0d230370db2bec121a1302e4d3310f73b4016a (diff)
downloadtkzinc-21fbda1bf732caa83dcda3773dbaddcb096dad40.zip
tkzinc-21fbda1bf732caa83dcda3773dbaddcb096dad40.tar.gz
tkzinc-21fbda1bf732caa83dcda3773dbaddcb096dad40.tar.bz2
tkzinc-21fbda1bf732caa83dcda3773dbaddcb096dad40.tar.xz
* Tsave poss�de une fonctionalit� suppl�mentaire: lorsqu'elle est
appel�e avec 1 seul param�tre (le nom d'une transfo, elle dit si ce nom de transfo est d�j� utilis�). * Gname poss�de une fonctionalit� suppl�mentaire: lorsqu'elle est appel�e avec 1 seul param�tre (le nom d'un gradient, elle dit si ce nom de gradient est d�j� utilis�).
Diffstat (limited to 'generic/tkZinc.c')
-rw-r--r--generic/tkZinc.c102
1 files changed, 61 insertions, 41 deletions
diff --git a/generic/tkZinc.c b/generic/tkZinc.c
index f84f03d..ef300bf 100644
--- a/generic/tkZinc.c
+++ b/generic/tkZinc.c
@@ -598,18 +598,48 @@ ZincObjCmd(ClientData client_data, /* Main window associated with
Tk_Window tkwin;
unsigned int num;
int major_op, first_err, first_evt;
+ int major_glx, minor_glx;
+ ZnBool has_glx = False;
+#ifdef GLX
+ Display *dpy = Tk_Display(top_w);
+ Screen *screen = Tk_Screen(top_w);
+ int attribs[] = {
+ GLX_RGBA,
+ GLX_DOUBLEBUFFER,
+ GLX_BUFFER_SIZE, 24,
+ /*GLX_BUFFER_SIZE, 32,*/
+ GLX_STENCIL_SIZE, 8,
+ /*GLX_ALPHA_SIZE, 8,*/
+ None
+ };
+#endif
InitZinc(interp);
+#ifdef GLX
+ if (XQueryExtension(dpy, "GLX", &major_op, &first_evt, &first_err)) {
+ if (glXQueryExtension(dpy, &first_err, &first_evt)) {
+ if (glXQueryVersion(dpy, &major_glx, &minor_glx)) {
+ if ((major_glx == 1) && (minor_glx >= 1)) {
+ has_glx = True;
+ }
+ }
+ }
+ }
+#endif
if (argc == 1) {
Tcl_AppendResult(interp, ZINCVERSION, NULL);
+ Tcl_AppendResult(interp, " X11", NULL);
+#ifdef GLX
+ if (has_glx && glXChooseVisual(dpy,
+ XScreenNumberOfScreen(screen),
+ attribs)) {
+ Tcl_AppendResult(interp, " GL", NULL);
+ }
+#endif
return TCL_OK;
}
- if (argc < 2) {
- Tcl_WrongNumArgs(interp, 1, args, "pathName ?options?");
- return ZN_ERROR;
- }
-
+
tkwin = Tk_CreateWindowFromPath(interp, top_w, Tcl_GetString(args[1]), NULL);
if (tkwin == NULL) {
return ZN_ERROR;
@@ -624,24 +654,7 @@ ZincObjCmd(ClientData client_data, /* Main window associated with
wi->interp = interp;
wi->dpy = Tk_Display(tkwin);
wi->screen = Tk_Screen(tkwin);
- wi->has_glx = False;
-#ifdef GLX
- if (XQueryExtension(wi->dpy, "GLX", &major_op, &first_evt, &first_err)) {
- if (glXQueryExtension(wi->dpy, &first_err, &first_evt)) {
- int minor_op;
- if (glXQueryVersion(wi->dpy, &major_op, &minor_op)) {
- if ((major_op == 1) && (minor_op >= 1)) {
-#if GLX_PRINT_CONFIG
- if (wi->render) {
- printf("GLX version %d.%d\n", major_op, minor_op);
- }
-#endif
- wi->has_glx = True;
- }
- }
- }
- }
-#endif
+ wi->has_glx = has_glx;;
#ifdef SHAPE
wi->has_x_shape = XQueryExtension(wi->dpy, "SHAPE",
@@ -786,16 +799,10 @@ ZincObjCmd(ClientData client_data, /* Main window associated with
#ifdef GLX_PRINT_CONFIG
int val;
#endif
- int attribs[] = {
- GLX_RGBA,
- GLX_DOUBLEBUFFER,
- GLX_BUFFER_SIZE, 24,
- /*GLX_BUFFER_SIZE, 32,*/
- GLX_STENCIL_SIZE, 8,
- /*GLX_ALPHA_SIZE, 8,*/
- None
- };
+#if GLX_PRINT_CONFIG
+ printf("GLX version %d.%d\n", major_glx, minor_glx);
+#endif
wi->gl_visual = glXChooseVisual(wi->dpy,
XScreenNumberOfScreen(wi->screen),
attribs);
@@ -3575,15 +3582,22 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
{
ZnBool ok;
- if (argc != 4) {
- Tcl_WrongNumArgs(interp, 1, args, "gname grad gName");
+ if ((argc != 3) && (argc != 4)) {
+ Tcl_WrongNumArgs(interp, 1, args, "gname ?grad? gName");
goto error;
}
- ok = ZnNameGradient(interp, wi->win, Tcl_GetString(args[2]), Tcl_GetString(args[3]));
- if (!ok) {
- Tcl_AppendResult(interp, "gradient name \"", Tcl_GetString(args[3]),
- "\", already in use or incorrect specification", NULL);
- goto error;
+ if (argc == 3) {
+ l = NewBooleanObj(ZnGradientNameExists(Tcl_GetString(args[2])));
+ Tcl_SetObjResult(interp, l);
+ }
+ else {
+ ok = ZnNameGradient(interp, wi->win, Tcl_GetString(args[2]),
+ Tcl_GetString(args[3]));
+ if (!ok) {
+ Tcl_AppendResult(interp, "gradient name \"", Tcl_GetString(args[3]),
+ "\", already in use or incorrect specification", NULL);
+ goto error;
+ }
}
}
break;
@@ -4500,10 +4514,16 @@ WidgetObjCmd(ClientData client_data, /* Information about the widget. */
int new, invert=0;
ZnTransfo *inv;
- if ((argc != 4) && (argc != 5)) {
- Tcl_WrongNumArgs(interp, 1, args, "tsave tagOrId tName ?invert?");
+ if ((argc != 3) && (argc != 4) && (argc != 5)) {
+ Tcl_WrongNumArgs(interp, 1, args, "tsave ?tagOrId? tName ?invert?");
goto error;
}
+ if (argc == 3) {
+ entry = Tcl_FindHashEntry(wi->t_table, Tcl_GetString(args[2]));
+ l = NewBooleanObj(entry != NULL);
+ Tcl_SetObjResult(interp, l);
+ goto done;
+ }
result = ZnItemWithTagOrId(wi, args[2], &item, &search_var);
if ((result == ZN_ERROR) || (item == ZN_NO_ITEM)) {
goto error;