From bfafcb46641df7d984e1c4eb6b843964bb922cde Mon Sep 17 00:00:00 2001 From: Vinzenz Feenstra Date: Fri, 14 Feb 2014 11:31:41 +0100 Subject: [PATCH] x11: Set icon issue fix Signed-off-by: Vinzenz Feenstra --- platform/x11/os_x11.cpp | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 95b30423f0f..1d00796ae94 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -1210,20 +1210,17 @@ void OS_X11::swap_buffers() { void OS_X11::set_icon(const Image& p_icon) { - - //does not work, if anyone knows why, please fix if (!p_icon.empty()) { - Image img=p_icon; img.convert(Image::FORMAT_RGBA); - int w = img.get_width(); int h = img.get_height(); - Vector pd; + // We're using size_t to have wordsize (32Bit build -> 32 Bits, 64 Bit build -> 64 Bits + Vector pd; - pd.resize((2+w*h)*sizeof(long)); + pd.resize(2+w*h); print_line("***** SET ICON ***** "+itos(w)+" "+itos(h)); @@ -1232,23 +1229,17 @@ void OS_X11::set_icon(const Image& p_icon) { DVector::Read r = img.get_data().read(); - long *wr=(long*)&pd[2]; + size_t * wr = &pd[2]; + uint8_t const * pr = r.ptr(); for(int i=0;i