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_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,7 +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);
} }
luaA_object_emit_signal(L, didx, "property::geometry", 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)

View File

@ -188,7 +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);
luaA_object_emit_signal(L, udx, "property::geometry", 0); 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)