summaryrefslogtreecommitdiffstats
path: root/xrdp
diff options
context:
space:
mode:
authorjsorg71 <jsorg71>2005-03-06 03:44:27 +0000
committerjsorg71 <jsorg71>2005-03-06 03:44:27 +0000
commitd5dea39bafc3440b1726cf90a8295ecb393e059c (patch)
tree58a3d4f5a3666980433bbe5648cf3229731d8b0c /xrdp
parent8e807eefd25dd678d525fd0b8248e397fae6ffa9 (diff)
downloadxrdp-proprietary-d5dea39bafc3440b1726cf90a8295ecb393e059c.tar.gz
xrdp-proprietary-d5dea39bafc3440b1726cf90a8295ecb393e059c.zip
added connection log
Diffstat (limited to 'xrdp')
-rw-r--r--xrdp/funcs.c44
-rw-r--r--xrdp/xrdp.h5
-rw-r--r--xrdp/xrdp_bitmap.c17
-rw-r--r--xrdp/xrdp_cache.c35
-rw-r--r--xrdp/xrdp_interface.c112
-rw-r--r--xrdp/xrdp_login_wnd.c82
-rw-r--r--xrdp/xrdp_types.h11
-rw-r--r--xrdp/xrdp_wm.c38
8 files changed, 260 insertions, 84 deletions
diff --git a/xrdp/funcs.c b/xrdp/funcs.c
index 4c3ac42b..f33c4854 100644
--- a/xrdp/funcs.c
+++ b/xrdp/funcs.c
@@ -23,16 +23,25 @@
#include "xrdp.h"
/*****************************************************************************/
+/* returns boolean */
int rect_contains_pt(struct xrdp_rect* in, int x, int y)
{
if (x < in->left)
+ {
return 0;
+ }
if (y < in->top)
+ {
return 0;
+ }
if (x >= in->right)
+ {
return 0;
+ }
if (y >= in->bottom)
+ {
return 0;
+ }
return 1;
}
@@ -44,19 +53,31 @@ int rect_intersect(struct xrdp_rect* in1, struct xrdp_rect* in2,
struct xrdp_rect dumby;
if (out == 0)
+ {
out = &dumby;
+ }
*out = *in1;
if (in2->left > in1->left)
+ {
out->left = in2->left;
+ }
if (in2->top > in1->top)
+ {
out->top = in2->top;
+ }
if (in2->right < in1->right)
+ {
out->right = in2->right;
+ }
if (in2->bottom < in1->bottom)
+ {
out->bottom = in2->bottom;
+ }
rv = !ISRECTEMPTY(*out);
if (!rv)
+ {
g_memset(out, 0, sizeof(struct xrdp_rect));
+ }
return rv;
}
@@ -66,9 +87,13 @@ int rect_intersect(struct xrdp_rect* in1, struct xrdp_rect* in2,
int check_bounds(struct xrdp_bitmap* b, int* x, int* y, int* cx, int* cy)
{
if (*x >= b->width)
+ {
return 0;
+ }
if (*y >= b->height)
+ {
return 0;
+ }
if (*x < 0)
{
*cx += *x;
@@ -80,16 +105,25 @@ int check_bounds(struct xrdp_bitmap* b, int* x, int* y, int* cx, int* cy)
*y = 0;
}
if (*cx <= 0)
+ {
return 0;
+ }
if (*cy <= 0)
+ {
return 0;
+ }
if (*x + *cx > b->width)
+ {
*cx = b->width - *x;
+ }
if (*y + *cy > b->height)
+ {
*cy = b->height - *y;
+ }
return 1;
}
+/*****************************************************************************/
/* scan codes
1 esc
2 1 or ?
@@ -253,18 +287,28 @@ char get_char_from_scan_code(int device_flags, int scan_code, int* keys,
if (ext)
{
if (scan_code == 53)
+ {
rv = '/';
+ }
}
else
{
if (shift)
+ {
rv = chars2[scan_code];
+ }
else
+ {
rv = chars1[scan_code];
+ }
if (rv >= 'a' && rv <= 'z' && caps_lock)
+ {
rv = rv - ('a' - 'A');
+ }
else if (rv >= 'A' && rv <= 'Z' && caps_lock)
+ {
rv = rv + ('a' - 'A');
+ }
}
return rv;
}
diff --git a/xrdp/xrdp.h b/xrdp/xrdp.h
index 0c2a4a4a..a73e1353 100644
--- a/xrdp/xrdp.h
+++ b/xrdp/xrdp.h
@@ -138,6 +138,9 @@ int xrdp_cache_add_char(struct xrdp_cache* self,
struct xrdp_font_item* font_item);
int xrdp_cache_add_pointer(struct xrdp_cache* self,
struct xrdp_pointer_item* pointer_item);
+int xrdp_cache_add_pointer_static(struct xrdp_cache* self,
+ struct xrdp_pointer_item* pointer_item,
+ int index);
/* xrdp_wm.c */
struct xrdp_wm* xrdp_wm_create(struct xrdp_process* owner,
@@ -292,6 +295,6 @@ int server_paint_rect(struct xrdp_mod* mod, int x, int y, int cx, int cy,
int server_set_pointer(struct xrdp_mod* mod, int x, int y,
char* data, char* mask);
int server_palette(struct xrdp_mod* mod, int* palette);
-int server_error_popup(struct xrdp_mod* mod, char* error, char* caption);
+int server_msg(struct xrdp_mod* mod, char* msg);
int server_is_term(struct xrdp_mod* mod);
#endif
diff --git a/xrdp/xrdp_bitmap.c b/xrdp/xrdp_bitmap.c
index 9080758b..27b0e356 100644
--- a/xrdp/xrdp_bitmap.c
+++ b/xrdp/xrdp_bitmap.c
@@ -173,6 +173,10 @@ void xrdp_bitmap_delete(struct xrdp_bitmap* self)
{
self->wm->login_window = 0;
}
+ if (self->wm->log_wnd == self)
+ {
+ self->wm->log_wnd = 0;
+ }
}
if (self->child_list != 0)
{
@@ -825,14 +829,20 @@ int xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect)
char* p;
if (self == 0) /* if no bitmap */
+ {
return 0;
+ }
if (self->type == WND_TYPE_BITMAP) /* if 0, bitmap, leave */
+ {
return 0;
+ }
painter = xrdp_painter_create(self->wm);
xrdp_painter_font_needed(painter);
painter->rop = 0xcc; /* copy */
if (rect == 0)
+ {
painter->use_clip = 0;
+ }
else
{
if (ISRECTEMPTY(*rect))
@@ -899,8 +909,11 @@ int xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect)
y = rect->top;
w = rect->right - rect->left;
h = rect->bottom - rect->top;
- self->wm->mod->mod_event(self->wm->mod, WM_INVALIDATE, /* 200 */
- MAKELONG(x, y), MAKELONG(w, h));
+ if (check_bounds(self->wm->screen, &x, &y, &w, &h))
+ {
+ self->wm->mod->mod_event(self->wm->mod, WM_INVALIDATE,
+ MAKELONG(x, y), MAKELONG(w, h));
+ }
}
}
}
diff --git a/xrdp/xrdp_cache.c b/xrdp/xrdp_cache.c
index e3c73ecd..62bce7a6 100644
--- a/xrdp/xrdp_cache.c
+++ b/xrdp/xrdp_cache.c
@@ -340,7 +340,7 @@ int xrdp_cache_add_pointer(struct xrdp_cache* self,
}
self->pointer_stamp++;
/* look for match */
- for (i = 0; i < self->pointer_cache_entries; i++)
+ for (i = 2; i < self->pointer_cache_entries; i++)
{
if (self->pointer_items[i].x == pointer_item->x &&
self->pointer_items[i].y == pointer_item->y &&
@@ -351,14 +351,15 @@ int xrdp_cache_add_pointer(struct xrdp_cache* self,
{
self->pointer_items[i].stamp = self->pointer_stamp;
xrdp_wm_set_pointer(self->wm, i);
+ self->wm->current_pointer = i;
DEBUG(("found pointer at %d\n\r", i));
return i;
}
}
/* look for oldest */
- index = 0;
+ index = 2;
oldest = 0x7fffffff;
- for (i = 0; i < self->pointer_cache_entries; i++)
+ for (i = 2; i < self->pointer_cache_entries; i++)
{
if (self->pointer_items[i].stamp < oldest)
{
@@ -378,6 +379,34 @@ int xrdp_cache_add_pointer(struct xrdp_cache* self,
self->pointer_items[index].mask,
self->pointer_items[index].x,
self->pointer_items[index].y);
+ self->wm->current_pointer = index;
+ DEBUG(("adding pointer at %d\n\r", index));
+ return index;
+}
+
+/*****************************************************************************/
+int xrdp_cache_add_pointer_static(struct xrdp_cache* self,
+ struct xrdp_pointer_item* pointer_item,
+ int index)
+{
+
+ if (self == 0)
+ {
+ return 0;
+ }
+ self->pointer_items[index].x = pointer_item->x;
+ self->pointer_items[index].y = pointer_item->y;
+ g_memcpy(self->pointer_items[index].data,
+ pointer_item->data, 32 * 32 * 3);
+ g_memcpy(self->pointer_items[index].mask,
+ pointer_item->mask, 32 * 32 / 8);
+ self->pointer_items[index].stamp = self->pointer_stamp;
+ xrdp_wm_send_pointer(self->wm, index,
+ self->pointer_items[index].data,
+ self->pointer_items[index].mask,
+ self->pointer_items[index].x,
+ self->pointer_items[index].y);
+ self->wm->current_pointer = index;
DEBUG(("adding pointer at %d\n\r", index));
return index;
}
diff --git a/xrdp/xrdp_interface.c b/xrdp/xrdp_interface.c
index 5ae532a3..f5b4f7fd 100644
--- a/xrdp/xrdp_interface.c
+++ b/xrdp/xrdp_interface.c
@@ -216,6 +216,61 @@ int server_palette(int* palette)
#else
/*****************************************************************************/
+/* this is the log windows nofity function */
+int xrdp_wm_log_wnd_notify(struct xrdp_bitmap* wnd,
+ struct xrdp_bitmap* sender,
+ int msg, int param1, int param2)
+{
+ struct xrdp_painter* painter;
+ struct xrdp_wm* wm;
+ struct xrdp_rect rect;
+ int index;
+ char* text;
+
+ if (wnd == 0)
+ {
+ return 0;
+ }
+ if (sender == 0)
+ {
+ return 0;
+ }
+ if (wnd->owner == 0)
+ {
+ return 0;
+ }
+ wm = wnd->wm;
+ if (msg == 1) /* click */
+ {
+ if (sender->id == 1) /* ok button */
+ {
+ /* close the log window */
+ MAKERECT(rect, wnd->left, wnd->top, wnd->width, wnd->height);
+ xrdp_bitmap_delete(wnd);
+ xrdp_bitmap_invalidate(wm->screen, &rect);
+ if (wm->mod_handle == 0)
+ {
+ wm->pro_layer->term = 1; /* kill session */
+ }
+ }
+ }
+ else if (msg == WM_PAINT) /* 3 */
+ {
+ painter = (struct xrdp_painter*)param1;
+ if (painter != 0)
+ {
+ painter->font->color = wnd->wm->black;
+ for (index = 0; index < wnd->wm->log->count; index++)
+ {
+ text = (char*)xrdp_list_get_item(wnd->wm->log, index);
+ xrdp_painter_draw_text(painter, wnd, 10, 30 + index * 15, text);
+ }
+ }
+ }
+ return 0;
+}
+
+/*****************************************************************************/
int server_begin_update(struct xrdp_mod* mod)
{
struct xrdp_wm* wm;
@@ -308,39 +363,40 @@ int server_palette(struct xrdp_mod* mod, int* palette)
}
/*****************************************************************************/
-int server_error_popup(struct xrdp_mod* mod, char* error, char* caption)
+int server_msg(struct xrdp_mod* mod, char* msg)
{
-#if 0
struct xrdp_wm* wm;
- struct xrdp_bitmap* wnd;
struct xrdp_bitmap* but;
wm = (struct xrdp_wm*)mod->wm;
- wnd = xrdp_bitmap_create(400, 200, wm->screen->bpp, WND_TYPE_WND, wm);
- xrdp_list_add_item(wm->screen->child_list, (int)wnd);
- wnd->parent = wm->screen;
- wnd->owner = wm->screen;
- wnd->bg_color = wm->grey;
- wnd->left = wm->screen->width / 2 - wnd->width / 2;
- wnd->top = wm->screen->height / 2 - wnd->height / 2;
- wnd->notify = xrdp_wm_popup_notify;
- g_strcpy(wnd->caption, caption);
-
- /* button */
- but = xrdp_bitmap_create(60, 25, wm->screen->bpp, WND_TYPE_BUTTON, wm);
- xrdp_list_add_item(wnd->child_list, (int)but);
- but->parent = wnd;
- but->owner = wnd;
- but->left = 180;
- but->top = 160;
- but->id = 1;
- g_strcpy(but->caption, "OK");
- but->tab_stop = 1;
-
- xrdp_bitmap_invalidate(wm->screen, 0);
- //xrdp_bitmap_invalidate(wnd, 0);
- g_sleep(2000);
-#endif
+ xrdp_list_add_item(wm->log, (long)g_strdup(msg));
+ if (wm->log_wnd == 0)
+ {
+ /* log window */
+ wm->log_wnd = xrdp_bitmap_create(400, 400, wm->screen->bpp,
+ WND_TYPE_WND, wm);
+ xrdp_list_add_item(wm->screen->child_list, (long)wm->log_wnd);
+ wm->log_wnd->parent = wm->screen;
+ wm->log_wnd->owner = wm->screen;
+ wm->log_wnd->bg_color = wm->grey;
+ wm->log_wnd->left = 10;
+ wm->log_wnd->top = 10;
+ set_string(&wm->log_wnd->caption1, "Connection Log");
+ /* ok button */
+ but = xrdp_bitmap_create(60, 25, wm->screen->bpp, WND_TYPE_BUTTON, wm);
+ xrdp_list_insert_item(wm->log_wnd->child_list, 0, (long)but);
+ but->parent = wm->log_wnd;
+ but->owner = wm->log_wnd;
+ but->left = (400 - 60) - 10;
+ but->top = (400 - 25) - 10;
+ but->id = 1;
+ but->tab_stop = 1;
+ set_string(&but->caption1, "OK");
+ wm->log_wnd->focused_control = but;
+ /* set notify function */
+ wm->log_wnd->notify = xrdp_wm_log_wnd_notify;
+ }
+ xrdp_bitmap_invalidate(wm->log_wnd, 0);
return 0;
}
diff --git a/xrdp/xrdp_login_wnd.c b/xrdp/xrdp_login_wnd.c
index b449ab85..3f516041 100644
--- a/xrdp/xrdp_login_wnd.c
+++ b/xrdp/xrdp_login_wnd.c
@@ -31,11 +31,17 @@ int xrdp_wm_login_help_notify(struct xrdp_bitmap* wnd,
struct xrdp_painter* p;
if (wnd == 0)
+ {
return 0;
+ }
if (sender == 0)
+ {
return 0;
+ }
if (wnd->owner == 0)
+ {
return 0;
+ }
if (msg == 1) /* click */
{
if (sender->id == 1) /* ok button */
@@ -90,13 +96,13 @@ int xrdp_wm_setup_mod(struct xrdp_wm* self,
self->mod_handle = g_load_library(mod_data->lib);
if (self->mod_handle != 0)
{
- self->mod_init = (int(*)())
+ self->mod_init = (struct xrdp_mod* (*)(void))
g_get_proc_address(self->mod_handle, "mod_init");
- self->mod_exit = (int(*)(int))
+ self->mod_exit = (int (*)(struct xrdp_mod*))
g_get_proc_address(self->mod_handle, "mod_exit");
if (self->mod_init != 0 && self->mod_exit != 0)
{
- self->mod = (struct xrdp_mod*)self->mod_init();
+ self->mod = self->mod_init();
}
}
if (self->mod != 0)
@@ -109,7 +115,7 @@ int xrdp_wm_setup_mod(struct xrdp_wm* self,
self->mod->server_paint_rect = server_paint_rect;
self->mod->server_set_pointer = server_set_pointer;
self->mod->server_palette = server_palette;
- self->mod->server_error_popup= server_error_popup;
+ self->mod->server_msg = server_msg;
self->mod->server_is_term = server_is_term;
}
}
@@ -159,8 +165,9 @@ int xrdp_wm_login_notify(struct xrdp_bitmap* wnd,
if (sender->id == 1) /* help button */
{
/* create help screen */
- help = xrdp_bitmap_create(300, 300, wnd->wm->screen->bpp, 1, wnd->wm);
- xrdp_list_insert_item(wnd->wm->screen->child_list, 0, (int)help);
+ help = xrdp_bitmap_create(300, 300, wnd->wm->screen->bpp,
+ WND_TYPE_WND, wnd->wm);
+ xrdp_list_insert_item(wnd->wm->screen->child_list, 0, (long)help);
help->parent = wnd->wm->screen;
help->owner = wnd;
wnd->modal_dialog = help;
@@ -170,8 +177,9 @@ int xrdp_wm_login_notify(struct xrdp_bitmap* wnd,
help->notify = xrdp_wm_login_help_notify;
set_string(&help->caption1, "Login help");
/* ok button */
- but = xrdp_bitmap_create(60, 25, wnd->wm->screen->bpp, 3, wnd->wm);
- xrdp_list_insert_item(help->child_list, 0, (int)but);
+ but = xrdp_bitmap_create(60, 25, wnd->wm->screen->bpp,
+ WND_TYPE_BUTTON, wnd->wm);
+ xrdp_list_insert_item(help->child_list, 0, (long)but);
but->parent = help;
but->owner = help;
but->left = 120;
@@ -181,25 +189,29 @@ int xrdp_wm_login_notify(struct xrdp_bitmap* wnd,
set_string(&but->caption1, "OK");
/* draw it */
help->focused_control = but;
- //wnd->wm->focused_window = help;
xrdp_bitmap_invalidate(help, 0);
xrdp_wm_set_focused(wnd->wm, help);
- //xrdp_bitmap_invalidate(wnd->focused_control, 0);
}
else if (sender->id == 2) /* cancel button */
{
if (wnd != 0)
+ {
if (wnd->wm != 0)
+ {
if (wnd->wm->pro_layer != 0)
+ {
wnd->wm->pro_layer->term = 1;
+ }
+ }
+ }
}
else if (sender->id == 3) /* ok button */
{
combo = xrdp_bitmap_get_child_by_id(wnd, 6);
if (combo != 0)
{
- mod = (struct xrdp_mod_data*)xrdp_list_get_item(combo->data_list,
- combo->item_index);
+ mod = (struct xrdp_mod_data*)
+ xrdp_list_get_item(combo->data_list, combo->item_index);
if (mod != 0)
{
con_mod = *mod;
@@ -238,14 +250,24 @@ int xrdp_wm_login_notify(struct xrdp_bitmap* wnd,
wm->mod->mod_set_param(wm->mod, "password", con_mod.password);
if (wm->mod->mod_connect(wm->mod) != 0)
{
- wm->pro_layer->term = 1; /* kill session */
+ /* totaly free mod */
+ wm->mod_exit(wm->mod);
+ g_free_library(wm->mod_handle);
+ wm->mod = 0;
+ wm->mod_handle = 0;
+ wm->mod_init = 0;
+ wm->mod_exit = 0;
+ //wm->pro_layer->app_sck = 0;
}
}
if (!wm->pro_layer->term)
{
- if (wm->mod->sck != 0)
+ if (wm->mod != 0)
{
- wm->pro_layer->app_sck = wm->mod->sck;
+ if (wm->mod->sck != 0)
+ {
+ wm->pro_layer->app_sck = wm->mod->sck;
+ }
}
}
}
@@ -258,7 +280,7 @@ int xrdp_wm_login_notify(struct xrdp_bitmap* wnd,
}
else if (msg == 100) /* modal result is done */
{
- i = xrdp_list_index_of(wnd->wm->screen->child_list, (int)sender);
+ i = xrdp_list_index_of(wnd->wm->screen->child_list, (long)sender);
if (i >= 0)
{
b = (struct xrdp_bitmap*)
@@ -337,8 +359,8 @@ int xrdp_wm_login_fill_in_combo(struct xrdp_wm* self, struct xrdp_bitmap* b)
g_strcpy(mod_data->password, r);
}
}
- xrdp_list_add_item(b->string_list, (int)g_strdup(mod_data->name));
- xrdp_list_add_item(b->data_list, (int)mod_data);
+ xrdp_list_add_item(b->string_list, (long)g_strdup(mod_data->name));
+ xrdp_list_add_item(b->data_list, (long)mod_data);
}
}
g_file_close(fd);
@@ -356,7 +378,7 @@ int xrdp_login_wnd_create(struct xrdp_wm* self)
/* draw login window */
self->login_window = xrdp_bitmap_create(400, 200, self->screen->bpp,
WND_TYPE_WND, self);
- xrdp_list_add_item(self->screen->child_list, (int)self->login_window);
+ xrdp_list_add_item(self->screen->child_list, (long)self->login_window);
self->login_window->parent = self->screen;
self->login_window->owner = self->screen;
self->login_window->bg_color = self->grey;
@@ -374,7 +396,7 @@ int xrdp_login_wnd_create(struct xrdp_wm* self)
but->owner = self->screen;
but->left = self->screen->width - but->width;
but->top = self->screen->height - but->height;
- xrdp_list_add_item(self->screen->child_list, (int)but);
+ xrdp_list_add_item(self->screen->child_list, (long)but);
/* image */
but = xrdp_bitmap_create(4, 4, self->screen->bpp, WND_TYPE_IMAGE, self);
@@ -383,11 +405,11 @@ int xrdp_login_wnd_create(struct xrdp_wm* self)
but->owner = self->login_window;
but->left = 10;
but->top = 30;
- xrdp_list_add_item(self->login_window->child_list, (int)but);
+ xrdp_list_add_item(self->login_window->child_list, (long)but);
/* label */
but = xrdp_bitmap_create(60, 20, self->screen->bpp, WND_TYPE_LABEL, self);
- xrdp_list_add_item(self->login_window->child_list, (int)but);
+ xrdp_list_add_item(self->login_window->child_list, (long)but);
but->parent = self->login_window;
but->owner = self->login_window;
but->left = 155;
@@ -396,7 +418,7 @@ int xrdp_login_wnd_create(struct xrdp_wm* self)
/* edit */
but = xrdp_bitmap_create(140, 20, self->screen->bpp, WND_TYPE_EDIT, self);
- xrdp_list_add_item(self->login_window->child_list, (int)but);
+ xrdp_list_add_item(self->login_window->child_list, (long)but);
but->parent = self->login_window;
but->owner = self->login_window;
but->left = 220;
@@ -409,7 +431,7 @@ int xrdp_login_wnd_create(struct xrdp_wm* self)
/* label */
but = xrdp_bitmap_create(60, 20, self->screen->bpp, WND_TYPE_LABEL, self);
- xrdp_list_add_item(self->login_window->child_list, (int)but);
+ xrdp_list_add_item(self->login_window->child_list, (long)but);
but->parent = self->login_window;
but->owner = self->login_window;
but->left = 155;
@@ -418,7 +440,7 @@ int xrdp_login_wnd_create(struct xrdp_wm* self)
/* edit */
but = xrdp_bitmap_create(140, 20, self->screen->bpp, WND_TYPE_EDIT, self);
- xrdp_list_add_item(self->login_window->child_list, (int)but);
+ xrdp_list_add_item(self->login_window->child_list, (long)but);
but->parent = self->login_window;
but->owner = self->login_window;
but->left = 220;
@@ -431,7 +453,7 @@ int xrdp_login_wnd_create(struct xrdp_wm* self)
/* label */
but = xrdp_bitmap_create(60, 20, self->screen->bpp, WND_TYPE_LABEL, self);
- xrdp_list_add_item(self->login_window->child_list, (int)but);
+ xrdp_list_add_item(self->login_window->child_list, (long)but);
but->parent = self->login_window;
but->owner = self->login_window;
but->left = 155;
@@ -440,7 +462,7 @@ int xrdp_login_wnd_create(struct xrdp_wm* self)
/* combo */
but = xrdp_bitmap_create(140, 20, self->screen->bpp, WND_TYPE_COMBO, self);
- xrdp_list_add_item(self->login_window->child_list, (int)but);
+ xrdp_list_add_item(self->login_window->child_list, (long)but);
but->parent = self->login_window;
but->owner = self->login_window;
but->left = 220;
@@ -451,7 +473,7 @@ int xrdp_login_wnd_create(struct xrdp_wm* self)
/* button */
but = xrdp_bitmap_create(60, 25, self->screen->bpp, WND_TYPE_BUTTON, self);
- xrdp_list_add_item(self->login_window->child_list, (int)but);
+ xrdp_list_add_item(self->login_window->child_list, (long)but);
but->parent = self->login_window;
but->owner = self->login_window;
but->left = 180;
@@ -462,7 +484,7 @@ int xrdp_login_wnd_create(struct xrdp_wm* self)
/* button */
but = xrdp_bitmap_create(60, 25, self->screen->bpp, WND_TYPE_BUTTON, self);
- xrdp_list_add_item(self->login_window->child_list, (int)but);
+ xrdp_list_add_item(self->login_window->child_list, (long)but);
but->parent = self->login_window;
but->owner = self->login_window;
but->left = 250;
@@ -473,7 +495,7 @@ int xrdp_login_wnd_create(struct xrdp_wm* self)
/* button */
but = xrdp_bitmap_create(60, 25, self->screen->bpp, WND_TYPE_BUTTON, self);
- xrdp_list_add_item(self->login_window->child_list, (int)but);
+ xrdp_list_add_item(self->login_window->child_list, (long)but);
but->parent = self->login_window;
but->owner = self->login_window;
but->left = 320;
diff --git a/xrdp/xrdp_types.h b/xrdp/xrdp_types.h
index b89560a0..5757a8cc 100644
--- a/xrdp/xrdp_types.h
+++ b/xrdp/xrdp_types.h
@@ -42,7 +42,7 @@ struct xrdp_mod
char* data);
int (*server_set_pointer)(struct xrdp_mod* v, int x, int y, char* data, char* mask);
int (*server_palette)(struct xrdp_mod* v, int* palette);
- int (*server_error_popup)(struct xrdp_mod* v, char* error, char* caption);
+ int (*server_msg)(struct xrdp_mod* v, char* msg);
int (*server_is_term)(struct xrdp_mod* v);
/* common */
long handle; /* pointer to self as int */
@@ -398,12 +398,15 @@ struct xrdp_wm
int scroll_lock;
int num_lock;
/* mod vars */
- int mod_handle;
- int (*mod_init)();
- int (*mod_exit)(int);
+ int mod_handle; /* returned from g_load_library */
+ struct xrdp_mod* (*mod_init)(void);
+ int (*mod_exit)(struct xrdp_mod*);
struct xrdp_mod* mod;
/* client info */
struct xrdp_client_info* client_info;
+ /* session log */
+ struct xrdp_list* log;
+ struct xrdp_bitmap* log_wnd;
};
/* rdp process */
diff --git a/xrdp/xrdp_wm.c b/xrdp/xrdp_wm.c
index efaa5a8d..2a5f985c 100644
--- a/xrdp/xrdp_wm.c
+++ b/xrdp/xrdp_wm.c
@@ -40,6 +40,8 @@ struct xrdp_wm* xrdp_wm_create(struct xrdp_process* owner,
self->painter = xrdp_painter_create(self);
self->rdp_layer = owner->rdp_layer;
self->cache = xrdp_cache_create(self, self->orders, self->client_info);
+ self->log = xrdp_list_create();
+ self->log->auto_free = 1;
return self;
}
@@ -58,7 +60,7 @@ void xrdp_wm_delete(struct xrdp_wm* self)
{
if (self->mod_exit != 0)
{
- self->mod_exit((int)self->mod);
+ self->mod_exit(self->mod);
}
}
if (self->mod_handle != 0)
@@ -236,7 +238,9 @@ int xrdp_wm_send_bitmap(struct xrdp_wm* self, struct xrdp_bitmap* bitmap,
{
lines_sending = 4096 / (line_size + e * Bpp);
if (i + lines_sending > total_lines)
+ {
lines_sending = total_lines - i;
+ }
p = p + line_size * lines_sending;
xrdp_rdp_init_data(self->rdp_layer, s);
out_uint16_le(s, RDP_UPDATE_BITMAP);
@@ -340,7 +344,7 @@ int xrdp_wm_pointer(struct xrdp_wm* self, char* data, char* mask, int x, int y)
pointer_item.y = y;
g_memcpy(pointer_item.data, data, 32 * 32 * 3);
g_memcpy(pointer_item.mask, mask, 32 * 32 / 8);
- xrdp_cache_add_pointer(self->cache, &pointer_item);
+ self->screen->pointer = xrdp_cache_add_pointer(self->cache, &pointer_item);
return 0;
}
@@ -468,7 +472,6 @@ int xrdp_wm_set_pointer(struct xrdp_wm* self, int cache_idx)
out_uint16_le(s, RDP_POINTER_CACHED);
out_uint16_le(s, 0); /* pad */
out_uint16_le(s, cache_idx); /* cache_idx */
- //g_printf("%d\n", cache_idx);
s_mark_end(s);
xrdp_rdp_send_data(self->rdp_layer, s, RDP_DATA_PDU_POINTER);
free_stream(s);
@@ -479,13 +482,10 @@ int xrdp_wm_set_pointer(struct xrdp_wm* self, int cache_idx)
int xrdp_wm_init(struct xrdp_wm* self)
{
#ifndef XRDP_LIB /* if lib, dodn't create login screen */
- char data[32 * (32 * 3)];
- char mask[32 * (32 / 8)];
- int x;
- int y;
int bindex;
int gindex;
int rindex;
+ struct xrdp_pointer_item pointer_item;
if (self->screen->bpp == 8)
{
@@ -547,12 +547,13 @@ int xrdp_wm_init(struct xrdp_wm* self)
self->green = COLOR24(0x00, 0xff, 0x00);
}
DEBUG(("sending cursor\n\r"));
- xrdp_wm_load_pointer(self, "cursor1.cur", data, mask, &x, &y);
- xrdp_wm_send_pointer(self, 1, data, mask, x, y);
+ xrdp_wm_load_pointer(self, "cursor1.cur", pointer_item.data,
+ pointer_item.mask, &pointer_item.x, &pointer_item.y);
+ xrdp_cache_add_pointer_static(self->cache, &pointer_item, 1);
DEBUG(("sending cursor\n\r"));
- xrdp_wm_load_pointer(self, "cursor0.cur", data, mask, &x, &y);
- xrdp_wm_send_pointer(self, 0, data, mask, x, y);
-
+ xrdp_wm_load_pointer(self, "cursor0.cur", pointer_item.data,
+ pointer_item.mask, &pointer_item.x, &pointer_item.y);
+ xrdp_cache_add_pointer_static(self->cache, &pointer_item, 0);
xrdp_login_wnd_create(self);
/* clear screen */
self->screen->bg_color = self->black;
@@ -738,7 +739,7 @@ int xrdp_wm_is_rect_vis(struct xrdp_wm* self, struct xrdp_bitmap* wnd,
return 0;
}
- i = xrdp_list_index_of(self->screen->child_list, (int)wnd);
+ i = xrdp_list_index_of(self->screen->child_list, (long)wnd);
i--;
while (i >= 0)
{
@@ -842,8 +843,13 @@ int xrdp_wm_mouse_move(struct xrdp_wm* self, int x, int y)
return 0;
}
b = xrdp_wm_at_pos(self->screen, x, y, 0);
- if (b == 0)
+ if (b == 0) /* if b is null, the movment must be over the screen */
{
+ if (self->screen->pointer != self->current_pointer)
+ {
+ xrdp_wm_set_pointer(self, self->screen->pointer);
+ self->current_pointer = self->screen->pointer;
+ }
if (self->mod != 0) /* if screen is mod controled */
{
if (self->mod->mod_event != 0)
@@ -900,7 +906,7 @@ int xrdp_wm_clear_popup(struct xrdp_wm* self)
if (self->popup_wnd != 0)
{
//b = self->popup_wnd->popped_from;
- i = xrdp_list_index_of(self->screen->child_list, (int)self->popup_wnd);
+ i = xrdp_list_index_of(self->screen->child_list, (long)self->popup_wnd);
xrdp_list_remove_item(self->screen->child_list, i);
MAKERECT(rect, self->popup_wnd->left, self->popup_wnd->top,
self->popup_wnd->width, self->popup_wnd->height);
@@ -1218,7 +1224,7 @@ int xrdp_wm_pu(struct xrdp_wm* self, struct xrdp_bitmap* control)
self->popup_wnd->left = x;
self->popup_wnd->top = y + control->height;
self->popup_wnd->item_index = control->item_index;
- xrdp_list_insert_item(self->screen->child_list, 0, (int)self->popup_wnd);
+ xrdp_list_insert_item(self->screen->child_list, 0, (long)self->popup_wnd);
xrdp_bitmap_invalidate(self->popup_wnd, 0);
return 0;
}