Merge pull request #136 from ArvidNorr/backgrounddev

added support for optional background image
This commit is contained in:
jsorg71 2014-06-10 12:03:35 -07:00
commit 547a34cb6c
3 changed files with 26 additions and 1 deletions

View File

@ -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=

View File

@ -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);

View File

@ -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 */