added new layout files

This commit is contained in:
garbeam 2005-12-05 03:09:27 +02:00
parent 6637f664be
commit 571c792922
5 changed files with 146 additions and 109 deletions

View File

@ -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 */

View File

@ -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 *));
}

52
cmd/wm/layout_dummy.c Normal file
View File

@ -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)
{
}

52
cmd/wm/layout_float.c Normal file
View File

@ -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)
{
}

View File

@ -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);