From c1d0dee20db9c8bfd62d6db77c1c63614a0422d6 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Tue, 4 Oct 2011 15:23:11 +0200 Subject: [PATCH] naughty: fix image data copy Signed-off-by: Julien Danjou --- lib/naughty.lua.in | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/naughty.lua.in b/lib/naughty.lua.in index b8fe294aa..0aaec1f51 100644 --- a/lib/naughty.lua.in +++ b/lib/naughty.lua.in @@ -546,13 +546,15 @@ if capi.dbus then -- 1 -> width, 2 -> height, 3 -> rowstride, 4 -> has alpha -- 5 -> bits per sample, 6 -> channels, 7 -> data - local imgdata + local imgdata = "" -- If has alpha (ARGB32) if hints.icon_data[6] == 4 then - imgdata = hints.icon_data[7] + for i = 1, #hints.icon_data[7], 4 do + imgdata = imgdata .. hints.icon_data[7]:sub(i, i + 2):reverse() + imgdata = imgdata .. hints.icon_data[7]:sub(i + 3, i + 3) + end -- If has not alpha (RGB24) elseif hints.icon_data[6] == 3 then - imgdata = "" for i = 1, #hints.icon_data[7], 3 do imgdata = imgdata .. hints.icon_data[7]:sub(i , i + 2):reverse() imgdata = imgdata .. string.format("%c", 255) -- alpha is 255