#include "sys.h"
#include "wm.h"
-#define MODKEY ctrl
+#define MODKEY alt
#define MARGIN 10
/* Loca types */
int tx=0, ty=0; // Total x/y size
int mx=0, my=0; // Maximum x/y size (screen size)
-
/* Scale horizontally */
+ x = wm_root->x;
mx = wm_root->w - (list_length(wm_cols)+1)*MARGIN;
for (list_t *lx = cols; lx; lx = lx->next)
tx += ((col_t*)lx->data)->width;
ty = 0;
for (list_t *ly = col->rows; ly; ly = ly->next)
ty += ((win_t*)ly->data)->h;
- y = 0;
+ y = wm_root->y;
my = wm_root->h - (list_length(col->rows)+1)*MARGIN;
for (list_t *ly = col->rows; ly; ly = ly->next) {
win_t *win = ly->data;
}
/* Window management functions */
+void wm_update(void)
+{
+ arrange(wm_cols);
+}
+
int wm_handle_key(win_t *win, Key_t key, mod_t mod, ptr_t ptr)
{
if (!win || win == wm_root) return 0;
if (key == key_enter)
set_focus(win);
+ /* Reset focus after after focus change,
+ * not sure what is causing the focus change in the first place
+ * but preventing that would be a better solution */
+ if (key == key_focus)
+ set_focus(wm_focus);
+
return 0;
}
/* Initialize window */
win->wm = new0(win_wm_t);
sys_watch(win, key_enter, MOD());
+ sys_watch(win, key_focus, MOD());
/* Add to screen */
list_t *lcol = wm_focus && wm_focus->wm ?
/* Arrange */
arrange(wm_cols);
+ sys_focus(wm_focus);
print_txt(wm_cols);
}
sys_watch(root, key_mouse1, MOD(.MODKEY=1));
sys_watch(root, key_mouse3, MOD(.MODKEY=1));
sys_watch(root, key_enter, MOD());
+ sys_watch(root, key_focus, MOD());
Key_t keys[] = {'h', 'j', 'k', 'l'};
for (int i = 0; i < countof(keys); i++) {
sys_watch(root, keys[i], MOD(.MODKEY=1));