Linux 2.3 problems
Lex Spoon
lex at cc.gatech.edu
Thu Mar 4 15:15:51 UTC 1999
Bert Freudenberg <bert at isgnw.CS.Uni-Magdeburg.De> wrote:
> On Wed, 3 Mar 1999, Marcus Denker wrote:
>
> > On Wed, Mar 03, 1999 at 03:50:21PM -0500, Richard L. Peskin wrote:
> > > 1. The "Normal" cursor, the scroll bar between browser panes, the
menu icon
> > > (scroll region), adn other widgets are not clear. That is, details
are not
> > > showing up. For example if you move the cursor from the X window
background
> > > into Squeak, the "arrow" details get fuzzy. This occurs with X
running on
> > > the system console, but not with a remote X server.
> > >
> > Bert Freudenberg posted a fix to the list on Tue, 2 Feb 1999:
> >
> > |Subject: [BUG,FIX] CursorWithMask on X
> > |
> > |I really wanted to have that nice CursorWithMask but it showed only
as a
> > |black blob - stColorBlack and stColorWhite were not initialized
with RGB
> > |triplets (which are needed for 16/32 bpp visuals). A diff is
attached.
>
> I'm not quite sure the symptoms described are the ones this fix is for
> (it only sets the mouse pointer's color). My guess is that the
cursor's
> bits are reversed. In sqXWindow.c, in function ioSetCursorWithMask(),
> there is a loop reversing bits:
>
> /* if (BitmapBitOrder(stDisplay) == LSBFirst)*/
> {
> /* the bytes are always in the right order: swap only bits
> within bytes */
> char *dp= (char *)data;
> char *mp= (char *)mask;
> for (i= 0; i < 32; i++)
> {
> dp[i]= swapBits(dp[i]);
> mp[i]= swapBits(mp[i]);
> }
> }
>
To add more fuel to the fire, my Squeak cursor looks great (at least,
most of them do). It has the desired white outline and everything. My
X display is 16-bit, if that makes any difference.
I'm not sure of the history of the sqXWindow.c file I'm using; I'll
append the ioSetCursorWithMask and swapBits functions from it if anyone
wants to try and compare.
Lex
#ifndef HEADLESS
static unsigned char swapBits(unsigned char in)
{
unsigned char out= 0;
int i;
for (i= 0; i < 8; i++)
{
out= (out << 1) + (in & 1);
in >>= 1;
}
return out;
}
#endif
int ioSetCursorWithMask(int cursorBitsIndex, int cursorMaskIndex,
int offsetX, int offsetY)
{
#ifndef HEADLESS
unsigned char data[32], mask[32]; /* cursors are always 16x16 */
int i;
Cursor cursor;
Pixmap dataPixmap, maskPixmap;
/* Use bits as mask if not specified */
if (cursorMaskIndex == null)
cursorMaskIndex = cursorBitsIndex;
for (i= 0; i < 16; i++)
{
data[i*2+0]= ((unsigned)checkedLongAt(cursorBitsIndex + (4 * i))
>> 24) & 0xFF;
data[i*2+1]= ((unsigned)checkedLongAt(cursorBitsIndex + (4 * i))
>> 16) & 0xFF;
mask[i*2+0]= ((unsigned)checkedLongAt(cursorMaskIndex + (4 * i))
>> 24) & 0xFF;
mask[i*2+1]= ((unsigned)checkedLongAt(cursorMaskIndex + (4 * i))
>> 16) & 0xFF;
}
/* if (BitmapBitOrder(stDisplay) == LSBFirst)*/
{
/* the bytes are always in the right order: swap only bits within
bytes */
char *dp= (char *)data;
char *mp= (char *)mask;
for (i= 0; i < 32; i++)
{
dp[i]= swapBits(dp[i]);
mp[i]= swapBits(mp[i]);
}
}
dataPixmap= XCreateBitmapFromData(stDisplay,
DefaultRootWindow(stDisplay),
(char *)data, 16, 16);
maskPixmap= XCreateBitmapFromData(stDisplay,
DefaultRootWindow(stDisplay),
(char *)mask, 16, 16);
cursor= XCreatePixmapCursor(stDisplay, dataPixmap, maskPixmap,
&stColorBlack, &stColorWhite,
-offsetX, -offsetY);
XFreePixmap(stDisplay, dataPixmap);
XFreePixmap(stDisplay, maskPixmap);
if (cursor != None)
XDefineCursor(stDisplay, stWindow, cursor);
#endif
return 0;
}
More information about the Squeak-dev
mailing list
|