copied from core Signed-off-by: Pedro Pinto da Silva <pedro.silva@collabora.com> Change-Id: Ic22f4dd885094a268c755e1ebb60c157d775bf06