layout: rename to banning

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2009-05-10 16:51:20 +02:00
parent 38400cd026
commit 332e2cb8e8
9 changed files with 52 additions and 58 deletions

View File

@ -47,7 +47,7 @@ set(AWE_SRCS
${SOURCE_DIR}/key.c
${SOURCE_DIR}/keygrabber.c
${SOURCE_DIR}/mousegrabber.c
${SOURCE_DIR}/layout.c
${SOURCE_DIR}/banning.c
${SOURCE_DIR}/luaa.c
${SOURCE_DIR}/spawn.c
${SOURCE_DIR}/hooks.c

View File

@ -1,7 +1,7 @@
/*
* layout.c - layout management
* banning.c - client banning management
*
* Copyright © 2007-2008 Julien Danjou <julien@danjou.info>
* Copyright © 2007-2009 Julien Danjou <julien@danjou.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -19,17 +19,17 @@
*
*/
#include "layout.h"
#include "banning.h"
#include "tag.h"
#include "window.h"
#include "screen.h"
#include "titlebar.h"
/** Arrange windows following current selected layout.
/** Reban windows following current selected tags.
* \param screen The screen to arrange.
*/
static void
arrange(screen_t *screen)
reban(screen_t *screen)
{
uint32_t select_input_val[] = { CLIENT_SELECT_INPUT_EVENT_MASK & ~(XCB_EVENT_MASK_ENTER_WINDOW | XCB_EVENT_MASK_LEAVE_WINDOW) };
@ -66,18 +66,7 @@ arrange(screen_t *screen)
client_ban(c);
}
/* Reset status before calling arrange hook.
* This is needed if you call a function that relies
* on need_arrange while arrange is in progress.
*/
screen->need_arrange = false;
/* call hook */
if(globalconf.hooks.arrange != LUA_REFNIL)
{
lua_pushnumber(globalconf.L, screen_array_indexof(&globalconf.screens, screen) + 1);
luaA_dofunction(globalconf.L, globalconf.hooks.arrange, 1, 0);
}
screen->need_reban = false;
/* Now, we want to receive EnterNotify and LeaveNotify events back. */
select_input_val[0] = CLIENT_SELECT_INPUT_EVENT_MASK;
@ -88,15 +77,15 @@ arrange(screen_t *screen)
select_input_val);
}
/** Refresh the screen disposition
/** Refresh the client disposition.
* \return true if the screen was arranged, false otherwise
*/
void
layout_refresh(void)
banning_refresh(void)
{
foreach(screen, globalconf.screens)
if(screen->need_arrange)
arrange(screen);
if(screen->need_reban)
reban(screen);
}
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80

View File

@ -1,7 +1,7 @@
/*
* layout.h - layout management header
* banning.h - client banning management header
*
* Copyright © 2007-2008 Julien Danjou <julien@danjou.info>
* Copyright © 2007-2009 Julien Danjou <julien@danjou.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -19,10 +19,10 @@
*
*/
#ifndef AWESOME_LAYOUT_H
#define AWESOME_LAYOUT_H
#ifndef AWESOME_BANNING_H
#define AWESOME_BANNING_H
void layout_refresh(void);
void banning_refresh(void);
#endif
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80

View File

