struts: split off client.c
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
efed142b97
commit
47011cb324
|
@ -38,6 +38,7 @@ set(AWE_DOC_FILES
|
||||||
set(AWE_SRCS
|
set(AWE_SRCS
|
||||||
${SOURCE_DIR}/awesome.c
|
${SOURCE_DIR}/awesome.c
|
||||||
${SOURCE_DIR}/client.c
|
${SOURCE_DIR}/client.c
|
||||||
|
${SOURCE_DIR}/strut.c
|
||||||
${SOURCE_DIR}/dbus.c
|
${SOURCE_DIR}/dbus.c
|
||||||
${SOURCE_DIR}/root.c
|
${SOURCE_DIR}/root.c
|
||||||
${SOURCE_DIR}/event.c
|
${SOURCE_DIR}/event.c
|
||||||
|
|
26
client.c
26
client.c
|
@ -1568,26 +1568,6 @@ luaA_client_geometry(lua_State *L)
|
||||||
return luaA_pusharea(L, c->geometry);
|
return luaA_pusharea(L, c->geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Push a strut type to a table on stack.
|
|
||||||
* \param L The Lua VM state.
|
|
||||||
* \param struts The struts to push.
|
|
||||||
* \return The number of elements pushed on stack.
|
|
||||||
*/
|
|
||||||
static inline int
|
|
||||||
luaA_pushstruts(lua_State *L, strut_t struts)
|
|
||||||
{
|
|
||||||
lua_createtable(L, 4, 0);
|
|
||||||
lua_pushnumber(L, struts.left);
|
|
||||||
lua_setfield(L, -2, "left");
|
|
||||||
lua_pushnumber(L, struts.right);
|
|
||||||
lua_setfield(L, -2, "right");
|
|
||||||
lua_pushnumber(L, struts.top);
|
|
||||||
lua_setfield(L, -2, "top");
|
|
||||||
lua_pushnumber(L, struts.bottom);
|
|
||||||
lua_setfield(L, -2, "bottom");
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Return client struts (reserved space at the edge of the screen).
|
/** Return client struts (reserved space at the edge of the screen).
|
||||||
* \param L The Lua VM state.
|
* \param L The Lua VM state.
|
||||||
* \return The number of elements pushed on stack.
|
* \return The number of elements pushed on stack.
|
||||||
|
@ -1628,13 +1608,11 @@ luaA_client_struts(lua_State *L)
|
||||||
ewmh_update_client_strut(c);
|
ewmh_update_client_strut(c);
|
||||||
|
|
||||||
hook_property(c, "struts");
|
hook_property(c, "struts");
|
||||||
luaA_object_push(globalconf.L, c);
|
luaA_object_emit_signal(L, 1, "property::struts", 0);
|
||||||
luaA_object_emit_signal(L, -1, "property::struts", 0);
|
|
||||||
lua_pop(globalconf.L, 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return luaA_pushstruts(L, c->strut);
|
return luaA_pushstrut(L, c->strut);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
13
client.h
13
client.h
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* client.h - client management header
|
* client.h - client 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
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include "mouse.h"
|
#include "mouse.h"
|
||||||
#include "stack.h"
|
#include "stack.h"
|
||||||
|
#include "strut.h"
|
||||||
#include "common/luaobject.h"
|
#include "common/luaobject.h"
|
||||||
|
|
||||||
#define CLIENT_SELECT_INPUT_EVENT_MASK (XCB_EVENT_MASK_STRUCTURE_NOTIFY \
|
#define CLIENT_SELECT_INPUT_EVENT_MASK (XCB_EVENT_MASK_STRUCTURE_NOTIFY \
|
||||||
|
@ -55,16 +56,6 @@ typedef enum
|
||||||
WINDOW_TYPE_DND
|
WINDOW_TYPE_DND
|
||||||
} window_type_t;
|
} window_type_t;
|
||||||
|
|
||||||
/* Strut */
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
uint16_t left, right, top, bottom;
|
|
||||||
uint16_t left_start_y, left_end_y;
|
|
||||||
uint16_t right_start_y, right_end_y;
|
|
||||||
uint16_t top_start_x, top_end_x;
|
|
||||||
uint16_t bottom_start_x, bottom_end_x;
|
|
||||||
} strut_t;
|
|
||||||
|
|
||||||
/** client_t type */
|
/** client_t type */
|
||||||
struct client_t
|
struct client_t
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
* strut.c - strut management
|
||||||
|
*
|
||||||
|
* Copyright © 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
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "strut.h"
|
||||||
|
|
||||||
|
/** Push a strut type to a table on stack.
|
||||||
|
* \param L The Lua VM state.
|
||||||
|
* \param strut The strut to push.
|
||||||
|
* \return The number of elements pushed on stack.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
luaA_pushstrut(lua_State *L, strut_t strut)
|
||||||
|
{
|
||||||
|
lua_createtable(L, 4, 0);
|
||||||
|
lua_pushnumber(L, strut.left);
|
||||||
|
lua_setfield(L, -2, "left");
|
||||||
|
lua_pushnumber(L, strut.right);
|
||||||
|
lua_setfield(L, -2, "right");
|
||||||
|
lua_pushnumber(L, strut.top);
|
||||||
|
lua_setfield(L, -2, "top");
|
||||||
|
lua_pushnumber(L, strut.bottom);
|
||||||
|
lua_setfield(L, -2, "bottom");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
|
@ -0,0 +1,41 @@
|
||||||
|
/*
|
||||||
|
* strut.h - strut management header
|
||||||
|
*
|
||||||
|
* Copyright © 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
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AWESOME_STRUTS_H
|
||||||
|
#define AWESOME_STRUTS_H
|
||||||
|
|
||||||
|
#include <lua.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/* Strut */
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
uint16_t left, right, top, bottom;
|
||||||
|
uint16_t left_start_y, left_end_y;
|
||||||
|
uint16_t right_start_y, right_end_y;
|
||||||
|
uint16_t top_start_x, top_end_x;
|
||||||
|
uint16_t bottom_start_x, bottom_end_x;
|
||||||
|
} strut_t;
|
||||||
|
|
||||||
|
int luaA_pushstrut(lua_State *, strut_t);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
Loading…
Reference in New Issue