1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:57:44 +00:00

LibGUI: Create the emoji buttons only once for EmojiInputDialog

To prevent lag when the displayed code points are redrawn in support of
a search box, only create the GUI::Button objects for the emoji a single
time. Re-use those buttons when adding them to the dialog.
This commit is contained in:
Timothy Flynn 2022-09-06 10:30:37 -04:00 committed by Linus Groh
parent a511dec5ca
commit 1c32823dd8
2 changed files with 57 additions and 43 deletions

View file

@ -13,6 +13,11 @@ namespace GUI {
class EmojiInputDialog final : public Dialog {
C_OBJECT(EmojiInputDialog);
struct Emoji {
u32 code_point { 0 };
RefPtr<Button> button;
};
public:
String const& selected_emoji_text() const { return m_selected_emoji_text; }
@ -20,10 +25,11 @@ private:
virtual void event(Core::Event&) override;
explicit EmojiInputDialog(Window* parent_window);
Vector<Emoji> supported_emoji();
void update_displayed_emoji();
RefPtr<Widget> m_emojis_widget;
Vector<u32> m_code_points;
Vector<Emoji> m_emojis;
String m_selected_emoji_text;
};