Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(#3357) provide a mechanism to move the cursor to a position immediately #3370

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mattkae
Copy link
Contributor

@mattkae mattkae commented May 3, 2024

What's new?

Compositor implementers can now control the cursor like so:

bool FloatingWindowManagerPolicy::handle_keyboard_event(MirKeyboardEvent const* event)
{
    // ...

    auto const action = mir_keyboard_event_action(event);
    auto const scan_code = mir_keyboard_event_scan_code(event);
    auto const modifiers = mir_keyboard_event_modifiers(event) & modifier_mask;

    if (action == mir_keyboard_action_down && modifiers == mir_input_event_modifier_alt && scan_code == KEY_0)
    {
        tools.move_cursor_to(mir::geometry::PointF(0, 0)); // Move the cursor to top left corner
    }

    // ...
}

All bounds checking is handled by the internal input code, so no need for bounds checking at the interface layer :)

Copy link

codecov bot commented May 3, 2024

Codecov Report

Attention: Patch coverage is 33.33333% with 26 lines in your changes are missing coverage. Please review.

Project coverage is 77.50%. Comparing base (4128d65) to head (0b981ae).
Report is 21 commits behind head on main.

Files Patch % Lines
src/miral/basic_window_manager.cpp 30.00% 14 Missing ⚠️
src/miral/window_management_trace.cpp 0.00% 6 Missing ⚠️
src/miral/set_window_management_policy.cpp 50.00% 2 Missing ⚠️
src/miral/window_management_options.cpp 0.00% 2 Missing ⚠️
src/miral/window_manager_tools.cpp 0.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3370      +/-   ##
==========================================
- Coverage   77.52%   77.50%   -0.03%     
==========================================
  Files        1065     1066       +1     
  Lines       67869    67937      +68     
==========================================
+ Hits        52618    52657      +39     
- Misses      15251    15280      +29     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mattkae mattkae requested a review from AlanGriffiths May 3, 2024 15:55
@mattkae mattkae marked this pull request as ready for review May 3, 2024 15:55
@mattkae mattkae requested a review from a team as a code owner May 3, 2024 15:55
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.

None yet

1 participant