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

WindowServer: Start implementing a menu system.

I'm going with a global top-of-the-screen menu instead of per-window menus.
The basic idea is that menus will live in the WindowServer and clients can
create menus via WindowServer requests.
This commit is contained in:
Andreas Kling 2019-02-11 09:47:10 +01:00
parent 7abef6ba9e
commit 443b043b49
14 changed files with 487 additions and 6 deletions

View file

@ -58,6 +58,7 @@ public:
byte glyph_width() const { return m_glyph_width; }
byte glyph_height() const { return m_glyph_height; }
int width(const String& string) const { return string.length() * glyph_width(); }
String name() const { return m_name; }
void set_name(const String& name) { m_name = name; }

View file

@ -39,6 +39,25 @@ GraphicsBitmap::GraphicsBitmap(Process& process, const Size& size)
m_data = (RGBA32*)m_server_region->laddr().as_ptr();
}
RetainPtr<GraphicsBitmap> GraphicsBitmap::create_kernel_only(const Size& size)
{
return adopt(*new GraphicsBitmap(size));
}
GraphicsBitmap::GraphicsBitmap(const Size& size)
: m_size(size)
, m_pitch(size.width() * sizeof(RGBA32))
{
InterruptDisabler disabler;
size_t size_in_bytes = size.width() * size.height() * sizeof(RGBA32);
auto vmo = VMObject::create_anonymous(size_in_bytes);
auto& server = WSMessageLoop::the().server_process();
m_server_region = server.allocate_region_with_vmo(LinearAddress(), size_in_bytes, move(vmo), 0, "GraphicsBitmap (server)", true, false);
m_server_region->set_shared(true);
m_server_region->set_is_bitmap(true);
m_data = (RGBA32*)m_server_region->laddr().as_ptr();
}
#endif
RetainPtr<GraphicsBitmap> GraphicsBitmap::create_wrapper(const Size& size, RGBA32* data)

View file

@ -15,6 +15,7 @@ class GraphicsBitmap : public Retainable<GraphicsBitmap> {
public:
#ifdef KERNEL
static RetainPtr<GraphicsBitmap> create(Process&, const Size&);
static RetainPtr<GraphicsBitmap> create_kernel_only(const Size&);
#endif
static RetainPtr<GraphicsBitmap> create_wrapper(const Size&, RGBA32*);
static RetainPtr<GraphicsBitmap> load_from_file(const String& path, const Size&);
@ -37,6 +38,7 @@ public:
private:
#ifdef KERNEL
GraphicsBitmap(Process&, const Size&);
GraphicsBitmap(const Size&);
#endif
GraphicsBitmap(const Size&, RGBA32*);