diff options
Diffstat (limited to 'xrdp/xrdp_region.c')
-rw-r--r-- | xrdp/xrdp_region.c | 75 |
1 files changed, 43 insertions, 32 deletions
diff --git a/xrdp/xrdp_region.c b/xrdp/xrdp_region.c index e1d0a597..2f5ade6c 100644 --- a/xrdp/xrdp_region.c +++ b/xrdp/xrdp_region.c @@ -24,40 +24,46 @@ #include "xrdp.h" /*****************************************************************************/ -struct xrdp_region* xrdp_region_create(struct xrdp_wm* wm) +struct xrdp_region* APP_CC +xrdp_region_create(struct xrdp_wm* wm) { struct xrdp_region* self; self = (struct xrdp_region*)g_malloc(sizeof(struct xrdp_region), 1); self->wm = wm; - self->rects = xrdp_list_create(); + self->rects = list_create(); self->rects->auto_free = 1; return self; } /*****************************************************************************/ -void xrdp_region_delete(struct xrdp_region* self) +void APP_CC +xrdp_region_delete(struct xrdp_region* self) { if (self == 0) + { return; - xrdp_list_delete(self->rects); + } + list_delete(self->rects); g_free(self); } /*****************************************************************************/ -int xrdp_region_add_rect(struct xrdp_region* self, struct xrdp_rect* rect) +int APP_CC +xrdp_region_add_rect(struct xrdp_region* self, struct xrdp_rect* rect) { struct xrdp_rect* r; r = (struct xrdp_rect*)g_malloc(sizeof(struct xrdp_rect), 1); *r = *rect; - xrdp_list_add_item(self->rects, (long)r); + list_add_item(self->rects, (long)r); return 0; } /*****************************************************************************/ -int xrdp_region_insert_rect(struct xrdp_region* self, int i, int left, - int top, int right, int bottom) +int APP_CC +xrdp_region_insert_rect(struct xrdp_region* self, int i, int left, + int top, int right, int bottom) { struct xrdp_rect* r; @@ -66,13 +72,14 @@ int xrdp_region_insert_rect(struct xrdp_region* self, int i, int left, r->top = top; r->right = right; r->bottom = bottom; - xrdp_list_insert_item(self->rects, i, (long)r); + list_insert_item(self->rects, i, (long)r); return 0; } /*****************************************************************************/ -int xrdp_region_subtract_rect(struct xrdp_region* self, - struct xrdp_rect* rect) +int APP_CC +xrdp_region_subtract_rect(struct xrdp_region* self, + struct xrdp_rect* rect) { struct xrdp_rect* r; struct xrdp_rect rect1; @@ -80,7 +87,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self, for (i = self->rects->count - 1; i >= 0; i--) { - r = (struct xrdp_rect*)xrdp_list_get_item(self->rects, i); + r = (struct xrdp_rect*)list_get_item(self->rects, i); rect1 = *r; r = &rect1; //g_printf("r is %d %d %d %d\n", r->left, r->top, r->right, r->bottom); @@ -89,7 +96,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self, rect->right >= r->right && rect->bottom >= r->bottom) { /* rect is not visible */ - xrdp_list_remove_item(self->rects, i); + list_remove_item(self->rects, i); } else if (rect->right < r->left || rect->bottom < r->top || @@ -102,7 +109,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self, rect->bottom < r->bottom && rect->top <= r->top) { /* partially covered(whole top) */ - xrdp_list_remove_item(self->rects, i); + list_remove_item(self->rects, i); xrdp_region_insert_rect(self, i, r->left, rect->bottom, r->right, r->bottom); } @@ -111,7 +118,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self, rect->right < r->right && rect->left <= r->left) { /* partially covered(left) */ - xrdp_list_remove_item(self->rects, i); + list_remove_item(self->rects, i); xrdp_region_insert_rect(self, i, rect->right, r->top, r->right, r->bottom); } @@ -120,7 +127,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self, rect->top > r->top && rect->bottom >= r->bottom) { /* partially covered(bottom) */ - xrdp_list_remove_item(self->rects, i); + list_remove_item(self->rects, i); xrdp_region_insert_rect(self, i, r->left, r->top, r->right, rect->top); } @@ -129,7 +136,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self, rect->left > r->left && rect->right >= r->right) { /* partially covered(right) */ - xrdp_list_remove_item(self->rects, i); + list_remove_item(self->rects, i); xrdp_region_insert_rect(self, i, r->left, r->top, rect->left, r->bottom); } @@ -138,7 +145,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self, rect->right < r->right && rect->bottom < r->bottom) { /* partially covered(top left) */ - xrdp_list_remove_item(self->rects, i); + list_remove_item(self->rects, i); xrdp_region_insert_rect(self, i, rect->right, r->top, r->right, rect->bottom); xrdp_region_insert_rect(self, i, r->left, rect->bottom, @@ -149,7 +156,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self, rect->right < r->right && rect->top > r->top) { /* partially covered(bottom left) */ - xrdp_list_remove_item(self->rects, i); + list_remove_item(self->rects, i); xrdp_region_insert_rect(self, i, r->left, r->top, r->right, rect->top); xrdp_region_insert_rect(self, i, rect->right, rect->top, @@ -160,7 +167,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self, rect->top <= r->top && rect->bottom < r->bottom) { /* partially covered(top right) */ - xrdp_list_remove_item(self->rects, i); + list_remove_item(self->rects, i); xrdp_region_insert_rect(self, i, r->left, r->top, rect->left, r->bottom); xrdp_region_insert_rect(self, i, rect->left, rect->bottom, @@ -171,7 +178,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self, rect->top > r->top && rect->bottom >= r->bottom) { /* partially covered(bottom right) */ - xrdp_list_remove_item(self->rects, i); + list_remove_item(self->rects, i); xrdp_region_insert_rect(self, i, r->left, r->top, r->right, rect->top); xrdp_region_insert_rect(self, i, r->left, rect->top, @@ -182,7 +189,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self, rect->right < r->right && rect->bottom >= r->bottom) { /* 2 rects, one on each end */ - xrdp_list_remove_item(self->rects, i); + list_remove_item(self->rects, i); xrdp_region_insert_rect(self, i, r->left, r->top, rect->left, r->bottom); xrdp_region_insert_rect(self, i, rect->right, r->top, @@ -193,7 +200,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self, rect->right >= r->right && rect->bottom < r->bottom) { /* 2 rects, one on each end */ - xrdp_list_remove_item(self->rects, i); + list_remove_item(self->rects, i); xrdp_region_insert_rect(self, i, r->left, r->top, r->right, rect->top); xrdp_region_insert_rect(self, i, r->left, rect->bottom, @@ -204,7 +211,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self, rect->top <= r->top && rect->bottom < r->bottom) { /* partially covered(top) */ - xrdp_list_remove_item(self->rects, i); + list_remove_item(self->rects, i); xrdp_region_insert_rect(self, i, r->left, r->top, rect->left, r->bottom); xrdp_region_insert_rect(self, i, rect->left, rect->bottom, @@ -217,7 +224,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self, rect->left <= r->left && rect->right < r->right) { /* partially covered(left) */ - xrdp_list_remove_item(self->rects, i); + list_remove_item(self->rects, i); xrdp_region_insert_rect(self, i, r->left, r->top, r->right, rect->top); xrdp_region_insert_rect(self, i, rect->right, rect->top, @@ -230,7 +237,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self, rect->bottom >= r->bottom && rect->top > r->top) { /* partially covered(bottom) */ - xrdp_list_remove_item(self->rects, i); + list_remove_item(self->rects, i); xrdp_region_insert_rect(self, i, r->left, r->top, rect->left, r->bottom); xrdp_region_insert_rect(self, i, rect->left, r->top, @@ -243,7 +250,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self, rect->right >= r->right && rect->left > r->left) { /* partially covered(right) */ - xrdp_list_remove_item(self->rects, i); + list_remove_item(self->rects, i); xrdp_region_insert_rect(self, i, r->left, r->top, r->right, rect->top); xrdp_region_insert_rect(self, i, r->left, rect->top, @@ -256,7 +263,7 @@ int xrdp_region_subtract_rect(struct xrdp_region* self, rect->right < r->right && rect->bottom < r->bottom) { /* totally contained, 4 rects */ - xrdp_list_remove_item(self->rects, i); + list_remove_item(self->rects, i); xrdp_region_insert_rect(self, i, r->left, r->top, r->right, rect->top); xrdp_region_insert_rect(self, i, r->left, rect->top, @@ -267,21 +274,25 @@ int xrdp_region_subtract_rect(struct xrdp_region* self, r->right, rect->bottom); } else + { g_printf("error in xrdp_region_subtract_rect\n\r"); - + } } return 0; } /*****************************************************************************/ -int xrdp_region_get_rect(struct xrdp_region* self, int index, - struct xrdp_rect* rect) +int APP_CC +xrdp_region_get_rect(struct xrdp_region* self, int index, + struct xrdp_rect* rect) { struct xrdp_rect* r; - r = (struct xrdp_rect*)xrdp_list_get_item(self->rects, index); + r = (struct xrdp_rect*)list_get_item(self->rects, index); if (r == 0) + { return 1; + } *rect = *r; return 0; } |