From: Axel Davy Date: Sat, 15 Sep 2018 19:53:25 +0000 (+0200) Subject: st/nine: Don't call SetCursor until a cursor is set X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0eeb583650c64e789e0bfa7b3194310c5c44ba4f;p=mesa.git st/nine: Don't call SetCursor until a cursor is set The previous code was ignoring the input until a cursor is set inside d3d (with SetCursorProperties), as expected by wine tests. However it did still make a call to ID3DPresent_SetCursor, which would result into a SetCursor(NULL) call, thus hidding any cursor set outside d3d, which we shouldn't do. Add comment about not avoiding redundant ID3DPresent_SetCursor calls once a cursor has been set in d3d, as it has been tested to cause regressions. Fixes: https://github.com/iXit/Mesa-3D/issues/197 Signed-off-by: Axel Davy --- diff --git a/src/gallium/state_trackers/nine/device9.c b/src/gallium/state_trackers/nine/device9.c index b3e56d70b74..04f90ad8210 100644 --- a/src/gallium/state_trackers/nine/device9.c +++ b/src/gallium/state_trackers/nine/device9.c @@ -810,7 +810,14 @@ NineDevice9_ShowCursor( struct NineDevice9 *This, DBG("This=%p bShow=%d\n", This, (int) bShow); - This->cursor.visible = bShow && (This->cursor.hotspot.x != -1); + /* No-op until a cursor is set in d3d */ + if (This->cursor.hotspot.x == -1) + return old; + + This->cursor.visible = bShow; + /* Note: Don't optimize by avoiding the call if This->cursor.visible + * hasn't changed. One has to keep in mind the app may do SetCursor + * calls outside d3d, thus such an optimization affects behaviour. */ if (!This->cursor.software) This->cursor.software = ID3DPresent_SetCursor(This->swapchains[0]->present, NULL, NULL, bShow) != D3D_OK;