mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:07:34 +00:00
Taskbar: Start working on a taskbar app.
I originally thought I would do this inside WindowServer, but let's try to make it as a standalone app that communicates with WindowServer instead. That will allow us to use LibGUI. :^)
This commit is contained in:
parent
318db1e48e
commit
a22774ee3f
31 changed files with 577 additions and 18 deletions
|
@ -16,7 +16,11 @@ GDesktop::GDesktop()
|
|||
|
||||
void GDesktop::did_receive_screen_rect(Badge<GEventLoop>, const Rect& rect)
|
||||
{
|
||||
if (m_rect == rect)
|
||||
return;
|
||||
m_rect = rect;
|
||||
if (on_rect_change)
|
||||
on_rect_change(rect);
|
||||
}
|
||||
|
||||
bool GDesktop::set_wallpaper(const String& path)
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <AK/AKString.h>
|
||||
#include <AK/Badge.h>
|
||||
#include <AK/Function.h>
|
||||
#include <SharedGraphics/Rect.h>
|
||||
|
||||
class GEventLoop;
|
||||
|
@ -17,6 +18,8 @@ public:
|
|||
Rect rect() const { return m_rect; }
|
||||
void did_receive_screen_rect(Badge<GEventLoop>, const Rect&);
|
||||
|
||||
Function<void(const Rect&)> on_rect_change;
|
||||
|
||||
private:
|
||||
Rect m_rect;
|
||||
};
|
||||
|
|
|
@ -64,6 +64,7 @@ void GEventLoop::connect_to_server()
|
|||
request.greeting.client_pid = getpid();
|
||||
auto response = sync_request(request, WSAPI_ServerMessage::Type::Greeting);
|
||||
s_server_pid = response.greeting.server_pid;
|
||||
GDesktop::the().did_receive_screen_rect(Badge<GEventLoop>(), response.greeting.screen_rect);
|
||||
}
|
||||
|
||||
GEventLoop::GEventLoop()
|
||||
|
|
|
@ -64,6 +64,7 @@ void GWindow::show()
|
|||
request.window.opacity = m_opacity_when_windowless;
|
||||
request.window.size_increment = m_size_increment;
|
||||
request.window.base_size = m_base_size;
|
||||
request.window.type = (WSAPI_WindowType)m_window_type;
|
||||
ASSERT(m_title_when_windowless.length() < (ssize_t)sizeof(request.text));
|
||||
strcpy(request.text, m_title_when_windowless.characters());
|
||||
request.text_length = m_title_when_windowless.length();
|
||||
|
@ -140,6 +141,11 @@ void GWindow::set_rect(const Rect& a_rect)
|
|||
GEventLoop::current().post_message_to_server(request);
|
||||
}
|
||||
|
||||
void GWindow::set_window_type(GWindowType window_type)
|
||||
{
|
||||
m_window_type = window_type;
|
||||
}
|
||||
|
||||
void GWindow::set_override_cursor(GStandardCursor cursor)
|
||||
{
|
||||
if (!m_window_id)
|
||||
|
|
|
@ -16,6 +16,12 @@ enum class GStandardCursor {
|
|||
ResizeVertical,
|
||||
};
|
||||
|
||||
enum class GWindowType {
|
||||
Invalid = 0,
|
||||
Normal,
|
||||
Taskbar,
|
||||
};
|
||||
|
||||
class GWindow : public GObject {
|
||||
public:
|
||||
GWindow(GObject* parent = nullptr);
|
||||
|
@ -29,6 +35,7 @@ public:
|
|||
void set_double_buffering_enabled(bool);
|
||||
void set_has_alpha_channel(bool);
|
||||
void set_opacity(float);
|
||||
void set_window_type(GWindowType);
|
||||
|
||||
int window_id() const { return m_window_id; }
|
||||
|
||||
|
@ -117,6 +124,7 @@ private:
|
|||
Vector<Rect> m_pending_paint_event_rects;
|
||||
Size m_size_increment;
|
||||
Size m_base_size;
|
||||
GWindowType m_window_type { GWindowType::Normal };
|
||||
bool m_is_active { false };
|
||||
bool m_should_exit_app_on_close { false };
|
||||
bool m_has_alpha_channel { false };
|
||||
|
@ -124,4 +132,3 @@ private:
|
|||
bool m_modal { false };
|
||||
bool m_resizable { true };
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue