mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-29 06:02:07 +03:00
Taskbar+LibGUI: More work on bringup.
This commit is contained in:
parent
a22774ee3f
commit
aa03a07e61
Notes:
sideshowbarker
2024-07-19 14:50:02 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/aa03a07e614
4
Applications/Taskbar/.gitignore
vendored
Normal file
4
Applications/Taskbar/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
*.o
|
||||
*.d
|
||||
Taskbar
|
||||
*.autosave
|
Binary file not shown.
@ -9,7 +9,7 @@ STANDARD_FLAGS = -std=c++17 -Wno-sized-deallocation
|
||||
WARNING_FLAGS = -Wextra -Wall -Wundef -Wcast-qual -Wwrite-strings -Wimplicit-fallthrough
|
||||
FLAVOR_FLAGS = -fno-exceptions -fno-rtti
|
||||
OPTIMIZATION_FLAGS = -Os
|
||||
INCLUDE_FLAGS = -I../.. -I. -I../../LibC
|
||||
INCLUDE_FLAGS = -I../.. -I../../Servers -I. -I../../LibC
|
||||
|
||||
DEFINES = -DSERENITY -DSANITIZE_PTRS -DUSERLAND
|
||||
|
||||
|
Binary file not shown.
@ -9,7 +9,7 @@ TaskbarWidget::TaskbarWidget(GWidget* parent)
|
||||
: GFrame(parent)
|
||||
{
|
||||
set_fill_with_background_color(true);
|
||||
set_layout(make<GBoxLayout>(Orientation::Vertical));
|
||||
set_layout(make<GBoxLayout>(Orientation::Horizontal));
|
||||
layout()->set_margins({ 0, 8, 0, 8 });
|
||||
layout()->set_spacing(8);
|
||||
|
||||
|
@ -1,133 +0,0 @@
|
||||
TaskbarWidget.o: TaskbarWidget.cpp TaskbarWidget.h ../../LibGUI/GFrame.h \
|
||||
../../LibGUI/GWidget.h ../../LibGUI/GElapsedTimer.h ../../LibC/time.h \
|
||||
../../LibC/sys/cdefs.h ../../LibC/sys/types.h ../../LibC/stdint.h \
|
||||
../../LibGUI/GEvent.h ../../SharedGraphics/Point.h ../../AK/AKString.h \
|
||||
../../AK/ByteBuffer.h ../../AK/Types.h ../../AK/StdLibExtras.h \
|
||||
../../LibC/stdlib.h ../../LibC/stddef.h ../../LibC/string.h \
|
||||
../../AK/Retainable.h ../../AK/Assertions.h ../../LibC/assert.h \
|
||||
../../AK/RetainPtr.h ../../AK/Retained.h ../../AK/kmalloc.h \
|
||||
../../AK/StringImpl.h ../../AK/Traits.h ../../AK/kstdio.h \
|
||||
../../Kernel/kstdio.h ../../Kernel/kprintf.h ../../AK/HashFunctions.h \
|
||||
../../AK/Vector.h ../../AK/OwnPtr.h ../../SharedGraphics/Rect.h \
|
||||
../../SharedGraphics/Size.h ../../AK/WeakPtr.h ../../AK/Weakable.h \
|
||||
../../Kernel/KeyCode.h ../../LibGUI/GObject.h \
|
||||
../../SharedGraphics/Color.h ../../SharedGraphics/Font.h \
|
||||
../../AK/MappedFile.h ../../AK/Badge.h ../../LibGUI/GLabel.h \
|
||||
../../SharedGraphics/TextAlignment.h ../../LibGUI/GButton.h \
|
||||
../../SharedGraphics/StylePainter.h ../../AK/Function.h \
|
||||
../../SharedGraphics/GraphicsBitmap.h ../../LibC/SharedBuffer.h \
|
||||
../../LibGUI/GBoxLayout.h ../../LibGUI/GLayout.h ../../LibGUI/GMargins.h \
|
||||
../../LibGUI/GPainter.h ../../SharedGraphics/Painter.h \
|
||||
../../LibC/stdio.h ../../LibC/stdarg.h ../../LibC/limits.h
|
||||
|
||||
TaskbarWidget.h:
|
||||
|
||||
../../LibGUI/GFrame.h:
|
||||
|
||||
../../LibGUI/GWidget.h:
|
||||
|
||||
../../LibGUI/GElapsedTimer.h:
|
||||
|
||||
../../LibC/time.h:
|
||||
|
||||
../../LibC/sys/cdefs.h:
|
||||
|
||||
../../LibC/sys/types.h:
|
||||
|
||||
../../LibC/stdint.h:
|
||||
|
||||
../../LibGUI/GEvent.h:
|
||||
|
||||
../../SharedGraphics/Point.h:
|
||||
|
||||
../../AK/AKString.h:
|
||||
|
||||
../../AK/ByteBuffer.h:
|
||||
|
||||
../../AK/Types.h:
|
||||
|
||||
../../AK/StdLibExtras.h:
|
||||
|
||||
../../LibC/stdlib.h:
|
||||
|
||||
../../LibC/stddef.h:
|
||||
|
||||
../../LibC/string.h:
|
||||
|
||||
../../AK/Retainable.h:
|
||||
|
||||
../../AK/Assertions.h:
|
||||
|
||||
../../LibC/assert.h:
|
||||
|
||||
../../AK/RetainPtr.h:
|
||||
|
||||
../../AK/Retained.h:
|
||||
|
||||
../../AK/kmalloc.h:
|
||||
|
||||
../../AK/StringImpl.h:
|
||||
|
||||
../../AK/Traits.h:
|
||||
|
||||
../../AK/kstdio.h:
|
||||
|
||||
../../Kernel/kstdio.h:
|
||||
|
||||
../../Kernel/kprintf.h:
|
||||
|
||||
../../AK/HashFunctions.h:
|
||||
|
||||
../../AK/Vector.h:
|
||||
|
||||
../../AK/OwnPtr.h:
|
||||
|
||||
../../SharedGraphics/Rect.h:
|
||||
|
||||
../../SharedGraphics/Size.h:
|
||||
|
||||
../../AK/WeakPtr.h:
|
||||
|
||||
../../AK/Weakable.h:
|
||||
|
||||
../../Kernel/KeyCode.h:
|
||||
|
||||
../../LibGUI/GObject.h:
|
||||
|
||||
../../SharedGraphics/Color.h:
|
||||
|
||||
../../SharedGraphics/Font.h:
|
||||
|
||||
../../AK/MappedFile.h:
|
||||
|
||||
../../AK/Badge.h:
|
||||
|
||||
../../LibGUI/GLabel.h:
|
||||
|
||||
../../SharedGraphics/TextAlignment.h:
|
||||
|
||||
../../LibGUI/GButton.h:
|
||||
|
||||
../../SharedGraphics/StylePainter.h:
|
||||
|
||||
../../AK/Function.h:
|
||||
|
||||
../../SharedGraphics/GraphicsBitmap.h:
|
||||
|
||||
../../LibC/SharedBuffer.h:
|
||||
|
||||
../../LibGUI/GBoxLayout.h:
|
||||
|
||||
../../LibGUI/GLayout.h:
|
||||
|
||||
../../LibGUI/GMargins.h:
|
||||
|
||||
../../LibGUI/GPainter.h:
|
||||
|
||||
../../SharedGraphics/Painter.h:
|
||||
|
||||
../../LibC/stdio.h:
|
||||
|
||||
../../LibC/stdarg.h:
|
||||
|
||||
../../LibC/limits.h:
|
Binary file not shown.
@ -2,6 +2,8 @@
|
||||
#include "TaskbarWidget.h"
|
||||
#include <LibGUI/GWindow.h>
|
||||
#include <LibGUI/GDesktop.h>
|
||||
#include <LibGUI/GEventLoop.h>
|
||||
#include <WindowServer/WSAPITypes.h>
|
||||
#include <stdio.h>
|
||||
|
||||
TaskbarWindow::TaskbarWindow()
|
||||
@ -27,3 +29,13 @@ void TaskbarWindow::on_screen_rect_change(const Rect& rect)
|
||||
Rect new_rect { rect.x(), rect.bottom() - taskbar_height() + 1, rect.width(), taskbar_height() };
|
||||
set_rect(new_rect);
|
||||
}
|
||||
|
||||
void TaskbarWindow::wm_event(GWMEvent& event)
|
||||
{
|
||||
#if 0
|
||||
switch (event.type()) {
|
||||
case GEvent::WM_WindowAdded:
|
||||
m_window_list.append({})
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -14,7 +14,9 @@ TaskbarWindow.o: TaskbarWindow.cpp TaskbarWindow.h ../../LibGUI/GWindow.h \
|
||||
../../LibGUI/GWidget.h ../../LibGUI/GElapsedTimer.h ../../LibC/time.h \
|
||||
../../LibGUI/GEvent.h ../../Kernel/KeyCode.h ../../SharedGraphics/Font.h \
|
||||
../../AK/Badge.h TaskbarWidget.h ../../LibGUI/GFrame.h \
|
||||
../../LibGUI/GDesktop.h ../../AK/Function.h ../../LibC/stdio.h \
|
||||
../../LibGUI/GDesktop.h ../../AK/Function.h ../../LibGUI/GEventLoop.h \
|
||||
../../AK/HashMap.h ../../AK/HashTable.h ../../AK/DoublyLinkedList.h \
|
||||
../../Servers/WindowServer/WSAPITypes.h ../../LibC/stdio.h \
|
||||
../../LibC/stdarg.h ../../LibC/limits.h
|
||||
|
||||
TaskbarWindow.h:
|
||||
@ -111,6 +113,16 @@ TaskbarWidget.h:
|
||||
|
||||
../../AK/Function.h:
|
||||
|
||||
../../LibGUI/GEventLoop.h:
|
||||
|
||||
../../AK/HashMap.h:
|
||||
|
||||
../../AK/HashTable.h:
|
||||
|
||||
../../AK/DoublyLinkedList.h:
|
||||
|
||||
../../Servers/WindowServer/WSAPITypes.h:
|
||||
|
||||
../../LibC/stdio.h:
|
||||
|
||||
../../LibC/stdarg.h:
|
||||
|
@ -13,4 +13,5 @@ public:
|
||||
private:
|
||||
void on_screen_rect_change(const Rect&);
|
||||
|
||||
virtual void wm_event(GWMEvent&) override;
|
||||
};
|
||||
|
Binary file not shown.
@ -1,114 +0,0 @@
|
||||
main.o: main.cpp ../../LibGUI/GApplication.h ../../AK/Badge.h \
|
||||
../../AK/OwnPtr.h ../../AK/StdLibExtras.h ../../LibC/stdlib.h \
|
||||
../../LibC/sys/cdefs.h ../../LibC/sys/types.h ../../LibC/stdint.h \
|
||||
../../LibC/stddef.h ../../LibC/string.h ../../AK/Types.h \
|
||||
../../AK/Traits.h ../../AK/kstdio.h ../../Kernel/kstdio.h \
|
||||
../../Kernel/kprintf.h ../../AK/HashFunctions.h ../../AK/HashMap.h \
|
||||
../../AK/HashTable.h ../../AK/Assertions.h ../../LibC/assert.h \
|
||||
../../AK/DoublyLinkedList.h ../../LibGUI/GShortcut.h \
|
||||
../../Kernel/KeyCode.h ../../AK/AKString.h ../../AK/ByteBuffer.h \
|
||||
../../AK/Retainable.h ../../AK/RetainPtr.h ../../AK/Retained.h \
|
||||
../../AK/kmalloc.h ../../AK/StringImpl.h ../../AK/Vector.h \
|
||||
TaskbarWindow.h ../../LibGUI/GWindow.h ../../LibGUI/GObject.h \
|
||||
../../AK/Weakable.h ../../SharedGraphics/Rect.h \
|
||||
../../SharedGraphics/Point.h ../../SharedGraphics/Size.h \
|
||||
../../SharedGraphics/GraphicsBitmap.h ../../SharedGraphics/Color.h \
|
||||
../../AK/MappedFile.h ../../LibC/SharedBuffer.h ../../AK/WeakPtr.h \
|
||||
../../LibGUI/GWidget.h ../../LibGUI/GElapsedTimer.h ../../LibC/time.h \
|
||||
../../LibGUI/GEvent.h ../../SharedGraphics/Font.h
|
||||
|
||||
../../LibGUI/GApplication.h:
|
||||
|
||||
../../AK/Badge.h:
|
||||
|
||||
../../AK/OwnPtr.h:
|
||||
|
||||
../../AK/StdLibExtras.h:
|
||||
|
||||
../../LibC/stdlib.h:
|
||||
|
||||
../../LibC/sys/cdefs.h:
|
||||
|
||||
../../LibC/sys/types.h:
|
||||
|
||||
../../LibC/stdint.h:
|
||||
|
||||
../../LibC/stddef.h:
|
||||
|
||||
../../LibC/string.h:
|
||||
|
||||
../../AK/Types.h:
|
||||
|
||||
../../AK/Traits.h:
|
||||
|
||||
../../AK/kstdio.h:
|
||||
|
||||
../../Kernel/kstdio.h:
|
||||
|
||||
../../Kernel/kprintf.h:
|
||||
|
||||
../../AK/HashFunctions.h:
|
||||
|
||||
../../AK/HashMap.h:
|
||||
|
||||
../../AK/HashTable.h:
|
||||
|
||||
../../AK/Assertions.h:
|
||||
|
||||
../../LibC/assert.h:
|
||||
|
||||
../../AK/DoublyLinkedList.h:
|
||||
|
||||
../../LibGUI/GShortcut.h:
|
||||
|
||||
../../Kernel/KeyCode.h:
|
||||
|
||||
../../AK/AKString.h:
|
||||
|
||||
../../AK/ByteBuffer.h:
|
||||
|
||||
../../AK/Retainable.h:
|
||||
|
||||
../../AK/RetainPtr.h:
|
||||
|
||||
../../AK/Retained.h:
|
||||
|
||||
../../AK/kmalloc.h:
|
||||
|
||||
../../AK/StringImpl.h:
|
||||
|
||||
../../AK/Vector.h:
|
||||
|
||||
TaskbarWindow.h:
|
||||
|
||||
../../LibGUI/GWindow.h:
|
||||
|
||||
../../LibGUI/GObject.h:
|
||||
|
||||
../../AK/Weakable.h:
|
||||
|
||||
../../SharedGraphics/Rect.h:
|
||||
|
||||
../../SharedGraphics/Point.h:
|
||||
|
||||
../../SharedGraphics/Size.h:
|
||||
|
||||
../../SharedGraphics/GraphicsBitmap.h:
|
||||
|
||||
../../SharedGraphics/Color.h:
|
||||
|
||||
../../AK/MappedFile.h:
|
||||
|
||||
../../LibC/SharedBuffer.h:
|
||||
|
||||
../../AK/WeakPtr.h:
|
||||
|
||||
../../LibGUI/GWidget.h:
|
||||
|
||||
../../LibGUI/GElapsedTimer.h:
|
||||
|
||||
../../LibC/time.h:
|
||||
|
||||
../../LibGUI/GEvent.h:
|
||||
|
||||
../../SharedGraphics/Font.h:
|
Binary file not shown.
@ -36,6 +36,9 @@ public:
|
||||
WindowCloseRequest,
|
||||
ChildAdded,
|
||||
ChildRemoved,
|
||||
WM_WindowAdded,
|
||||
WM_WindowRemoved,
|
||||
WM_WindowStateChanged,
|
||||
};
|
||||
|
||||
GEvent() { }
|
||||
@ -52,6 +55,65 @@ private:
|
||||
Type m_type { Invalid };
|
||||
};
|
||||
|
||||
class GWMEvent : public GEvent {
|
||||
public:
|
||||
GWMEvent(Type type, int client_id, int window_id)
|
||||
: GEvent(type)
|
||||
, m_client_id(client_id)
|
||||
, m_window_id(window_id)
|
||||
{
|
||||
}
|
||||
|
||||
int client_id() const { return m_client_id; }
|
||||
int window_id() const { return m_window_id; }
|
||||
|
||||
private:
|
||||
int m_client_id { -1 };
|
||||
int m_window_id { -1 };
|
||||
};
|
||||
|
||||
class GWMWindowAddedEvent : public GWMEvent {
|
||||
public:
|
||||
GWMWindowAddedEvent(int client_id, int window_id, const String& title, const Rect& rect)
|
||||
: GWMEvent(GEvent::Type::WM_WindowAdded, client_id, window_id)
|
||||
, m_title(title)
|
||||
, m_rect(rect)
|
||||
{
|
||||
}
|
||||
|
||||
String title() const { return m_title; }
|
||||
Rect rect() const { return m_rect; }
|
||||
|
||||
private:
|
||||
String m_title;
|
||||
Rect m_rect;
|
||||
};
|
||||
|
||||
class GWMWindowRemovedEvent : public GWMEvent {
|
||||
public:
|
||||
GWMWindowRemovedEvent(int client_id, int window_id)
|
||||
: GWMEvent(GEvent::Type::WM_WindowRemoved, client_id, window_id)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
class GWMWindowStateChangedEvent : public GWMEvent {
|
||||
public:
|
||||
GWMWindowStateChangedEvent(int client_id, int window_id, const String& title, const Rect& rect)
|
||||
: GWMEvent(GEvent::Type::WM_WindowStateChanged, client_id, window_id)
|
||||
, m_title(title)
|
||||
, m_rect(rect)
|
||||
{
|
||||
}
|
||||
|
||||
String title() const { return m_title; }
|
||||
Rect rect() const { return m_rect; }
|
||||
|
||||
private:
|
||||
String m_title;
|
||||
Rect m_rect;
|
||||
};
|
||||
|
||||
class QuitEvent final : public GEvent {
|
||||
public:
|
||||
QuitEvent()
|
||||
|
@ -258,6 +258,9 @@ void GWindow::event(GEvent& event)
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.type() == GEvent::WM_WindowAdded || event.type() == GEvent::WM_WindowRemoved || event.type() == GEvent::WM_WindowStateChanged)
|
||||
return wm_event(static_cast<GWMEvent&>(event));
|
||||
|
||||
GObject::event(event);
|
||||
}
|
||||
|
||||
@ -422,3 +425,7 @@ void GWindow::set_modal(bool modal)
|
||||
ASSERT(!m_window_id);
|
||||
m_modal = modal;
|
||||
}
|
||||
|
||||
void GWindow::wm_event(GWMEvent&)
|
||||
{
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <AK/WeakPtr.h>
|
||||
|
||||
class GWidget;
|
||||
class GWMEvent;
|
||||
|
||||
enum class GStandardCursor {
|
||||
None = 0,
|
||||
@ -103,6 +104,9 @@ public:
|
||||
|
||||
virtual const char* class_name() const override { return "GWindow"; }
|
||||
|
||||
protected:
|
||||
virtual void wm_event(GWMEvent&);
|
||||
|
||||
private:
|
||||
virtual bool is_window() const override final { return true; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user