diff --git a/src/driver/fb_generic.cpp b/src/driver/fb_generic.cpp index be5cf4b3e..4f86016e6 100644 --- a/src/driver/fb_generic.cpp +++ b/src/driver/fb_generic.cpp @@ -700,6 +700,14 @@ std::string CFrameBuffer::getIconPath(std::string icon_name, std::string file_ty { std::vector filetypes = { ".svg", ".png", ".jpg" }; std::string path, filetype = ""; + + std::string::size_type pos = icon_name.find_last_of("."); + if (pos != std::string::npos && file_type.empty()) + if (std::find(filetypes.begin(), filetypes.end(), icon_name.substr(pos)) != filetypes.end()) + { + icon_name = icon_name.substr(0,pos); + file_type = icon_name.substr(pos+1); + } if (!file_type.empty()) { filetypes.clear(); @@ -714,9 +722,9 @@ std::string CFrameBuffer::getIconPath(std::string icon_name, std::string file_ty iconBasePath }; - for(int t=0; tgetIcon(newname, &width, &height); @@ -1575,7 +1583,7 @@ void CFrameBuffer::Clear() bool CFrameBuffer::showFrame(const std::string & filename, int fallback_mode) { - std::string picture = getIconPath(filename, ""); + std::string picture = getIconPath(filename); bool ret = false; if (access(picture.c_str(), F_OK) == 0 && !(fallback_mode & SHOW_FRAME_FALLBACK_MODE_IMAGE_UNSCALED)) diff --git a/src/driver/fb_generic.h b/src/driver/fb_generic.h index c6e383fc2..cd93867ae 100644 --- a/src/driver/fb_generic.h +++ b/src/driver/fb_generic.h @@ -233,7 +233,7 @@ class CFrameBuffer : public sigc::trackable void setIconBasePath(const std::string & iconPath); std::string getIconBasePath(){return iconBasePath;}; - std::string getIconPath(std::string icon_name, std::string file_type = "png"); + std::string getIconPath(std::string icon_name, std::string file_type = ""); void getIconSize(const char * const filename, int* width, int *height); /* h is the height of the target "window", if != 0 the icon gets centered in that window */