From 510fb93b994fcf855959cffc07a72647ebb97722 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Tue, 9 Aug 2011 03:01:40 -0400 Subject: [PATCH] libfreerdp-core: update core <-> client interface for window alternate secondary drawing orders --- include/freerdp/update.h | 142 +++++++++++++++++++++++++++++++++++++++ libfreerdp-core/window.c | 65 +++++++++++------- libfreerdp-core/window.h | 115 ------------------------------- 3 files changed, 184 insertions(+), 138 deletions(-) diff --git a/include/freerdp/update.h b/include/freerdp/update.h index e3888cd37..c3cefc02b 100644 --- a/include/freerdp/update.h +++ b/include/freerdp/update.h @@ -675,6 +675,123 @@ struct _DRAW_GDIPLUS_CACHE_END_ORDER }; typedef struct _DRAW_GDIPLUS_CACHE_END_ORDER DRAW_GDIPLUS_CACHE_END_ORDER; +/* Window Alternate Secondary Drawing Orders */ + +struct _WINDOW_ORDER_INFO +{ + uint32 windowId; + uint32 fieldFlags; + uint32 notifyIconId; +}; +typedef struct _WINDOW_ORDER_INFO WINDOW_ORDER_INFO; + +struct _UNICODE_STRING +{ + uint16 cbString; + uint8* string; +}; +typedef struct _UNICODE_STRING UNICODE_STRING; + +struct _RECTANGLE_16 +{ + uint16 left; + uint16 top; + uint16 right; + uint16 bottom; +}; +typedef struct _RECTANGLE_16 RECTANGLE_16; + +struct _ICON_INFO +{ + uint16 cacheEntry; + uint8 cacheId; + uint8 bpp; + uint16 width; + uint16 height; + uint16 cbColorTable; + uint16 cbBitsMask; + uint16 cbBitsColor; + uint8* bitsMask; + uint8* colorTable; + uint8* bitsColor; +}; +typedef struct _ICON_INFO ICON_INFO; + +struct _CACHED_ICON_INFO +{ + uint16 cacheEntry; + uint8 cacheId; +}; +typedef struct _CACHED_ICON_INFO CACHED_ICON_INFO; + +struct _NOTIFY_ICON_INFOTIP +{ + uint32 timeout; + uint32 flags; + UNICODE_STRING text; + UNICODE_STRING title; +}; +typedef struct _NOTIFY_ICON_INFOTIP NOTIFY_ICON_INFOTIP; + +struct _WINDOW_STATE_ORDER +{ + uint32 ownerWindowId; + uint32 style; + uint32 extendedStyle; + uint8 showState; + UNICODE_STRING titleInfo; + uint32 clientOffsetX; + uint32 clientOffsetY; + uint32 clientAreaWidth; + uint32 clientAreaHeight; + uint8 RPContent; + uint32 rootParentHandle; + uint32 windowOffsetX; + uint32 windowOffsetY; + uint32 windowClientDeltaX; + uint32 windowClientDeltaY; + uint32 windowWidth; + uint32 windowHeight; + uint16 numWindowRects; + RECTANGLE_16* windowRects; + uint32 visibleOffsetX; + uint32 visibleOffsetY; + uint16 numVisibilityRects; + RECTANGLE_16* visibilityRects; +}; +typedef struct _WINDOW_STATE_ORDER WINDOW_STATE_ORDER; + +struct _WINDOW_ICON_ORDER +{ + ICON_INFO iconInfo; +}; +typedef struct _WINDOW_ICON_ORDER WINDOW_ICON_ORDER; + +struct _WINDOW_CACHED_ICON_ORDER +{ + CACHED_ICON_INFO cachedIcon; +}; +typedef struct _WINDOW_CACHED_ICON_ORDER WINDOW_CACHED_ICON_ORDER; + +struct _NOTIFY_ICON_STATE_ORDER +{ + uint32 version; + UNICODE_STRING toolTip; + NOTIFY_ICON_INFOTIP infoTip; + uint32 state; + ICON_INFO icon; + CACHED_ICON_INFO cachedIcon; +}; +typedef struct _NOTIFY_ICON_STATE_ORDER NOTIFY_ICON_STATE_ORDER; + +struct _MONITORED_DESKTOP_ORDER +{ + uint32 activeWindowId; + uint8 numWindowIds; + uint32* windowIds; +}; +typedef struct _MONITORED_DESKTOP_ORDER MONITORED_DESKTOP_ORDER; + /* Constants */ #define CACHED_BRUSH 0x80 @@ -768,6 +885,15 @@ typedef void (*pcDrawGdiPlusCacheFirst)(rdpUpdate* update, DRAW_GDIPLUS_CACHE_FI typedef void (*pcDrawGdiPlusCacheNext)(rdpUpdate* update, DRAW_GDIPLUS_CACHE_NEXT_ORDER* draw_gdiplus_cache_next); typedef void (*pcDrawGdiPlusCacheEnd)(rdpUpdate* update, DRAW_GDIPLUS_CACHE_END_ORDER* draw_gdiplus_cache_end); +typedef void (*pcWindowState)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* window_state); +typedef void (*pcWindowIcon)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo, WINDOW_ICON_ORDER* window_icon); +typedef void (*pcWindowCachedIcon)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo, WINDOW_CACHED_ICON_ORDER* window_cached_icon); +typedef void (*pcWindowDeleted)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo); +typedef void (*pcNotifyIconState)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notify_icon_state); +typedef void (*pcNotifyIconDeleted)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo); +typedef void (*pcMonitoredDesktop)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo, MONITORED_DESKTOP_ORDER* monitored_desktop); +typedef void (*pcNonMonitoredDesktop)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo); + struct rdp_update { void* rdp; @@ -827,6 +953,15 @@ struct rdp_update pcDrawGdiPlusCacheNext DrawGdiPlusCacheNext; pcDrawGdiPlusCacheEnd DrawGdiPlusCacheEnd; + pcWindowState WindowState; + pcWindowIcon WindowIcon; + pcWindowCachedIcon WindowCachedIcon; + pcWindowDeleted WindowDeleted; + pcNotifyIconState NotifyIconState; + pcNotifyIconDeleted NotifyIconDeleted; + pcMonitoredDesktop MonitoredDesktop; + pcNonMonitoredDesktop NonMonitoredDesktop; + BITMAP_UPDATE bitmap_update; PALETTE_UPDATE palette_update; ORDER_INFO order_info; @@ -874,6 +1009,13 @@ struct rdp_update DRAW_GDIPLUS_FIRST_ORDER draw_gdiplus_first; DRAW_GDIPLUS_NEXT_ORDER draw_gdiplus_next; DRAW_GDIPLUS_END_ORDER draw_gdiplus_end; + + WINDOW_ORDER_INFO orderInfo; + WINDOW_STATE_ORDER window_state; + WINDOW_ICON_ORDER window_icon; + WINDOW_CACHED_ICON_ORDER window_cached_icon; + NOTIFY_ICON_STATE_ORDER notify_icon_state; + MONITORED_DESKTOP_ORDER monitored_desktop; }; #endif /* __UPDATE_API_H */ diff --git a/libfreerdp-core/window.c b/libfreerdp-core/window.c index 9ab15548b..388859244 100644 --- a/libfreerdp-core/window.c +++ b/libfreerdp-core/window.c @@ -203,20 +203,30 @@ void update_read_window_deleted_order(STREAM* s, WINDOW_ORDER_INFO* orderInfo) /* window deletion event */ } -void update_read_window_info_order(STREAM* s, WINDOW_ORDER_INFO* orderInfo) +void update_recv_window_info_order(rdpUpdate* update, STREAM* s, WINDOW_ORDER_INFO* orderInfo) { - WINDOW_STATE_ORDER window_state; - WINDOW_ICON_ORDER window_icon; - WINDOW_CACHED_ICON_ORDER window_cached_icon; + stream_read_uint32(s, orderInfo->windowId); /* windowId (4 bytes) */ if (orderInfo->fieldFlags & WINDOW_ORDER_ICON) - update_read_window_icon_order(s, orderInfo, &window_icon); + { + update_read_window_icon_order(s, orderInfo, &update->window_icon); + IFCALL(update->WindowIcon, update, orderInfo, &update->window_icon); + } else if (orderInfo->fieldFlags & WINDOW_ORDER_CACHED_ICON) - update_read_window_cached_icon_order(s, orderInfo, &window_cached_icon); + { + update_read_window_cached_icon_order(s, orderInfo, &update->window_cached_icon); + IFCALL(update->WindowCachedIcon, update, orderInfo, &update->window_cached_icon); + } else if (orderInfo->fieldFlags & WINDOW_ORDER_STATE_DELETED) + { update_read_window_deleted_order(s, orderInfo); + IFCALL(update->WindowDeleted, update, orderInfo); + } else - update_read_window_state_order(s, orderInfo, &window_state); + { + update_read_window_state_order(s, orderInfo, &update->window_state); + IFCALL(update->WindowState, update, orderInfo, &update->window_state); + } } void update_read_notification_icon_state_order(STREAM* s, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notify_icon_state) @@ -245,14 +255,21 @@ void update_read_notification_icon_deleted_order(STREAM* s, WINDOW_ORDER_INFO* o /* notification icon deletion event */ } -void update_read_notification_icon_info_order(STREAM* s, WINDOW_ORDER_INFO* orderInfo) +void update_recv_notification_icon_info_order(rdpUpdate* update, STREAM* s, WINDOW_ORDER_INFO* orderInfo) { - NOTIFY_ICON_STATE_ORDER notify_icon_state_order; + stream_read_uint32(s, orderInfo->windowId); /* windowId (4 bytes) */ + stream_read_uint32(s, orderInfo->notifyIconId); /* notifyIconId (4 bytes) */ if (orderInfo->fieldFlags & WINDOW_ORDER_STATE_DELETED) + { update_read_notification_icon_deleted_order(s, orderInfo); + IFCALL(update->NotifyIconDeleted, update, orderInfo); + } else - update_read_notification_icon_state_order(s, orderInfo, ¬ify_icon_state_order); + { + update_read_notification_icon_state_order(s, orderInfo, &update->notify_icon_state); + IFCALL(update->NotifyIconState, update, orderInfo, &update->notify_icon_state); + } } void update_read_desktop_actively_monitored_order(STREAM* s, WINDOW_ORDER_INFO* orderInfo, MONITORED_DESKTOP_ORDER* monitored_desktop) @@ -287,30 +304,32 @@ void update_read_desktop_non_monitored_order(STREAM* s, WINDOW_ORDER_INFO* order /* non-monitored desktop notification event */ } -void update_read_desktop_info_order(STREAM* s, WINDOW_ORDER_INFO* orderInfo) +void update_recv_desktop_info_order(rdpUpdate* update, STREAM* s, WINDOW_ORDER_INFO* orderInfo) { - MONITORED_DESKTOP_ORDER monitored_desktop_order; - if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_DESKTOP_NONE) + { update_read_desktop_non_monitored_order(s, orderInfo); + IFCALL(update->NonMonitoredDesktop, update, orderInfo); + } else - update_read_desktop_actively_monitored_order(s, orderInfo, &monitored_desktop_order); + { + update_read_desktop_actively_monitored_order(s, orderInfo, &update->monitored_desktop); + IFCALL(update->MonitoredDesktop, update, orderInfo, &update->monitored_desktop); + } } void update_recv_altsec_window_order(rdpUpdate* update, STREAM* s) { uint16 orderSize; - WINDOW_ORDER_INFO windowOrderInfo; stream_read_uint16(s, orderSize); /* orderSize (2 bytes) */ - stream_read_uint32(s, windowOrderInfo.fieldFlags); /* FieldsPresentFlags (4 bytes) */ - stream_read_uint32(s, windowOrderInfo.windowId); /* windowId (4 bytes) */ + stream_read_uint32(s, update->orderInfo.fieldFlags); /* FieldsPresentFlags (4 bytes) */ - if (windowOrderInfo.fieldFlags & WINDOW_ORDER_TYPE_WINDOW) - update_read_window_info_order(s, &windowOrderInfo); - else if (windowOrderInfo.fieldFlags & WINDOW_ORDER_TYPE_NOTIFY) - update_read_notification_icon_info_order(s, &windowOrderInfo); - else if (windowOrderInfo.fieldFlags & WINDOW_ORDER_TYPE_DESKTOP) - update_read_desktop_info_order(s, &windowOrderInfo); + if (update->orderInfo.fieldFlags & WINDOW_ORDER_TYPE_WINDOW) + update_recv_window_info_order(update, s, &update->orderInfo); + else if (update->orderInfo.fieldFlags & WINDOW_ORDER_TYPE_NOTIFY) + update_recv_notification_icon_info_order(update, s, &update->orderInfo); + else if (update->orderInfo.fieldFlags & WINDOW_ORDER_TYPE_DESKTOP) + update_recv_desktop_info_order(update, s, &update->orderInfo); } diff --git a/libfreerdp-core/window.h b/libfreerdp-core/window.h index a6479e876..36f09cae9 100644 --- a/libfreerdp-core/window.h +++ b/libfreerdp-core/window.h @@ -59,121 +59,6 @@ #define WINDOW_ORDER_FIELD_DESKTOP_ZORDER 0x00000010 #define WINDOW_ORDER_FIELD_DESKTOP_ACTIVE_WND 0x00000020 -struct _UNICODE_STRING -{ - uint16 cbString; - uint8* string; -}; -typedef struct _UNICODE_STRING UNICODE_STRING; - -struct _RECTANGLE_16 -{ - uint16 left; - uint16 top; - uint16 right; - uint16 bottom; -}; -typedef struct _RECTANGLE_16 RECTANGLE_16; - -struct _ICON_INFO -{ - uint16 cacheEntry; - uint8 cacheId; - uint8 bpp; - uint16 width; - uint16 height; - uint16 cbColorTable; - uint16 cbBitsMask; - uint16 cbBitsColor; - uint8* bitsMask; - uint8* colorTable; - uint8* bitsColor; -}; -typedef struct _ICON_INFO ICON_INFO; - -struct _CACHED_ICON_INFO -{ - uint16 cacheEntry; - uint8 cacheId; -}; -typedef struct _CACHED_ICON_INFO CACHED_ICON_INFO; - -struct _NOTIFY_ICON_INFOTIP -{ - uint32 timeout; - uint32 flags; - UNICODE_STRING text; - UNICODE_STRING title; -}; -typedef struct _NOTIFY_ICON_INFOTIP NOTIFY_ICON_INFOTIP; - -struct _WINDOW_ORDER_INFO -{ - uint32 windowId; - uint32 fieldFlags; - uint32 notifyIconId; -}; -typedef struct _WINDOW_ORDER_INFO WINDOW_ORDER_INFO; - -struct _WINDOW_STATE_ORDER -{ - uint32 ownerWindowId; - uint32 style; - uint32 extendedStyle; - uint8 showState; - UNICODE_STRING titleInfo; - uint32 clientOffsetX; - uint32 clientOffsetY; - uint32 clientAreaWidth; - uint32 clientAreaHeight; - uint8 RPContent; - uint32 rootParentHandle; - uint32 windowOffsetX; - uint32 windowOffsetY; - uint32 windowClientDeltaX; - uint32 windowClientDeltaY; - uint32 windowWidth; - uint32 windowHeight; - uint16 numWindowRects; - RECTANGLE_16* windowRects; - uint32 visibleOffsetX; - uint32 visibleOffsetY; - uint16 numVisibilityRects; - RECTANGLE_16* visibilityRects; -}; -typedef struct _WINDOW_STATE_ORDER WINDOW_STATE_ORDER; - -struct _WINDOW_ICON_ORDER -{ - ICON_INFO iconInfo; -}; -typedef struct _WINDOW_ICON_ORDER WINDOW_ICON_ORDER; - -struct _WINDOW_CACHED_ICON_ORDER -{ - CACHED_ICON_INFO cachedIcon; -}; -typedef struct _WINDOW_CACHED_ICON_ORDER WINDOW_CACHED_ICON_ORDER; - -struct _NOTIFY_ICON_STATE_ORDER -{ - uint32 version; - UNICODE_STRING toolTip; - NOTIFY_ICON_INFOTIP infoTip; - uint32 state; - ICON_INFO icon; - CACHED_ICON_INFO cachedIcon; -}; -typedef struct _NOTIFY_ICON_STATE_ORDER NOTIFY_ICON_STATE_ORDER; - -struct _MONITORED_DESKTOP_ORDER -{ - uint32 activeWindowId; - uint8 numWindowIds; - uint32* windowIds; -}; -typedef struct _MONITORED_DESKTOP_ORDER MONITORED_DESKTOP_ORDER; - void update_recv_altsec_window_order(rdpUpdate* update, STREAM* s); #endif /* __WINDOW_H */