mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:57:44 +00:00
WindowServer: Add support for default MenuItem
This allows marking a MenuItem as a default action, e.g. in a context menu for an action that reflects what e.g. a double click would perform. Also enhance the window menu to mark the close action as the default, and when double clicked perform that action. Fixes #1289
This commit is contained in:
parent
684b04e02a
commit
fc4e01a3c9
10 changed files with 194 additions and 32 deletions
|
@ -172,6 +172,9 @@ public:
|
|||
|
||||
void did_popup_a_menu(Badge<Menu>);
|
||||
|
||||
void start_menu_doubleclick(Window& window, const MouseEvent& event);
|
||||
bool is_menu_doubleclick(Window& window, const MouseEvent& event) const;
|
||||
|
||||
private:
|
||||
NonnullRefPtr<Cursor> get_cursor(const String& name);
|
||||
NonnullRefPtr<Cursor> get_cursor(const String& name, const Gfx::IntPoint& hotspot);
|
||||
|
@ -227,6 +230,7 @@ private:
|
|||
Gfx::IntPoint last_position;
|
||||
};
|
||||
|
||||
const ClickMetadata& metadata_for_button(MouseButton) const;
|
||||
ClickMetadata& metadata_for_button(MouseButton);
|
||||
|
||||
void reset()
|
||||
|
@ -247,6 +251,9 @@ private:
|
|||
ClickMetadata m_back;
|
||||
ClickMetadata m_forward;
|
||||
};
|
||||
|
||||
bool is_considered_doubleclick(const MouseEvent& event, const DoubleClickInfo::ClickMetadata& metadata) const;
|
||||
|
||||
DoubleClickInfo m_double_click_info;
|
||||
int m_double_click_speed { 0 };
|
||||
int m_max_distance_for_double_click { 4 };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue