Emit property::geometry only if something changed

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2015-10-14 19:40:18 +02:00
parent 438a10973b
commit 085bc00a24
4 changed files with 8 additions and 3 deletions

2
draw.h
View File

@ -42,6 +42,8 @@ struct area_t
#define AREA_TOP(a) ((a).y)
#define AREA_RIGHT(a) ((a).x + (a).width)
#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 *);

View File

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

View File

@ -104,6 +104,7 @@ drawable_set_geometry(lua_State *L, int didx, area_t geom)
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)
luaA_object_emit_signal(L, didx, "property::x", 0);

View File

@ -188,6 +188,7 @@ drawin_moveresize(lua_State *L, int udx, area_t geometry)
w->geometry_dirty = true;
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)
luaA_object_emit_signal(L, udx, "property::x", 0);