mirror of
https://github.com/RGBCube/serenity
synced 2025-07-06 14:27:35 +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:
parent
183ee5847c
commit
f5dfb29607
5 changed files with 36 additions and 6 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue