Skip to content

Commit

Permalink
More work on the windowing system, added new elements, updated layout…
Browse files Browse the repository at this point in the history
… and more details on the accessbar.
  • Loading branch information
Meulengracht committed Jul 30, 2018
1 parent 933371c commit 3c32ee9
Show file tree
Hide file tree
Showing 37 changed files with 643 additions and 149 deletions.
Binary file added docs/images/accessbar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 1 addition & 8 deletions kernel/arch/x86/interrupts/interrupts.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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
Expand Down
6 changes: 4 additions & 2 deletions kernel/handle.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ DestroyHandle(
_In_ UUId_t Handle)
{
SystemHandle_t *Instance;
OsStatus_t Status = OsSuccess;
DataKey_t Key;
int References;

Expand All @@ -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;
}
6 changes: 3 additions & 3 deletions kernel/include/revision.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_
Binary file added resources/system/themes/default/power16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/system/themes/default/power24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/system/themes/default/power32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/system/themes/default/power48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/system/themes/default/power64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/system/themes/default/reboot16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/system/themes/default/reboot24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/system/themes/default/reboot32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/system/themes/default/reboot48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/system/themes/default/reboot64.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added resources/system/themes/default/settings32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions revision.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_
50 changes: 50 additions & 0 deletions services/sessionmanager/process/process.h
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*
*
* 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 <os/osdefs.h>

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__
2 changes: 1 addition & 1 deletion userspace/nanovg
Submodule nanovg updated 5 files
+3 −0 src/nanovg.c
+1 −0 src/nanovg.h
+21 −3 src/nanovg_gl.h
+1,540 −692 src/stb_image.h
+1,719 −115 src/stb_truetype.h
2 changes: 1 addition & 1 deletion userspace/vioarr/engine/backend/nanovg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions userspace/vioarr/engine/backend/nanovg_gl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
56 changes: 50 additions & 6 deletions userspace/vioarr/engine/elements/accessbar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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
Expand Down
10 changes: 5 additions & 5 deletions userspace/vioarr/engine/elements/accessbar.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
74 changes: 74 additions & 0 deletions userspace/vioarr/engine/elements/accessbar_widget.cpp
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*
*
* 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<void(CEntity*)>& Function)
{
m_Callback = Function;
}

void CAccessBarWidget::Update(size_t MilliSeconds) {
}

void CAccessBarWidget::Draw(NVGcontext* VgContext) {
// Draw border

}
50 changes: 50 additions & 0 deletions userspace/vioarr/engine/elements/accessbar_widget.hpp
Original file line number Diff line number Diff line change
@@ -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 <http://www.gnu.org/licenses/>.
*
*
* MollenOS - Vioarr Window Compositor System
* - The window compositor system and general window manager for
* MollenOS.
*/
#pragma once
#include "../entity.hpp"
#include <functional>
#include <string>

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<void(CEntity*)>& 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<void(CEntity*)> m_Callback;
std::string m_Text;
};
Loading

0 comments on commit 3c32ee9

Please sign in to comment.