aboutsummaryrefslogtreecommitdiff
path: root/generic/tkZinc.c
diff options
context:
space:
mode:
authorlecoanet2002-01-23 14:25:00 +0000
committerlecoanet2002-01-23 14:25:00 +0000
commit02be4a4f5b51eeafe16b8534e89a702e9089010e (patch)
tree6f5b43dff75c47bf53575e3451f605129851ed68 /generic/tkZinc.c
parent5ab9ee6b0f799e844d5285373bac3cd7a019beec (diff)
downloadtkzinc-02be4a4f5b51eeafe16b8534e89a702e9089010e.zip
tkzinc-02be4a4f5b51eeafe16b8534e89a702e9089010e.tar.gz
tkzinc-02be4a4f5b51eeafe16b8534e89a702e9089010e.tar.bz2
tkzinc-02be4a4f5b51eeafe16b8534e89a702e9089010e.tar.xz
Emet un message si on tente de changer render apr�s la cr�ation.
Redessine tout le widget lors d'un changement de focus ou un enter/leave pour tenter de r�parer les d�gats lors d'un d�placement de fenetre sous GL.
Diffstat (limited to 'generic/tkZinc.c')
-rw-r--r--generic/tkZinc.c49
1 files changed, 42 insertions, 7 deletions
diff --git a/generic/tkZinc.c b/generic/tkZinc.c
index 7b1affb..c33b63b 100644
--- a/generic/tkZinc.c
+++ b/generic/tkZinc.c
@@ -4193,8 +4193,9 @@ Configure(Tcl_Interp *interp,/* Used for error reporting. */
#define CONFIG_PROBE(offset) (ISSET(config_specs[offset].specFlags, \
TK_CONFIG_OPTION_SPECIFIED))
ZnBBox bbox;
- Bool render;
-
+ Bool render, init;
+
+ init = wi->fore_color == NULL;
render = wi->render;
if (Tk_ConfigureWidget(interp, wi->win, config_specs, argc,
#ifdef PTK
@@ -4204,6 +4205,12 @@ Configure(Tcl_Interp *interp,/* Used for error reporting. */
#endif
return ZN_ERROR;
}
+ if (!init) {
+ if (wi->render != render) {
+ ZnWarning("It is not possible to change the -render option after widget creation.");
+ }
+ wi->render = render;
+ }
/*
* Maintain the pick aperture within meaningful bounds.
@@ -4385,6 +4392,15 @@ Focus(WidgetInfo *wi,
if (wi->highlight_width > 0) {
ZnNeedRedisplay(wi);
}
+ if (wi->render) {
+ ZnBBox bbox;
+
+ bbox.orig.x = bbox.orig.y = 0;
+ bbox.corner.x = Tk_Width(wi->win);
+ bbox.corner.y = Tk_Height(wi->win);
+ ITEM_P.Damage(wi, &bbox);
+ ZnNeedRedisplay(wi);
+ }
}
@@ -4411,19 +4427,19 @@ Event(ClientData client_data, /* Information about widget. */
{
WidgetInfo *wi = (WidgetInfo *) client_data;
- /*printf("=============== DEBUT %s EVENT ==================\n",
+ /*printf("=============== DEBUT %s %d EVENT ==================\n",
event->type == MapNotify ? "MAP":
event->type == Expose? "EXPOSE" :
event->type == ConfigureNotify ? "CONFIGURE" :
event->type == DestroyNotify ? "DESTROY" :
- "??");*/
+ "??", event->type);*/
if (event->type == MapNotify) {
if (!wi->gc) {
wi->realized = True;
if (wi->render) {
#ifdef GLX
GLfloat r[2];
-
+
glXMakeCurrent(wi->dpy, ZnWindowId(wi->win), wi->gl_context);
/*glGetFloatv(GL_ALIASED_LINE_WIDTH_RANGE, r);*/
glGetFloatv(GL_SMOOTH_LINE_WIDTH_RANGE, r);
@@ -4498,7 +4514,7 @@ Event(ClientData client_data, /* Information about widget. */
* if we are done adding exposed parts.
*/
AddBBoxToBBox(&wi->exposed_area, &bbox);
- if ((((XExposeEvent*) event)->count == 0) &&
+ if (/*(((XExposeEvent*) event)->count == 0) &&*/
!IsEmptyBBox(&wi->exposed_area)) {
ZnNeedRedisplay(wi);
}
@@ -4550,8 +4566,8 @@ Event(ClientData client_data, /* Information about widget. */
bbox.corner.x = Tk_Width(wi->win);
bbox.corner.y = Tk_Height(wi->win);
AddBBoxToBBox(&wi->exposed_area, &bbox);
- ZnNeedRedisplay(wi);
}
+ ZnNeedRedisplay(wi);
}
/*
* Take into account that the window has been actually cancelled.
@@ -5050,6 +5066,25 @@ Bind(ClientData client_data, /* Information about widget. */
}
else if ((event->type == EnterNotify) || (event->type == LeaveNotify)) {
+#ifdef GLX_DAMAGE
+ /*
+ * Kludge to prevent incorrect redrawing after
+ * a move window when using GL. This code force
+ * a full window redraw on window enter/leaves
+ * hoping it will realign the back buffer soon
+ * enough to make the bug unnoticed.
+ */
+ if (wi->render) {
+ ZnBBox bbox;
+
+ bbox.orig.x = bbox.orig.y = 0;
+ bbox.corner.x = Tk_Width(wi->win);
+ bbox.corner.y = Tk_Height(wi->win);
+ ITEM_P.Damage(wi, &bbox);
+ ZnNeedRedisplay(wi);
+ }
+#endif
+
wi->state = event->xcrossing.state;
PickCurrentItem(wi, event);
goto done;