Merge pull request #531 from psychon/property_geometry

Property geometry

Closes https://github.com/awesomeWM/awesome/pull/531.
This commit is contained in:
Daniel Hahler 2015-11-05 23:08:00 +01:00
commit 83ed65212d
4 changed files with 16 additions and 1 deletions

2
draw.h
View File

@ -42,6 +42,8 @@ struct area_t
#define AREA_TOP(a) ((a).y) #define AREA_TOP(a) ((a).y)
#define AREA_RIGHT(a) ((a).x + (a).width) #define AREA_RIGHT(a) ((a).x + (a).width)
#define AREA_BOTTOM(a) ((a).y + (a).height) #define AREA_BOTTOM(a) ((a).y + (a).height)
#define AREA_EQUAL(a, b) ((a).x == (b).x && (a).y == (b).y && \
(a).width == (b).width && (a).height == (b).height)
bool draw_iso2utf8(const char *, size_t, char **, ssize_t *); bool draw_iso2utf8(const char *, size_t, char **, ssize_t *);

View File

@ -864,7 +864,8 @@ client_resize_do(client_t *c, area_t geometry, bool force_notice)
client_restore_enterleave_events(); client_restore_enterleave_events();
luaA_object_push(L, c); luaA_object_push(L, c);
luaA_object_emit_signal(L, -1, "property::geometry", 0); if (!AREA_EQUAL(old_geometry, geometry))
luaA_object_emit_signal(L, -1, "property::geometry", 0);
if (old_geometry.x != geometry.x) if (old_geometry.x != geometry.x)
luaA_object_emit_signal(L, -1, "property::x", 0); luaA_object_emit_signal(L, -1, "property::x", 0);
if (old_geometry.y != geometry.y) if (old_geometry.y != geometry.y)

View File

@ -104,6 +104,8 @@ drawable_set_geometry(lua_State *L, int didx, area_t geom)
luaA_object_emit_signal(L, didx, "property::surface", 0); luaA_object_emit_signal(L, didx, "property::surface", 0);
} }
if (!AREA_EQUAL(old, geom))
luaA_object_emit_signal(L, didx, "property::geometry", 0);
if (old.x != geom.x) if (old.x != geom.x)
luaA_object_emit_signal(L, didx, "property::x", 0); luaA_object_emit_signal(L, didx, "property::x", 0);
if (old.y != geom.y) if (old.y != geom.y)
@ -202,6 +204,10 @@ drawable_class_setup(lua_State *L)
* @signal mouse::move * @signal mouse::move
*/ */
signal_add(&drawable_class.signals, "mouse::move"); signal_add(&drawable_class.signals, "mouse::move");
/**
* @signal property::geometry
*/
signal_add(&drawable_class.signals, "property::geometry");
/** /**
* @signal property::height * @signal property::height
*/ */

View File

@ -188,6 +188,8 @@ drawin_moveresize(lua_State *L, int udx, area_t geometry)
w->geometry_dirty = true; w->geometry_dirty = true;
drawin_update_drawing(L, udx); drawin_update_drawing(L, udx);
if (!AREA_EQUAL(old_geometry, w->geometry))
luaA_object_emit_signal(L, udx, "property::geometry", 0);
if (old_geometry.x != w->geometry.x) if (old_geometry.x != w->geometry.x)
luaA_object_emit_signal(L, udx, "property::x", 0); luaA_object_emit_signal(L, udx, "property::x", 0);
if (old_geometry.y != w->geometry.y) if (old_geometry.y != w->geometry.y)
@ -690,6 +692,10 @@ drawin_class_setup(lua_State *L)
(lua_class_propfunc_t) luaA_drawin_get_shape_clip, (lua_class_propfunc_t) luaA_drawin_get_shape_clip,
(lua_class_propfunc_t) luaA_drawin_set_shape_clip); (lua_class_propfunc_t) luaA_drawin_set_shape_clip);
/**
* @signal property::geometry
*/
signal_add(&drawin_class.signals, "property::geometry");
/** /**
* @signal property::shape_bounding * @signal property::shape_bounding
*/ */