From 5030b97d241b7e4f5f39c892366eb8d2d619d504 Mon Sep 17 00:00:00 2001 From: ArvidNorr Date: Fri, 23 May 2014 07:15:53 +0200 Subject: [PATCH] added support for optional background image --- xrdp/xrdp.ini | 3 +++ xrdp/xrdp_login_wnd.c | 23 ++++++++++++++++++++++- xrdp/xrdp_types.h | 1 + 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/xrdp/xrdp.ini b/xrdp/xrdp.ini index 12387ce3..1f11f8c3 100644 --- a/xrdp/xrdp.ini +++ b/xrdp/xrdp.ini @@ -68,6 +68,9 @@ ls_height=430 # login screen background color in RGB format ls_bg_color=dedede +# optional background image filename (bmp format). +#ls_background_image= + # logo # full path to bmp-file or file in shared folder ls_logo_filename= diff --git a/xrdp/xrdp_login_wnd.c b/xrdp/xrdp_login_wnd.c index 8b14cb26..f8896c4e 100644 --- a/xrdp/xrdp_login_wnd.c +++ b/xrdp/xrdp_login_wnd.c @@ -576,6 +576,23 @@ xrdp_login_wnd_create(struct xrdp_wm *self) if (regular) { + // Load the background image. + // If no file is specified no default image will be loaded. + // We only load the image if bpp > 8 + if (globals->ls_background_image[0] != 0 && self->screen->bpp > 8) + { + char fileName[256] ; + but = xrdp_bitmap_create(4, 4, self->screen->bpp, WND_TYPE_IMAGE, self); + g_snprintf(fileName, 255, "%s/%s", XRDP_SHARE_PATH, globals->ls_background_image); + log_message(LOG_LEVEL_DEBUG, "We try to load the following background file: %s", fileName); + xrdp_bitmap_load(but, fileName, self->palette); + but->parent = self->screen; + but->owner = self->screen; + but->left = self->screen->width - but->width; + but->top = self->screen->height - but->height; + list_add_item(self->screen->child_list, (long)but); + } + /* if logo image not specified, use default */ if (globals->ls_logo_filename[0] == 0) g_snprintf(globals->ls_logo_filename, 255, "%s/xrdp_logo.bmp", XRDP_SHARE_PATH); @@ -848,7 +865,11 @@ load_xrdp_config(struct xrdp_config *config, int bpp) g_strncpy(globals->ls_logo_filename, v, 255); globals->ls_logo_filename[255] = 0; } - + else if (g_strncmp(n, "ls_background_image", 255) == 0) + { + g_strncpy(globals->ls_background_image, v, 255); + globals->ls_background_image[255] = 0; + } else if (g_strncmp(n, "ls_logo_x_pos", 64) == 0) globals->ls_logo_x_pos = g_atoi(v); diff --git a/xrdp/xrdp_types.h b/xrdp/xrdp_types.h index 973b64e8..0e31dd59 100644 --- a/xrdp/xrdp_types.h +++ b/xrdp/xrdp_types.h @@ -580,6 +580,7 @@ struct xrdp_cfg_globals int ls_height; /* window height */ int ls_bg_color; /* background color */ char ls_logo_filename[256]; /* logo filename */ + char ls_background_image[256]; /* background image file name */ int ls_logo_x_pos; /* logo x co-ordinate */ int ls_logo_y_pos; /* logo y co-ordinate */ int ls_label_x_pos; /* x pos of labels */