diff --git a/docs/images/accessbar.png b/docs/images/accessbar.png
new file mode 100644
index 000000000..572b89014
Binary files /dev/null and b/docs/images/accessbar.png differ
diff --git a/kernel/arch/x86/interrupts/interrupts.c b/kernel/arch/x86/interrupts/interrupts.c
index df8a74300..dbe22f06c 100644
--- a/kernel/arch/x86/interrupts/interrupts.c
+++ b/kernel/arch/x86/interrupts/interrupts.c
@@ -539,13 +539,6 @@ ExceptionEntry(
enter_thread(Registers);
}
- // Next step is to check whether or not the address is already
- // mapped, because then it's due to accessibility
- if (GetSystemMemoryMapping(GetCurrentSystemMemorySpace(), Address) != 0) {
- WARNING("Page fault at address 0x%x, mapping exists: 0x%x, invalid access. (%u, User tried to access kernel memory ex).",
- Address, GetSystemMemoryMapping(GetCurrentSystemMemorySpace(), Address), Registers->ErrorCode);
- }
-
// Final step is to see if kernel can handle the
// unallocated address
if (DebugPageFault(Registers, Address) == OsSuccess) {
@@ -571,7 +564,7 @@ ExceptionEntry(
// Was it a page-fault?
if (Address != __MASK) {
- WRITELINE("CR2 Address: 0x%x", Address);
+ WRITELINE("page-fault address: 0x%x, error-code 0x%x", Address, Registers->ErrorCode);
}
// Locate which module
diff --git a/kernel/handle.c b/kernel/handle.c
index 851326306..1daa8f8ee 100644
--- a/kernel/handle.c
+++ b/kernel/handle.c
@@ -114,6 +114,7 @@ DestroyHandle(
_In_ UUId_t Handle)
{
SystemHandle_t *Instance;
+ OsStatus_t Status = OsSuccess;
DataKey_t Key;
int References;
@@ -127,7 +128,8 @@ DestroyHandle(
References = atomic_fetch_sub(&Instance->References, 1) - 1;
if (References == 0) {
CollectionRemoveByNode(&Handles, &Instance->Header);
- return HandleDestructors[Instance->Type](Instance->Resource);
+ Status = HandleDestructors[Instance->Type](Instance->Resource);
+ kfree(Instance);
}
- return OsSuccess;
+ return Status;
}
diff --git a/kernel/include/revision.h b/kernel/include/revision.h
index f775d7eef..2774d3361 100644
--- a/kernel/include/revision.h
+++ b/kernel/include/revision.h
@@ -3,12 +3,12 @@
#ifndef _REVISION_H_
#define _REVISION_H_
-#define BUILD_DATE "27 July 2018"
-#define BUILD_TIME "20:55:39"
+#define BUILD_DATE "30 July 2018"
+#define BUILD_TIME "08:06:47"
#define BUILD_SYSTEM "clang"
#define REVISION_MAJOR 0
#define REVISION_MINOR 4
-#define REVISION_BUILD 8637
+#define REVISION_BUILD 8638
#endif //!_REVISION_H_
diff --git a/resources/system/themes/default/power16.png b/resources/system/themes/default/power16.png
new file mode 100644
index 000000000..b8b18c28d
Binary files /dev/null and b/resources/system/themes/default/power16.png differ
diff --git a/resources/system/themes/default/power24.png b/resources/system/themes/default/power24.png
new file mode 100644
index 000000000..48c641c0e
Binary files /dev/null and b/resources/system/themes/default/power24.png differ
diff --git a/resources/system/themes/default/power32.png b/resources/system/themes/default/power32.png
new file mode 100644
index 000000000..541344e7d
Binary files /dev/null and b/resources/system/themes/default/power32.png differ
diff --git a/resources/system/themes/default/power48.png b/resources/system/themes/default/power48.png
new file mode 100644
index 000000000..2aa66ca6f
Binary files /dev/null and b/resources/system/themes/default/power48.png differ
diff --git a/resources/system/themes/default/power64.png b/resources/system/themes/default/power64.png
new file mode 100644
index 000000000..052623db6
Binary files /dev/null and b/resources/system/themes/default/power64.png differ
diff --git a/resources/system/themes/default/reboot16.png b/resources/system/themes/default/reboot16.png
new file mode 100644
index 000000000..8090219b4
Binary files /dev/null and b/resources/system/themes/default/reboot16.png differ
diff --git a/resources/system/themes/default/reboot24.png b/resources/system/themes/default/reboot24.png
new file mode 100644
index 000000000..8226e8473
Binary files /dev/null and b/resources/system/themes/default/reboot24.png differ
diff --git a/resources/system/themes/default/reboot32.png b/resources/system/themes/default/reboot32.png
new file mode 100644
index 000000000..36f533ee5
Binary files /dev/null and b/resources/system/themes/default/reboot32.png differ
diff --git a/resources/system/themes/default/reboot48.png b/resources/system/themes/default/reboot48.png
new file mode 100644
index 000000000..fb80be51a
Binary files /dev/null and b/resources/system/themes/default/reboot48.png differ
diff --git a/resources/system/themes/default/reboot64.png b/resources/system/themes/default/reboot64.png
new file mode 100644
index 000000000..5b7b9fed6
Binary files /dev/null and b/resources/system/themes/default/reboot64.png differ
diff --git a/resources/system/themes/default/settings32.png b/resources/system/themes/default/settings32.png
new file mode 100644
index 000000000..4925da96e
Binary files /dev/null and b/resources/system/themes/default/settings32.png differ
diff --git a/revision.h b/revision.h
index f775d7eef..2774d3361 100644
--- a/revision.h
+++ b/revision.h
@@ -3,12 +3,12 @@
#ifndef _REVISION_H_
#define _REVISION_H_
-#define BUILD_DATE "27 July 2018"
-#define BUILD_TIME "20:55:39"
+#define BUILD_DATE "30 July 2018"
+#define BUILD_TIME "08:06:47"
#define BUILD_SYSTEM "clang"
#define REVISION_MAJOR 0
#define REVISION_MINOR 4
-#define REVISION_BUILD 8637
+#define REVISION_BUILD 8638
#endif //!_REVISION_H_
diff --git a/services/sessionmanager/process/process.h b/services/sessionmanager/process/process.h
new file mode 100644
index 000000000..152ceae74
--- /dev/null
+++ b/services/sessionmanager/process/process.h
@@ -0,0 +1,50 @@
+/* MollenOS
+ *
+ * Copyright 2018, Philip Meulengracht
+ *
+ * This program is free software : you can redistribute it and / or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation ? , either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.If not, see .
+ *
+ *
+ * MollenOS Service - Session Manager
+ * - Contains the implementation of the session-manager which keeps track
+ * of all users and their running applications.
+ */
+
+#ifndef __PROCESS_INTERFACE__
+#define __PROCESS_INTERFACE__
+
+#include
+
+typedef struct _SystemProcess {
+ UUId_t MainThread;
+ UUId_t Id;
+
+ const char* Name;
+ const char* Path;
+ UUId_t MemorySpace;
+
+ // Below is everything related to
+ // the startup and the executable information
+ // that the Ash has
+ void* Executable;
+ uintptr_t NextLoadingAddress;
+ uint8_t* FileBuffer;
+ size_t FileBufferLength;
+ int Code;
+} SystemProcess_t;
+
+
+
+
+#endif //!__PROCESS_INTERFACE__
diff --git a/userspace/nanovg b/userspace/nanovg
index e64086b1c..1737d160a 160000
--- a/userspace/nanovg
+++ b/userspace/nanovg
@@ -1 +1 @@
-Subproject commit e64086b1ca67c44ba0fbf4b36e1e0924d1e0d297
+Subproject commit 1737d160ae828813b68e4b9a5e816a67ef2889e3
diff --git a/userspace/vioarr/engine/backend/nanovg.c b/userspace/vioarr/engine/backend/nanovg.c
index 9b75b7bef..0d0f07083 100644
--- a/userspace/vioarr/engine/backend/nanovg.c
+++ b/userspace/vioarr/engine/backend/nanovg.c
@@ -317,7 +317,7 @@ NVGcontext* nvgCreateInternal(NVGparams* params)
memset(&fontParams, 0, sizeof(fontParams));
fontParams.width = NVG_INIT_FONTIMAGE_SIZE;
fontParams.height = NVG_INIT_FONTIMAGE_SIZE;
- fontParams.flags = FONS_ZERO_TOPLEFT;
+ fontParams.flags = FONS_ZERO_BOTTOMLEFT;
fontParams.renderCreate = NULL;
fontParams.renderUpdate = NULL;
fontParams.renderDraw = NULL;
diff --git a/userspace/vioarr/engine/backend/nanovg_gl.h b/userspace/vioarr/engine/backend/nanovg_gl.h
index 6fd8f4e58..eb11e8fea 100644
--- a/userspace/vioarr/engine/backend/nanovg_gl.h
+++ b/userspace/vioarr/engine/backend/nanovg_gl.h
@@ -1232,8 +1232,9 @@ static void glnvg__renderFlush(void* uptr)
// Setup require GL state.
glUseProgram(gl->shader.prog);
- glEnable(GL_CULL_FACE);
- glCullFace(GL_BACK);
+ glDisable(GL_CULL_FACE);
+ //glEnable(GL_CULL_FACE);
+ //glCullFace(GL_BACK);
glFrontFace(GL_CCW);
glEnable(GL_BLEND);
glDisable(GL_DEPTH_TEST);
diff --git a/userspace/vioarr/engine/elements/accessbar.cpp b/userspace/vioarr/engine/elements/accessbar.cpp
index fb40aa8eb..05fed80ab 100644
--- a/userspace/vioarr/engine/elements/accessbar.cpp
+++ b/userspace/vioarr/engine/elements/accessbar.cpp
@@ -20,8 +20,12 @@
* - The window compositor system and general window manager for
* MollenOS.
*/
+
+#include "accessbar_widget.hpp"
#include "accessbar.hpp"
+#include "button.hpp"
#include "sprite.hpp"
+#include "label.hpp"
CAccessBar::CAccessBar(CEntity *Parent, NVGcontext* VgContext, int Width, int Height)
: CEntity(Parent, VgContext)
@@ -31,14 +35,36 @@ CAccessBar::CAccessBar(CEntity *Parent, NVGcontext* VgContext, int Width, int He
// Create resources
auto UserIcon = new CSprite(VgContext, "$sys/themes/default/user64.png", 64, 64);
+
UserIcon->Move((Width / 2) - 32, (m_Height - (16 + 64)), 0);
- // Widgets?
- // User-widget
- // Shelve widget
+ // Create buttons
+ auto SettingsIcon = new CButton(VgContext, 32, 32);
+ auto ShutdownIcon = new CButton(VgContext, 32, 32);
+ auto ApplicationsIcon = new CButton(VgContext, 16, 16);
+
+ auto ApplicationsLabel = new CLabel(VgContext);
+
+ ShutdownIcon->SetButtonStateIcon(CButton::ButtonStateNormal, "$sys/themes/default/power32.png");
+ ShutdownIcon->Move(20, 8, 0);
+
+ SettingsIcon->SetButtonStateIcon(CButton::ButtonStateNormal, "$sys/themes/default/settings32.png");
+ SettingsIcon->Move(Width - 32 - 20, 8, 0);
- // Add icon
+ ApplicationsIcon->SetButtonStateIcon(CButton::ButtonStateNormal, "$sys/themes/default/apps16.png");
+ ApplicationsIcon->Move(Width - 16 - 16, m_Height - 162, 0);
+
+ ApplicationsLabel->SetText("Applications");
+ ApplicationsLabel->SetFontSize(18.0f);
+ ApplicationsLabel->SetFontColor(nvgRGBA(ACCESSBAR_HEADER_RGBA));
+ ApplicationsLabel->Move(14.0f, m_Height - 160, 0);
+
+ // Add icons to our children
this->AddEntity(UserIcon);
+ this->AddEntity(SettingsIcon);
+ this->AddEntity(ShutdownIcon);
+ this->AddEntity(ApplicationsIcon);
+ this->AddEntity(ApplicationsLabel);
}
CAccessBar::CAccessBar(NVGcontext* VgContext, int Width, int Height)
@@ -57,15 +83,33 @@ void CAccessBar::Draw(NVGcontext* VgContext) {
// Use the fill color to fill the entirety
nvgBeginPath(VgContext);
nvgRect(VgContext, 0.0f, 0.0f, m_Width, m_Height);
- nvgFillColor(VgContext, nvgRGBA(ACESSBAR_FILL_COLOR_RGBA));
+ nvgFillColor(VgContext, nvgRGBA(ACCESSBAR_FILL_COLOR_RGBA));
nvgFill(VgContext);
+ // Draw the lower divider
+ nvgBeginPath(VgContext);
+ nvgMoveTo(VgContext, 8.0f, 48.0f);
+ nvgLineTo(VgContext, (m_Width - 8), 48.0f);
+ nvgMoveTo(VgContext, (m_Width / 2.0f), 40.0f);
+ nvgLineTo(VgContext, (m_Width / 2.0f), 8.0f);
+ nvgStrokeWidth(VgContext, 1.0f);
+ nvgStrokeColor(VgContext, nvgRGBA(ACCESSBAR_HEADER_RGBA));
+ nvgStroke(VgContext);
+
+ // Draw the upper divider
+ nvgBeginPath(VgContext);
+ nvgMoveTo(VgContext, 8.0f, (m_Height - 160.0f - 8.0f));
+ nvgLineTo(VgContext, (m_Width - 8), (m_Height - 160.0f - 8.0f));
+ nvgStrokeWidth(VgContext, 1.0f);
+ nvgStrokeColor(VgContext, nvgRGBA(ACCESSBAR_HEADER_RGBA));
+ nvgStroke(VgContext);
+
// First 16 pixels + (icon_height / 2) are colored with
// the same color as the title bar of windows
y += (m_Height - (ACCESSBAR_HEADER_HEIGHT + 32));
nvgBeginPath(VgContext);
nvgRect(VgContext, x, y, m_Width, ACCESSBAR_HEADER_HEIGHT + 32);
- nvgFillColor(VgContext, nvgRGBA(ACCSSBAR_HEADER_RGBA));
+ nvgFillColor(VgContext, nvgRGBA(ACCESSBAR_HEADER_RGBA));
nvgFill(VgContext);
// Drop shadow for the header
diff --git a/userspace/vioarr/engine/elements/accessbar.hpp b/userspace/vioarr/engine/elements/accessbar.hpp
index dc1eba977..a07ae68d6 100644
--- a/userspace/vioarr/engine/elements/accessbar.hpp
+++ b/userspace/vioarr/engine/elements/accessbar.hpp
@@ -28,19 +28,19 @@
// Adjustable access-bar layout settings
#define ACCESSBAR_HEADER_HEIGHT 16
-#define ACESSBAR_FILL_COLOR_RGBA 229, 229, 232, 255
-#define ACCSSBAR_HEADER_RGBA 103, 103, 103, 255
+#define ACCESSBAR_FILL_COLOR_RGBA 229, 229, 232, 255
+#define ACCESSBAR_HEADER_RGBA 103, 103, 103, 255
class CAccessBar : public CEntity {
public:
- CAccessBar(CEntity *Parent, NVGcontext* VgContext, int Width, int Height);
+ CAccessBar(CEntity* Parent, NVGcontext* VgContext, int Width, int Height);
CAccessBar(NVGcontext* VgContext, int Width, int Height);
~CAccessBar();
protected:
// Override the inherited methods
- void Update(size_t MilliSeconds);
- void Draw(NVGcontext* VgContext);
+ void Update(size_t MilliSeconds);
+ void Draw(NVGcontext* VgContext);
private:
int m_Width;
diff --git a/userspace/vioarr/engine/elements/accessbar_widget.cpp b/userspace/vioarr/engine/elements/accessbar_widget.cpp
new file mode 100644
index 000000000..4b09391a6
--- /dev/null
+++ b/userspace/vioarr/engine/elements/accessbar_widget.cpp
@@ -0,0 +1,74 @@
+/* MollenOS
+ *
+ * Copyright 2011 - 2018, Philip Meulengracht
+ *
+ * This program is free software : you can redistribute it and / or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation ? , either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.If not, see .
+ *
+ *
+ * MollenOS - Vioarr Window Compositor System
+ * - The window compositor system and general window manager for
+ * MollenOS.
+ */
+#include "accessbar_widget.hpp"
+#include "accessbar.hpp"
+#include "sprite.hpp"
+
+// Dummy - do nothing callback
+void WidgetDummyCallback(CEntity* Entity) {}
+
+CAccessBarWidget::CAccessBarWidget(CEntity* Parent, NVGcontext* VgContext, int Width, int Height)
+ : CEntity(Parent, VgContext), m_Entity(nullptr), m_Callback(WidgetDummyCallback), m_Text("Widget")
+{
+ m_Width = Width;
+ m_Height = Height;
+}
+
+CAccessBarWidget::CAccessBarWidget(NVGcontext* VgContext, int Width, int Height)
+ : CAccessBarWidget(nullptr, VgContext, Width, Height) { }
+
+CAccessBarWidget::~CAccessBarWidget() {
+}
+
+void CAccessBarWidget::SetWidgetText(std::string& Text)
+{
+ m_Text = Text;
+}
+
+void CAccessBarWidget::SetWidgetIcon(std::string& IconPath)
+{
+ auto Icon = new CSprite(m_VgContext, IconPath, 16, 16);
+ float x = (m_Width - 16) - 4; // Position to the right, with margin 4 pixels
+ float y = ((m_Height - 16) / 2.0f); // Position in the vertical middle
+
+ Icon->Move(x, y, 0.0f);
+ this->AddEntity(Icon);
+}
+
+void CAccessBarWidget::SetWidgetEntity(CEntity* Entity)
+{
+ m_Entity = Entity;
+}
+
+void CAccessBarWidget::SetWidgetFunction(std::function& Function)
+{
+ m_Callback = Function;
+}
+
+void CAccessBarWidget::Update(size_t MilliSeconds) {
+}
+
+void CAccessBarWidget::Draw(NVGcontext* VgContext) {
+ // Draw border
+
+}
diff --git a/userspace/vioarr/engine/elements/accessbar_widget.hpp b/userspace/vioarr/engine/elements/accessbar_widget.hpp
new file mode 100644
index 000000000..90892fb41
--- /dev/null
+++ b/userspace/vioarr/engine/elements/accessbar_widget.hpp
@@ -0,0 +1,50 @@
+/* MollenOS
+ *
+ * Copyright 2011 - 2018, Philip Meulengracht
+ *
+ * This program is free software : you can redistribute it and / or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation ? , either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.If not, see .
+ *
+ *
+ * MollenOS - Vioarr Window Compositor System
+ * - The window compositor system and general window manager for
+ * MollenOS.
+ */
+#pragma once
+#include "../entity.hpp"
+#include
+#include
+
+class CAccessBarWidget : public CEntity {
+public:
+ CAccessBarWidget(CEntity* Parent, NVGcontext* VgContext, int Width, int Height);
+ CAccessBarWidget(NVGcontext* VgContext, int Width, int Height);
+ ~CAccessBarWidget();
+
+ void SetWidgetText(std::string& Text);
+ void SetWidgetIcon(std::string& IconPath);
+ void SetWidgetEntity(CEntity* Entity);
+ void SetWidgetFunction(std::function& Function);
+
+protected:
+ // Override the inherited methods
+ void Update(size_t MilliSeconds);
+ void Draw(NVGcontext* VgContext);
+
+private:
+ int m_Width;
+ int m_Height;
+ CEntity* m_Entity;
+ std::function m_Callback;
+ std::string m_Text;
+};
diff --git a/userspace/vioarr/engine/elements/button.cpp b/userspace/vioarr/engine/elements/button.cpp
new file mode 100644
index 000000000..79f3e9eec
--- /dev/null
+++ b/userspace/vioarr/engine/elements/button.cpp
@@ -0,0 +1,74 @@
+/* MollenOS
+ *
+ * Copyright 2018, Philip Meulengracht
+ *
+ * This program is free software : you can redistribute it and / or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation ? , either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.If not, see .
+ *
+ *
+ * MollenOS - Vioarr Engine System (V8)
+ * - The Vioarr V8 Graphics Engine.
+ */
+
+#include "button.hpp"
+#include "../../utils/log_manager.hpp"
+
+CButton::CButton(CEntity* Parent, NVGcontext* VgContext, int Width, int Height)
+ : CEntity(Parent, VgContext)
+{
+ m_Width = Width;
+ m_Height = Height;
+ m_ActiveState = ButtonStateNormal;
+}
+
+CButton::CButton(NVGcontext* VgContext, int Width, int Height)
+ : CButton(nullptr, VgContext, Width, Height) { }
+
+CButton::~CButton()
+{
+ for (int i = 0; i < ButtonStateCount; i++) {
+ if (m_ResourceIds[i] != 0) {
+ nvgDeleteImage(m_VgContext, m_ResourceIds[i]);
+ }
+ }
+}
+
+void CButton::SetButtonStateIcon(const EButtonState State, const std::string& IconPath)
+{
+ // Make sure we don't leak resources
+ if (m_ResourceIds[State] != 0) {
+ nvgDeleteImage(m_VgContext, m_ResourceIds[State]);
+ }
+ m_ResourceIds[State] = nvgCreateImage(m_VgContext, IconPath.c_str(), NVG_IMAGE_FLIPY);
+}
+
+void CButton::SetState(EButtonState State)
+{
+ m_ActiveState = State;
+}
+
+// Override the inherited methods
+void CButton::Update(size_t MilliSeconds) {
+}
+
+void CButton::Draw(NVGcontext* VgContext) {
+ if (m_ResourceIds[m_ActiveState] == 0) {
+ return;
+ }
+
+ NVGpaint imgPaint = nvgImagePattern(VgContext, 0.0f, 0.0f, m_Width, m_Height, 0.0f, m_ResourceIds[m_ActiveState], 1.0f);
+ nvgBeginPath(VgContext);
+ nvgRect(VgContext, 0, 0, m_Width, m_Height);
+ nvgFillPaint(VgContext, imgPaint);
+ nvgFill(VgContext);
+}
diff --git a/userspace/vioarr/engine/elements/button.hpp b/userspace/vioarr/engine/elements/button.hpp
new file mode 100644
index 000000000..eeacd7b92
--- /dev/null
+++ b/userspace/vioarr/engine/elements/button.hpp
@@ -0,0 +1,55 @@
+/* MollenOS
+ *
+ * Copyright 2018, Philip Meulengracht
+ *
+ * This program is free software : you can redistribute it and / or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation ? , either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.If not, see .
+ *
+ *
+ * MollenOS - Vioarr Engine System (V8)
+ * - The Vioarr V8 Graphics Engine.
+ */
+#pragma once
+#include "../entity.hpp"
+#include
+
+class CButton : public CEntity {
+public:
+ enum EButtonState {
+ ButtonStateNormal = 0,
+ ButtonStateHovering,
+ ButtonStateActive,
+ ButtonStateDisabled,
+
+ ButtonStateCount
+ };
+
+public:
+ CButton(CEntity* Parent, NVGcontext* VgContext, int Width, int Height);
+ CButton(NVGcontext* VgContext, int Width, int Height);
+ ~CButton();
+
+ void SetButtonStateIcon(const EButtonState State, const std::string& IconPath);
+ void SetState(EButtonState State);
+
+protected:
+ // Override the inherited methods
+ void Update(size_t MilliSeconds);
+ void Draw(NVGcontext* VgContext);
+
+private:
+ int m_ResourceIds[ButtonStateCount];
+ int m_Width;
+ int m_Height;
+ EButtonState m_ActiveState;
+};
diff --git a/userspace/vioarr/engine/elements/label.cpp b/userspace/vioarr/engine/elements/label.cpp
new file mode 100644
index 000000000..3522875d8
--- /dev/null
+++ b/userspace/vioarr/engine/elements/label.cpp
@@ -0,0 +1,67 @@
+/* MollenOS
+ *
+ * Copyright 2018, Philip Meulengracht
+ *
+ * This program is free software : you can redistribute it and / or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation ? , either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.If not, see .
+ *
+ *
+ * MollenOS - Vioarr Engine System (V8)
+ * - The Vioarr V8 Graphics Engine.
+ */
+
+#include "label.hpp"
+#include "../../utils/log_manager.hpp"
+
+CLabel::CLabel(CEntity* Parent, NVGcontext* VgContext)
+ : CEntity(Parent, VgContext), m_Size(14.0f), m_Text("new-label"), m_Font("sans-normal") {
+}
+
+CLabel::CLabel(NVGcontext* VgContext)
+ : CLabel(nullptr, VgContext) { }
+
+CLabel::~CLabel() {
+}
+
+void CLabel::SetText(const std::string& Text)
+{
+ m_Text = Text;
+}
+
+void CLabel::SetFont(const std::string& Font)
+{
+ m_Font = Font;
+}
+
+void CLabel::SetFontSize(float Size)
+{
+ m_Size = Size;
+}
+
+void CLabel::SetFontColor(NVGcolor Color)
+{
+ m_Color = Color;
+}
+
+// Override the inherited methods
+void CLabel::Update(size_t MilliSeconds) {
+}
+
+void CLabel::Draw(NVGcontext* VgContext) {
+ nvgFontSize(VgContext, m_Size);
+ nvgFontFace(VgContext, m_Font.c_str());
+ nvgTextAlign(VgContext, NVG_ALIGN_LEFT | NVG_ALIGN_BASELINE);
+
+ nvgFillColor(VgContext, m_Color);
+ nvgText(VgContext, 0.0f, 0.0f, m_Text.c_str(), NULL);
+}
diff --git a/userspace/vioarr/engine/elements/label.hpp b/userspace/vioarr/engine/elements/label.hpp
new file mode 100644
index 000000000..f7c62f5e0
--- /dev/null
+++ b/userspace/vioarr/engine/elements/label.hpp
@@ -0,0 +1,47 @@
+/* MollenOS
+ *
+ * Copyright 2018, Philip Meulengracht
+ *
+ * This program is free software : you can redistribute it and / or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation ? , either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.If not, see .
+ *
+ *
+ * MollenOS - Vioarr Engine System (V8)
+ * - The Vioarr V8 Graphics Engine.
+ */
+#pragma once
+#include "../entity.hpp"
+#include
+
+class CLabel : public CEntity {
+public:
+ CLabel(CEntity* Parent, NVGcontext* VgContext);
+ CLabel(NVGcontext* VgContext);
+ ~CLabel();
+
+ void SetText(const std::string& Text);
+ void SetFont(const std::string& Font);
+ void SetFontSize(float Size);
+ void SetFontColor(NVGcolor Color);
+
+protected:
+ // Override the inherited methods
+ void Update(size_t MilliSeconds);
+ void Draw(NVGcontext* VgContext);
+
+private:
+ float m_Size;
+ NVGcolor m_Color;
+ std::string m_Text;
+ std::string m_Font;
+};
diff --git a/userspace/vioarr/engine/elements/sprite.cpp b/userspace/vioarr/engine/elements/sprite.cpp
index dd1f47a92..fb1f60f92 100644
--- a/userspace/vioarr/engine/elements/sprite.cpp
+++ b/userspace/vioarr/engine/elements/sprite.cpp
@@ -1,6 +1,6 @@
/* MollenOS
*
- * Copyright 2011 - 2018, Philip Meulengracht
+ * Copyright 2018, Philip Meulengracht
*
* This program is free software : you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
@@ -23,7 +23,7 @@
#include "sprite.hpp"
#include "../../utils/log_manager.hpp"
-CSprite::CSprite(CEntity *Parent, NVGcontext* VgContext,
+CSprite::CSprite(CEntity* Parent, NVGcontext* VgContext,
const std::string &Path, int Width, int Height) : CEntity(Parent, VgContext) {
m_ResourceId = nvgCreateImage(VgContext, Path.c_str(), NVG_IMAGE_FLIPY);
assert(m_ResourceId != 0);
diff --git a/userspace/vioarr/engine/elements/sprite.hpp b/userspace/vioarr/engine/elements/sprite.hpp
index e352536b6..245d9cc59 100644
--- a/userspace/vioarr/engine/elements/sprite.hpp
+++ b/userspace/vioarr/engine/elements/sprite.hpp
@@ -1,6 +1,6 @@
/* MollenOS
*
- * Copyright 2011 - 2018, Philip Meulengracht
+ * Copyright 2018, Philip Meulengracht
*
* This program is free software : you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
@@ -25,7 +25,7 @@
class CSprite : public CEntity {
public:
- CSprite(CEntity *Parent, NVGcontext* VgContext, const std::string &Path, int Width, int Height);
+ CSprite(CEntity* Parent, NVGcontext* VgContext, const std::string &Path, int Width, int Height);
CSprite(NVGcontext* VgContext, const std::string &Path, int Width, int Height);
~CSprite();
diff --git a/userspace/vioarr/engine/elements/window.cpp b/userspace/vioarr/engine/elements/window.cpp
index c7ac88d5f..1fa376670 100644
--- a/userspace/vioarr/engine/elements/window.cpp
+++ b/userspace/vioarr/engine/elements/window.cpp
@@ -1,6 +1,6 @@
/* MollenOS
*
- * Copyright 2011 - 2018, Philip Meulengracht
+ * Copyright 2018, Philip Meulengracht
*
* This program is free software : you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
@@ -22,7 +22,7 @@
*/
#include "window.hpp"
-CWindow::CWindow(CEntity *Parent, NVGcontext* VgContext,
+CWindow::CWindow(CEntity* Parent, NVGcontext* VgContext,
const std::string &Title, int Width, int Height) : CEntity(Parent, VgContext) {
m_Title = Title;
m_Width = Width;
@@ -42,7 +42,7 @@ CWindow::CWindow(CEntity *Parent, NVGcontext* VgContext,
CWindow::CWindow(NVGcontext* VgContext, const std::string &Title, int Width, int Height)
: CWindow(nullptr, VgContext, Title, Width, Height) { }
-CWindow::CWindow(CEntity *Parent, NVGcontext* VgContext)
+CWindow::CWindow(CEntity* Parent, NVGcontext* VgContext)
: CWindow(Parent, VgContext, "New Window", 0, 0) { }
CWindow::CWindow(NVGcontext* VgContext)
@@ -91,7 +91,7 @@ void CWindow::SetStreamingBufferDimensions(int Width, int Height) {
m_StreamHeight = Height;
}
-void CWindow::SetStreamingBuffer(DmaBuffer_t *Buffer) {
+void CWindow::SetStreamingBuffer(DmaBuffer_t* Buffer) {
m_StreamBuffer = Buffer;
}
diff --git a/userspace/vioarr/engine/elements/window.hpp b/userspace/vioarr/engine/elements/window.hpp
index 126b7851d..701622c90 100644
--- a/userspace/vioarr/engine/elements/window.hpp
+++ b/userspace/vioarr/engine/elements/window.hpp
@@ -1,6 +1,6 @@
/* MollenOS
*
- * Copyright 2011 - 2018, Philip Meulengracht
+ * Copyright 2018, Philip Meulengracht
*
* This program is free software : you can redistribute it and / or modify
* it under the terms of the GNU General Public License as published by
@@ -36,9 +36,9 @@
class CWindow : public CEntity {
public:
- CWindow(CEntity *Parent, NVGcontext* VgContext, const std::string &Title, int Width, int Height);
+ CWindow(CEntity* Parent, NVGcontext* VgContext, const std::string &Title, int Width, int Height);
CWindow(NVGcontext* VgContext, const std::string &Title, int Width, int Height);
- CWindow(CEntity *Parent, NVGcontext* VgContext);
+ CWindow(CEntity* Parent, NVGcontext* VgContext);
CWindow(NVGcontext* VgContext);
~CWindow();
@@ -51,7 +51,7 @@ class CWindow : public CEntity {
void SetStreamingBufferFormat(GLenum Format, GLenum InternalFormat);
void SetStreamingBufferDimensions(int Width, int Height);
- void SetStreamingBuffer(DmaBuffer_t *Buffer);
+ void SetStreamingBuffer(DmaBuffer_t* Buffer);
void SetStreaming(bool Enable);
UUId_t GetOwner() const { return m_Owner; }
diff --git a/userspace/vioarr/engine/veightengine.cpp b/userspace/vioarr/engine/veightengine.cpp
index d2e68f58b..415a67d8c 100644
--- a/userspace/vioarr/engine/veightengine.cpp
+++ b/userspace/vioarr/engine/veightengine.cpp
@@ -47,6 +47,7 @@ void CVEightEngine::Initialize(CDisplay *Screen) {
m_Screen = Screen;
// Initialize the viewport
+ sLog.Info("Creating nvg context");
glViewport(0, 0, Screen->GetWidth(), Screen->GetHeight());
m_PixelRatio = (float)Screen->GetWidth() / (float)Screen->GetHeight();
#ifdef QUALITY_MSAA
@@ -55,6 +56,11 @@ void CVEightEngine::Initialize(CDisplay *Screen) {
m_VgContext = nvgCreateGL3(NVG_ANTIALIAS | NVG_STENCIL_STROKES | NVG_DEBUG);
#endif
assert(m_VgContext != nullptr);
+
+ // Load fonts
+ sLog.Info("Loading fonts");
+ nvgCreateFont(m_VgContext, "sans-normal", "$sys/fonts/DejaVuSans.ttf");
+ nvgCreateFont(m_VgContext, "sans-light", "$sys/fonts/DejaVuSans-ExtraLight.ttf");
}
void CVEightEngine::SetRootEntity(CEntity *Entity) {
diff --git a/userspace/vioarr/engine/veightengine.hpp b/userspace/vioarr/engine/veightengine.hpp
index 7095b92d1..1a272dbb6 100644
--- a/userspace/vioarr/engine/veightengine.hpp
+++ b/userspace/vioarr/engine/veightengine.hpp
@@ -37,27 +37,27 @@ class CEntity;
class CVEightEngine {
public:
- static CVEightEngine& GetInstance() {
- // Guaranteed to be destroyed.
- // Is instantiated on first use
- static CVEightEngine _Instance;
- return _Instance;
- }
+ static CVEightEngine& GetInstance() {
+ // Guaranteed to be destroyed.
+ // Is instantiated on first use
+ static CVEightEngine _Instance;
+ return _Instance;
+ }
private:
- CVEightEngine();
+ CVEightEngine();
~CVEightEngine();
public:
- CVEightEngine(CVEightEngine const&) = delete;
- void operator=(CVEightEngine const&) = delete;
+ CVEightEngine(CVEightEngine const&) = delete;
+ void operator=(CVEightEngine const&) = delete;
- void Initialize(CDisplay *Screen);
- void SetRootEntity(CEntity *Entity);
+ void Initialize(CDisplay *Screen);
+ void SetRootEntity(CEntity *Entity);
// **************************************
// Render Logic
- void Update(size_t MilliSeconds);
- void Render();
+ void Update(size_t MilliSeconds);
+ void Render();
// **************************************
// Business Logic
@@ -66,10 +66,10 @@ class CVEightEngine {
// **************************************
// Utilities
- float ClampToScreenAxisX(int Value);
- float ClampToScreenAxisY(int Value);
- float ClampMagnitudeToScreenAxisX(int Value);
- float ClampMagnitudeToScreenAxisY(int Value);
+ float ClampToScreenAxisX(int Value);
+ float ClampToScreenAxisY(int Value);
+ float ClampMagnitudeToScreenAxisX(int Value);
+ float ClampMagnitudeToScreenAxisY(int Value);
NVGcontext* GetContext() const;
CEntity* GetRootEntity() const;
@@ -78,7 +78,7 @@ class CVEightEngine {
CDisplay* m_Screen;
CEntity* m_RootEntity;
float m_PixelRatio;
- NVGcontext* m_VgContext;
+ NVGcontext* m_VgContext;
};
// Shorthand for the vioarr
diff --git a/userspace/vioarr/makefile b/userspace/vioarr/makefile
index ff9b39a3b..5f076aac6 100644
--- a/userspace/vioarr/makefile
+++ b/userspace/vioarr/makefile
@@ -9,7 +9,7 @@ NVG_SOURCES = engine/backend/nanovg.c
SHARED_SOURCES = $(wildcard engine/elements/*.cpp) \
$(wildcard engine/*.cpp) \
$(wildcard scenes/*.cpp) \
- main.cpp
+ $(wildcard *.cpp)
OSMESA_ASM = graphics/opengl/osmesa/display_osmesa_$(VALI_ARCH).s
OSMESA_OBJECTS = $(OSMESA_ASM:.s=.o) $(NVG_SOURCES:.c=.o) $(SHARED_SOURCES:.cpp=.o)
diff --git a/userspace/vioarr/vioarr.cpp b/userspace/vioarr/vioarr.cpp
new file mode 100644
index 000000000..e85ef4475
--- /dev/null
+++ b/userspace/vioarr/vioarr.cpp
@@ -0,0 +1,114 @@
+/* MollenOS
+ *
+ * Copyright 2018, Philip Meulengracht
+ *
+ * This program is free software : you can redistribute it and / or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation ? , either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.If not, see .
+ *
+ *
+ * MollenOS - Vioarr Window Compositor System
+ * - The window compositor system and general window manager for
+ * MollenOS.
+ */
+
+#include
+#include
+#include "vioarr.hpp"
+
+#if defined(_VIOARR_OSMESA)
+#include "graphics/opengl/osmesa/display_osmesa.hpp"
+#define DISPLAY_TYPE() CDisplayOsMesa()
+#else
+#include "graphics/soft/display_framebuffer.hpp"
+#define DISPLAY_TYPE() CDisplayFramebuffer()
+#endif
+
+// Run
+// The main program loop
+int VioarrCompositor::Run()
+{
+ //std::chrono::time_point LastUpdate;
+ _IsRunning = true;
+
+ // Create the display
+ sLog.Info("Creating display");
+ _Display = new DISPLAY_TYPE();
+ if (!_Display->Initialize()) {
+ delete _Display;
+ return -2;
+ }
+
+ // Spawn message handler
+ sLog.Info("Spawning message handler");
+ SpawnMessageHandler();
+
+ // Initialize V8 Engine
+ sLog.Info("Initializing V8");
+ sEngine.Initialize(_Display);
+ sEngine.SetRootEntity(CreateStandardScene());
+ MollenOSEndBoot();
+
+ // Initial render
+ sEngine.Update(0);
+ sEngine.Render();
+
+ // Spawn the test application
+ ProcessSpawn("$bin/wintest.app", NULL, 1);
+
+ // Enter event loop
+ //LastUpdate = std::chrono::system_clock::now();
+ while (_IsRunning) {
+ CVioarrEvent *Event = nullptr;
+ {
+ std::unique_lock _eventlock(_EventMutex);
+ while (_EventQueue.empty()) _EventSignal.wait(_eventlock);
+ Event = _EventQueue.front();
+ _EventQueue.pop();
+ }
+ sLog.Info("processing event");
+
+ // Handle event
+ switch (Event->GetType()) {
+ case CVioarrEvent::EventWindowCreated: {
+ sEngine.GetRootEntity()->AddEntity(((CWindowCreatedEvent*)Event)->GetWindow());
+ } break;
+ case CVioarrEvent::EventWindowDestroy: {
+ sEngine.GetRootEntity()->RemoveEntity(((CWindowDestroyEvent*)Event)->GetWindow());
+ delete ((CWindowDestroyEvent*)Event)->GetWindow();
+ } break;
+ case CVioarrEvent::EventWindowUpdate: {
+ ((CWindowUpdateEvent*)Event)->GetWindow()->SwapOnNextUpdate(true);
+ } break;
+ }
+ delete Event;
+
+ // Run updates
+ // auto milliseconds = std::chrono::duration_cast(std::chrono::system_clock::now() - LastUpdate);
+ sEngine.Update(0 /* milliseconds.count() */);
+
+ // Update screen if there are no more events
+ if (_EventQueue.empty()) {
+ sEngine.Render();
+ }
+ // LastUpdate = std::chrono::system_clock::now();
+ }
+ return 0;
+}
+
+// Queues a new event up
+void VioarrCompositor::QueueEvent(CVioarrEvent *Event)
+{
+ std::unique_lock _eventlock(_EventMutex);
+ _EventQueue.push(Event);
+ _EventSignal.notify_one();
+}
diff --git a/userspace/vioarr/vioarr.hpp b/userspace/vioarr/vioarr.hpp
index fe7f895b6..6dff9e9f9 100644
--- a/userspace/vioarr/vioarr.hpp
+++ b/userspace/vioarr/vioarr.hpp
@@ -22,19 +22,9 @@
*/
#pragma once
-#include
-#include
#include
#include
#include
-
-#if defined(_VIOARR_OSMESA)
-#include "graphics/opengl/osmesa/display_osmesa.hpp"
-#define DISPLAY_TYPE() CDisplayOsMesa()
-#else
-#include "graphics/soft/display_framebuffer.hpp"
-#define DISPLAY_TYPE() CDisplayFramebuffer()
-#endif
#include "engine/veightengine.hpp"
#include "utils/log_manager.hpp"
#include "events/event_window.hpp"
@@ -54,89 +44,16 @@ class VioarrCompositor {
VioarrCompositor(VioarrCompositor const&) = delete;
void operator=(VioarrCompositor const&) = delete;
- // Run
// The main program loop
- int Run() {
-
- // Initialize state
- //std::chrono::time_point LastUpdate;
- _IsRunning = true;
-
- // Create the display
- sLog.Info("Creating display");
- _Display = new DISPLAY_TYPE();
- if (!_Display->Initialize()) {
- delete _Display;
- return -2;
- }
-
- // Spawn message handler
- sLog.Info("Spawning message handler");
- SpawnMessageHandler();
-
- // Initialize V8 Engine
- sLog.Info("Initializing V8");
- sEngine.Initialize(_Display);
- sEngine.SetRootEntity(CreateStandardScene());
- MollenOSEndBoot();
-
- // Initial render
- sEngine.Update(0);
- sEngine.Render();
-
- // Spawn the test application
- ProcessSpawn("$bin/wintest.app", NULL, 1);
-
- // Enter event loop
- //LastUpdate = std::chrono::system_clock::now();
- while (_IsRunning) {
- CVioarrEvent *Event = nullptr;
- {
- std::unique_lock _eventlock(_EventMutex);
- while (_EventQueue.empty()) _EventSignal.wait(_eventlock);
- Event = _EventQueue.front();
- _EventQueue.pop();
- }
- sLog.Info("processing event");
-
- // Handle event
- switch (Event->GetType()) {
- case CVioarrEvent::EventWindowCreated: {
- sEngine.GetRootEntity()->AddEntity(((CWindowCreatedEvent*)Event)->GetWindow());
- } break;
- case CVioarrEvent::EventWindowDestroy: {
- sEngine.GetRootEntity()->RemoveEntity(((CWindowDestroyEvent*)Event)->GetWindow());
- delete ((CWindowDestroyEvent*)Event)->GetWindow();
- } break;
- case CVioarrEvent::EventWindowUpdate: {
- ((CWindowUpdateEvent*)Event)->GetWindow()->SwapOnNextUpdate(true);
- } break;
- }
- delete Event;
-
- // Run updates
- // auto milliseconds = std::chrono::duration_cast(std::chrono::system_clock::now() - LastUpdate);
- sEngine.Update(0 /* milliseconds.count() */);
-
- // Update screen if there are no more events
- if (_EventQueue.empty()) {
- sEngine.Render();
- }
- }
- return 0;
- }
+ int Run();
// Queues a new event up
- void QueueEvent(CVioarrEvent *Event) {
- std::unique_lock _eventlock(_EventMutex);
- _EventQueue.push(Event);
- _EventSignal.notify_one();
- }
+ void QueueEvent(CVioarrEvent *Event);
private:
// Functions
- void SpawnMessageHandler();
- CEntity* CreateStandardScene();
+ void SpawnMessageHandler();
+ CEntity* CreateStandardScene();
// Resources
CDisplay* _Display;