struct Column {
int width;
- Client* clients;
+ int nclients;
+ Client clients[MAX_COLUMN_CLIENTS];
};
struct Workspace {
Arg arg;
} Key;
-/* anvil.c */
+/* winmgr.c */
extern XConf X;
+/* event.c */
void Event_Map(Window w, XWindowAttributes* attr);
void Event_Unmap(Window w, Window parent);
void Event_Destroy(Window w);
void Event_PropertyChange(Window w);
void Event_Enter(Window w);
void Event_Redraw(Window w);
-void Event_ButtonPress(Window w, int win_x, int win_y, int root_x, int root_y);
-void Event_ButtonRelease(Window w);
-void Event_ButtonMotion(Window w);
+void Event_ButtonPress(Window w, XButtonEvent* ev);
+void Event_ButtonRelease(Window w, XButtonEvent* ev);
+void Event_ButtonMotion(Window w, XMotionEvent* ev);
void Event_KeyPress(Window w);
+/* client.c */
+extern Client* Focused;
void Client_InitExistingWindows(void);
Client* Client_Find(Window win);
Client* Client_Add(Window win, XWindowAttributes* attr);
void Client_Show(Client* c, int show);
void Client_Close(Client* c);
-
+/* mons.c */
+extern Monitor Monitors[MAX_MONITORS];
+void Monitors_Init(void);
void Monitors_Place(Client* c);
+/* mouse.c */
void Mouse_ToCorner(Client* client);
void Mouse_Down(XButtonEvent* ev, Client* client);
void Mouse_Up(XButtonEvent* ev, Client* client);
void Mouse_Drag(XMotionEvent* ev, Client* client);
+/* keys.c */
+void Keys_Init(void);
void Keys_Run(XKeyEvent* ev);
-
-
-
-
/* list.c */
int list_length(void* list);
void* list_del(void* list, void* node);
#define LIST_FOR_EACH_UNTIL(val,list,cond) \
for (val = list; (val != NULL) && !(cond); val = val->next)
-/* keys.c */
-void keys_init(void);
-void keys_run(XKeyEvent* ev);
-
-/* mons.c */
-extern Monitor Monitors[MAX_MONITORS];
-
-void mons_init(void);
-void mons_delclient(Location* loc);
-void mons_activate(Window win);
-
-void mons_layer(Monitor* mon);
-void mons_addclient(Client* c);
-void mons_togglefloat(Location* loc);
-int mons_find(Window win, Location* loc);
-void mons_place(Client* c);
-void mons_wspace(int i);
-void mons_towspace(Client* c, int i);
-void mons_raise(Monitor* mon, Client* c);
-void mons_lower(Monitor* mon, Client* c);
-void mons_colsplit(void);
-void mons_coljoin(void);
-void mons_coladjust(Monitor* mon, Column* col, int wdiff);
-void mons_tilemove(Location* loc, int hdiff);
-
-/* client.c */
-extern Client* Focused;
-void client_initall(void);
-Client* client_add(Window win, XWindowAttributes* attr);
-void client_draw(Client* c);
-void client_adjust(Client* c);
-void client_move(Client* c, int xdiff, int ydiff);
-void client_resize(Client* c, int xdiff, int ydiff);
-void client_close(Client* c);
-void client_focus(Client* c);
-void client_show(Client* c, int show);
-void client_readprops(Client* c);
-void client_shade(Client* c);
-void client_setshade(Client* c, int shade);
-
-/* mouse.c */
-void mouse_down(XButtonEvent* ev, Location* loc);
-void mouse_up(XButtonEvent* ev, Location* loc);
-void mouse_drag(XMotionEvent* ev, Location* loc);
-void mouse_tocorner(Client* c);
-void mouse_totitle(Client* c);
-void mouse_get(int* ptrx, int* ptry);
-
-/* tile.c */
-void tile_add(Location* loc);
-void tile_del(Location* loc);
-void tile_set(Location* loc);
-void tile_addheight(Location* loc, int amount);
+///* mons.c */
+//void mons_init(void);
+//void mons_delclient(Location* loc);
+//void mons_activate(Window win);
+//void mons_layer(Monitor* mon);
+//void mons_addclient(Client* c);
+//void mons_togglefloat(Location* loc);
+//int mons_find(Window win, Location* loc);
+//void mons_place(Client* c);
+//void mons_wspace(int i);
+//void mons_towspace(Client* c, int i);
+//void mons_raise(Monitor* mon, Client* c);
+//void mons_lower(Monitor* mon, Client* c);
+//void mons_colsplit(void);
+//void mons_coljoin(void);
+//void mons_coladjust(Monitor* mon, Column* col, int wdiff);
+//void mons_tilemove(Location* loc, int hdiff);
+
+///* client.c */
+//extern Client* Focused;
+//void client_initall(void);
+//Client* client_add(Window win, XWindowAttributes* attr);
+//void client_draw(Client* c);
+//void client_adjust(Client* c);
+//void client_move(Client* c, int xdiff, int ydiff);
+//void client_resize(Client* c, int xdiff, int ydiff);
+//void client_close(Client* c);
+//void client_focus(Client* c);
+//void client_show(Client* c, int show);
+//void client_readprops(Client* c);
+//void client_shade(Client* c);
+//void client_setshade(Client* c, int shade);
+
+///* mouse.c */
+//void mouse_down(XButtonEvent* ev, Location* loc);
+//void mouse_up(XButtonEvent* ev, Location* loc);
+//void mouse_drag(XMotionEvent* ev, Location* loc);
+//void mouse_tocorner(Client* c);
+//void mouse_totitle(Client* c);
+//void mouse_get(int* ptrx, int* ptry);
+
+///* tile.c */
+//void tile_add(Location* loc);
+//void tile_del(Location* loc);
+//void tile_set(Location* loc);
+//void tile_addheight(Location* loc, int amount);
/* error.c */
extern int (*error_default)(Display* disp, XErrorEvent* ev);
}
}
-void Event_ButtonPress(Window w, int win_x, int win_y, int root_x, int root_y)
+void Event_ButtonPress(Window w, XButtonEvent* ev)
{
Client* client = Client_Find(w);
if (client && (client->frame == w))
{
- if (win_y < MIN_HEIGHT)
+ if (ev->y < MIN_HEIGHT)
{
X.edge = E_TOP;
}
- else if (root_y > (client->y + client->h - BORDER_WIDTH))
+ else if (ev->y_root > (client->y + client->h - BORDER_WIDTH))
{
X.edge = E_BOTTOM;
}
- else if (win_x < BORDER_WIDTH)
+ else if (ev->x < BORDER_WIDTH)
{
X.edge = E_LEFT;
}
- else if (root_x > (client->x + client->w - BORDER_WIDTH))
+ else if (ev->x_root > (client->x + client->w - BORDER_WIDTH))
{
X.edge = E_RIGHT;
}
{
X.edge = E_NONE;
}
-// Mouse_Down(ev, client);
+ Mouse_Down(ev, client);
}
}
-void Event_ButtonRelease(Window w)
+void Event_ButtonRelease(Window w, XButtonEvent* ev)
{
Client* client = Client_Find(w);
if (client && (client->frame == w))
{
-// Mouse_Up(ev, client);
+ Mouse_Up(ev, client);
}
X.mode = M_IDLE;
XUngrabPointer(X.disp, CurrentTime);
}
-void Event_ButtonMotion(Window w)
+void Event_ButtonMotion(Window w, XMotionEvent* ev)
{
Client* client = Client_Find(w);
if (client && (client->frame == w))
{
-// Mouse_Drag(ev, client);
+ Mouse_Drag(ev, client);
}
}
#include "anvil.h"
#include <unistd.h>
-static char* wmcmd[] = { "anvil", NULL };
+static char* wmcmd[] = { "winmgr", NULL };
static char* pickexec[] = { "pickexec", NULL };
static char* terminal[] = { "st", NULL };
static char* locker[] = { "slock", NULL };
-static char* new_note[] = { "j", "note", NULL };
-static char* new_task[] = { "j", "task", NULL };
-static char* new_journal[] = { "j", "journal", NULL };
-static char* fetchsel[] = { "fetch", NULL, NULL };
static void restart(Arg* arg)
{
static void set_workspace(Arg* arg)
{
- mons_wspace(arg->i);
+ (void)arg;
+// mons_wspace(arg->i);
}
static void to_workspace(Arg* arg)
{
- mons_towspace(Focused, arg->i);
+ (void)arg;
+// mons_towspace(Focused, arg->i);
}
static void runcmd(Arg *arg)
static void coljoin(Arg *arg)
{
(void)arg;
- mons_coljoin();
+// mons_coljoin();
}
static void colsplit(Arg *arg)
{
(void)arg;
- mons_colsplit();
+// mons_colsplit();
}
static void togfloat(Arg *arg)
{
(void)arg;
- Location loc;
- if (Focused && mons_find(Focused->win, &loc))
- {
- mons_togglefloat(&loc);
- }
+// Location loc;
+// if (Focused && mons_find(Focused->win, &loc))
+// {
+// mons_togglefloat(&loc);
+// }
}
static Key keys[] = {
{ MODKEY|ShiftMask, XK_c, killwin, { 0 } },
{ MODKEY|ShiftMask, XK_f, togfloat, { 0 } },
- /* Jarvis-specific shortcuts */
- { MODKEY, XK_n, runcmd, { .cmd = new_note } },
- { MODKEY, XK_t, runcmd, { .cmd = new_task } },
- { MODKEY, XK_j, runcmd, { .cmd = new_journal } },
- { MODKEY, XK_f, runcmd, { .cmd = fetchsel } },
+// /* Jarvis-specific shortcuts */
+// { MODKEY, XK_n, runcmd, { .cmd = new_note } },
+// { MODKEY, XK_t, runcmd, { .cmd = new_task } },
+// { MODKEY, XK_j, runcmd, { .cmd = new_journal } },
+// { MODKEY, XK_f, runcmd, { .cmd = fetchsel } },
{ MODKEY, XK_1, set_workspace, { .i = 0 } },
{ MODKEY, XK_2, set_workspace, { .i = 1 } },
{ MODKEY|ShiftMask, XK_0, to_workspace, { .i = 9 } },
};
-void keys_init(void)
+void Keys_Init(void)
{
KeyCode code;
for (unsigned int i = 0; i < sizeof(keys)/sizeof(keys[0]); i++)
}
}
-void keys_run(XKeyEvent* ev)
+void Keys_Run(XKeyEvent* ev)
{
KeySym keysym = XkbKeycodeToKeysym(X.disp, ev->keycode, 0, 0);
for (unsigned int i = 0; i < sizeof(keys)/sizeof(keys[0]); i++)
}
}
}
-
-void Keys_Run(XKeyEvent* ev)
-{
-}
#include "anvil.h"
#include <math.h>
-int PtrX = 0, PtrY = 0;
+//int PtrX = 0, PtrY = 0;
Monitor Monitors[MAX_MONITORS];
-void Monitors_Place(Client* c)
-{}
-
-void mons_init(void)
+void Monitors_Init(void)
{
int nmons;
check( XineramaIsActive(X.disp), "Xinerama extension is required");
xfree(mons);
}
-int mons_find(Window win, Location* loc)
-{
- return 0;
-}
-
-/* adds a new client to the most appropriate monitor */
-void mons_addclient(Client* c)
-{}
-
-void mons_delclient(Location* loc)
-{}
-
-void mons_layer(Monitor* mon)
-{}
-
-void mons_togglefloat(Location* loc)
-{}
-
-/* find the best monitor to own the window by calculating the overlap */
-void mons_place(Client* c)
+void Monitors_Place(Client* c)
{
- (void)c;
}
-void mons_wspace(int wsid)
-{}
-
-void mons_towspace(Client* c, int wsid)
-{}
-
-void mons_raise(Monitor* mon, Client* c)
-{}
-
-void mons_lower(Monitor* mon, Client* c)
-{}
-
-void mons_colsplit(void)
-{}
-
-void mons_coljoin(void)
-{}
-
-void mons_coladjust(Monitor* mon, Column* col, int wdiff)
-{}
-
-void mons_tilemove(Location* loc, int hdiff)
-{}
-
-void mons_activate(Window win)
-{}
+//
+//int mons_find(Window win, Location* loc)
+//{
+// return 0;
+//}
+//
+///* adds a new client to the most appropriate monitor */
+//void mons_addclient(Client* c)
+//{}
+//
+//void mons_delclient(Location* loc)
+//{}
+//
+//void mons_layer(Monitor* mon)
+//{}
+//
+//void mons_togglefloat(Location* loc)
+//{}
+//
+///* find the best monitor to own the window by calculating the overlap */
+//void mons_place(Client* c)
+//{
+// (void)c;
+//}
+//
+//void mons_wspace(int wsid)
+//{}
+//
+//void mons_towspace(Client* c, int wsid)
+//{}
+//
+//void mons_raise(Monitor* mon, Client* c)
+//{}
+//
+//void mons_lower(Monitor* mon, Client* c)
+//{}
+//
+//void mons_colsplit(void)
+//{}
+//
+//void mons_coljoin(void)
+//{}
+//
+//void mons_coladjust(Monitor* mon, Column* col, int wdiff)
+//{}
+//
+//void mons_tilemove(Location* loc, int hdiff)
+//{}
+//
+//void mons_activate(Window win)
+//{}
GrabModeAsync, GrabModeAsync, None, X.csr_move, CurrentTime);
X.start_x = ev->x_root, X.start_y = ev->y_root;
X.last_x = ev->x_root, X.last_y = ev->y_root;
- Event_ButtonPress(
- ev->window,
- ev->x,
- ev->y,
- ev->x_root,
- ev->y_root
- );
+ Event_ButtonPress(ev->window, ev);
}
static void xbtnrelease(XEvent* e)
{
XButtonEvent* ev = &(e->xbutton);
- Event_ButtonRelease(ev->window);
+ Event_ButtonRelease(ev->window, ev);
}
static void xbtnmotion(XEvent* e)
/* make sure we get just the latest event */
XMotionEvent *ev = &e->xmotion;
while (XCheckTypedWindowEvent(X.disp, ev->window, ev->type, e));
- Event_ButtonMotion(ev->window);
+ Event_ButtonMotion(ev->window, ev);
X.last_x = ev->x_root, X.last_y = ev->y_root;
}
check_for_wm();
init_cursors();
init_font();
- mons_init();
+ Monitors_Init();
Client_InitExistingWindows();
- keys_init();
+ Keys_Init();
/* setup event handlers */
X.eventfns[ButtonPress] = xbtnpress;