X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Flibgame%2Fx11.c;h=cfa0ce78857abc3ee46afc846e42bd63b201cf45;hb=dfe0a71a9939e0c55bb54dcc92db1749e8e21747;hp=fd1d8b80c7f44b15e5af4f56c6e65af627edaeb3;hpb=b201bc433fb5ad1a9f0b7780ac6a73a3617f6dd6;p=rocksndiamonds.git diff --git a/src/libgame/x11.c b/src/libgame/x11.c index fd1d8b80..cfa0ce78 100644 --- a/src/libgame/x11.c +++ b/src/libgame/x11.c @@ -14,6 +14,7 @@ #include "system.h" #include "pcx.h" #include "misc.h" +#include "setup.h" #if defined(TARGET_X11) @@ -144,7 +145,7 @@ static DrawWindow *X11InitWindow() icon_pic.picture_filename); #endif if (XReadBitmapFile(display, new_window->drawable, - program.x11_icon_filename, + getCustomImageFilename(program.x11_icon_filename), &icon_width, &icon_height, &icon_pixmap, &icon_hot_x, &icon_hot_y) != BitmapSuccess) Error(ERR_EXIT, "cannot read icon bitmap file '%s'", @@ -155,7 +156,7 @@ static DrawWindow *X11InitWindow() icon_pic.picturemask_filename); #endif if (XReadBitmapFile(display, new_window->drawable, - program.x11_iconmask_filename, + getCustomImageFilename(program.x11_iconmask_filename), &icon_width, &icon_height, &iconmask_pixmap, &icon_hot_x, &icon_hot_y) != BitmapSuccess) Error(ERR_EXIT, "cannot read icon bitmap file '%s'", @@ -231,6 +232,16 @@ static DrawWindow *X11InitWindow() return new_window; } +static void SetImageDimensions(Bitmap *bitmap) +{ + Window root; + int x, y; + unsigned int border_width, depth; + + XGetGeometry(display, bitmap->drawable, &root, &x, &y, + &bitmap->width, &bitmap->height, &border_width, &depth); +} + Bitmap *X11LoadImage(char *filename) { Bitmap *new_bitmap = CreateBitmapStruct(); @@ -285,6 +296,9 @@ Bitmap *X11LoadImage(char *filename) /* set GraphicContext inheritated from Window */ new_bitmap->gc = window->gc; + /* set image width and height */ + SetImageDimensions(new_bitmap); + return new_bitmap; }