@ -752,9 +752,9 @@ client_setminimized(client_t *c, bool s)
{
if(c->isminimized != s)
{
client_need_arrange(c);
client_need_reban(c);
c->isminimized = s;
client_need_arrange(c);
client_need_reban(c);
if(s)
window_state_set(c->win, XCB_WM_STATE_ICONIC);
else
@ -774,9 +774,9 @@ client_setsticky(client_t *c, bool s)
{
if(c->issticky != s)
{
client_need_arrange(c);
client_need_reban(c);
c->issticky = s;
client_need_arrange(c);
client_need_reban(c);
ewmh_client_update_hints(c);
hook_property(client, c, "sticky");
}
@ -1469,9 +1469,9 @@ luaA_client_newindex(lua_State *L)
b = luaA_checkboolean(L, 3);
if(b != c->ishidden)
{
client_need_arrange(c);
client_need_reban(c);
c->ishidden = b;
client_need_arrange(c);
client_need_reban(c);
hook_property(client, c, "hide");
}
break;

View File

@ -155,11 +155,11 @@ client_t * luaA_client_checkudata(lua_State *, int);
ARRAY_FUNCS(client_t *, client, DO_NOTHING)
LUA_OBJECT_FUNCS(client_t, client, "client")
#define client_need_arrange(c) \
#define client_need_reban(c) \
do { \
if(!c->screen->need_arrange \
if(!c->screen->need_reban \
&& client_isvisible(c, (c)->screen)) \
c->screen->need_arrange = true; \
c->screen->need_reban = true; \
} while(0)
bool client_maybevisible(client_t *, screen_t *);

View File

@ -23,13 +23,13 @@
#define AWESOME_EVENT_H
#include "wibox.h"
#include "layout.h"
#include "banning.h"
#include "client.h"
static inline int
awesome_refresh(void)
{
layout_refresh();
banning_refresh();
wibox_refresh();
client_stack_refresh();
return xcb_flush(globalconf.connection);

View File

@ -363,7 +363,7 @@ luaA_screen_tags(lua_State *L)
tag_array_wipe(&s->tags);
tag_array_init(&s->tags);
s->need_arrange = true;
s->need_reban = true;
/* push new tags */
lua_pushnil(L);

View File

@ -1,7 +1,7 @@
/*
* screen.h - screen management header
*
* Copyright © 2007-2008 Julien Danjou <julien@danjou.info>
* Copyright © 2007-2009 Julien Danjou <julien@danjou.info>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -28,8 +28,8 @@ struct a_screen
{
/** Screen geometry */
area_t geometry;
/** true if we need to arrange() */
bool need_arrange;
/** True if we need to reban() */
bool need_reban;
/** Tag list */
tag_array_t tags;
/** Window that contains the systray */

37
tag.c
View File

@ -54,21 +54,24 @@ luaA_tag_gc(lua_State *L)
static void
tag_view(tag_t *tag, bool view)
{
int screen_index = screen_array_indexof(&globalconf.screens, tag->screen);
tag->selected = view;
tag->screen->need_arrange = true;
ewmh_update_net_current_desktop(screen_virttophys(screen_index));
if(globalconf.hooks.tags != LUA_REFNIL)
if(tag->selected != view)
{
lua_pushnumber(globalconf.L, screen_index + 1);
tag_push(globalconf.L, tag);
if(view)
lua_pushliteral(globalconf.L, "select");
else
lua_pushliteral(globalconf.L, "unselect");
luaA_dofunction(globalconf.L, globalconf.hooks.tags, 3, 0);
int screen_index = screen_array_indexof(&globalconf.screens, tag->screen);
tag->selected = view;
tag->screen->need_reban = true;
ewmh_update_net_current_desktop(screen_virttophys(screen_index));
if(globalconf.hooks.tags != LUA_REFNIL)
{
lua_pushnumber(globalconf.L, screen_index + 1);
tag_push(globalconf.L, tag);
if(view)
lua_pushliteral(globalconf.L, "select");
else
lua_pushliteral(globalconf.L, "unselect");
luaA_dofunction(globalconf.L, globalconf.hooks.tags, 3, 0);
}
}
}
@ -151,7 +154,8 @@ tag_client(client_t *c)
client_array_append(&t->clients, c);
ewmh_client_update_desktop(c);
client_need_arrange(c);
client_need_reban(c);
/* call hook */
if(globalconf.hooks.tagged != LUA_REFNIL)
{
@ -171,8 +175,9 @@ untag_client(client_t *c, tag_t *t)
for(int i = 0; i < t->clients.len; i++)
if(t->clients.tab[i] == c)
{
client_need_arrange(c);
client_need_reban(c);
client_array_take(&t->clients, i);
client_need_reban(c);
ewmh_client_update_desktop(c);
/* call hook */
if(globalconf.hooks.tagged != LUA_REFNIL)