xrdp: added xrdp.ini options to auto execute a modules and hide log window

ulab-original
Jay Sorg 12 years ago
parent 238d14b60a
commit b124612675

@ -91,7 +91,7 @@ xrdp_wm_send_palette(struct xrdp_wm* self);
int APP_CC
xrdp_wm_send_bell(struct xrdp_wm* self);
int APP_CC
xrdp_wm_load_static_colors(struct xrdp_wm* self);
xrdp_wm_load_static_colors_plus(struct xrdp_wm* self, char* autorun_name);
int APP_CC
xrdp_wm_load_static_pointers(struct xrdp_wm* self);
int APP_CC

@ -15,6 +15,8 @@ max_bpp=24
#red=ff0000
#green=00ff00
#background=626c72
#autorun=xrdp7
#hidelogwindow=yes
[xrdp1]
name=sesman-Xvnc

@ -1522,7 +1522,7 @@ server_reset(struct xrdp_mod* mod, int width, int height, int bpp)
xrdp_bitmap_resize(wm->screen, wm->client_info->width,
wm->client_info->height);
/* load some stuff */
xrdp_wm_load_static_colors(wm);
xrdp_wm_load_static_colors_plus(wm, 0);
xrdp_wm_load_static_pointers(wm);
return 0;
}

@ -266,6 +266,7 @@ struct xrdp_wm
struct xrdp_mm* mm;
struct xrdp_font* default_font;
struct xrdp_keymap keymap;
int hide_log_window;
};
/* rdp process */

@ -309,7 +309,7 @@ unsigned int xrdp_wm_htoi (const char *ptr)
/*****************************************************************************/
int APP_CC
xrdp_wm_load_static_colors(struct xrdp_wm* self)
xrdp_wm_load_static_colors_plus(struct xrdp_wm* self, char* autorun_name)
{
int bindex;
int gindex;
@ -322,6 +322,11 @@ xrdp_wm_load_static_colors(struct xrdp_wm* self)
struct list* values;
char cfg_file[256];
if (autorun_name != 0)
{
autorun_name[0] = 0;
}
/* initialize with defaults */
self->black = HCOLOR(self->screen->bpp,0x000000);
self->grey = HCOLOR(self->screen->bpp,0xc0c0c0);
@ -394,6 +399,24 @@ xrdp_wm_load_static_colors(struct xrdp_wm* self)
val = (char*)list_get_item(values, index);
self->background = HCOLOR(self->screen->bpp,xrdp_wm_htoi(val));
}
else if (g_strcasecmp(val, "autorun") == 0)
{
val = (char*)list_get_item(values, index);
if (autorun_name != 0)
{
g_strncpy(autorun_name, val, 255);
}
}
else if (g_strcasecmp(val, "hidelogwindow") == 0)
{
val = (char*)list_get_item(values, index);
if ((g_strcasecmp(val, "yes") == 0) ||
(g_strcasecmp(val, "1") == 0) ||
(g_strcasecmp(val, "true") == 0))
{
self->hide_log_window = 1;
}
}
}
}
}
@ -462,11 +485,12 @@ xrdp_wm_init(struct xrdp_wm* self)
char* r;
char section_name[256];
char cfg_file[256];
char autorun_name[256];
xrdp_wm_load_static_colors(self);
xrdp_wm_load_static_colors_plus(self, autorun_name);
xrdp_wm_load_static_pointers(self);
self->screen->bg_color = self->background;
if (self->session->client_info->rdp_autologin)
if (self->session->client_info->rdp_autologin || (autorun_name[0] != 0))
{
g_snprintf(cfg_file, 255, "%s/xrdp.ini", XRDP_CFG_PATH);
fd = g_file_open(cfg_file); /* xrdp.ini */
@ -479,18 +503,26 @@ xrdp_wm_init(struct xrdp_wm* self)
g_strncpy(section_name, self->session->client_info->domain, 255);
if (section_name[0] == 0)
{
/* if no doamin is passed, use the first item in the xrdp.ini
file thats not named 'globals' */
file_read_sections(fd, names);
for (index = 0; index < names->count; index++)
if (autorun_name[0] == 0)
{
q = (char*)list_get_item(names, index);
if (g_strncasecmp("globals", q, 8) != 0)
/* if no doamin is passed, and no autorun in xrdp.ini,
use the first item in the xrdp.ini
file thats not named 'globals' */
file_read_sections(fd, names);
for (index = 0; index < names->count; index++)
{
g_strncpy(section_name, q, 255);
break;
q = (char*)list_get_item(names, index);
if (g_strncasecmp("globals", q, 8) != 0)
{
g_strncpy(section_name, q, 255);
break;
}
}
}
else
{
g_strncpy(section_name, autorun_name, 255);
}
}
list_clear(names);
if (file_read_section(fd, section_name, names, values) == 0)
@ -1526,6 +1558,10 @@ xrdp_wm_log_msg(struct xrdp_wm* self, char* msg)
int xoffset;
int yoffset;
if (self->hide_log_window)
{
return 0;
}
list_add_item(self->log, (long)g_strdup(msg));
if (self->log_wnd == 0)
{

Loading…
Cancel
Save