XWorkstation.st
changeset 3608 6ac2b6c8fbd8
parent 3603 3665199a413f
child 3609 5742cce8a004
equal deleted inserted replaced
3607:62e5a818d378 3608:6ac2b6c8fbd8
  3123     if (ISCONNECTED
  3123     if (ISCONNECTED
  3124      && __isExternalAddress(aGCId)
  3124      && __isExternalAddress(aGCId)
  3125      && __isExternalAddress(aDrawableId)
  3125      && __isExternalAddress(aDrawableId)
  3126      && __bothSmallInteger(x0, y0)
  3126      && __bothSmallInteger(x0, y0)
  3127      && __bothSmallInteger(x1, y1)) {
  3127      && __bothSmallInteger(x1, y1)) {
  3128         Display *dpy = myDpy;
  3128 	Display *dpy = myDpy;
  3129         int ix0, iy0, ix1, iy1;
  3129 	int ix0, iy0, ix1, iy1;
  3130         gc = __GCVal(aGCId);
  3130 	gc = __GCVal(aGCId);
  3131         win = __WindowVal(aDrawableId);
  3131 	win = __WindowVal(aDrawableId);
  3132 
  3132 
  3133         ix0 = __intVal(x0);
  3133 	ix0 = __intVal(x0);
  3134         iy0 = __intVal(y0);
  3134 	iy0 = __intVal(y0);
  3135         ix1 = __intVal(x1);
  3135 	ix1 = __intVal(x1);
  3136         iy1 = __intVal(y1);
  3136 	iy1 = __intVal(y1);
  3137 
  3137 
  3138         /* attention: coordinates in X are shorts and wrap; clamp here. */
  3138 	/* attention: coordinates in X are shorts and wrap; clamp here. */
  3139         if (ix0 > 0x7FFF) ix0 = 0x7FFF;
  3139 	if (ix0 > 0x7FFF) ix0 = 0x7FFF;
  3140         else if (ix0 < -0x8000) ix0 = -0x8000;
  3140 	else if (ix0 < -0x8000) ix0 = -0x8000;
  3141         if (iy0 > 0x7FFF) iy0 = 0x7FFF;
  3141 	if (iy0 > 0x7FFF) iy0 = 0x7FFF;
  3142         else if (iy0 < -0x8000) iy0 = -0x8000;
  3142 	else if (iy0 < -0x8000) iy0 = -0x8000;
  3143         if (ix1 > 0x7FFF) ix1 = 0x7FFF;
  3143 	if (ix1 > 0x7FFF) ix1 = 0x7FFF;
  3144         else if (ix1 < -0x8000) ix1 = -0x8000;
  3144 	else if (ix1 < -0x8000) ix1 = -0x8000;
  3145         if (iy1 > 0x7FFF) iy1 = 0x7FFF;
  3145 	if (iy1 > 0x7FFF) iy1 = 0x7FFF;
  3146         else if (iy1 < -0x8000) iy1 = -0x8000;
  3146 	else if (iy1 < -0x8000) iy1 = -0x8000;
  3147 
  3147 
  3148         ENTER_XLIB();
  3148 	ENTER_XLIB();
  3149         if ((ix0 == ix1) && (iy0 == iy1)) {
  3149 	if ((ix0 == ix1) && (iy0 == iy1)) {
  3150             /* little bit shorter X-lib message (better with slow connections...) */
  3150 	    /* little bit shorter X-lib message (better with slow connections...) */
  3151             XDrawPoint(dpy, win, gc, ix0, iy0);
  3151 	    XDrawPoint(dpy, win, gc, ix0, iy0);
  3152         } else {
  3152 	} else {
  3153             XDrawLine(dpy, win, gc, ix0, iy0, ix1, iy1);
  3153 	    XDrawLine(dpy, win, gc, ix0, iy0, ix1, iy1);
  3154         }
  3154 	}
  3155         LEAVE_XLIB();
  3155 	LEAVE_XLIB();
  3156         RETURN ( self );
  3156 	RETURN ( self );
  3157     }
  3157     }
  3158 %}.
  3158 %}.
  3159     "badGC, badDrawable or coordinates not integer"
  3159     "badGC, badDrawable or coordinates not integer"
  3160     self primitiveFailedOrClosedConnection
  3160     self primitiveFailedOrClosedConnection
  3161 !
  3161 !
  3168     <context: #return>
  3168     <context: #return>
  3169 
  3169 
  3170     |noY|
  3170     |noY|
  3171 
  3171 
  3172     (noY := yValues size) < 2 ifTrue:[
  3172     (noY := yValues size) < 2 ifTrue:[
  3173         ^ self
  3173 	^ self
  3174     ].
  3174     ].
  3175 
  3175 
  3176 %{
  3176 %{
  3177     OBJ      yA, t;
  3177     OBJ      yA, t;
  3178     int      i, num;
  3178     int      i, num;
  3185     Window win;
  3185     Window win;
  3186 
  3186 
  3187     if (ISCONNECTED
  3187     if (ISCONNECTED
  3188      && __isExternalAddress(aGCId)
  3188      && __isExternalAddress(aGCId)
  3189      && __isExternalAddress(aDrawableId) ) {
  3189      && __isExternalAddress(aDrawableId) ) {
  3190         gc = __GCVal(aGCId);
  3190 	gc = __GCVal(aGCId);
  3191         win = __WindowVal(aDrawableId);
  3191 	win = __WindowVal(aDrawableId);
  3192 
  3192 
  3193         if( __isSmallInteger(scaleY) ) 
  3193 	if( __isSmallInteger(scaleY) ) 
  3194             sY = (float) __intVal( scaleY );
  3194 	    sY = (float) __intVal( scaleY );
  3195         else if (__isFloat(scaleY)) 
  3195 	else if (__isFloat(scaleY)) 
  3196             sY = __floatVal( scaleY );
  3196 	    sY = __floatVal( scaleY );
  3197         else if (__isShortFloat(scaleY)) 
  3197 	else if (__isShortFloat(scaleY)) 
  3198             sY = __shortFloatVal( scaleY );
  3198 	    sY = __shortFloatVal( scaleY );
  3199         else {
  3199 	else {
  3200             t = __SSEND0(scaleY, @symbol(asFloat), 0);
  3200 	    t = __SSEND0(scaleY, @symbol(asFloat), 0);
  3201             if (! __isFloat(t)) goto fail;
  3201 	    if (! __isFloat(t)) goto fail;
  3202             sY = __floatVal( t );
  3202 	    sY = __floatVal( t );
  3203         }
  3203 	}
  3204 
  3204 
  3205         if( __isSmallInteger(transY) ) 
  3205 	if( __isSmallInteger(transY) ) 
  3206             tY = (float) __intVal( transY );
  3206 	    tY = (float) __intVal( transY );
  3207         else if (__isFloat(transY)) 
  3207 	else if (__isFloat(transY)) 
  3208             tY = __floatVal( transY );
  3208 	    tY = __floatVal( transY );
  3209         else if (__isShortFloat(transY)) 
  3209 	else if (__isShortFloat(transY)) 
  3210             tY = __shortFloatVal( transY );
  3210 	    tY = __shortFloatVal( transY );
  3211         else {
  3211 	else {
  3212             t = __SSEND0(transY, @symbol(asFloat), 0);
  3212 	    t = __SSEND0(transY, @symbol(asFloat), 0);
  3213             if (! __isFloat(t)) goto fail;
  3213 	    if (! __isFloat(t)) goto fail;
  3214             tY = __floatVal( t );
  3214 	    tY = __floatVal( t );
  3215         }
  3215 	}
  3216 
  3216 
  3217         if( __isSmallInteger(startX) ) 
  3217 	if( __isSmallInteger(startX) ) 
  3218             x = (float) __intVal( startX );
  3218 	    x = (float) __intVal( startX );
  3219         else if (__isFloat(startX)) 
  3219 	else if (__isFloat(startX)) 
  3220             x = __floatVal( startX );
  3220 	    x = __floatVal( startX );
  3221         else if (__isShortFloat(startX)) 
  3221 	else if (__isShortFloat(startX)) 
  3222             x = __shortFloatVal( startX );
  3222 	    x = __shortFloatVal( startX );
  3223         else {
  3223 	else {
  3224             t = __SSEND0(startX, @symbol(asFloat), 0);
  3224 	    t = __SSEND0(startX, @symbol(asFloat), 0);
  3225             if (! __isFloat(t)) goto fail;
  3225 	    if (! __isFloat(t)) goto fail;
  3226             x = __floatVal( t );
  3226 	    x = __floatVal( t );
  3227         }
  3227 	}
  3228 
  3228 
  3229         if( __isSmallInteger(stepX) ) 
  3229 	if( __isSmallInteger(stepX) ) 
  3230             step = (float) __intVal( stepX );
  3230 	    step = (float) __intVal( stepX );
  3231         else if (__isFloat(stepX)) 
  3231 	else if (__isFloat(stepX)) 
  3232             step = __floatVal( stepX );
  3232 	    step = __floatVal( stepX );
  3233         else if (__isShortFloat(stepX)) 
  3233 	else if (__isShortFloat(stepX)) 
  3234             step = __shortFloatVal( stepX );
  3234 	    step = __shortFloatVal( stepX );
  3235         else {
  3235 	else {
  3236             t = __SSEND0(stepX, @symbol(asFloat), 0);
  3236 	    t = __SSEND0(stepX, @symbol(asFloat), 0);
  3237             if (! __isFloat(t)) goto fail;
  3237 	    if (! __isFloat(t)) goto fail;
  3238             step = __floatVal( t );
  3238 	    step = __floatVal( t );
  3239         }
  3239 	}
  3240 
  3240 
  3241         num = __intVal( noY );
  3241 	num = __intVal( noY );
  3242 
  3242 
  3243         if( num > 200 ) {
  3243 	if( num > 200 ) {
  3244             if( ! (points = (XPoint *) malloc ( sizeof(XPoint) * num )) )
  3244 	    if( ! (points = (XPoint *) malloc ( sizeof(XPoint) * num )) )
  3245                 goto fail;
  3245 		goto fail;
  3246             mustFree = 1;
  3246 	    mustFree = 1;
  3247         } else {
  3247 	} else {
  3248             points = qPoints;
  3248 	    points = qPoints;
  3249         }
  3249 	}
  3250         for( i = 0; i < num; ++i ) {
  3250 	for( i = 0; i < num; ++i ) {
  3251             int px, py;
  3251 	    int px, py;
  3252 
  3252 
  3253             yA  = __AT_(yValues, __MKSMALLINT(i+1) );
  3253 	    yA  = __AT_(yValues, __MKSMALLINT(i+1) );
  3254 
  3254 
  3255             if( __isFloat(yA) )
  3255 	    if( __isFloat(yA) )
  3256                 y = __floatVal( yA );
  3256 		y = __floatVal( yA );
  3257             else if( __isSmallInteger(yA) )
  3257 	    else if( __isSmallInteger(yA) )
  3258                 y = (float) __intVal( yA );
  3258 		y = (float) __intVal( yA );
  3259             else if( __isShortFloat( yA) )
  3259 	    else if( __isShortFloat( yA) )
  3260                 y = __shortFloatVal( yA );
  3260 		y = __shortFloatVal( yA );
  3261             else {
  3261 	    else {
  3262                 t = __SSEND0(yA, @symbol(asFloat), 0);
  3262 		t = __SSEND0(yA, @symbol(asFloat), 0);
  3263                 if (! __isFloat(t)) goto fail;
  3263 		if (! __isFloat(t)) goto fail;
  3264                 y = __floatVal( t );
  3264 		y = __floatVal( t );
  3265             }
  3265 	    }
  3266 
  3266 
  3267             px = (int) (x + 0.5);
  3267 	    px = (int) (x + 0.5);
  3268             py = (int) ((y * sY) + tY + 0.5);
  3268 	    py = (int) ((y * sY) + tY + 0.5);
  3269 
  3269 
  3270             /* attention: coordinates in X are shorts and wrap; clamp here. */
  3270 	    /* attention: coordinates in X are shorts and wrap; clamp here. */
  3271             if (px > 0x7FFF) px = 0x7FFF;
  3271 	    if (px > 0x7FFF) px = 0x7FFF;
  3272             else if (px < -0x8000) px = -0x8000;
  3272 	    else if (px < -0x8000) px = -0x8000;
  3273             if (py > 0x7FFF) py = 0x7FFF;
  3273 	    if (py > 0x7FFF) py = 0x7FFF;
  3274             else if (py < -0x8000) py = -0x8000;
  3274 	    else if (py < -0x8000) py = -0x8000;
  3275 
  3275 
  3276             points[i].x = px;
  3276 	    points[i].x = px;
  3277             points[i].y = py;
  3277 	    points[i].y = py;
  3278             x = x + step;
  3278 	    x = x + step;
  3279         }
  3279 	}
  3280 
  3280 
  3281         ENTER_XLIB();
  3281 	ENTER_XLIB();
  3282         XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin);
  3282 	XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin);
  3283         LEAVE_XLIB();
  3283 	LEAVE_XLIB();
  3284 
  3284 
  3285         if( mustFree ) {
  3285 	if( mustFree ) {
  3286             free( points );
  3286 	    free( points );
  3287         }
  3287 	}
  3288         RETURN ( self );
  3288 	RETURN ( self );
  3289     }
  3289     }
  3290 
  3290 
  3291 fail:
  3291 fail:
  3292     if( mustFree )
  3292     if( mustFree )
  3293         free( points );
  3293 	free( points );
  3294 %}.
  3294 %}.
  3295     ^ super displayLinesFromX:startX step:stepX yValues:yValues scaleY:scaleY transY:transY in:aDrawableId with:aGCId
  3295     ^ super displayLinesFromX:startX step:stepX yValues:yValues scaleY:scaleY transY:transY in:aDrawableId with:aGCId
  3296 
  3296 
  3297     "Modified: / 13.6.1998 / 13:51:39 / cg"
  3297     "Modified: / 13.6.1998 / 13:51:39 / cg"
  3298 !
  3298 !
  3308 
  3308 
  3309     if (ISCONNECTED
  3309     if (ISCONNECTED
  3310      && __isExternalAddress(aGCId)
  3310      && __isExternalAddress(aGCId)
  3311      && __isExternalAddress(aDrawableId)
  3311      && __isExternalAddress(aDrawableId)
  3312      && __bothSmallInteger(x, y)) {
  3312      && __bothSmallInteger(x, y)) {
  3313         int px, py;
  3313 	int px, py;
  3314 
  3314 
  3315         gc = __GCVal(aGCId);
  3315 	gc = __GCVal(aGCId);
  3316         win = __WindowVal(aDrawableId);
  3316 	win = __WindowVal(aDrawableId);
  3317 
  3317 
  3318         px = __intVal(x);
  3318 	px = __intVal(x);
  3319         py = __intVal(y);
  3319 	py = __intVal(y);
  3320         if (px > 0x7FFF) px = 0x7FFF;
  3320 	if (px > 0x7FFF) px = 0x7FFF;
  3321         else if (px < -0x8000) px = -0x8000;
  3321 	else if (px < -0x8000) px = -0x8000;
  3322         if (py > 0x7FFF) py = 0x7FFF;
  3322 	if (py > 0x7FFF) py = 0x7FFF;
  3323         else if (py < -0x8000) py = -0x8000;
  3323 	else if (py < -0x8000) py = -0x8000;
  3324 
  3324 
  3325         ENTER_XLIB();
  3325 	ENTER_XLIB();
  3326         XDrawPoint(myDpy, win, gc, px, py);
  3326 	XDrawPoint(myDpy, win, gc, px, py);
  3327         LEAVE_XLIB();
  3327 	LEAVE_XLIB();
  3328 
  3328 
  3329         RETURN ( self );
  3329 	RETURN ( self );
  3330     }
  3330     }
  3331 %}.
  3331 %}.
  3332     "badGC, badDrawable or x/y not integer"
  3332     "badGC, badDrawable or x/y not integer"
  3333     self primitiveFailedOrClosedConnection
  3333     self primitiveFailedOrClosedConnection
  3334 !
  3334 !
  3354 
  3354 
  3355     if (ISCONNECTED
  3355     if (ISCONNECTED
  3356      && __isExternalAddress(aGCId)
  3356      && __isExternalAddress(aGCId)
  3357      && __isExternalAddress(aDrawableId)
  3357      && __isExternalAddress(aDrawableId)
  3358      && __isSmallInteger(numberOfPoints)) {
  3358      && __isSmallInteger(numberOfPoints)) {
  3359         gc = __GCVal(aGCId);
  3359 	gc = __GCVal(aGCId);
  3360         win = __WindowVal(aDrawableId);
  3360 	win = __WindowVal(aDrawableId);
  3361         num = __intVal(numberOfPoints);
  3361 	num = __intVal(numberOfPoints);
  3362         /*
  3362 	/*
  3363          * avoid a (slow) malloc, if the number of points is small
  3363 	 * avoid a (slow) malloc, if the number of points is small
  3364          */
  3364 	 */
  3365         if (num > 100) {
  3365 	if (num > 100) {
  3366             points = (XPoint *)malloc(sizeof(XPoint) * num);
  3366 	    points = (XPoint *)malloc(sizeof(XPoint) * num);
  3367             if (! points) goto fail;
  3367 	    if (! points) goto fail;
  3368             mustFree = 1;
  3368 	    mustFree = 1;
  3369         } else
  3369 	} else
  3370             points = qPoints;
  3370 	    points = qPoints;
  3371 
  3371 
  3372         for (i=0; i<num; i++) {
  3372 	for (i=0; i<num; i++) {
  3373             int px, py;
  3373 	    int px, py;
  3374 
  3374 
  3375             point = __AT_(aPolygon, __MKSMALLINT(i+1));
  3375 	    point = __AT_(aPolygon, __MKSMALLINT(i+1));
  3376             if (! __isPoint(point)) goto fail;
  3376 	    if (! __isPoint(point)) goto fail;
  3377             x = _point_X(point);
  3377 	    x = _point_X(point);
  3378             y = _point_Y(point);
  3378 	    y = _point_Y(point);
  3379             if (! __bothSmallInteger(x, y))
  3379 	    if (! __bothSmallInteger(x, y))
  3380                 goto fail;
  3380 		goto fail;
  3381 
  3381 
  3382             px = __intVal(x);
  3382 	    px = __intVal(x);
  3383             py = __intVal(y);
  3383 	    py = __intVal(y);
  3384 
  3384 
  3385             /* attention: coordinates in X are shorts and wrap; clamp here. */
  3385 	    /* attention: coordinates in X are shorts and wrap; clamp here. */
  3386             if (px > 0x7FFF) px = 0x7FFF;
  3386 	    if (px > 0x7FFF) px = 0x7FFF;
  3387             else if (px < -0x8000) px = -0x8000;
  3387 	    else if (px < -0x8000) px = -0x8000;
  3388             if (py > 0x7FFF) py = 0x7FFF;
  3388 	    if (py > 0x7FFF) py = 0x7FFF;
  3389             else if (py < -0x8000) py = -0x8000;
  3389 	    else if (py < -0x8000) py = -0x8000;
  3390 
  3390 
  3391             points[i].x = px;
  3391 	    points[i].x = px;
  3392             points[i].y = py;
  3392 	    points[i].y = py;
  3393         }
  3393 	}
  3394 
  3394 
  3395         ENTER_XLIB();
  3395 	ENTER_XLIB();
  3396         XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin);
  3396 	XDrawLines(myDpy, win, gc, points, num, CoordModeOrigin);
  3397         LEAVE_XLIB();
  3397 	LEAVE_XLIB();
  3398 
  3398 
  3399         if (mustFree)
  3399 	if (mustFree)
  3400             free(points);
  3400 	    free(points);
  3401         RETURN ( self );
  3401 	RETURN ( self );
  3402     }
  3402     }
  3403 fail: ;
  3403 fail: ;
  3404     if (mustFree)
  3404     if (mustFree)
  3405         free(points);
  3405 	free(points);
  3406 %}.
  3406 %}.
  3407     "badGC, badDrawable or coordinates not integer"
  3407     "badGC, badDrawable or coordinates not integer"
  3408     self primitiveFailedOrClosedConnection
  3408     self primitiveFailedOrClosedConnection
  3409 !
  3409 !
  3410 
  3410 
  3421     if (ISCONNECTED
  3421     if (ISCONNECTED
  3422      && __isExternalAddress(aGCId)
  3422      && __isExternalAddress(aGCId)
  3423      && __isExternalAddress(aDrawableId)
  3423      && __isExternalAddress(aDrawableId)
  3424      && __bothSmallInteger(x, y)
  3424      && __bothSmallInteger(x, y)
  3425      && __bothSmallInteger(width, height)) {
  3425      && __bothSmallInteger(width, height)) {
  3426         int px, py;
  3426 	int px, py;
  3427 
  3427 
  3428         gc = __GCVal(aGCId);
  3428 	gc = __GCVal(aGCId);
  3429         win = __WindowVal(aDrawableId);
  3429 	win = __WindowVal(aDrawableId);
  3430         w = __intVal(width);
  3430 	w = __intVal(width);
  3431         h = __intVal(height);
  3431 	h = __intVal(height);
  3432 
  3432 
  3433         /*
  3433 	/*
  3434          * need this check here: some servers simply dump core with bad args
  3434 	 * need this check here: some servers simply dump core with bad args
  3435          */
  3435 	 */
  3436         if ((w >= 0) && (h >= 0)) {
  3436 	if ((w >= 0) && (h >= 0)) {
  3437             px = __intVal(x);
  3437 	    px = __intVal(x);
  3438             py = __intVal(y);
  3438 	    py = __intVal(y);
  3439 
  3439 
  3440             /* attention: coordinates in X are shorts and wrap; clamp here. */
  3440 	    /* attention: coordinates in X are shorts and wrap; clamp here. */
  3441             if (px > 0x7FFF) px = 0x7FFF;
  3441 	    if (px > 0x7FFF) px = 0x7FFF;
  3442             else if (px < -0x8000) px = -0x8000;
  3442 	    else if (px < -0x8000) px = -0x8000;
  3443             if (py > 0x7FFF) py = 0x7FFF;
  3443 	    if (py > 0x7FFF) py = 0x7FFF;
  3444             else if (py < -0x8000) py = -0x8000;
  3444 	    else if (py < -0x8000) py = -0x8000;
  3445 
  3445 
  3446             ENTER_XLIB();
  3446 	    ENTER_XLIB();
  3447             XDrawRectangle(myDpy, win, gc, px, py, w, h);
  3447 	    XDrawRectangle(myDpy, win, gc, px, py, w, h);
  3448             LEAVE_XLIB();
  3448 	    LEAVE_XLIB();
  3449         }
  3449 	}
  3450         RETURN ( self );
  3450 	RETURN ( self );
  3451     }
  3451     }
  3452 %}.
  3452 %}.
  3453     "badGC, badDrawable or coordinates not integer"
  3453     "badGC, badDrawable or coordinates not integer"
  3454     self primitiveFailedOrClosedConnection
  3454     self primitiveFailedOrClosedConnection
  3455 !
  3455 !
  3751     "
  3751     "
  3752     (self 
  3752     (self 
  3753 	primDrawBits:bits 
  3753 	primDrawBits:bits 
  3754 	bitsPerPixel:bitsPerPixel 
  3754 	bitsPerPixel:bitsPerPixel 
  3755 	depth:imageDepth 
  3755 	depth:imageDepth 
       
  3756 	msb:true 
  3756 	padding:padding
  3757 	padding:padding
  3757 	width:imageWidth height:imageHeight 
  3758 	width:imageWidth height:imageHeight 
  3758 	x:srcx y:srcy
  3759 	x:srcx y:srcy
  3759 	into:aDrawableId 
  3760 	into:aDrawableId 
  3760 	x:dstx y:dsty 
  3761 	x:dstx y:dsty 
  3923 %}.
  3924 %}.
  3924     "badGC, badDrawable or coordinates not integer"
  3925     "badGC, badDrawable or coordinates not integer"
  3925     self primitiveFailedOrClosedConnection
  3926     self primitiveFailedOrClosedConnection
  3926 !
  3927 !
  3927 
  3928 
  3928 primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth padding:bitPadding
  3929 primDrawBits:imageBits bitsPerPixel:bitsPerPixel depth:imageDepth msb:msb padding:bitPadding
  3929 			      width:imageWidth height:imageHeight 
  3930 			      width:imageWidth height:imageHeight 
  3930 				  x:srcx y:srcy
  3931 				  x:srcx y:srcy
  3931 			       into:aDrawableId 
  3932 			       into:aDrawableId 
  3932 				  x:dstx y:dsty 
  3933 				  x:dstx y:dsty 
  3933 			      width:w height:h 
  3934 			      width:w height:h 
  3972 	image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element;
  3973 	image.data = (char *)__ByteArrayInstPtr(imageBits)->ba_element;
  3973 	image.width = imgWdth = __intVal(imageWidth);
  3974 	image.width = imgWdth = __intVal(imageWidth);
  3974 	image.height = __intVal(imageHeight);
  3975 	image.height = __intVal(imageHeight);
  3975 	image.xoffset = 0;
  3976 	image.xoffset = 0;
  3976 	image.format = ZPixmap;
  3977 	image.format = ZPixmap;
  3977 	image.byte_order = MSBFirst;
  3978 	image.byte_order = (msb == true) ? MSBFirst : LSBFirst;
  3978 	image.bitmap_unit = 8;
  3979 	image.bitmap_unit = 8;
  3979 	image.bitmap_bit_order = MSBFirst;
  3980 	image.bitmap_bit_order = MSBFirst;
  3980 	image.bitmap_pad = pad;
  3981 	image.bitmap_pad = pad;
  3981 	image.depth = __intVal(imageDepth);
  3982 	image.depth = __intVal(imageDepth);
  3982 	image.bits_per_pixel = __intVal(bitsPerPixel);
  3983 	image.bits_per_pixel = __intVal(bitsPerPixel);
  4175 configure:view x:x y:y width:w height:h above:above
  4176 configure:view x:x y:y width:w height:h above:above
  4176     "forward a size-change event for some view"
  4177     "forward a size-change event for some view"
  4177 
  4178 
  4178     self configureX:x y:y width:w height:h view:view.
  4179     self configureX:x y:y width:w height:h view:view.
  4179     above notNil ifTrue:[
  4180     above notNil ifTrue:[
  4180         |aboveView|
  4181 	|aboveView|
  4181         aboveView := self viewFromId:above.
  4182 	aboveView := self viewFromId:above.
  4182         aboveView notNil ifTrue:[
  4183 	aboveView notNil ifTrue:[
  4183             self coveredBy:aboveView view:view.
  4184 	    self coveredBy:aboveView view:view.
  4184         ].
  4185 	].
  4185      ].
  4186      ].
  4186 !
  4187 !
  4187 
  4188 
  4188 configureRequest:view x:x y:y width:w height:h above:above detail:detail
  4189 configureRequest:view x:x y:y width:w height:h above:above detail:detail
  4189     "ignored for now"
  4190     "ignored for now"
  6839 %{
  6840 %{
  6840     XFontStruct *f;
  6841     XFontStruct *f;
  6841     int len;
  6842     int len;
  6842 
  6843 
  6843     if (ISCONNECTED) {
  6844     if (ISCONNECTED) {
  6844         if (__isExternalAddress(fontId)) {
  6845 	if (__isExternalAddress(fontId)) {
  6845             f = __FontVal(fontId);
  6846 	    f = __FontVal(fontId);
  6846             if (f) {
  6847 	    if (f) {
  6847                 avgAscent = __MKSMALLINT(f->ascent);
  6848 		avgAscent = __MKSMALLINT(f->ascent);
  6848                 avgDescent = __MKSMALLINT(f->descent);
  6849 		avgDescent = __MKSMALLINT(f->descent);
  6849                 maxAscent = __MKSMALLINT(f->max_bounds.ascent);
  6850 		maxAscent = __MKSMALLINT(f->max_bounds.ascent);
  6850                 maxDescent = __MKSMALLINT(f->max_bounds.descent);
  6851 		maxDescent = __MKSMALLINT(f->max_bounds.descent);
  6851                 minWidth = __MKSMALLINT(f->min_bounds.width);
  6852 		minWidth = __MKSMALLINT(f->min_bounds.width);
  6852                 maxWidth = __MKSMALLINT(f->max_bounds.width);
  6853 		maxWidth = __MKSMALLINT(f->max_bounds.width);
  6853 
  6854 
  6854                 ENTER_XLIB();
  6855 		ENTER_XLIB();
  6855                 len = XTextWidth(f, " ", 1);
  6856 		len = XTextWidth(f, " ", 1);
  6856                 LEAVE_XLIB();
  6857 		LEAVE_XLIB();
  6857 
  6858 
  6858                 avgWidth = __MKSMALLINT( len );
  6859 		avgWidth = __MKSMALLINT( len );
  6859             }
  6860 	    }
  6860         }
  6861 	}
  6861     }
  6862     }
  6862 %}.
  6863 %}.
  6863     avgAscent == nil ifTrue:[
  6864     avgAscent == nil ifTrue:[
  6864         self primitiveFailedOrClosedConnection.
  6865 	self primitiveFailedOrClosedConnection.
  6865         ^ nil
  6866 	^ nil
  6866     ].
  6867     ].
  6867 
  6868 
  6868     maxAscent == 0 ifTrue:[
  6869     maxAscent == 0 ifTrue:[
  6869         "DingBats font does not define this"
  6870 	"DingBats font does not define this"
  6870         maxAscent := avgAscent.
  6871 	maxAscent := avgAscent.
  6871     ].
  6872     ].
  6872     maxDescent == 0 ifTrue:[
  6873     maxDescent == 0 ifTrue:[
  6873         "DingBats font does not define this"
  6874 	"DingBats font does not define this"
  6874         maxDescent := avgDescent
  6875 	maxDescent := avgDescent
  6875     ].
  6876     ].
  6876 
  6877 
  6877     info := DeviceWorkstation::DeviceFontMetrics new.
  6878     info := DeviceWorkstation::DeviceFontMetrics new.
  6878     info
  6879     info
  6879       ascent:avgAscent
  6880       ascent:avgAscent
  7019     char **fonts;
  7020     char **fonts;
  7020     OBJ arr, str;
  7021     OBJ arr, str;
  7021     int i;
  7022     int i;
  7022 
  7023 
  7023     if (ISCONNECTED) {
  7024     if (ISCONNECTED) {
  7024         if (__isString(pattern)) {
  7025 	if (__isString(pattern)) {
  7025             for (;;) {
  7026 	    for (;;) {
  7026                 ENTER_XLIB();
  7027 		ENTER_XLIB();
  7027                 fonts = XListFonts(myDpy, __stringVal(pattern), nnames, &available);
  7028 		fonts = XListFonts(myDpy, __stringVal(pattern), nnames, &available);
  7028                 LEAVE_XLIB();
  7029 		LEAVE_XLIB();
  7029                 if (fonts == 0) RETURN(nil);
  7030 		if (fonts == 0) RETURN(nil);
  7030                 if (available < nnames) break;
  7031 		if (available < nnames) break;
  7031                 XFreeFontNames(fonts);
  7032 		XFreeFontNames(fonts);
  7032                 nnames = available * 2;
  7033 		nnames = available * 2;
  7033             }
  7034 	    }
  7034 
  7035 
  7035             /*
  7036 	    /*
  7036              * now, that we know the number of font names,
  7037 	     * now, that we know the number of font names,
  7037              * create the array ...
  7038 	     * create the array ...
  7038              */
  7039 	     */
  7039             arr = __ARRAY_NEW_INT(available);
  7040 	    arr = __ARRAY_NEW_INT(available);
  7040             if (arr != nil) {
  7041 	    if (arr != nil) {
  7041                 /*
  7042 		/*
  7042                  * ... and fill it
  7043 		 * ... and fill it
  7043                  */
  7044 		 */
  7044                 for (i=0; i<available; i++) {
  7045 		for (i=0; i<available; i++) {
  7045                     __PROTECT__(arr);
  7046 		    __PROTECT__(arr);
  7046                     str = __MKSTRING(fonts[i]);
  7047 		    str = __MKSTRING(fonts[i]);
  7047                     __UNPROTECT__(arr);
  7048 		    __UNPROTECT__(arr);
  7048                     __ArrayInstPtr(arr)->a_element[i] = str; __STORE(arr, str);
  7049 		    __ArrayInstPtr(arr)->a_element[i] = str; __STORE(arr, str);
  7049                 }
  7050 		}
  7050             }
  7051 	    }
  7051             XFreeFontNames(fonts);
  7052 	    XFreeFontNames(fonts);
  7052             RETURN (arr);
  7053 	    RETURN (arr);
  7053         }
  7054 	}
  7054     }
  7055     }
  7055 %}.
  7056 %}.
  7056     ^ nil
  7057     ^ nil
  7057 !
  7058 !
  7058 
  7059 
  7375 
  7376 
  7376     |sizes|
  7377     |sizes|
  7377 
  7378 
  7378     sizes := super sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter.
  7379     sizes := super sizesInFamily:aFamilyName face:aFaceName style:aStyleName filtering:filter.
  7379     (sizes notNil and:[sizes includes:0]) ifTrue:[
  7380     (sizes notNil and:[sizes includes:0]) ifTrue:[
  7380         "special: in X11R5 and above, size 0 means:
  7381 	"special: in X11R5 and above, size 0 means:
  7381          there are scaled versions in all sizes available"
  7382 	 there are scaled versions in all sizes available"
  7382 
  7383 
  7383         ^ #(4 5 6 7 8 9 10 11 12 14 16 18 20 22 24 28 32 48 64 72 96 144 192 288)
  7384 	^ #(4 5 6 7 8 9 10 11 12 14 16 18 20 22 24 28 32 48 64 72 96 144 192 288)
  7384     ].
  7385     ].
  7385     ^ sizes
  7386     ^ sizes
  7386 
  7387 
  7387     "
  7388     "
  7388      Display sizesInFamily:'courier' face:'bold' style:'roman'
  7389      Display sizesInFamily:'courier' face:'bold' style:'roman'
  7405     int nInstBytes;
  7406     int nInstBytes;
  7406     int directionReturn, fontAscentReturn, fontDescentReturn;
  7407     int directionReturn, fontAscentReturn, fontDescentReturn;
  7407     XCharStruct overAllReturn;
  7408     XCharStruct overAllReturn;
  7408 
  7409 
  7409     if (ISCONNECTED) {
  7410     if (ISCONNECTED) {
  7410         if (__bothSmallInteger(index1, index2)
  7411 	if (__bothSmallInteger(index1, index2)
  7411          && __isExternalAddress(aFontId)
  7412 	 && __isExternalAddress(aFontId)
  7412          && __isNonNilObject(aString)) {
  7413 	 && __isNonNilObject(aString)) {
  7413             int lMax = __intVal(@global(XWorkstation:MaxStringLength));
  7414 	    int lMax = __intVal(@global(XWorkstation:MaxStringLength));
  7414             f = __FontVal(aFontId);
  7415 	    f = __FontVal(aFontId);
  7415             if (! f) goto fail;
  7416 	    if (! f) goto fail;
  7416 
  7417 
  7417             i1 = __intVal(index1) - 1;
  7418 	    i1 = __intVal(index1) - 1;
  7418             cls = __qClass(aString);
  7419 	    cls = __qClass(aString);
  7419 
  7420 
  7420             if (i1 >= 0) {
  7421 	    if (i1 >= 0) {
  7421                 i2 = __intVal(index2) - 1;
  7422 		i2 = __intVal(index2) - 1;
  7422                 if (i2 < i1) {
  7423 		if (i2 < i1) {
  7423                     RETURN ( __MKSMALLINT(0) );
  7424 		    RETURN ( __MKSMALLINT(0) );
  7424                 }
  7425 		}
  7425 
  7426 
  7426                 cp = (char *) __stringVal(aString);
  7427 		cp = (char *) __stringVal(aString);
  7427                 l = i2 - i1 + 1;
  7428 		l = i2 - i1 + 1;
  7428 
  7429 
  7429                 if ((cls == @global(String)) || (cls == @global(Symbol))) {
  7430 		if ((cls == @global(String)) || (cls == @global(Symbol))) {
  7430                     n = __stringSize(aString);
  7431 		    n = __stringSize(aString);
  7431                     if (i2 < n) {
  7432 		    if (i2 < n) {
  7432                         cp += i1;
  7433 			cp += i1;
  7433 
  7434 
  7434 #if 0
  7435 #if 0
  7435                         ENTER_XLIB();
  7436 			ENTER_XLIB();
  7436                         len = XQueryTextExtents(myDpy, f->fid, cp, l, 
  7437 			len = XQueryTextExtents(myDpy, f->fid, cp, l, 
  7437                                                 &directionReturn, &fontAscentReturn, &fontDescentReturn,
  7438 						&directionReturn, &fontAscentReturn, &fontDescentReturn,
  7438                                                 &overAllReturn);
  7439 						&overAllReturn);
  7439                         LEAVE_XLIB();
  7440 			LEAVE_XLIB();
  7440                         printf("lBear:%d rBear:%d width:%d\n", overAllReturn.lbearing, overAllReturn.rbearing, overAllReturn.width);
  7441 			printf("lBear:%d rBear:%d width:%d\n", overAllReturn.lbearing, overAllReturn.rbearing, overAllReturn.width);
  7441 #endif
  7442 #endif
  7442                         ENTER_XLIB();
  7443 			ENTER_XLIB();
  7443                         len = XTextWidth(f, cp, l);
  7444 			len = XTextWidth(f, cp, l);
  7444                         LEAVE_XLIB();
  7445 			LEAVE_XLIB();
  7445 
  7446 
  7446                         RETURN ( __MKSMALLINT(len) );
  7447 			RETURN ( __MKSMALLINT(len) );
  7447                     }
  7448 		    }
  7448                 }
  7449 		}
  7449 
  7450 
  7450                 nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
  7451 		nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
  7451                 cp += nInstBytes;
  7452 		cp += nInstBytes;
  7452 
  7453 
  7453                 if (__isBytes(aString)) {
  7454 		if (__isBytes(aString)) {
  7454                     n = __byteArraySize(aString) - nInstBytes;
  7455 		    n = __byteArraySize(aString) - nInstBytes;
  7455                     if (i2 < n) {
  7456 		    if (i2 < n) {
  7456                         cp += i1;
  7457 			cp += i1;
  7457 
  7458 
  7458                         ENTER_XLIB();
  7459 			ENTER_XLIB();
  7459                         len = XTextWidth(f, cp, l);
  7460 			len = XTextWidth(f, cp, l);
  7460                         LEAVE_XLIB();
  7461 			LEAVE_XLIB();
  7461 
  7462 
  7462                         RETURN ( __MKSMALLINT(len) );
  7463 			RETURN ( __MKSMALLINT(len) );
  7463                     }
  7464 		    }
  7464                 }
  7465 		}
  7465 
  7466 
  7466                 /* TWOBYTESTRINGS */
  7467 		/* TWOBYTESTRINGS */
  7467                 if (__isWords(aString)) {
  7468 		if (__isWords(aString)) {
  7468                     n = (__byteArraySize(aString) - nInstBytes) / 2;
  7469 		    n = (__byteArraySize(aString) - nInstBytes) / 2;
  7469 
  7470 
  7470                     if (i2 < n) {
  7471 		    if (i2 < n) {
  7471                         union {
  7472 			union {
  7472                             char b[2];
  7473 			    char b[2];
  7473                             unsigned short s;
  7474 			    unsigned short s;
  7474                         } u;
  7475 			} u;
  7475                         int i;
  7476 			int i;
  7476                         XChar2b *cp2 = (XChar2b *)0;
  7477 			XChar2b *cp2 = (XChar2b *)0;
  7477                         int mustFree = 0;
  7478 			int mustFree = 0;
  7478 
  7479 
  7479                         cp += (i1 * 2);
  7480 			cp += (i1 * 2);
  7480                         if (l > lMax) l = lMax;
  7481 			if (l > lMax) l = lMax;
  7481 
  7482 
  7482                         /*
  7483 			/*
  7483                          * ST/X TwoByteStrings store the asciiValue in native byteOrder;
  7484 			 * ST/X TwoByteStrings store the asciiValue in native byteOrder;
  7484                          * X expects them MSB first
  7485 			 * X expects them MSB first
  7485                          * convert as required
  7486 			 * convert as required
  7486                          */
  7487 			 */
  7487 
  7488 
  7488                         u.s = 0x1234;
  7489 			u.s = 0x1234;
  7489                         if (u.b[0] != 0x12) {
  7490 			if (u.b[0] != 0x12) {
  7490                             if (l <= NLOCALBUFFER) {
  7491 			    if (l <= NLOCALBUFFER) {
  7491                                 cp2 = xlatebuffer;
  7492 				cp2 = xlatebuffer;
  7492                             } else {
  7493 			    } else {
  7493                                 cp2 = (XChar2b *)(malloc(l * 2));
  7494 				cp2 = (XChar2b *)(malloc(l * 2));
  7494                                 mustFree = 1;
  7495 				mustFree = 1;
  7495                             }
  7496 			    }
  7496                             for (i=0; i<l; i++) {
  7497 			    for (i=0; i<l; i++) {
  7497                                 cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
  7498 				cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
  7498                                 cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
  7499 				cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
  7499                             }
  7500 			    }
  7500                             cp = (char *) cp2;
  7501 			    cp = (char *) cp2;
  7501                         }
  7502 			}
  7502 
  7503 
  7503                         ENTER_XLIB();
  7504 			ENTER_XLIB();
  7504                         len = XTextWidth16(f, (XChar2b *)cp, l);
  7505 			len = XTextWidth16(f, (XChar2b *)cp, l);
  7505                         LEAVE_XLIB();
  7506 			LEAVE_XLIB();
  7506 
  7507 
  7507 
  7508 
  7508                         if (mustFree) {
  7509 			if (mustFree) {
  7509                             free(cp2);
  7510 			    free(cp2);
  7510                         }
  7511 			}
  7511 
  7512 
  7512                         RETURN ( __MKSMALLINT(len) );
  7513 			RETURN ( __MKSMALLINT(len) );
  7513                     }
  7514 		    }
  7514                 }
  7515 		}
  7515             }
  7516 	    }
  7516         }
  7517 	}
  7517     }
  7518     }
  7518 #undef NLOCALBUFFER
  7519 #undef NLOCALBUFFER
  7519 fail: ;
  7520 fail: ;
  7520 %}.
  7521 %}.
  7521     self primitiveFailedOrClosedConnection.
  7522     self primitiveFailedOrClosedConnection.
  7536     int nInstBytes;
  7537     int nInstBytes;
  7537     int directionReturn, fontAscentReturn, fontDescentReturn;
  7538     int directionReturn, fontAscentReturn, fontDescentReturn;
  7538     XCharStruct overAllReturn;
  7539     XCharStruct overAllReturn;
  7539 
  7540 
  7540     if (ISCONNECTED) {
  7541     if (ISCONNECTED) {
  7541         if (__isExternalAddress(aFontId)
  7542 	if (__isExternalAddress(aFontId)
  7542          && __isNonNilObject(aString)) {
  7543 	 && __isNonNilObject(aString)) {
  7543             int lMax = __intVal(@global(XWorkstation:MaxStringLength));
  7544 	    int lMax = __intVal(@global(XWorkstation:MaxStringLength));
  7544             f = __FontVal(aFontId);
  7545 	    f = __FontVal(aFontId);
  7545             if (! f) goto fail;
  7546 	    if (! f) goto fail;
  7546 
  7547 
  7547             cls = __qClass(aString);
  7548 	    cls = __qClass(aString);
  7548 
  7549 
  7549             cp = (char *) __stringVal(aString);
  7550 	    cp = (char *) __stringVal(aString);
  7550 
  7551 
  7551             if ((cls == @global(String)) || (cls == @global(Symbol))) {
  7552 	    if ((cls == @global(String)) || (cls == @global(Symbol))) {
  7552                 n = __stringSize(aString);
  7553 		n = __stringSize(aString);
  7553 
  7554 
  7554 #if 0
  7555 #if 0
  7555                 ENTER_XLIB();
  7556 		ENTER_XLIB();
  7556                 len = XQueryTextExtents(myDpy, f->fid, cp, n, 
  7557 		len = XQueryTextExtents(myDpy, f->fid, cp, n, 
  7557                                         &directionReturn, &fontAscentReturn, &fontDescentReturn,
  7558 					&directionReturn, &fontAscentReturn, &fontDescentReturn,
  7558                                         &overAllReturn);
  7559 					&overAllReturn);
  7559                 LEAVE_XLIB();
  7560 		LEAVE_XLIB();
  7560                 printf("lBear:%d rBear:%d width:%d\n", overAllReturn.lbearing, overAllReturn.rbearing, overAllReturn.width);
  7561 		printf("lBear:%d rBear:%d width:%d\n", overAllReturn.lbearing, overAllReturn.rbearing, overAllReturn.width);
  7561 #endif
  7562 #endif
  7562 
  7563 
  7563                 ENTER_XLIB();
  7564 		ENTER_XLIB();
  7564                 len = XTextWidth(f, cp, n);
  7565 		len = XTextWidth(f, cp, n);
  7565                 LEAVE_XLIB();
  7566 		LEAVE_XLIB();
  7566 
  7567 
  7567                 RETURN ( __MKSMALLINT(len) );
  7568 		RETURN ( __MKSMALLINT(len) );
  7568             }
  7569 	    }
  7569 
  7570 
  7570             nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
  7571 	    nInstBytes = __OBJS2BYTES__(__intVal(__ClassInstPtr(cls)->c_ninstvars));
  7571             cp += nInstBytes;
  7572 	    cp += nInstBytes;
  7572 
  7573 
  7573             if (__isBytes(aString)) {
  7574 	    if (__isBytes(aString)) {
  7574                 n = __byteArraySize(aString) - nInstBytes;
  7575 		n = __byteArraySize(aString) - nInstBytes;
  7575 
  7576 
  7576 
  7577 
  7577                 ENTER_XLIB();
  7578 		ENTER_XLIB();
  7578                 len = XTextWidth(f, cp, n);
  7579 		len = XTextWidth(f, cp, n);
  7579                 LEAVE_XLIB();
  7580 		LEAVE_XLIB();
  7580 
  7581 
  7581                 RETURN ( __MKSMALLINT(len) );
  7582 		RETURN ( __MKSMALLINT(len) );
  7582             }
  7583 	    }
  7583 
  7584 
  7584             /* TWOBYTESTRINGS */
  7585 	    /* TWOBYTESTRINGS */
  7585             if (__isWords(aString)) {
  7586 	    if (__isWords(aString)) {
  7586                 union {
  7587 		union {
  7587                     char b[2];
  7588 		    char b[2];
  7588                     unsigned short s;
  7589 		    unsigned short s;
  7589                 } u;
  7590 		} u;
  7590                 int i;
  7591 		int i;
  7591                 XChar2b *cp2;
  7592 		XChar2b *cp2;
  7592                 int mustFree = 0;
  7593 		int mustFree = 0;
  7593 
  7594 
  7594                 n = (__byteArraySize(aString) - nInstBytes) / 2;
  7595 		n = (__byteArraySize(aString) - nInstBytes) / 2;
  7595                 if (n > lMax) n = lMax;
  7596 		if (n > lMax) n = lMax;
  7596 
  7597 
  7597                 /*
  7598 		/*
  7598                  * ST/X TwoByteStrings store the asciiValue in native byteOrder;
  7599 		 * ST/X TwoByteStrings store the asciiValue in native byteOrder;
  7599                  * X expects them MSB first
  7600 		 * X expects them MSB first
  7600                  * convert as required
  7601 		 * convert as required
  7601                  */
  7602 		 */
  7602 
  7603 
  7603                 u.s = 0x1234;
  7604 		u.s = 0x1234;
  7604                 if (u.b[0] != 0x12) {
  7605 		if (u.b[0] != 0x12) {
  7605                     if (n <= NLOCALBUFFER) {
  7606 		    if (n <= NLOCALBUFFER) {
  7606                         cp2 = xlatebuffer;
  7607 			cp2 = xlatebuffer;
  7607                     } else {
  7608 		    } else {
  7608                         cp2 = (XChar2b *)(malloc(n * 2));
  7609 			cp2 = (XChar2b *)(malloc(n * 2));
  7609                         mustFree = 1;
  7610 			mustFree = 1;
  7610                     }
  7611 		    }
  7611 
  7612 
  7612                     for (i=0; i<n; i++) {
  7613 		    for (i=0; i<n; i++) {
  7613                         cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
  7614 			cp2[i].byte1 = (((XChar2b *)cp)[i]).byte2;
  7614                         cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
  7615 			cp2[i].byte2 = (((XChar2b *)cp)[i]).byte1;
  7615                     }
  7616 		    }
  7616                     cp = (char *) cp2;
  7617 		    cp = (char *) cp2;
  7617                 }
  7618 		}
  7618 
  7619 
  7619 
  7620 
  7620                 ENTER_XLIB();
  7621 		ENTER_XLIB();
  7621                 len = XTextWidth16(f, (XChar2b *)cp, n);
  7622 		len = XTextWidth16(f, (XChar2b *)cp, n);
  7622                 LEAVE_XLIB();
  7623 		LEAVE_XLIB();
  7623 
  7624 
  7624 
  7625 
  7625                 if (mustFree) {
  7626 		if (mustFree) {
  7626                     free(cp2);
  7627 		    free(cp2);
  7627                 }
  7628 		}
  7628 
  7629 
  7629                 RETURN ( __MKSMALLINT(len) );
  7630 		RETURN ( __MKSMALLINT(len) );
  7630             }
  7631 	    }
  7631         }
  7632 	}
  7632     }
  7633     }
  7633 #undef NLOCALBUFFER
  7634 #undef NLOCALBUFFER
  7634   fail: ;
  7635   fail: ;
  7635 %}.
  7636 %}.
  7636     ^ super widthOf:aString inFont:aFontId
  7637     ^ super widthOf:aString inFont:aFontId
  7887 
  7888 
  7888 ungrabKeyboard
  7889 ungrabKeyboard
  7889     "release the keyboard"
  7890     "release the keyboard"
  7890 
  7891 
  7891     activeKeyboardGrab notNil ifTrue:[
  7892     activeKeyboardGrab notNil ifTrue:[
  7892         activeKeyboardGrab := nil.
  7893 	activeKeyboardGrab := nil.
  7893         self primUngrabKeyboard.
  7894 	self primUngrabKeyboard.
  7894     ]
  7895     ]
  7895 !
  7896 !
  7896 
  7897 
  7897 ungrabPointer
  7898 ungrabPointer
  7898     "release the pointer"
  7899     "release the pointer"
  7899 
  7900 
  7900     activePointerGrab notNil ifTrue:[
  7901     activePointerGrab notNil ifTrue:[
  7901         activePointerGrab := nil.
  7902 	activePointerGrab := nil.
  7902         self primUngrabPointer.
  7903 	self primUngrabPointer.
  7903     ]
  7904     ]
  7904 ! !
  7905 ! !
  7905 
  7906 
  7906 !XWorkstation methodsFor:'graphic context stuff'!
  7907 !XWorkstation methodsFor:'graphic context stuff'!
  7907 
  7908 
 11649 ! !
 11650 ! !
 11650 
 11651 
 11651 !XWorkstation class methodsFor:'documentation'!
 11652 !XWorkstation class methodsFor:'documentation'!
 11652 
 11653 
 11653 version
 11654 version
 11654     ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.404 2002-02-26 12:18:52 stefan Exp $'
 11655     ^ '$Header: /cvs/stx/stx/libview/XWorkstation.st,v 1.405 2002-02-27 10:23:27 cg Exp $'
 11655 ! !
 11656 ! !
 11656 XWorkstation initialize!
 11657 XWorkstation initialize!