Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
2c709c59
Commit
2c709c59
authored
Apr 25, 2007
by
Andrew Riedi
Committed by
Alexandre Julliard
Apr 27, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11.drv: Add legacy 32-bit cursor support.
parent
735df246
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
13 deletions
+43
-13
mouse.c
dlls/winex11.drv/mouse.c
+43
-13
No files found.
dlls/winex11.drv/mouse.c
View file @
2c709c59
...
...
@@ -560,9 +560,11 @@ static Cursor create_xcursor_cursor( Display *display, CURSORICONINFO *ptr )
*/
static
Cursor
create_cursor
(
Display
*
display
,
CURSORICONINFO
*
ptr
)
{
Pixmap
pixmapBits
,
pixmapMask
,
pixmapMaskInv
,
pixmapAll
;
Pixmap
pixmapBits
,
pixmapMask
,
pixmapMaskInv
=
0
,
pixmapAll
;
XColor
fg
,
bg
;
Cursor
cursor
=
None
;
POINT
hotspot
;
char
*
bitMask32
=
NULL
;
#ifdef HAVE_X11_XCURSOR_XCURSOR_H
if
(
pXcursorImageLoadCursor
)
return
create_xcursor_cursor
(
display
,
ptr
);
...
...
@@ -589,6 +591,7 @@ static Cursor create_cursor( Display *display, CURSORICONINFO *ptr )
TRACE
(
"Bitmap %dx%d planes=%d bpp=%d bytesperline=%d
\n
"
,
ptr
->
nWidth
,
ptr
->
nHeight
,
ptr
->
bPlanes
,
ptr
->
bBitsPerPixel
,
ptr
->
nWidthBytes
);
/* Create a pixmap and transfer all the bits to it */
/* NOTE: Following hack works, but only because XFree depth
...
...
@@ -635,6 +638,10 @@ static Cursor create_cursor( Display *display, CURSORICONINFO *ptr )
switch
(
ptr
->
bBitsPerPixel
)
{
case
32
:
bitMask32
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
ptr
->
nWidth
*
ptr
->
nHeight
/
8
);
/* Fallthrough */
case
24
:
rbits
=
8
;
gbits
=
8
;
...
...
@@ -683,6 +690,20 @@ static Cursor create_cursor( Display *display, CURSORICONINFO *ptr )
red
=
green
=
blue
=
0
;
switch
(
ptr
->
bBitsPerPixel
)
{
case
32
:
theChar
=
theImage
[
byteIndex
++
];
blue
=
theChar
;
theChar
=
theImage
[
byteIndex
++
];
green
=
theChar
;
theChar
=
theImage
[
byteIndex
++
];
red
=
theChar
;
theChar
=
theImage
[
byteIndex
++
];
/* If the alpha channel is >5% transparent,
* assume that we can add it to the bitMask32.
*/
if
(
theChar
>
0x0D
)
*
(
bitMask32
+
(
y
*
xmax
+
x
)
/
8
)
|=
1
<<
(
x
&
7
);
break
;
case
24
:
theChar
=
theImage
[
byteIndex
++
];
blue
=
theChar
;
...
...
@@ -767,21 +788,20 @@ static Cursor create_cursor( Display *display, CURSORICONINFO *ptr )
/* Now create the 2 pixmaps for bits and mask */
pixmapBits
=
XCreatePixmap
(
display
,
root_window
,
ptr
->
nWidth
,
ptr
->
nHeight
,
1
);
pixmapMask
=
XCreatePixmap
(
display
,
root_window
,
ptr
->
nWidth
,
ptr
->
nHeight
,
1
);
if
(
ptr
->
bBitsPerPixel
!=
32
)
{
pixmapMaskInv
=
XCreatePixmap
(
display
,
root_window
,
ptr
->
nWidth
,
ptr
->
nHeight
,
1
);
pixmapMask
=
XCreatePixmap
(
display
,
root_window
,
ptr
->
nWidth
,
ptr
->
nHeight
,
1
);
/* Make sure everything went OK so far */
if
(
pixmapBits
&&
pixmapMask
&&
pixmapMaskInv
)
{
POINT
hotspot
;
/* We have to do some magic here, as cursors are not fully
* compatible between Windows and X11. Under X11, the
re
* are only 3 possible color cursor: black, white and
* masked. So we map the 4th Windows color (invert the
* bits on the screen) to black and an additional white bit on
* an other place
(+1,+1). This require some boolean arithmetic:
* compatible between Windows and X11. Under X11, there a
re
* only 3 possible color cursor: black, white and masked. So
* we map the 4th Windows color (invert the bits on the screen)
* to black and an additional white bit on an other place
*
(+1,+1). This require some boolean arithmetic:
*
* Windows | X11
* And Xor Result | Bits Mask Result
...
...
@@ -795,8 +815,8 @@ static Cursor create_cursor( Display *display, CURSORICONINFO *ptr )
* Mask = not 'And' or 'Xor' or 'And2' and 'Xor2'
*
* FIXME: apparently some servers do support 'inverted' color.
* I don't know if it's correct per the X spec, but mayb
e
* we
ought to take advantage of it. -- AJ
* I don't know if it's correct per the X spec, but maybe w
e
*
ought to take advantage of it. -- AJ
*/
XSetFunction
(
display
,
gc
,
GXcopy
);
XCopyArea
(
display
,
pixmapAll
,
pixmapBits
,
gc
,
...
...
@@ -821,6 +841,15 @@ static Cursor create_cursor( Display *display, CURSORICONINFO *ptr )
XCopyArea
(
display
,
pixmapMaskInv
,
pixmapBits
,
gc
,
0
,
0
,
ptr
->
nWidth
,
ptr
->
nHeight
,
1
,
1
);
XSetFunction
(
display
,
gc
,
GXcopy
);
}
}
else
{
pixmapMask
=
XCreateBitmapFromData
(
display
,
root_window
,
bitMask32
,
ptr
->
nWidth
,
ptr
->
nHeight
);
HeapFree
(
GetProcessHeap
(),
0
,
bitMask32
);
}
/* Make sure hotspot is valid */
hotspot
.
x
=
ptr
->
ptHotSpot
.
x
;
...
...
@@ -831,9 +860,10 @@ static Cursor create_cursor( Display *display, CURSORICONINFO *ptr )
hotspot
.
x
=
ptr
->
nWidth
/
2
;
hotspot
.
y
=
ptr
->
nHeight
/
2
;
}
if
(
pixmapBits
&&
pixmapMask
)
cursor
=
XCreatePixmapCursor
(
display
,
pixmapBits
,
pixmapMask
,
&
fg
,
&
bg
,
hotspot
.
x
,
hotspot
.
y
);
}
/* Now free everything */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment