[hackers] wmix: new tip (= 28)

From: Anselm R. Garbe <arg_AT_suckless.org>
Date: Tue, 06 Feb 2007 14:50:06 +0100

changeset: 28:8d60f3fd69d5
tag: tip
user: Denis Grelich <denisg_AT_suckless.org>
date: Tue Feb 06 14:46:46 2007 +0100
files: structures.c wmii.h
description:
some more boring implementation

diff -r cbd50ff78a63 -r 8d60f3fd69d5 structures.c
--- a/structures.c Sat Feb 03 18:51:29 2007 +0100
+++ b/structures.c Tue Feb 06 14:46:46 2007 +0100
@@ -1,21 +1,97 @@
 #include "wmii.h"
 
 View *
-get_view (Scope *scope, const char *tag) {
+get_view (const char *tag) {
         View *v;
- for (v = views; v; v = v->next) {
- if (!strcmp(v->tag, tag)) {
- printf("%u\n", (uint) v);
+ for (v = scope->view; v; v = v->next) {
+ if (!strcmp(v->tag, tag))
                         return v;
- }
         }
         v = ixp_emallocz(sizeof (View));
         v->tag = ixp_estrdup(tag);
         v->scope = scope;
         scope->view = v;
- v->fsel = v->flt = NULL;
- v->sel = v->col = NULL;
- v->cols_cnt = 0;
- v->next = views;
- return (views = v);
+ v->next = scope->view;
+ v->flt = ixp_emallocz(sizeof (Float));
+ v->flt->floating = True;
+ v->flt->view = v;
+ v->flt->x = scope->rect.x;
+ v->flt->width = scope->rect.w;
+ v->float_selected = False;
+ return v;
 }
+
+void
+destroy_view (View *v) {
+ free(v->tag);
+ View **vp;
+ for (*vp = &scope->view; *vp; *vp = &(*vp)->next) {
+ if (*vp == v) {
+ *vp = v->next;
+ break;
+ }
+ }
+ free(v);
+}
+
+Column *
+create_column (View *v, Column *after) {
+ Column **cp, *col = ixp_emallocz(sizeof (Column));
+ cp = after ? &after->next : &v->col;
+ col->next = *cp;
+ col->prev = after;
+ if (col->next) col->next->prev = col;
+ *cp = col;
+
+ col->view = v;
+ col->floating = False;
+ ++v->c_cnt;
+ if (!v->c_sel)
+ v->sel = col;
+ return col;
+}
+
+void
+destroy_column (Column *col) {
+ View *v = col->view;
+ if (col->prev)
+ col->prev->next = col->next;
+ if(col->next)
+ col->next->prev = col->prev;
+ if(v->col == col)
+ v->col = col->next;
+ if (v->c_sel == col)
+ v->c_sel = col->next ? col->next : col->prev;
+ free(col);
+ --v->c_cnt;
+}
+
+Frame *
+create_frame (Client *c, View *v) {
+ Frame *f = ixp_emallocz(sizeof (Frame));
+
+ f->view = v;
+
+ f->crect.y = def.barheight;
+ f->rect = def.frame_min;
+ f->frect = c->rect;
+
+ f->rollup = False;
+
+ f->client = c;
+ f->cnext = c->f;
+ c->f = f;
+ return f;
+}
+
+void
+destroy_frame (Frame *f) {
+ Frame **fp;
+ for (fp = &f->client->f; *fp; fp = &(*fp)->next) {
+ if ((*fp)->cnext == f) {
+ (*fp)->cnext = f->cnext;
+ break;
+ }
+ }
+ // proceed here
+}
diff -r cbd50ff78a63 -r 8d60f3fd69d5 wmii.h
--- a/wmii.h Sat Feb 03 18:51:29 2007 +0100
+++ b/wmii.h Tue Feb 06 14:46:46 2007 +0100
@@ -57,7 +57,7 @@ typedef struct Frame Frame;
 typedef struct Frame Frame;
 typedef struct Area Area;
 #define Column Area
-#define Floating Area
+#define Float Area
 typedef struct View View;
 typedef struct Scope Scope;
 
@@ -111,7 +111,7 @@ struct View {
         Column* col; // list of columns
         uint c_cnt; // number of columns
         Column* c_sel; // (last) selected column
- Floating *flt; // floating layer
+ Float *flt; // floating layer
         Bool float_selected; // true if floating layer is focused
         Scope *scope;
 };
Received on Tue Feb 06 2007 - 14:50:06 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:54:56 UTC