2011-08-16 07:37:43 +04:00
|
|
|
/**
|
|
|
|
* FreeRDP: A Remote Desktop Protocol Client
|
|
|
|
* RAIL Windows
|
|
|
|
*
|
|
|
|
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <freerdp/utils/stream.h>
|
|
|
|
#include <freerdp/utils/memory.h>
|
2011-08-18 06:31:27 +04:00
|
|
|
#include <freerdp/utils/hexdump.h>
|
|
|
|
#include <freerdp/utils/unicode.h>
|
2011-08-16 07:37:43 +04:00
|
|
|
|
|
|
|
#include <freerdp/rail/window.h>
|
|
|
|
|
2011-08-16 08:22:00 +04:00
|
|
|
void window_state_update(rdpWindow* window, WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* window_state)
|
|
|
|
{
|
2011-08-18 06:50:49 +04:00
|
|
|
window->fieldFlags = orderInfo->fieldFlags;
|
|
|
|
|
2011-08-16 08:22:00 +04:00
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_OWNER)
|
|
|
|
{
|
|
|
|
window->ownerWindowId = window_state->ownerWindowId;
|
2011-08-22 01:32:18 +04:00
|
|
|
printf("ownerWindowId:0x%08X\n", window->ownerWindowId);
|
2011-08-16 08:22:00 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_STYLE)
|
|
|
|
{
|
|
|
|
window->style = window_state->style;
|
|
|
|
window->extendedStyle = window_state->extendedStyle;
|
2011-08-22 01:32:18 +04:00
|
|
|
printf("Style:%d, ExtendedStyle:%d\n", window->style, window->extendedStyle);
|
2011-08-16 08:22:00 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_SHOW)
|
|
|
|
{
|
|
|
|
window->showState = window_state->showState;
|
2011-08-17 22:13:44 +04:00
|
|
|
printf("ShowState:%d\n", window->showState);
|
2011-08-16 08:22:00 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_TITLE)
|
|
|
|
{
|
2011-08-18 06:31:27 +04:00
|
|
|
window->titleInfo.length = window_state->titleInfo.length;
|
|
|
|
window->titleInfo.string = xmalloc(window_state->titleInfo.length);
|
|
|
|
memcpy(window->titleInfo.string, window_state->titleInfo.string, window->titleInfo.length);
|
|
|
|
freerdp_hexdump(window->titleInfo.string, window->titleInfo.length);
|
2011-08-16 08:22:00 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_OFFSET)
|
|
|
|
{
|
|
|
|
window->clientOffsetX = window_state->clientOffsetX;
|
|
|
|
window->clientOffsetY = window_state->clientOffsetY;
|
2011-08-17 22:13:44 +04:00
|
|
|
|
|
|
|
printf("Client Area Offset: (%d, %d)\n",
|
|
|
|
window->clientOffsetX, window->clientOffsetY);
|
2011-08-16 08:22:00 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_SIZE)
|
|
|
|
{
|
|
|
|
window->clientAreaWidth = window_state->clientAreaWidth;
|
|
|
|
window->clientAreaHeight = window_state->clientAreaHeight;
|
2011-08-17 22:13:44 +04:00
|
|
|
|
|
|
|
printf("Client Area Size: (%d, %d)\n",
|
|
|
|
window->clientAreaWidth, window->clientAreaHeight);
|
2011-08-16 08:22:00 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_RP_CONTENT)
|
|
|
|
{
|
|
|
|
window->RPContent = window_state->RPContent;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_ROOT_PARENT)
|
|
|
|
{
|
|
|
|
window->rootParentHandle = window_state->rootParentHandle;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_OFFSET)
|
|
|
|
{
|
|
|
|
window->windowOffsetX = window_state->windowOffsetX;
|
|
|
|
window->windowOffsetY = window_state->windowOffsetY;
|
2011-08-17 22:13:44 +04:00
|
|
|
|
|
|
|
printf("Window Offset: (%d, %d)\n",
|
|
|
|
window->windowOffsetX, window->windowOffsetY);
|
2011-08-16 08:22:00 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_CLIENT_DELTA)
|
|
|
|
{
|
|
|
|
window->windowClientDeltaX = window_state->windowClientDeltaX;
|
|
|
|
window->windowClientDeltaY = window_state->windowClientDeltaY;
|
2011-08-17 22:13:44 +04:00
|
|
|
|
|
|
|
printf("Window Client Delta: (%d, %d)\n",
|
|
|
|
window->windowClientDeltaX, window->windowClientDeltaY);
|
2011-08-16 08:22:00 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_SIZE)
|
|
|
|
{
|
|
|
|
window->windowWidth = window_state->windowWidth;
|
|
|
|
window->windowHeight = window_state->windowHeight;
|
2011-08-17 22:13:44 +04:00
|
|
|
|
|
|
|
printf("Window Size: (%d, %d)\n",
|
|
|
|
window->windowWidth, window->windowHeight);
|
2011-08-16 08:22:00 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_RECTS)
|
|
|
|
{
|
2011-08-22 01:32:18 +04:00
|
|
|
int i;
|
2011-08-16 08:22:00 +04:00
|
|
|
|
2011-08-22 01:32:18 +04:00
|
|
|
for (i = 0; i < window_state->numWindowRects; i++)
|
|
|
|
{
|
|
|
|
printf("Window Rect #%d: left:%d top:%d right:%d bottom:%d\n", i,
|
|
|
|
window_state->windowRects->left, window_state->windowRects->top,
|
|
|
|
window_state->windowRects->right, window_state->windowRects->bottom);
|
|
|
|
}
|
2011-08-16 08:22:00 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_VIS_OFFSET)
|
|
|
|
{
|
|
|
|
window->visibleOffsetX = window_state->visibleOffsetX;
|
|
|
|
window->visibleOffsetY = window_state->visibleOffsetY;
|
2011-08-17 22:13:44 +04:00
|
|
|
|
|
|
|
printf("Window Visible Offset: (%d, %d)\n",
|
|
|
|
window->visibleOffsetX, window->visibleOffsetY);
|
2011-08-16 08:22:00 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_VISIBILITY)
|
|
|
|
{
|
2011-08-22 01:32:18 +04:00
|
|
|
int i;
|
2011-08-16 08:22:00 +04:00
|
|
|
|
2011-08-22 01:32:18 +04:00
|
|
|
for (i = 0; i < window_state->numVisibilityRects; i++)
|
|
|
|
{
|
|
|
|
printf("Visibility Rect #%d: left:%d top:%d right:%d bottom:%d\n", i,
|
|
|
|
window_state->visibilityRects->left, window_state->visibilityRects->top,
|
|
|
|
window_state->visibilityRects->right, window_state->visibilityRects->bottom);
|
|
|
|
}
|
2011-08-16 08:22:00 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-08-17 10:14:02 +04:00
|
|
|
void rail_CreateWindow(rdpRail* rail, rdpWindow* window)
|
2011-08-16 07:37:43 +04:00
|
|
|
{
|
2011-08-18 06:31:27 +04:00
|
|
|
if (window->titleInfo.length > 0)
|
|
|
|
{
|
|
|
|
window->title = freerdp_uniconv_in(rail->uniconv, window->titleInfo.string, window->titleInfo.length);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
window->title = (char*) xmalloc(sizeof("RAIL"));
|
|
|
|
memcpy(window->title, "RAIL", sizeof("RAIL"));
|
|
|
|
}
|
|
|
|
|
2011-08-17 10:14:02 +04:00
|
|
|
IFCALL(rail->CreateWindow, rail, window);
|
2011-08-16 07:37:43 +04:00
|
|
|
}
|
|
|
|
|
2011-08-18 06:50:49 +04:00
|
|
|
void rail_UpdateWindow(rdpRail* rail, rdpWindow* window)
|
2011-08-16 07:37:43 +04:00
|
|
|
{
|
2011-08-18 06:50:49 +04:00
|
|
|
if (window->fieldFlags & WINDOW_ORDER_FIELD_OWNER)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (window->fieldFlags & WINDOW_ORDER_FIELD_STYLE)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (window->fieldFlags & WINDOW_ORDER_FIELD_SHOW)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (window->fieldFlags & WINDOW_ORDER_FIELD_TITLE)
|
|
|
|
{
|
2011-08-20 06:21:09 +04:00
|
|
|
if (window->title != NULL)
|
|
|
|
xfree(window->title);
|
|
|
|
|
2011-08-18 06:50:49 +04:00
|
|
|
window->title = freerdp_uniconv_in(rail->uniconv, window->titleInfo.string, window->titleInfo.length);
|
2011-08-20 06:21:09 +04:00
|
|
|
|
|
|
|
IFCALL(rail->SetWindowText, rail, window);
|
2011-08-18 06:50:49 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (window->fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_OFFSET)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
2011-08-18 06:31:27 +04:00
|
|
|
|
2011-08-18 06:50:49 +04:00
|
|
|
if (window->fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_SIZE)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (window->fieldFlags & WINDOW_ORDER_FIELD_RP_CONTENT)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (window->fieldFlags & WINDOW_ORDER_FIELD_ROOT_PARENT)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((window->fieldFlags & WINDOW_ORDER_FIELD_WND_OFFSET) ||
|
|
|
|
(window->fieldFlags & WINDOW_ORDER_FIELD_WND_SIZE))
|
|
|
|
{
|
|
|
|
IFCALL(rail->MoveWindow, rail, window);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (window->fieldFlags & WINDOW_ORDER_FIELD_WND_CLIENT_DELTA)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (window->fieldFlags & WINDOW_ORDER_FIELD_WND_RECTS)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (window->fieldFlags & WINDOW_ORDER_FIELD_VIS_OFFSET)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (window->fieldFlags & WINDOW_ORDER_FIELD_VISIBILITY)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void rail_DestroyWindow(rdpRail* rail, rdpWindow* window)
|
|
|
|
{
|
2011-08-18 06:31:27 +04:00
|
|
|
IFCALL(rail->DestroyWindow, rail, window);
|
|
|
|
|
2011-08-16 07:37:43 +04:00
|
|
|
if (window != NULL)
|
|
|
|
{
|
|
|
|
xfree(window);
|
|
|
|
}
|
|
|
|
}
|