1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 03:27:34 +00:00

WindowServer+Keymap+LibGUI: Add widget to display current keymap

This commit is contained in:
Timur Sultanov 2022-01-19 14:44:56 +03:00 committed by Andreas Kling
parent 68a01f0e27
commit b9c558f6c6
14 changed files with 160 additions and 17 deletions

View file

@ -67,6 +67,7 @@ public:
WM_SuperKeyPressed,
WM_SuperSpaceKeyPressed,
WM_WorkspaceChanged,
WM_KeymapChanged,
__End_WM_Events,
};
@ -228,6 +229,20 @@ private:
const unsigned m_current_column;
};
class WMKeymapChangedEvent : public WMEvent {
public:
explicit WMKeymapChangedEvent(int client_id, String const& keymap)
: WMEvent(Event::Type::WM_KeymapChanged, client_id, 0)
, m_keymap(keymap)
{
}
String const& keymap() const { return m_keymap; }
private:
const String m_keymap;
};
class MultiPaintEvent final : public Event {
public:
explicit MultiPaintEvent(Vector<Gfx::IntRect, 32> rects, Gfx::IntSize const& window_size)

View file

@ -70,4 +70,10 @@ void WindowManagerServerConnection::workspace_changed(i32 wm_id, u32 row, u32 co
Core::EventLoop::current().post_event(*window, make<WMWorkspaceChangedEvent>(wm_id, row, column));
}
void WindowManagerServerConnection::keymap_changed(i32 wm_id, String const& keymap)
{
if (auto* window = Window::from_window_id(wm_id))
Core::EventLoop::current().post_event(*window, make<WMKeymapChangedEvent>(wm_id, keymap));
}
}

View file

@ -35,6 +35,7 @@ private:
virtual void super_key_pressed(i32) override;
virtual void super_space_key_pressed(i32) override;
virtual void workspace_changed(i32, u32, u32) override;
virtual void keymap_changed(i32, String const&) override;
};
}