rails: allow a window with id == 0

This commit is contained in:
David Fort 2018-12-07 10:33:07 +01:00
parent 8c7f8eb395
commit 88e361fa00
2 changed files with 16 additions and 17 deletions

View File

@ -222,8 +222,7 @@ static void xf_rail_invalidate_region(xfContext* xfc, REGION16* invalidRegion)
for (index = 0; index < count; index++) for (index = 0; index < count; index++)
{ {
appWindow = (xfAppWindow*) HashTable_GetItemValue(xfc->railWindows, appWindow = (xfAppWindow*) HashTable_GetItemValue(xfc->railWindows, (void *)pKeys[index]);
(void*) pKeys[index]);
if (appWindow) if (appWindow)
{ {
@ -327,14 +326,12 @@ static BOOL xf_rail_window_common(rdpContext* context,
return FALSE; return FALSE;
} }
HashTable_Add(xfc->railWindows, (void*)(UINT_PTR) orderInfo->windowId, HashTable_Add(xfc->railWindows, &appWindow->windowId, (void*) appWindow);
(void*) appWindow);
xf_AppWindowInit(xfc, appWindow); xf_AppWindowInit(xfc, appWindow);
} }
else else
{ {
appWindow = (xfAppWindow*) HashTable_GetItemValue(xfc->railWindows, appWindow = (xfAppWindow*) HashTable_GetItemValue(xfc->railWindows, &orderInfo->windowId);
(void*)(UINT_PTR) orderInfo->windowId);
} }
if (!appWindow) if (!appWindow)
@ -544,7 +541,7 @@ static BOOL xf_rail_window_delete(rdpContext* context,
if (!xfc) if (!xfc)
return FALSE; return FALSE;
HashTable_Remove(xfc->railWindows, (void*)(UINT_PTR) orderInfo->windowId); HashTable_Remove(xfc->railWindows, &orderInfo->windowId);
return TRUE; return TRUE;
} }
@ -809,8 +806,7 @@ static void xf_rail_set_window_icon(xfContext* xfc,
static xfAppWindow* xf_rail_get_window_by_id(xfContext* xfc, UINT32 windowId) static xfAppWindow* xf_rail_get_window_by_id(xfContext* xfc, UINT32 windowId)
{ {
return (xfAppWindow*) HashTable_GetItemValue(xfc->railWindows, return (xfAppWindow*) HashTable_GetItemValue(xfc->railWindows, &windowId);
(void*)(UINT_PTR) windowId);
} }
static BOOL xf_rail_window_icon(rdpContext* context, static BOOL xf_rail_window_icon(rdpContext* context,
@ -1071,8 +1067,7 @@ static UINT xf_rail_server_local_move_size(RailClientContext* context,
Window child_window; Window child_window;
xfAppWindow* appWindow = NULL; xfAppWindow* appWindow = NULL;
xfContext* xfc = (xfContext*) context->custom; xfContext* xfc = (xfContext*) context->custom;
appWindow = (xfAppWindow*) HashTable_GetItemValue(xfc->railWindows, appWindow = (xfAppWindow*) HashTable_GetItemValue(xfc->railWindows, (void *)&localMoveSize->windowId);
(void*)(UINT_PTR) localMoveSize->windowId);
if (!appWindow) if (!appWindow)
return ERROR_INTERNAL_ERROR; return ERROR_INTERNAL_ERROR;
@ -1167,8 +1162,7 @@ static UINT xf_rail_server_min_max_info(RailClientContext* context,
{ {
xfAppWindow* appWindow = NULL; xfAppWindow* appWindow = NULL;
xfContext* xfc = (xfContext*) context->custom; xfContext* xfc = (xfContext*) context->custom;
appWindow = (xfAppWindow*) HashTable_GetItemValue(xfc->railWindows, appWindow = (xfAppWindow*) HashTable_GetItemValue(xfc->railWindows, (void *)&minMaxInfo->windowId);
(void*)(UINT_PTR) minMaxInfo->windowId);
if (appWindow) if (appWindow)
{ {
@ -1204,6 +1198,11 @@ static UINT xf_rail_server_get_appid_response(RailClientContext* context,
return CHANNEL_RC_OK; return CHANNEL_RC_OK;
} }
static BOOL rail_window_key_equals(void *key1, void* key2)
{
return *(UINT32 *)key1 == *(UINT32 *)key2;
}
static void rail_window_free(void* value) static void rail_window_free(void* value)
{ {
xfAppWindow* appWindow = (xfAppWindow*) value; xfAppWindow* appWindow = (xfAppWindow*) value;
@ -1232,12 +1231,13 @@ int xf_rail_init(xfContext* xfc, RailClientContext* rail)
rail->ServerMinMaxInfo = xf_rail_server_min_max_info; rail->ServerMinMaxInfo = xf_rail_server_min_max_info;
rail->ServerLanguageBarInfo = xf_rail_server_language_bar_info; rail->ServerLanguageBarInfo = xf_rail_server_language_bar_info;
rail->ServerGetAppIdResponse = xf_rail_server_get_appid_response; rail->ServerGetAppIdResponse = xf_rail_server_get_appid_response;
xfc->railWindows = HashTable_New(TRUE);
xfc->railWindows = HashTable_New(TRUE);
if (!xfc->railWindows) if (!xfc->railWindows)
return 0; return 0;
xfc->railWindows->keyCompare = rail_window_key_equals;
xfc->railWindows->valueFree = rail_window_free; xfc->railWindows->valueFree = rail_window_free;
xfc->railIconCache = RailIconCache_New(xfc->context.settings); xfc->railIconCache = RailIconCache_New(xfc->context.settings);
if (!xfc->railIconCache) if (!xfc->railIconCache)

View File

@ -1120,8 +1120,7 @@ xfAppWindow* xf_AppWindowFromX11Window(xfContext* xfc, Window wnd)
for (index = 0; index < count; index++) for (index = 0; index < count; index++)
{ {
appWindow = (xfAppWindow*) HashTable_GetItemValue(xfc->railWindows, appWindow = (xfAppWindow*) HashTable_GetItemValue(xfc->railWindows, (void*) pKeys[index]);
(void*) pKeys[index]);
if (appWindow->handle == wnd) if (appWindow->handle == wnd)
{ {