dws

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

commit 7a53811209d5bff5105e9340c1c38532d45d1318
parent 3746087495831eb16ac3b07b7afddcc9438f7206
Author: arg@garbe.us <unknown>
Date:   Thu, 26 Feb 2009 13:54:41 +0000

reorganized, added initial C stub
Diffstat:
Makefile | 49+++++++++++++++++++++++++++++++++++++++++++++++++
config.mk | 23+++++++++++++++++++++++
leinwand.c | 7+++++++
leinwand.h | 132+++++++++++++++++++++++++++++++++++++++++--------------------------------------
4 files changed, 147 insertions(+), 64 deletions(-)

diff --git a/Makefile b/Makefile @@ -0,0 +1,49 @@ +# leinwand - a new DRM-based window system +# See LICENSE file for copyright and license details. + +include config.mk + +SRC = leinwand.c +OBJ = ${SRC:.c=.o} + +all: options leinwand + +options: + @echo leinwand build options: + @echo "CFLAGS = ${CFLAGS}" + @echo "LDFLAGS = ${LDFLAGS}" + @echo "CC = ${CC}" + +.c.o: + @echo CC $< + @${CC} -c ${CFLAGS} $< + +${OBJ}: config.mk + +leinwand: ${OBJ} + @echo CC -o $@ + @${CC} -o $@ ${OBJ} ${LDFLAGS} + +clean: + @echo cleaning + @rm -f leinwand ${OBJ} leinwand-${VERSION}.tar.gz + +dist: clean + @echo creating dist tarball + @mkdir -p leinwand-${VERSION} + @cp -R LICENSE Makefile README config.mk ${SRC} leinwand-${VERSION} + @tar -cf leinwand-${VERSION}.tar leinwand-${VERSION} + @gzip leinwand-${VERSION}.tar + @rm -rf leinwand-${VERSION} + +install: all + @echo installing executable file to ${DESTDIR}${PREFIX}/bin + @mkdir -p ${DESTDIR}${PREFIX}/bin + @cp -f leinwand ${DESTDIR}${PREFIX}/bin + @chmod 755 ${DESTDIR}${PREFIX}/bin/leinwand + +uninstall: + @echo removing executable file from ${DESTDIR}${PREFIX}/bin + @rm -f ${DESTDIR}${PREFIX}/bin/leinwand + +.PHONY: all options clean dist install uninstall diff --git a/config.mk b/config.mk @@ -0,0 +1,23 @@ +# leinwand version +VERSION = 0.0 + +# Customize below to fit your system + +# paths +PREFIX = /usr/local + +# includes and libs +INCS = -I. -I/usr/include -I/usr/include/linux +LIBS = -L/usr/lib -lc + +# flags +CPPFLAGS = -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS} +CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS} +LDFLAGS = -s ${LIBS} + +# Solaris +#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\" +#LDFLAGS = ${LIBS} + +# compiler and linker +CC = cc diff --git a/leinwand.c b/leinwand.c @@ -0,0 +1,7 @@ +/* See LICENSE file for license details. */ +#include "leinwand.h" + +int +main(int argc, char *argv[]) { + return 0; +} diff --git a/leinwand.h b/leinwand.h @@ -1,24 +1,5 @@ /* 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, @@ -34,61 +15,83 @@ typedef enum { 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; -}; +typedef enum { + EventTypeKeyPress, + EventTypeKeyRelease, + EventTypeButtonPress, + EventTypeButtonRelease, + EventTypePointerMove, + EventTypeExpose, +} LEventType; -struct _LSurface { - unsigned int id; - usingned int tier; - LDisplay *dpy; - LSurface *parent; - LSurface *childs; - LSurface *next; +typedef enum { + InputTypeMouse, + InputTypeKeyboard, + InputTypeEnd +} LInputType; + +typedef struct _LComposer LComposer; +typedef struct _LDisplay LDisplay; +typedef struct _LEvent LEvent; +typedef struct _LImage LImage; +typedef struct _LInput LInput; +typedef struct _LRectangle LRectangle; +typedef struct _LScreen LScreen; +typedef struct _LSurface LSurface; + +struct _LRectangle { + int x; + int y; + unsigned int w; + unsigned int h; }; struct _LComposer { - unsigned int id; - LComposerType type; + unsigned int id; + LComposerType type; }; -typedef struct { - unsigned int id; - LRectangle r; - void *data; -} LImage; +struct _LDisplay { + unsigned int id; + LRectangle r; /* virtual rectangle spanned over all screens */ + LComposer *composer; + LSurface *root; /* root surface tier is 0 */ + LScreen *screens; + LInput *inputs; +}; +struct _LEvent { + unsigned int id; + LEventType type; +}; -typedef enum { - InputTypeMouse, - InputTypeKeyboard, - InputTypeEnd -} LInputType; +struct _LImage{ + unsigned int id; + LRectangle r; + void *data; +}; struct _LInput { - unsigned int id; - LInputType type; - LInput *next; + unsigned int id; + LInputType type; + LInput *next; }; -typedef enum { - EventTypeKeyPress, - EventTypeKeyRelease, - EventTypeButtonPress, - EventTypeButtonRelease, - EventTypePointerMove, - EventTypeExpose, -} LEventType; +struct _LScreen { + unsigned int id; + LDisplay *dpy; + LRectangle r; + LSurface *surface; + LScreen *next; +}; -typedef struct { - unsigned int id; - LEventType type; +struct _LSurface { + unsigned int id; + unsigned int tier; + LDisplay *dpy; + LSurface *parent; + LSurface *childs; + LSurface *next; }; LDisplay *LOpen(unsigned int id); @@ -97,13 +100,15 @@ LComposer *LCreateComposer(LDisplay *dpy, LComposerType type); void LClose(LDisplay *dpy); -LSurface *LCreateSurface(LDisplay *dpy); +LSurface *LGetRootSurface(LDisplay *dpy); + +LSurface *LCreateSurface(LDisplay *dpy, LSurface *parent); 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); +LImage *LGetImage(LDisplay *dpy, LSurface *surface, LRectangle r); void LFreeImage(LDisplay *dpy, LImage *img); @@ -115,4 +120,3 @@ void LAddInputHandler(LDisplay *dpy, LInput *input, void (*handler)(LEvent *even void LRemoveInputHandler(LDisplay *dpy, LInput *input, void (*handler)(LEvent *event)); -