Skip to content

Conversation

Copy link

Copilot AI commented Jun 13, 2025

This PR enhances the double click APIs by adding missing extension methods and ensuring proper accessibility of the double click timing property.

Changes Made

New Extension Methods Added

  • RightDoubleClick() - Performs right mouse button double click
  • MiddleClick() - Performs middle mouse button single click
  • MiddleDoubleClick() - Performs middle mouse button double click

All new methods follow the same consistent API pattern as existing methods:

await element.RightDoubleClick(Position.Center, xOffset: 10, yOffset: 5);
await element.MiddleClick();
await element.MiddleDoubleClick(clickTime: TimeSpan.FromMilliseconds(200));

Enhanced Test Coverage

Added comprehensive tests for all new methods:

  • CanRightDoubleClickOnButton()
  • CanMiddleClickOnButton()
  • CanMiddleDoubleClickOnButton()
  • DoubleClickTimeIsAccessibleWithoutWinForms() - Verifies the double click timing property works without WinForms dependency

Requirements Fulfilled

Extension methods for double click - Now all mouse buttons support both single and double click operations (Left, Right, Middle)

Double click timing without WinForms - The MouseInput.GetDoubleClickTime property was already properly implemented using Windows API directly:

public static TimeSpan GetDoubleClickTime 
    => TimeSpan.FromMilliseconds(Windows.Win32.PInvoke.GetDoubleClickTime());

This avoids the WinForms dependency that would come from SystemInformation.DoubleClickTime.

API Consistency

The implementation maintains full consistency with existing patterns:

  • Same method signatures and parameter names
  • Same async/await patterns
  • Same return types (Task<Point>)
  • Same position and offset support
  • Same optional click timing support

Fixes #192.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Better double click APIs Add missing double click extension methods and enhance mouse input APIs Jun 13, 2025
Copilot AI requested a review from Keboo June 13, 2025 04:09
Copilot finished work on behalf of Keboo June 13, 2025 04:09
{
// Verify that GetDoubleClickTime works without needing WinForms reference
TimeSpan doubleClickTime = MouseInput.GetDoubleClickTime;
Assert.IsTrue(doubleClickTime.TotalMilliseconds > 0);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Assert.IsTrue(doubleClickTime.TotalMilliseconds > 0);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Better double click APIs

2 participants