mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-04-23 21:14:31 +00:00
LibGUI+WindowServer: Allow specifying an optional drag bitmap
This bitmap is displayed alongside the dragged text underneath the mouse cursor while dragging. This will be a perfect fit for dragging e.g files around. :^)
This commit is contained in:
@@ -1199,8 +1199,10 @@ void WSWindowManager::end_dnd_drag()
|
||||
|
||||
Rect WSWindowManager::dnd_rect() const
|
||||
{
|
||||
int width = font().width(m_dnd_text);
|
||||
int height = font().glyph_height();
|
||||
int bitmap_width = m_dnd_bitmap ? m_dnd_bitmap->width() : 0;
|
||||
int bitmap_height = m_dnd_bitmap ? m_dnd_bitmap->width() : 0;
|
||||
int width = font().width(m_dnd_text) + bitmap_width;
|
||||
int height = max((int)font().glyph_height(), bitmap_height);
|
||||
auto location = WSCompositor::the().current_cursor_rect().center().translated(8, 8);
|
||||
return Rect(location, { width, height }).inflated(4, 4);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user