Am Samstag 29 Juli 2006 11:17 schrieb Andrew Riedi:
Well, here is my first patch, feel free to tell me what all is wrong with it. I noticed a problem in WoW d3d, so I tracked it down and checked out msdn. It seems that implementing ShowCursor() over GDI is acceptable, at least according to msdn, and it seems to work great. Anyhow, this patch fixes the two mouse cursor problem in WoW, and makes wined3d more compatible with windows, at least msdn. Here goes nothing.
MSDN says that the cursor image set with SetCursorProperties can be shown as a user cursor if it has a size of 32x32 pixels. Otherwise the cursor is emulated like we do it at already in swapchain.c, IDirect3DSwapChain9::Present.
So if the cursor image is 32x32 pixels, upload it to a gdi cursor, and do not upload it to a gl texture(doine in SetCusorProperties with the preload call), and do not draw it in present. Activate the user cursor in ShowCursor.
If the cursor is not 32x32 pixels then disable the gdi cursor, and draw the cursor as it is done now(upload to a gl texture, call Blt in present.
I don't know how to set a gdi cursor, but you can find the image in the d3d surface at surface->resource.allocatedMemory. Be aware that allocatedMemory may be NULL if the image is just stored in a gl texture, so the cleaner way is to call IWineD3DSurface::LockRect to retrieve the image.
On 06/08/06, Stefan Dösinger stefan@codeweavers.com wrote:
If the cursor is not 32x32 pixels then disable the gdi cursor,
Are you sure that's required?
I don't know how to set a gdi cursor,
SetCursor()
Am Sonntag 06 August 2006 12:12 schrieb H. Verbeet:
On 06/08/06, Stefan Dösinger stefan@codeweavers.com wrote:
If the cursor is not 32x32 pixels then disable the gdi cursor,
Are you sure that's required?
We might end up with 2 active cursors, the one drawn with the Blit and the gdi cursor.
I don't know how to set a gdi cursor,
SetCursor()
:-)
On 06/08/06, Stefan Dösinger stefan@codeweavers.com wrote:
Am Sonntag 06 August 2006 12:12 schrieb H. Verbeet:
On 06/08/06, Stefan Dösinger stefan@codeweavers.com wrote:
If the cursor is not 32x32 pixels then disable the gdi cursor,
Are you sure that's required?
We might end up with 2 active cursors, the one drawn with the Blit and the gdi cursor.
Well yes, but the Remarks section for IDirect3DDevice9::ShowCursor() seems to suggest that is what is supposed to happen.
Am Sonntag 06 August 2006 13:05 schrieb H. Verbeet:
On 06/08/06, Stefan Dösinger stefan@codeweavers.com wrote:
Am Sonntag 06 August 2006 12:12 schrieb H. Verbeet:
On 06/08/06, Stefan Dösinger stefan@codeweavers.com wrote:
If the cursor is not 32x32 pixels then disable the gdi cursor,
Are you sure that's required?
We might end up with 2 active cursors, the one drawn with the Blit and the gdi cursor.
Well yes, but the Remarks section for IDirect3DDevice9::ShowCursor() seems to suggest that is what is supposed to happen.
Due to the lack of games to test with I have written a small test app do draw the cursor. I tested it on win2k with a geforce 2 card.
With a 32x32 cursor SetCursor set the gdi cursor image to my d3d cursor, and placed the cursor position. If I moved the mouse the cursor moved. The old cusor(hourglass) disappeared
With a 64x64 the d3d cursor was drawn at the requested position, but didn't move when I moved the mouse. The hourglass wasn't shown.
My cursor tests are in the attached file. Our GetFrontBufferData implementation needs some more work for the automated tests to work(Well, I think a call to IWineD3DSurface::BltFast should do the job).
Søndag 06 august 2006 15:36, skrev Stefan Dösinger:
Am Sonntag 06 August 2006 13:05 schrieb H. Verbeet:
On 06/08/06, Stefan Dösinger stefan@codeweavers.com wrote:
Am Sonntag 06 August 2006 12:12 schrieb H. Verbeet:
On 06/08/06, Stefan Dösinger stefan@codeweavers.com wrote:
If the cursor is not 32x32 pixels then disable the gdi cursor,
Are you sure that's required?
We might end up with 2 active cursors, the one drawn with the Blit and the gdi cursor.
Well yes, but the Remarks section for IDirect3DDevice9::ShowCursor() seems to suggest that is what is supposed to happen.
Due to the lack of games to test with I have written a small test app do draw the cursor. I tested it on win2k with a geforce 2 card.
If you are looking for a game where two cursors are drawn, you can use Warlords IV: Heroes of Etheria. The demo is available here http://appdb.winehq.org/appview.php?iVersionId=4402
With a 32x32 cursor SetCursor set the gdi cursor image to my d3d cursor, and placed the cursor position. If I moved the mouse the cursor moved. The old cusor(hourglass) disappeared
With a 64x64 the d3d cursor was drawn at the requested position, but didn't move when I moved the mouse. The hourglass wasn't shown.
My cursor tests are in the attached file. Our GetFrontBufferData implementation needs some more work for the automated tests to work(Well, I think a call to IWineD3DSurface::BltFast should do the job).