window: add strut support
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
220d072164
commit
92717a0849
3
ewmh.c
3
ewmh.c
|
@ -452,6 +452,8 @@ ewmh_client_update_desktop(client_t *c)
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ewmh_update_strut(xcb_window_t window, strut_t *strut)
|
ewmh_update_strut(xcb_window_t window, strut_t *strut)
|
||||||
|
{
|
||||||
|
if(window)
|
||||||
{
|
{
|
||||||
const uint32_t state[] =
|
const uint32_t state[] =
|
||||||
{
|
{
|
||||||
|
@ -472,6 +474,7 @@ ewmh_update_strut(xcb_window_t window, strut_t *strut)
|
||||||
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
|
xcb_change_property(globalconf.connection, XCB_PROP_MODE_REPLACE,
|
||||||
window, _NET_WM_STRUT_PARTIAL, CARDINAL, 32, countof(state), state);
|
window, _NET_WM_STRUT_PARTIAL, CARDINAL, 32, countof(state), state);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ewmh_client_check_hints(client_t *c)
|
ewmh_client_check_hints(client_t *c)
|
||||||
|
|
|
@ -1506,29 +1506,6 @@ luaA_client_geometry(lua_State *L)
|
||||||
return luaA_pusharea(L, c->geometry);
|
return luaA_pusharea(L, c->geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return client struts (reserved space at the edge of the screen).
|
|
||||||
* \param L The Lua VM state.
|
|
||||||
* \return The number of elements pushed on stack.
|
|
||||||
* \luastack
|
|
||||||
* \lparam A table with new strut values, or none.
|
|
||||||
* \lreturn A table with strut values.
|
|
||||||
*/
|
|
||||||
static int
|
|
||||||
luaA_client_struts(lua_State *L)
|
|
||||||
{
|
|
||||||
client_t *c = luaA_checkudata(L, 1, &client_class);
|
|
||||||
|
|
||||||
if(lua_gettop(L) == 2)
|
|
||||||
{
|
|
||||||
luaA_tostrut(L, 2, &c->strut);
|
|
||||||
ewmh_update_strut(c->window, &c->strut);
|
|
||||||
luaA_object_emit_signal(L, 1, "property::struts", 0);
|
|
||||||
screen_emit_signal(L, c->screen, "property::workarea", 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return luaA_pushstrut(L, c->strut);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
luaA_client_set_screen(lua_State *L, client_t *c)
|
luaA_client_set_screen(lua_State *L, client_t *c)
|
||||||
{
|
{
|
||||||
|
@ -2048,7 +2025,6 @@ client_class_setup(lua_State *L)
|
||||||
{ "keys", luaA_client_keys },
|
{ "keys", luaA_client_keys },
|
||||||
{ "isvisible", luaA_client_isvisible },
|
{ "isvisible", luaA_client_isvisible },
|
||||||
{ "geometry", luaA_client_geometry },
|
{ "geometry", luaA_client_geometry },
|
||||||
{ "struts", luaA_client_struts },
|
|
||||||
{ "tags", luaA_client_tags },
|
{ "tags", luaA_client_tags },
|
||||||
{ "kill", luaA_client_kill },
|
{ "kill", luaA_client_kill },
|
||||||
{ "swap", luaA_client_swap },
|
{ "swap", luaA_client_swap },
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
|
|
||||||
#include "mouse.h"
|
#include "mouse.h"
|
||||||
#include "stack.h"
|
#include "stack.h"
|
||||||
#include "strut.h"
|
|
||||||
#include "draw.h"
|
#include "draw.h"
|
||||||
#include "banning.h"
|
#include "banning.h"
|
||||||
#include "objects/window.h"
|
#include "objects/window.h"
|
||||||
|
@ -80,8 +79,6 @@ struct client_t
|
||||||
/** Internal geometry (matching X11 protocol) */
|
/** Internal geometry (matching X11 protocol) */
|
||||||
area_t internal;
|
area_t internal;
|
||||||
} geometries;
|
} geometries;
|
||||||
/** Strut */
|
|
||||||
strut_t strut;
|
|
||||||
/** Border width and pre-fullscreen border width */
|
/** Border width and pre-fullscreen border width */
|
||||||
int border_width, border_width_fs;
|
int border_width, border_width_fs;
|
||||||
xcolor_t border_color;
|
xcolor_t border_color;
|
||||||
|
@ -123,8 +120,6 @@ struct client_t
|
||||||
xcb_window_t leader_window;
|
xcb_window_t leader_window;
|
||||||
/** Client's WM_PROTOCOLS property */
|
/** Client's WM_PROTOCOLS property */
|
||||||
xcb_get_wm_protocols_reply_t protocols;
|
xcb_get_wm_protocols_reply_t protocols;
|
||||||
/** Client logical screen */
|
|
||||||
screen_t *screen;
|
|
||||||
/** Client physical screen */
|
/** Client physical screen */
|
||||||
int phys_screen;
|
int phys_screen;
|
||||||
/** Button bindings */
|
/** Button bindings */
|
||||||
|
|
|
@ -884,24 +884,6 @@ luaA_wibox_geometry(lua_State *L)
|
||||||
return luaA_pusharea(L, wibox->geometry);
|
return luaA_pusharea(L, wibox->geometry);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
luaA_wibox_struts(lua_State *L)
|
|
||||||
{
|
|
||||||
wibox_t *w = luaA_checkudata(L, 1, &wibox_class);
|
|
||||||
|
|
||||||
if(lua_gettop(L) == 2)
|
|
||||||
{
|
|
||||||
luaA_tostrut(L, 2, &w->strut);
|
|
||||||
if(w->window)
|
|
||||||
ewmh_update_strut(w->window, &w->strut);
|
|
||||||
luaA_object_emit_signal(L, 1, "property::struts", 0);
|
|
||||||
if(w->screen)
|
|
||||||
screen_emit_signal(L, w->screen, "property::workarea", 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
return luaA_pushstrut(L, w->strut);
|
|
||||||
}
|
|
||||||
|
|
||||||
LUA_OBJECT_EXPORT_PROPERTY(wibox, wibox_t, ontop, lua_pushboolean)
|
LUA_OBJECT_EXPORT_PROPERTY(wibox, wibox_t, ontop, lua_pushboolean)
|
||||||
LUA_OBJECT_EXPORT_PROPERTY(wibox, wibox_t, cursor, lua_pushstring)
|
LUA_OBJECT_EXPORT_PROPERTY(wibox, wibox_t, cursor, lua_pushstring)
|
||||||
LUA_OBJECT_EXPORT_PROPERTY(wibox, wibox_t, visible, lua_pushboolean)
|
LUA_OBJECT_EXPORT_PROPERTY(wibox, wibox_t, visible, lua_pushboolean)
|
||||||
|
@ -1334,7 +1316,6 @@ wibox_class_setup(lua_State *L)
|
||||||
{
|
{
|
||||||
LUA_OBJECT_META(wibox)
|
LUA_OBJECT_META(wibox)
|
||||||
LUA_CLASS_META
|
LUA_CLASS_META
|
||||||
{ "struts", luaA_wibox_struts },
|
|
||||||
{ "buttons", luaA_wibox_buttons },
|
{ "buttons", luaA_wibox_buttons },
|
||||||
{ "geometry", luaA_wibox_geometry },
|
{ "geometry", luaA_wibox_geometry },
|
||||||
{ "__gc", luaA_wibox_gc },
|
{ "__gc", luaA_wibox_gc },
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#define AWESOME_WIBOX_H
|
#define AWESOME_WIBOX_H
|
||||||
|
|
||||||
#include "objects/widget.h"
|
#include "objects/widget.h"
|
||||||
#include "strut.h"
|
|
||||||
#include "objects/window.h"
|
#include "objects/window.h"
|
||||||
#include "common/luaobject.h"
|
#include "common/luaobject.h"
|
||||||
|
|
||||||
|
@ -35,8 +34,6 @@ struct wibox_t
|
||||||
bool ontop;
|
bool ontop;
|
||||||
/** Visible */
|
/** Visible */
|
||||||
bool visible;
|
bool visible;
|
||||||
/** Screen */
|
|
||||||
screen_t *screen;
|
|
||||||
/** Widget list */
|
/** Widget list */
|
||||||
widget_node_array_t widgets;
|
widget_node_array_t widgets;
|
||||||
void *widgets_table;
|
void *widgets_table;
|
||||||
|
@ -66,8 +63,6 @@ struct wibox_t
|
||||||
draw_context_t ctx;
|
draw_context_t ctx;
|
||||||
/** Orientation */
|
/** Orientation */
|
||||||
orientation_t orientation;
|
orientation_t orientation;
|
||||||
/** Strut */
|
|
||||||
strut_t strut;
|
|
||||||
/** The window's shape */
|
/** The window's shape */
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,11 +21,34 @@
|
||||||
|
|
||||||
#include "luaa.h"
|
#include "luaa.h"
|
||||||
#include "xwindow.h"
|
#include "xwindow.h"
|
||||||
|
#include "ewmh.h"
|
||||||
|
#include "screen.h"
|
||||||
#include "objects/window.h"
|
#include "objects/window.h"
|
||||||
#include "common/luaobject.h"
|
#include "common/luaobject.h"
|
||||||
|
|
||||||
LUA_CLASS_FUNCS(window, window_class)
|
LUA_CLASS_FUNCS(window, window_class)
|
||||||
|
|
||||||
|
/** Return window struts (reserved space at the edge of the screen).
|
||||||
|
* \param L The Lua VM state.
|
||||||
|
* \return The number of elements pushed on stack.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
luaA_window_struts(lua_State *L)
|
||||||
|
{
|
||||||
|
window_t *window = luaA_checkudata(L, 1, &window_class);
|
||||||
|
|
||||||
|
if(lua_gettop(L) == 2)
|
||||||
|
{
|
||||||
|
luaA_tostrut(L, 2, &window->strut);
|
||||||
|
ewmh_update_strut(window->window, &window->strut);
|
||||||
|
luaA_object_emit_signal(L, 1, "property::struts", 0);
|
||||||
|
if(window->screen)
|
||||||
|
screen_emit_signal(L, window->screen, "property::workarea", 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return luaA_pushstrut(L, window->strut);
|
||||||
|
}
|
||||||
|
|
||||||
/** Set a window opacity.
|
/** Set a window opacity.
|
||||||
* \param L The Lua VM state.
|
* \param L The Lua VM state.
|
||||||
* \param idx The index of the window on the stack.
|
* \param idx The index of the window on the stack.
|
||||||
|
@ -91,6 +114,7 @@ window_class_setup(lua_State *L)
|
||||||
|
|
||||||
static const struct luaL_reg window_meta[] =
|
static const struct luaL_reg window_meta[] =
|
||||||
{
|
{
|
||||||
|
{ "struts", luaA_window_struts },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#ifndef AWESOME_OBJECTS_WINDOW_H
|
#ifndef AWESOME_OBJECTS_WINDOW_H
|
||||||
#define AWESOME_OBJECTS_WINDOW_H
|
#define AWESOME_OBJECTS_WINDOW_H
|
||||||
|
|
||||||
|
#include "strut.h"
|
||||||
#include "common/luaclass.h"
|
#include "common/luaclass.h"
|
||||||
|
|
||||||
#define WINDOW_OBJECT_HEADER \
|
#define WINDOW_OBJECT_HEADER \
|
||||||
|
@ -29,7 +30,11 @@
|
||||||
/** The X window number */ \
|
/** The X window number */ \
|
||||||
xcb_window_t window; \
|
xcb_window_t window; \
|
||||||
/** Opacity */ \
|
/** Opacity */ \
|
||||||
double opacity;
|
double opacity; \
|
||||||
|
/** Strut */ \
|
||||||
|
strut_t strut; \
|
||||||
|
/** Client logical screen */ \
|
||||||
|
screen_t *screen;
|
||||||
|
|
||||||
/** Window structure */
|
/** Window structure */
|
||||||
typedef struct
|
typedef struct
|
||||||
|
|
Loading…
Reference in New Issue