| 3190 | } |
| 3191 | |
| 3192 | _shouldShowDotCursor() { |
| 3193 | // Called when this._cursorImage is updated |
| 3194 | if (!this._showDotCursor) { |
| 3195 | // User does not want to see the dot, so... |
| 3196 | return false; |
| 3197 | } |
| 3198 | |
| 3199 | // The dot should not be shown if the cursor is already visible, |
| 3200 | // i.e. contains at least one not-fully-transparent pixel. |
| 3201 | // So iterate through all alpha bytes in rgba and stop at the |
| 3202 | // first non-zero. |
| 3203 | for (let i = 3; i < this._cursorImage.rgbaPixels.length; i += 4) { |
| 3204 | if (this._cursorImage.rgbaPixels[i]) { |
| 3205 | return false; |
| 3206 | } |
| 3207 | } |
| 3208 | |
| 3209 | // At this point, we know that the cursor is fully transparent, and |
| 3210 | // the user wants to see the dot instead of this. |
| 3211 | return true; |
| 3212 | } |
| 3213 | |
| 3214 | _refreshCursor() { |
| 3215 | if (this._rfbConnectionState !== "connecting" && |