wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

commit 571c792922a86aaaca3eba619f01932d3f3b9c17
parent 6637f664be344c45c0c09773bbbb8daf3a65a30a
Author: garbeam <garbeam@localhost.localdomain>
Date:   Mon,  5 Dec 2005 03:09:27 +0200

added new layout files


Diffstat:
cmd/wm/core.c | 55+++++++++++++------------------------------------------
cmd/wm/layout_column.c | 8++------
cmd/wm/layout_dummy.c | 52++++++++++++++++++++++++++++++++++++++++++++++++++++
cmd/wm/layout_float.c | 52++++++++++++++++++++++++++++++++++++++++++++++++++++
cmd/wm/wm.c | 88++++++++++++++++++++++++-------------------------------------------------------
5 files changed, 146 insertions(+), 109 deletions(-)

diff --git a/cmd/wm/core.c b/cmd/wm/core.c @@ -94,26 +94,14 @@ static void draw_pager_page(Page * p, Draw * d) XRectangle r = d->rect; char name[4]; if (p == pages[sel]) { - d->bg = - blitz_loadcolor(dpy, screen_num, - defaults[WM_SEL_BG_COLOR]->content); - d->fg = - blitz_loadcolor(dpy, screen_num, - defaults[WM_SEL_FG_COLOR]->content); - d->border = - blitz_loadcolor(dpy, screen_num, - defaults[WM_SEL_BORDER_COLOR]->content); + d->bg = blitz_loadcolor(dpy, screen_num, defaults[WM_SEL_BG_COLOR]->content); + d->fg = blitz_loadcolor(dpy, screen_num, defaults[WM_SEL_FG_COLOR]->content); + d->border = blitz_loadcolor(dpy, screen_num, defaults[WM_SEL_BORDER_COLOR]->content); d->font = font; } else { - d->bg = - blitz_loadcolor(dpy, screen_num, - defaults[WM_NORM_BG_COLOR]->content); - d->fg = - blitz_loadcolor(dpy, screen_num, - defaults[WM_NORM_FG_COLOR]->content); - d->border = - blitz_loadcolor(dpy, screen_num, - defaults[WM_NORM_BORDER_COLOR]->content); + d->bg = blitz_loadcolor(dpy, screen_num, defaults[WM_NORM_BG_COLOR]->content); + d->fg = blitz_loadcolor(dpy, screen_num, defaults[WM_NORM_FG_COLOR]->content); + d->border = blitz_loadcolor(dpy, screen_num, defaults[WM_NORM_BORDER_COLOR]->content); d->font = font; } snprintf(name, sizeof(name), "%d", index_item((void **) pages, p)); @@ -124,34 +112,17 @@ static void draw_pager_page(Page * p, Draw * d) for (i = 0; p->areas[i]; i++) { for (j = 0; p->areas[i]->frames[j]; j++) { if (i == p->sel && j == p->areas[i]->sel) { - d->bg = - blitz_loadcolor(dpy, screen_num, - defaults[WM_SEL_BG_COLOR]->content); - d->fg = - blitz_loadcolor(dpy, screen_num, - defaults[WM_SEL_FG_COLOR]->content); - d->border = - blitz_loadcolor(dpy, screen_num, - defaults[WM_SEL_BORDER_COLOR]-> - content); + d->bg = blitz_loadcolor(dpy, screen_num, defaults[WM_SEL_BG_COLOR]->content); + d->fg = blitz_loadcolor(dpy, screen_num, defaults[WM_SEL_FG_COLOR]->content); + d->border = blitz_loadcolor(dpy, screen_num, defaults[WM_SEL_BORDER_COLOR]->content); d->font = font; } else { - d->bg = - blitz_loadcolor(dpy, screen_num, - defaults[WM_NORM_BG_COLOR]->content); - d->fg = - blitz_loadcolor(dpy, screen_num, - defaults[WM_NORM_FG_COLOR]->content); - d->border = - blitz_loadcolor(dpy, screen_num, - defaults[WM_NORM_BORDER_COLOR]-> - content); + d->bg = blitz_loadcolor(dpy, screen_num, defaults[WM_NORM_BG_COLOR]->content); + d->fg = blitz_loadcolor(dpy, screen_num, defaults[WM_NORM_FG_COLOR]->content); + d->border = blitz_loadcolor(dpy, screen_num, defaults[WM_NORM_BORDER_COLOR]->content); d->font = font; } - d->data = - p->areas[i]->frames[j]->clients[p->areas[i]->frames[j]-> - sel]->files[C_NAME]-> - content; + d->data = p->areas[i]->frames[j]->clients[p->areas[i]->frames[j]->sel]->files[C_NAME]->content; scale_rect(&rect, &r, &p->areas[i]->rect, &d->rect); blitz_drawlabel(dpy, d); XSync(dpy, False); /* do not clear upwards */ diff --git a/cmd/wm/layout_column.c b/cmd/wm/layout_column.c @@ -34,18 +34,14 @@ static void attach_col(Area * a, Client * c); static void detach_col(Area * a, Client * c, int unmapped, int destroyed); static void resize_col(Frame * f, XRectangle * new, XPoint * pt); -static Layout lcol = - { "col", init_col, deinit_col, arrange_col, attach_col, detach_col, -resize_col }; +static Layout lcol = { "col", init_col, deinit_col, arrange_col, attach_col, detach_col, resize_col }; static Column zero_column = { 0 }; static Acme zero_acme = { 0 }; void init_layout_column() { - layouts = - (Layout **) attach_item_end((void **) layouts, &lcol, - sizeof(Layout *)); + layouts = (Layout **) attach_item_end((void **) layouts, &lcol, sizeof(Layout *)); } diff --git a/cmd/wm/layout_dummy.c b/cmd/wm/layout_dummy.c @@ -0,0 +1,52 @@ +/* + * (C)opyright MMIV-MMV Anselm R. Garbe <garbeam at gmail dot com> + * See LICENSE file for license details. + */ + +#include <stdlib.h> +#include <string.h> +#include <math.h> + +#include "wm.h" +#include "layout.h" + +#include <cext.h> + +static void init_dummy(Area * a); +static void deinit_dummy(Area * a); +static void arrange_dummy(Area * a); +static void attach_dummy(Area * a, Client * c); +static void detach_dummy(Area * a, Client * c, int unmapped, int destroyed); +static void resize_dummy(Frame * f, XRectangle * new, XPoint * pt); + +static Layout ldummy = { "dummy", init_dummy, deinit_dummy, arrange_dummy, attach_dummy, detach_dummy, resize_dummy }; + +void init_layout_dummy() +{ + layouts = (Layout **) attach_item_end((void **) layouts, &ldummy, sizeof(Layout *)); +} + + +static void arrange_dummy(Area * a) +{ +} + +static void init_dummy(Area * a) +{ +} + +static void deinit_dummy(Area * a) +{ +} + +static void attach_dummy(Area * a, Client * c) +{ +} + +static void detach_dummy(Area * a, Client * c, int unmapped, int destroyed) +{ +} + +static void resize_dummy(Frame * f, XRectangle * new, XPoint * pt) +{ +} diff --git a/cmd/wm/layout_float.c b/cmd/wm/layout_float.c @@ -0,0 +1,52 @@ +/* + * (C)opyright MMIV-MMV Anselm R. Garbe <garbeam at gmail dot com> + * See LICENSE file for license details. + */ + +#include <stdlib.h> +#include <string.h> +#include <math.h> + +#include "wm.h" +#include "layout.h" + +#include <cext.h> + +static void init_float(Area * a); +static void deinit_float(Area * a); +static void arrange_float(Area * a); +static void attach_float(Area * a, Client * c); +static void detach_float(Area * a, Client * c, int unmapped, int destroyed); +static void resize_float(Frame * f, XRectangle * new, XPoint * pt); + +static Layout lfloat = { "float", init_float, deinit_float, arrange_float, attach_float, detach_float, resize_float }; + +void init_layout_float() +{ + layouts = (Layout **) attach_item_end((void **) layouts, &lfloat, sizeof(Layout *)); +} + + +static void arrange_float(Area * a) +{ +} + +static void init_float(Area * a) +{ +} + +static void deinit_float(Area * a) +{ +} + +static void attach_float(Area * a, Client * c) +{ +} + +static void detach_float(Area * a, Client * c, int unmapped, int destroyed) +{ +} + +static void resize_float(Frame * f, XRectangle * new, XPoint * pt) +{ +} diff --git a/cmd/wm/wm.c b/cmd/wm/wm.c @@ -61,59 +61,31 @@ static void init_defaults() { defaults[WM_DETACHED_FRAME] = ixp_create(ixps, "/detached/frame"); defaults[WM_DETACHED_CLIENT] = ixp_create(ixps, "/detached/client"); - defaults[WM_TRANS_COLOR] = - wmii_create_ixpfile(ixps, "/default/transcolor", - BLITZ_SEL_FG_COLOR); + defaults[WM_TRANS_COLOR] = wmii_create_ixpfile(ixps, "/default/transcolor", BLITZ_SEL_FG_COLOR); defaults[WM_TRANS_COLOR]->after_write = handle_after_write; - defaults[WM_SEL_BG_COLOR] = - wmii_create_ixpfile(ixps, "/default/selstyle/bgcolor", - BLITZ_SEL_BG_COLOR); - defaults[WM_SEL_FG_COLOR] = - wmii_create_ixpfile(ixps, "/default/selstyle/fgcolor", - BLITZ_SEL_FG_COLOR); - defaults[WM_SEL_BORDER_COLOR] = - wmii_create_ixpfile(ixps, "/default/selstyle/fgcolor", - BLITZ_SEL_BORDER_COLOR); - defaults[WM_NORM_BG_COLOR] = - wmii_create_ixpfile(ixps, "/default/normstyle/bgcolor", - BLITZ_NORM_BG_COLOR); - defaults[WM_NORM_FG_COLOR] = - wmii_create_ixpfile(ixps, "/default/normstyle/fgcolor", - BLITZ_NORM_FG_COLOR); - defaults[WM_NORM_BORDER_COLOR] = - wmii_create_ixpfile(ixps, "/default/normstyle/fgcolor", - BLITZ_NORM_BORDER_COLOR); - defaults[WM_FONT] = - wmii_create_ixpfile(ixps, "/default/font", BLITZ_FONT); - defaults[WM_FONT]->after_write = handle_after_write; - defaults[WM_PAGE_SIZE] = - wmii_create_ixpfile(ixps, "/default/pagesize", - "0,0,east,south-16"); + defaults[WM_SEL_BG_COLOR] = wmii_create_ixpfile(ixps, "/default/selstyle/bgcolor", BLITZ_SEL_BG_COLOR); + defaults[WM_SEL_FG_COLOR] = wmii_create_ixpfile(ixps, "/default/selstyle/fgcolor", BLITZ_SEL_FG_COLOR); + defaults[WM_SEL_BORDER_COLOR] = wmii_create_ixpfile(ixps, "/default/selstyle/fgcolor", BLITZ_SEL_BORDER_COLOR); + defaults[WM_NORM_BG_COLOR] = wmii_create_ixpfile(ixps, "/default/normstyle/bgcolor", BLITZ_NORM_BG_COLOR); + defaults[WM_NORM_FG_COLOR] = wmii_create_ixpfile(ixps, "/default/normstyle/fgcolor", BLITZ_NORM_FG_COLOR); + defaults[WM_NORM_BORDER_COLOR] = wmii_create_ixpfile(ixps, "/default/normstyle/fgcolor", BLITZ_NORM_BORDER_COLOR); + defaults[WM_FONT] = wmii_create_ixpfile(ixps, "/default/font", BLITZ_FONT); + defaults[WM_FONT]->after_write = handle_after_write; + defaults[WM_PAGE_SIZE] = wmii_create_ixpfile(ixps, "/default/pagesize", "0,0,east,south-16"); defaults[WM_SNAP_VALUE] = wmii_create_ixpfile(ixps, "/default/snapvalue", "20"); /* 0..1000 */ - defaults[WM_BORDER] = - wmii_create_ixpfile(ixps, "/default/border", "1"); + defaults[WM_BORDER] = wmii_create_ixpfile(ixps, "/default/border", "1"); defaults[WM_TAB] = wmii_create_ixpfile(ixps, "/default/tab", "1"); - defaults[WM_HANDLE_INC] = - wmii_create_ixpfile(ixps, "/default/handleinc", "1"); - defaults[WM_LOCKED] = - wmii_create_ixpfile(ixps, "/default/locked", "1"); - defaults[WM_LAYOUT] = - wmii_create_ixpfile(ixps, "/default/layout", LAYOUT); + defaults[WM_HANDLE_INC] = wmii_create_ixpfile(ixps, "/default/handleinc", "1"); + defaults[WM_LOCKED] = wmii_create_ixpfile(ixps, "/default/locked", "1"); + defaults[WM_LAYOUT] = wmii_create_ixpfile(ixps, "/default/layout", LAYOUT); defaults[WM_SEL_PAGE] = ixp_create(ixps, "/page/sel"); - defaults[WM_EVENT_PAGE_UPDATE] = - ixp_create(ixps, "/default/event/pageupdate"); - defaults[WM_EVENT_CLIENT_UPDATE] = - ixp_create(ixps, "/default/event/clientupdate"); - defaults[WM_EVENT_B1PRESS] = - ixp_create(ixps, "/defaults/event/b1press"); - defaults[WM_EVENT_B2PRESS] = - ixp_create(ixps, "/defaults/event/b2press"); - defaults[WM_EVENT_B3PRESS] = - ixp_create(ixps, "/defaults/event/b3press"); - defaults[WM_EVENT_B4PRESS] = - ixp_create(ixps, "/defaults/event/b4press"); - defaults[WM_EVENT_B5PRESS] = - ixp_create(ixps, "/defaults/event/b5press"); + defaults[WM_EVENT_PAGE_UPDATE] = ixp_create(ixps, "/default/event/pageupdate"); + defaults[WM_EVENT_CLIENT_UPDATE] = ixp_create(ixps, "/default/event/clientupdate"); + defaults[WM_EVENT_B1PRESS] = ixp_create(ixps, "/defaults/event/b1press"); + defaults[WM_EVENT_B2PRESS] = ixp_create(ixps, "/defaults/event/b2press"); + defaults[WM_EVENT_B3PRESS] = ixp_create(ixps, "/defaults/event/b3press"); + defaults[WM_EVENT_B4PRESS] = ixp_create(ixps, "/defaults/event/b4press"); + defaults[WM_EVENT_B5PRESS] = ixp_create(ixps, "/defaults/event/b5press"); } static void init_screen() @@ -164,16 +136,11 @@ static void init_screen() static int wmii_error_handler(Display * dpy, XErrorEvent * error) { if (error->error_code == BadWindow - || (error->request_code == X_SetInputFocus - && error->error_code == BadMatch) - || (error->request_code == X_PolyText8 - && error->error_code == BadDrawable) - || (error->request_code == X_PolyFillRectangle - && error->error_code == BadDrawable) - || (error->request_code == X_PolySegment - && error->error_code == BadDrawable) - || (error->request_code == X_ConfigureWindow - && error->error_code == BadMatch)) + || (error->request_code == X_SetInputFocus && error->error_code == BadMatch) + || (error->request_code == X_PolyText8 && error->error_code == BadDrawable) + || (error->request_code == X_PolyFillRectangle && error->error_code == BadDrawable) + || (error->request_code == X_PolySegment && error->error_code == BadDrawable) + || (error->request_code == X_ConfigureWindow && error->error_code == BadMatch)) return 0; fprintf(stderr, "%s", "wmiiwm: fatal error"); return x_error_handler(dpy, error); /* calls exit() */ @@ -236,8 +203,7 @@ static void run() scan_wins(); /* main event loop */ - run_server_with_fd_support(ixps, ConnectionNumber(dpy), check_event, - 0); + run_server_with_fd_support(ixps, ConnectionNumber(dpy), check_event, 0); cleanup(); deinit_server(ixps); XCloseDisplay(dpy);