diff --git a/common/defines.h b/common/defines.h index 77c7d75c..8dfba96b 100644 --- a/common/defines.h +++ b/common/defines.h @@ -30,11 +30,16 @@ #define DEBUG(args) #endif /* other macros */ +#undef MIN #define MIN(x1, x2) ((x1) < (x2) ? (x1) : (x2)) +#undef MAX #define MAX(x1, x2) ((x1) > (x2) ? (x1) : (x2)) +#undef HIWORD #define HIWORD(in) (((in) & 0xffff0000) >> 16) +#undef LOWORD #define LOWORD(in) ((in) & 0x0000ffff) -#define MAKELONG(hi, lo) ((((hi) & 0xffff) << 16) | ((lo) & 0xffff)) +#undef MAKELONG +#define MAKELONG(lo, hi) ((((hi) & 0xffff) << 16) | ((lo) & 0xffff)) #define MAKERECT(r, x, y, cx, cy) \ { (r).left = x; (r).top = y; (r).right = (x) + (cx); (r).bottom = (y) + (cy); } #define ISRECTEMPTY(r) (((r).right <= (r).left) || ((r).bottom <= (r).top)) diff --git a/xrdp/xrdp_bitmap.c b/xrdp/xrdp_bitmap.c index 17d38f01..61e59828 100644 --- a/xrdp/xrdp_bitmap.c +++ b/xrdp/xrdp_bitmap.c @@ -975,7 +975,7 @@ xrdp_bitmap_invalidate(struct xrdp_bitmap* self, struct xrdp_rect* rect) 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), 0, 0); + MAKELONG(y, x), MAKELONG(h, w), 0, 0); } } } diff --git a/xrdp/xrdp_cache.c b/xrdp/xrdp_cache.c index 57ec1f72..f029f590 100644 --- a/xrdp/xrdp_cache.c +++ b/xrdp/xrdp_cache.c @@ -174,7 +174,7 @@ xrdp_cache_add_bitmap(struct xrdp_cache* self, struct xrdp_bitmap* bitmap) self->bitmap_items[i][j].stamp = self->bitmap_stamp; DEBUG(("found bitmap at %d %d\n\r", i, j)); xrdp_bitmap_delete(bitmap); - return MAKELONG(i, j); + return MAKELONG(j, i); } } } @@ -192,7 +192,7 @@ xrdp_cache_add_bitmap(struct xrdp_cache* self, struct xrdp_bitmap* bitmap) self->bitmap_items[i][j].stamp = self->bitmap_stamp; DEBUG(("found bitmap at %d %d\n\r", i, j)); xrdp_bitmap_delete(bitmap); - return MAKELONG(i, j); + return MAKELONG(j, i); } } } @@ -260,7 +260,7 @@ xrdp_cache_add_bitmap(struct xrdp_cache* self, struct xrdp_bitmap* bitmap) bitmap->height, bitmap->bpp, bitmap->data, cache_id, cache_idx); } - return MAKELONG(cache_id, cache_idx); + return MAKELONG(cache_idx, cache_id); } /*****************************************************************************/ @@ -337,7 +337,7 @@ xrdp_cache_add_char(struct xrdp_cache* self, { self->char_items[i][j].stamp = self->char_stamp; DEBUG(("found font at %d %d\n\r", i, j)); - return MAKELONG(i, j); + return MAKELONG(j, i); } } } @@ -370,7 +370,7 @@ xrdp_cache_add_char(struct xrdp_cache* self, fi->height = font_item->height; self->char_items[f][c].stamp = self->char_stamp; libxrdp_orders_send_font(self->session, fi, f, c); - return MAKELONG(f, c); + return MAKELONG(c, f); } /*****************************************************************************/