summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-04-03 21:03:12 +0200
committerAndreas Kling <awesomekling@gmail.com>2019-04-03 21:04:16 +0200
commitaa03a07e6148c1609799f464197aab937d1287e2 (patch)
treedc6aac92aa201ed531d4ab6a79c78c40b6a63307
parenta22774ee3fc609177a56c6d6ac992b86026abdbc (diff)
downloadserenity-aa03a07e6148c1609799f464197aab937d1287e2.zip
Taskbar+LibGUI: More work on bringup.
-rw-r--r--Applications/Taskbar/.gitignore4
-rwxr-xr-xApplications/Taskbar/Aboutbin725612 -> 0 bytes
-rw-r--r--Applications/Taskbar/Makefile2
-rwxr-xr-xApplications/Taskbar/Taskbarbin729224 -> 0 bytes
-rw-r--r--Applications/Taskbar/TaskbarWidget.cpp2
-rw-r--r--Applications/Taskbar/TaskbarWidget.d133
-rw-r--r--Applications/Taskbar/TaskbarWidget.obin4704 -> 0 bytes
-rw-r--r--Applications/Taskbar/TaskbarWindow.cpp12
-rw-r--r--Applications/Taskbar/TaskbarWindow.d14
-rw-r--r--Applications/Taskbar/TaskbarWindow.h1
-rw-r--r--Applications/Taskbar/TaskbarWindow.obin4728 -> 0 bytes
-rw-r--r--Applications/Taskbar/main.d114
-rw-r--r--Applications/Taskbar/main.obin1280 -> 0 bytes
-rw-r--r--LibGUI/GEvent.h62
-rw-r--r--LibGUI/GWindow.cpp7
-rw-r--r--LibGUI/GWindow.h4
16 files changed, 105 insertions, 250 deletions
diff --git a/Applications/Taskbar/.gitignore b/Applications/Taskbar/.gitignore
new file mode 100644
index 0000000000..16c1af3246
--- /dev/null
+++ b/Applications/Taskbar/.gitignore
@@ -0,0 +1,4 @@
+*.o
+*.d
+Taskbar
+*.autosave
diff --git a/Applications/Taskbar/About b/Applications/Taskbar/About
deleted file mode 100755
index b6944de9f1..0000000000
--- a/Applications/Taskbar/About
+++ /dev/null
Binary files differ
diff --git a/Applications/Taskbar/Makefile b/Applications/Taskbar/Makefile
index c4a77d7f51..a766c0aa94 100644
--- a/Applications/Taskbar/Makefile
+++ b/Applications/Taskbar/Makefile
@@ -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
diff --git a/Applications/Taskbar/Taskbar b/Applications/Taskbar/Taskbar
deleted file mode 100755
index 50ed5b46a1..0000000000
--- a/Applications/Taskbar/Taskbar
+++ /dev/null
Binary files differ
diff --git a/Applications/Taskbar/TaskbarWidget.cpp b/Applications/Taskbar/TaskbarWidget.cpp
index a272dae747..114600ecb1 100644
--- a/Applications/Taskbar/TaskbarWidget.cpp
+++ b/Applications/Taskbar/TaskbarWidget.cpp
@@ -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);
diff --git a/Applications/Taskbar/TaskbarWidget.d b/Applications/Taskbar/TaskbarWidget.d
deleted file mode 100644
index 19d4a5a25b..0000000000
--- a/Applications/Taskbar/TaskbarWidget.d
+++ /dev/null
@@ -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:
diff --git a/Applications/Taskbar/TaskbarWidget.o b/Applications/Taskbar/TaskbarWidget.o
deleted file mode 100644
index aca67916c3..0000000000
--- a/Applications/Taskbar/TaskbarWidget.o
+++ /dev/null
Binary files differ
diff --git a/Applications/Taskbar/TaskbarWindow.cpp b/Applications/Taskbar/TaskbarWindow.cpp
index 08ac4d2385..4fd3abbddc 100644
--- a/Applications/Taskbar/TaskbarWindow.cpp
+++ b/Applications/Taskbar/TaskbarWindow.cpp
@@ -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
+}
diff --git a/Applications/Taskbar/TaskbarWindow.d b/Applications/Taskbar/TaskbarWindow.d
index 801cb5531a..05b00309bc 100644
--- a/Applications/Taskbar/TaskbarWindow.d
+++ b/Applications/Taskbar/TaskbarWindow.d
@@ -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:
diff --git a/Applications/Taskbar/TaskbarWindow.h b/Applications/Taskbar/TaskbarWindow.h
index a3f50c251b..d6eff7eafa 100644
--- a/Applications/Taskbar/TaskbarWindow.h
+++ b/Applications/Taskbar/TaskbarWindow.h
@@ -13,4 +13,5 @@ public:
private:
void on_screen_rect_change(const Rect&);
+ virtual void wm_event(GWMEvent&) override;
};
diff --git a/Applications/Taskbar/TaskbarWindow.o b/Applications/Taskbar/TaskbarWindow.o
deleted file mode 100644
index 3ad7dd7748..0000000000
--- a/Applications/Taskbar/TaskbarWindow.o
+++ /dev/null
Binary files differ
diff --git a/Applications/Taskbar/main.d b/Applications/Taskbar/main.d
deleted file mode 100644
index 2a08c9b957..0000000000
--- a/Applications/Taskbar/main.d
+++ /dev/null
@@ -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:
diff --git a/Applications/Taskbar/main.o b/Applications/Taskbar/main.o
deleted file mode 100644
index e9b64d8fa6..0000000000
--- a/Applications/Taskbar/main.o
+++ /dev/null
Binary files differ
diff --git a/LibGUI/GEvent.h b/LibGUI/GEvent.h
index fb395190b4..b39b7a81a1 100644
--- a/LibGUI/GEvent.h
+++ b/LibGUI/GEvent.h
@@ -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()
diff --git a/LibGUI/GWindow.cpp b/LibGUI/GWindow.cpp
index 6a3bb5a754..59d0280139 100644
--- a/LibGUI/GWindow.cpp
+++ b/LibGUI/GWindow.cpp
@@ -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&)
+{
+}
diff --git a/LibGUI/GWindow.h b/LibGUI/GWindow.h
index 8bdb285156..845b4b7c3d 100644
--- a/LibGUI/GWindow.h
+++ b/LibGUI/GWindow.h
@@ -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; }