dws

a new direct/dynamic/dri/drm based window system
git clone git://git.suckless.org/dws
Log | Files | Refs | README | LICENSE

commit 3746087495831eb16ac3b07b7afddcc9438f7206
Author: arg@garbe.us <unknown>
Date:   Thu, 26 Feb 2009 12:40:35 +0000

initial commit
Diffstat:
LICENSE | 21+++++++++++++++++++++
README | 33+++++++++++++++++++++++++++++++++
leinwand.h | 118+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 172 insertions(+), 0 deletions(-)

diff --git a/LICENSE b/LICENSE @@ -0,0 +1,21 @@ +MIT/X Consortium License + +© 20089Anselm R Garbe <ganselm at garbe dot us> + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. diff --git a/README b/README @@ -0,0 +1,33 @@ +leinwand - a new DRM-based window system +---------------------------------------- +leinwand is a new DRM-based window system in order to replace the obsolete X +Window System and to provide a modern and frugal window system on DRM-capable +Unices, such as Linux. + + +Requirements +------------ +In order to build leinwand you need the DRM header files (usually part of the +linux kernel header files). + + +Installation +------------ +Edit config.mk to match your local setup (leinwand is installed into +the /usr/local namespace by default). + +Afterwards enter the following command to build and install leinwand +(if necessary as root): + + make clean install + + +Running leinwand +---------------- +Make sure you have setup DRM in your kernel settings being usable and make sure +that you have a proper mode setup for the given screens you drive with DRM. +Details on these vary on different platforms and we will extend the manual +accordingly in the future. + +There is also a legacy leinwand port on top of X11, which we only recommend for +trying. diff --git a/leinwand.h b/leinwand.h @@ -0,0 +1,118 @@ +/* See LICENSE file for license details */ + +typedef struct { + int x; + int y; + unsigned int w; + unsigned int h; +} LRectangle; + +typedef struct _LInput LInput; +typedef struct _LDisplay LDisplay; +typedef struct _LScreen LScreen; +typedef struct _LSurface LSurface; +struct _LScreen { + unsigned int id; + LDisplay *dpy; + LRectangle r; + LSurface *surface; + LScreen *next; +}; + +typedef enum { + ComposerTypeSourceOver, + ComposerTypeSourceAtTop, + ComposerTypeSourceIn, + ComposerTypeSourceOut, + ComposerTypeDestOver, + ComposerTypeDestAtTop, + ComposerTypeDestIn, + ComposerTypeDestOut, + ComposerTypeLighter, + ComposerTypeCopy, + ComposerTypeXOR, + ComposerTypeEnd +} LComposerType; + +typedef struct _LComposer LComposer; +struct _LDisplay { + unsigned int id; + LRectangle vr; /* virtual rectangle convering all screens */ + LComposer *composer; + LSurface *root; /* root surface tier is 0 */ + LScreen *screens; + LInput *inputs; +}; + +struct _LSurface { + unsigned int id; + usingned int tier; + LDisplay *dpy; + LSurface *parent; + LSurface *childs; + LSurface *next; +}; + +struct _LComposer { + unsigned int id; + LComposerType type; +}; + +typedef struct { + unsigned int id; + LRectangle r; + void *data; +} LImage; + + +typedef enum { + InputTypeMouse, + InputTypeKeyboard, + InputTypeEnd +} LInputType; + +struct _LInput { + unsigned int id; + LInputType type; + LInput *next; +}; + +typedef enum { + EventTypeKeyPress, + EventTypeKeyRelease, + EventTypeButtonPress, + EventTypeButtonRelease, + EventTypePointerMove, + EventTypeExpose, +} LEventType; + +typedef struct { + unsigned int id; + LEventType type; +}; + +LDisplay *LOpen(unsigned int id); + +LComposer *LCreateComposer(LDisplay *dpy, LComposerType type); + +void LClose(LDisplay *dpy); + +LSurface *LCreateSurface(LDisplay *dpy); + +void LSetComposer(LDisplay *dpy, LSurface *surface, LComposer *composer); + +void LDrawSurface(LDisplay *dpy, LSurface *surface, LRectangle destr, LImage *src, LRectangle srcr); + +LImage *LGetImagine(LDisplay *dpy, LSurface *surface, LRectangle r); + +void LFreeImage(LDisplay *dpy, LImage *img); + +void LDestroySurface(LSurface *surface); + +LInput *LGetInput(LDisplay *dpy, LInputType type); + +void LAddInputHandler(LDisplay *dpy, LInput *input, void (*handler)(LEvent *event)); + +void LRemoveInputHandler(LDisplay *dpy, LInput *input, void (*handler)(LEvent *event)); + +