From: John Hodge Date: Sun, 11 May 2014 14:38:11 +0000 (+0800) Subject: Usermode/AxWin4 - Planning mostly X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=b26dd737345421b70f59fcfd1ddd5278876482da;p=tpg%2Facess2.git Usermode/AxWin4 - Planning mostly --- diff --git a/Usermode/Applications/axwin4_src/Notes.txt b/Usermode/Applications/axwin4_src/Notes.txt new file mode 100644 index 00000000..638f0db9 --- /dev/null +++ b/Usermode/Applications/axwin4_src/Notes.txt @@ -0,0 +1,41 @@ +Layers: + +IPC / Client management + +Renderers +Window Management +> "WM_CreateWindow(Parent, Class, Name)" +Window Drawing +> "WD_Fill" +> "WD_Blit" +> "WD_LockSurface" +> "WD_UnlockSurface" +Decorations +> ".InitWindow" +> ".Render" ++ "WM_SetBorder" +Compositing +> Dirty rectangling, use 2DCmd to selectively blit +> Request kernel/server buffers if possible + + +Server-side rendering primitives: + # Apply to regions, rendered in fixed order, each has an ID +> Auto-scaling bitmaps + - Control backed by an image with three five regions per axis + Edge Fixed, Fill, Center Fixed, Fill, Edge Fixed + - Definition is via two pixel counts (edge width, fill width), rest is derived + - Command to switch backing image to another already provided +> Tiling bitmaps + filled rects +> Text (single line) +> Canvas (Takes drawing commands, draws to internal buffer) +> Shared buffer (of an unspecified pixel format) + +=== Config options === +- Root App +- Display device (- = stdout) +- Keyboard device (- = stdin) +- Mouse device +- Pipe suffix, port number, etc. +- Key bindings + diff --git a/Usermode/Applications/axwin4_src/Server/IWindow.cpp b/Usermode/Applications/axwin4_src/Server/IWindow.cpp new file mode 100644 index 00000000..4243e33a --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/IWindow.cpp @@ -0,0 +1,15 @@ +/* + * + */ +#include + +namespace AxWin { + + +IWindow::IWindow(const std::string &name): + m_name(name) +{ +} + +} // namespace AxWin + diff --git a/Usermode/Applications/axwin4_src/Server/Makefile b/Usermode/Applications/axwin4_src/Server/Makefile new file mode 100644 index 00000000..47a936c4 --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/Makefile @@ -0,0 +1,8 @@ + +include ../../Makefile.cfg + +CPPFLAGS := -Iinclude/ +OBJ := IWindow.o +BIN := AxWinServer + +include ../../Makefile.tpl diff --git a/Usermode/Applications/axwin4_src/Server/include/IRegion.hpp b/Usermode/Applications/axwin4_src/Server/include/IRegion.hpp new file mode 100644 index 00000000..8208aa57 --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/include/IRegion.hpp @@ -0,0 +1,32 @@ +/* + * Acess2 GUI v4 + * - By John Hodge (thePowersGang) + * + * IRegion.hpp + * - Representation of a primitive region in a window (part of the window render list) + */ +#ifndef _IREGION_HPP_ +#define _IREGION_HPP_ + +#include +#include +#include "CRect.hpp" + +namespace AxWin { + +class IRegion +{ +protected: + CWindow& m_parentWindow; +public: + virtual IRegion(CWindow& parent, const ::AxWin::Rect& position); + virtual ~IRegion(); + + virtual void Redraw(const ::AxWin::Rect& area) = 0; + virtual bool SetAttr(unsigned int Index, const IPCAttrib& Value) = 0; +}; + +}; + +#endif + diff --git a/Usermode/Applications/axwin4_src/Server/include/IVideo.hpp b/Usermode/Applications/axwin4_src/Server/include/IVideo.hpp new file mode 100644 index 00000000..aa4fc52b --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/include/IVideo.hpp @@ -0,0 +1,28 @@ +/* + * Acess2 GUI v4 + * - By John Hodge (thePowersGang) + * + * IVideo.hpp + * - Graphics backend abstraction + */ +#ifndef _IVIDEO_HPP_ +#define _IVIDEO_HPP_ + +namespace AxWin { + +class IVideo +{ +public: + virtual ~IVideo(); + + // Allocate a new hardware surface + IHWSurface& AllocateHWSurface(uint16_t Width, uint16_t Height); + + // Request redraw of backbuffer + void Flip(); +}; + +}; + +#endif + diff --git a/Usermode/Applications/axwin4_src/Server/include/IWindow.hpp b/Usermode/Applications/axwin4_src/Server/include/IWindow.hpp new file mode 100644 index 00000000..6d91cc19 --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/include/IWindow.hpp @@ -0,0 +1,35 @@ +/* + * Acess2 GUI v4 + * - By John Hodge (thePowersGang) + * + * IWindow.hpp + * - Window abstract base class + */ +#ifndef _IWINDOW_HPP_ +#define _IWINDOW_HPP_ + +#include +#include +#include "CRect.hpp" + +namespace AxWin { + +class IWindow +{ +public: + virtual IWindow(const ::std::string &name); + virtual ~IWindow(); + + virtual void Repaint() = 0; + + virtual void MouseButton(int ButtonID, int X, int Y, bool Down); + virtual void MouseMove(int NewX, int NewY); + virtual void KeyEvent(uint32_t Scancode, const ::std::string &Translated, bool Down); +protected: + const ::std::string m_name; +}; + +} // namespace AxWin + +#endif + diff --git a/Usermode/Applications/axwin4_src/Server/main.cpp b/Usermode/Applications/axwin4_src/Server/main.cpp new file mode 100644 index 00000000..3953e07c --- /dev/null +++ b/Usermode/Applications/axwin4_src/Server/main.cpp @@ -0,0 +1,41 @@ +/* + */ +#include +#include +#include + +using namespace AxWin; + +// === CODE === +int main(int argc, char *argv[]) +{ + // - Load configuration (from file and argv) + // - Open graphics + Graphics::Open(/*config.m_displayDevice*/); + // - Open input + // - Initialise compositor structures + // - Prepare global hotkeys + // - Bind IPC channels + // - Start root child process (from config) + + // - Event loop + for( ;; ) + { + int nfd = 0; + fd_set rfds; + + Input::FillSelect(&nfd, &rfds); + IPC::FillSelect(&nfd, &rfds); + + // TODO: Timer events + int64_t timeout = Timing::GetTimeToNextEvent(); + int rv = ::_SysSelect(nfd, &rfds, NULL, &rfds, NULL, 0); + + Timing::CheckEvents(); + + Input::HandleSelect(&rfds); + IPC::HandleSelect(&rfds); + } + return 0; +} +