Skip to content

Commit

Permalink
steamcompmgr: Consolidate duped logic into ShouldDrawCursor
Browse files Browse the repository at this point in the history
  • Loading branch information
misyltoad committed Jun 20, 2024
1 parent 2e43c15 commit 4ecce4a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/steamcompmgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2225,6 +2225,16 @@ static void paint_pipewire()
#endif

gamescope::ConVar<int> cv_cursor_composite{ "cursor_composite", 1, "0 = Never composite a cursor. 1 = Composite cursor when not nested. 2 = Always composite a cursor manually" };
bool ShouldDrawCursor()
{
if ( cv_cursor_composite == 2 )
return true;

if ( cv_cursor_composite == 0 )
return false;

return g_bForceRelativeMouse || !GetBackend()->GetNestedHints();
}

static void
paint_all(bool async)
Expand Down Expand Up @@ -2441,10 +2451,8 @@ paint_all(bool async)
global_focus.cursor->undirty();
}

bool bForceHideCursor = ( ( GetBackend()->GetNestedHints() && !bSteamCompMgrGrab ) || cv_cursor_composite == 0 ) && cv_cursor_composite != 2;

// Draw cursor if we need to
if (input && !bForceHideCursor) {
if (input && !ShouldDrawCursor()) {
global_focus.cursor->paint(
input, w == input ? override : nullptr,
&frameInfo);
Expand Down

0 comments on commit 4ecce4a

Please sign in to comment.