-
Notifications
You must be signed in to change notification settings - Fork 104
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
Cursor Scaling Support #3735
base: main
Are you sure you want to change the base?
Cursor Scaling Support #3735
Conversation
9cd58cb
to
ed17b1f
Compare
4f3b5dc
to
b5ac991
Compare
Co-authored-by: Alan Griffiths <[email protected]> Co-authored-by: Michał Sawicz <[email protected]>
Works around lifetime issues
Since the order of initialization is the same as the order of declaration, the config file was initialized before the mutex. But it would use the mutex during its construction since it loads on construction, causing an error to be thrown and the application to crash.
b5ac991
to
080c35b
Compare
In the grand scheme of things, the cursor isn't scaled nor is it shown/hidden that much. So this check doesn't help much, while breaking tests
080c35b
to
bd302df
Compare
@@ -1,3 +1,5 @@ | |||
pkg_check_modules(PIXMAN REQUIRED IMPORTED_TARGET pixman-1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not super sure about this but putting this line in src/platform/graphics/CMakeLists.txt
causes a cmake error so this is the best I had in mind.
`create_scaled_renderable_for_current_cursor`
mir/src/server/graphics/software_cursor.cpp Lines 81 to 85 in fbf87c7
Edit: done |
Allows both `Cursor::{show, set_scale}` to lock to avoid races while showing/scaling the cursor, while also not requiring a recursive lock. We previously needed a recursive lock since `set_scale` called `show`, and both would lock the mutex, requiring either a recursive lock, or adding a non-locking version of `set_scale`. No other need for a recursive lock.
Bug: If you change the cursor scale from inside the running compositor, a copy of the new cursor is displayed where the old cursor was. Only happens if the cursor is over kgx/weston-terminal Edit: Doesn't seem to happen anymore. Not sure why it came up in the first place |
Another bug: the cursor doesn't work properly with x apps False alarm, xterm launched from kgx inside mir_demo_sever was opening outside the intended compositor. Ported the changes to miral-shell and started xterm from there and the cursor works properly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bunch of "housekeeping"...
@@ -84,6 +84,7 @@ MIR_PLATFORM_2.19 { | |||
mir::graphics::initialise_egl_logger*; | |||
mir::graphics::operator*; | |||
mir::graphics::red_channel_depth*; | |||
mir::graphics::scale_cursor_image*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR breaks the platform ABI, everything should move to a 2.20 stanza
CachedPtr<shell::AccessibilityManager> accessibility_manager; | ||
CachedPtr<shell::decoration::Manager> decoration_manager; | ||
CachedPtr<scene::ApplicationNotRespondingDetector> application_not_responding_detector; | ||
CachedPtr<cookie::Authority> cookie_authority; | ||
CachedPtr<input::receiver::XKBMapperRegistrar> xkb_mapper_registrar; | ||
std::shared_ptr<ConsoleServices> console_services; | ||
std::shared_ptr<DecorationStrategy> decoration_strategy; | ||
CachedPtr<shell::AccessibilityManager> accessibility_manager; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like an unnecessary reordering change?
mir::shell::AccessibilityManager::cursor_scale_changed*; | ||
mir::shell::AccessibilityManager::set_cursor*; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing the layout of AccessibilityManager
is an ABI break: we need to move to a 2.20 stanza
@@ -424,12 +426,12 @@ TEST_F(SoftwareCursor, handles_argb_8888_cursor_surface) | |||
ON_CALL(mock_buffer_allocator, supported_pixel_formats()) | |||
.WillByDefault(Return(std::vector<MirPixelFormat>{ mir_pixel_format_argb_8888 })); | |||
|
|||
StubCursorImage test_image{{8, 8}}; | |||
auto test_image = std::make_shared<StubCursorImage>(geom::Displacement{8, 8}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto test_image = std::make_shared<StubCursorImage>(geom::Displacement{8, 8}); | |
auto const test_image = std::make_shared<StubCursorImage>(geom::Displacement{8, 8}); |
@@ -478,12 +480,12 @@ TEST_F(SoftwareCursor, handles_argb_8888_buffer_with_stride) | |||
ON_CALL(mock_buffer_allocator, supported_pixel_formats()) | |||
.WillByDefault(Return(std::vector<MirPixelFormat>{ mir_pixel_format_argb_8888 })); | |||
|
|||
StubCursorImage test_image{{8, 8}}; | |||
auto test_image = std::make_shared<StubCursorImage>(geom::Displacement{8, 8}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto test_image = std::make_shared<StubCursorImage>(geom::Displacement{8, 8}); | |
auto const test_image = std::make_shared<StubCursorImage>(geom::Displacement{8, 8}); |
{ | ||
auto image = dynamic_cast<NamedCursorImage const*>(&i); | ||
auto image = std::dynamic_pointer_cast<NamedCursorImage const>(i); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto image = std::dynamic_pointer_cast<NamedCursorImage const>(i); | |
auto const image = std::dynamic_pointer_cast<NamedCursorImage const>(i); |
@@ -321,7 +322,7 @@ struct MesaCursorTest : ::testing::Test | |||
} | |||
|
|||
testing::NiceMock<mtd::MockDRM> mock_drm; | |||
StubCursorImage stub_image; | |||
std::shared_ptr<StubCursorImage> stub_image = std::make_shared<StubCursorImage>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
std::shared_ptr<StubCursorImage> stub_image = std::make_shared<StubCursorImage>(); | |
auto const stub_image = std::make_shared<StubCursorImage>(); |
Currently only implements cursor scaling for software cursors. Missing the actual configuration portion.