static layer_t move_layer;
static struct { int v, h; } move_dir;
+/* Prototypes */
+void wm_update(void);
+
/********************
* Helper functions *
********************/
}
}
-/*******************************
- * Window management functions *
- *******************************/
+/* Refresh the window layout */
void wm_update(void)
{
/* Updates window sizes */
set_focus(wm_focus);
}
+/*******************************
+ * Window management functions *
+ *******************************/
int wm_handle_event(win_t *win, event_t ev, mod_t mod, ptr_t ptr)
{
if (!win || win == wm_dpy->geom) return 0;
if (EV_MOUSE0 <= ev && ev <= EV_MOUSE7) {
if (ev == EV_MOUSE1 && !mod.MODKEY && !mod.up)
return raise_float(win), 0;
+ if ((ev == EV_MOUSE3 && mod.MODKEY && !mod.up) ||
+ (ev == EV_MOUSE1 && mod.MODKEY && !mod.up && mod.shift))
+ return set_move(win,ptr,RESIZE), 1;
if (ev == EV_MOUSE1 && mod.MODKEY && !mod.up)
return set_move(win,ptr,MOVE), 1;
- if (ev == EV_MOUSE3 && mod.MODKEY && !mod.up)
- return set_move(win,ptr,RESIZE), 1;
if (move_mode != NONE && mod.up)
return set_move(win,ptr,NONE), 1;
if (ev == EV_MOUSE1 && !mod.up && win->state == ST_SHADE)
printf("wm_insert: %p\n", win);
print_txt();
+ /* Check for toolbars */
+ if (win->type == TYPE_TOOLBAR)
+ return wm_update();
+
/* Initialize window */
win->wm = new0(win_wm_t);
sys_watch(win, EV_ENTER, MOD());
{
printf("wm_remove: %p\n", win);
print_txt();
+ if (win->type == TYPE_TOOLBAR)
+ return wm_update();
for (list_t *tag = wm->tags; tag; tag = tag->next)
cut_win(win, tag->data);
free(win->wm);
event_t ev_e[] = {EV_ENTER, EV_FOCUS};
event_t ev_s[] = {'h', 'j', 'k', 'l', 'c', 'q', ' ',
- '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
+ EV_MOUSE1, EV_MOUSE3};
event_t ev_m[] = {'h', 'j', 'k', 'l', 'd', 's', 'm', 't', 'f', ' ',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
EV_F1, EV_F2, EV_F3, EV_F4, EV_F5, EV_F6,