2011-08-16 07:37:43 +04:00
|
|
|
/**
|
2012-10-09 07:02:04 +04:00
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
2011-08-16 07:37:43 +04:00
|
|
|
* Remote Applications Integrated Locally (RAIL)
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2012-08-15 01:09:01 +04:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2012-11-22 04:22:41 +04:00
|
|
|
#include <winpr/crt.h>
|
|
|
|
|
2013-03-22 00:45:25 +04:00
|
|
|
#include <winpr/stream.h>
|
2011-08-16 07:37:43 +04:00
|
|
|
|
2011-09-02 21:29:17 +04:00
|
|
|
#include "librail.h"
|
|
|
|
|
2011-08-16 07:37:43 +04:00
|
|
|
#include <freerdp/rail/rail.h>
|
2011-08-22 01:32:18 +04:00
|
|
|
#include <freerdp/rail/window_list.h>
|
2011-08-16 07:37:43 +04:00
|
|
|
|
2011-11-22 06:07:03 +04:00
|
|
|
static void rail_WindowCreate(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* window_state)
|
2011-08-16 08:22:00 +04:00
|
|
|
{
|
2011-11-22 06:07:03 +04:00
|
|
|
rdpRail* rail = context->rail;
|
2011-08-16 08:22:00 +04:00
|
|
|
window_list_create(rail->list, orderInfo, window_state);
|
|
|
|
}
|
|
|
|
|
2011-11-22 06:07:03 +04:00
|
|
|
static void rail_WindowUpdate(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* window_state)
|
2011-08-16 08:22:00 +04:00
|
|
|
{
|
2011-11-22 06:07:03 +04:00
|
|
|
rdpRail* rail = context->rail;
|
2011-08-16 08:22:00 +04:00
|
|
|
window_list_update(rail->list, orderInfo, window_state);
|
|
|
|
}
|
|
|
|
|
2011-11-22 06:07:03 +04:00
|
|
|
static void rail_WindowDelete(rdpContext* context, WINDOW_ORDER_INFO* orderInfo)
|
2011-08-16 08:22:00 +04:00
|
|
|
{
|
2011-11-22 06:07:03 +04:00
|
|
|
rdpRail* rail = context->rail;
|
2011-08-16 08:22:00 +04:00
|
|
|
window_list_delete(rail->list, orderInfo);
|
|
|
|
}
|
|
|
|
|
2011-11-22 06:07:03 +04:00
|
|
|
static void rail_WindowIcon(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_ICON_ORDER* window_icon)
|
2011-08-22 01:32:18 +04:00
|
|
|
{
|
|
|
|
rdpIcon* icon;
|
|
|
|
rdpWindow* window;
|
2011-11-22 06:07:03 +04:00
|
|
|
rdpRail* rail = context->rail;
|
2011-08-22 01:32:18 +04:00
|
|
|
|
|
|
|
if (window_icon->iconInfo->cacheEntry != 0xFFFF)
|
|
|
|
{
|
|
|
|
/* cache icon */
|
|
|
|
}
|
|
|
|
|
|
|
|
window = window_list_get_by_id(rail->list, orderInfo->windowId);
|
2012-05-10 12:54:20 +04:00
|
|
|
if (!window)
|
|
|
|
return ;
|
2011-08-22 01:32:18 +04:00
|
|
|
|
2012-11-22 04:22:41 +04:00
|
|
|
icon = (rdpIcon*) malloc(sizeof(rdpIcon));
|
|
|
|
ZeroMemory(icon, sizeof(rdpIcon));
|
|
|
|
|
2011-08-22 01:32:18 +04:00
|
|
|
icon->entry = window_icon->iconInfo;
|
2012-10-09 10:31:28 +04:00
|
|
|
icon->big = (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_ICON_BIG) ? TRUE : FALSE;
|
2011-08-22 01:32:18 +04:00
|
|
|
|
2011-09-02 21:29:17 +04:00
|
|
|
DEBUG_RAIL("Window Icon: %dx%d@%dbpp cbBitsColor:%d cbBitsMask:%d cbColorTable:%d",
|
2011-08-22 01:32:18 +04:00
|
|
|
window_icon->iconInfo->width, window_icon->iconInfo->height, window_icon->iconInfo->bpp,
|
|
|
|
window_icon->iconInfo->cbBitsColor, window_icon->iconInfo->cbBitsMask, window_icon->iconInfo->cbColorTable);
|
|
|
|
|
|
|
|
if (icon->big)
|
|
|
|
window->bigIcon = icon;
|
|
|
|
else
|
|
|
|
window->smallIcon = icon;
|
|
|
|
|
2011-08-31 12:35:50 +04:00
|
|
|
IFCALL(rail->rail_SetWindowIcon, rail, window, icon);
|
2011-08-22 01:32:18 +04:00
|
|
|
}
|
|
|
|
|
2011-11-22 06:07:03 +04:00
|
|
|
static void rail_WindowCachedIcon(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_CACHED_ICON_ORDER* window_cached_icon)
|
2011-08-22 01:32:18 +04:00
|
|
|
{
|
2011-10-16 08:50:10 +04:00
|
|
|
|
2011-08-22 01:32:18 +04:00
|
|
|
}
|
|
|
|
|
2011-11-22 06:07:03 +04:00
|
|
|
static void rail_NotifyIconCreate(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notify_icon_state)
|
2011-08-23 05:22:05 +04:00
|
|
|
{
|
2011-10-16 08:50:10 +04:00
|
|
|
|
2011-08-23 05:22:05 +04:00
|
|
|
}
|
|
|
|
|
2011-11-22 06:07:03 +04:00
|
|
|
static void rail_NotifyIconUpdate(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notify_icon_state)
|
2011-08-23 05:22:05 +04:00
|
|
|
{
|
2011-10-16 08:50:10 +04:00
|
|
|
|
2011-08-23 05:22:05 +04:00
|
|
|
}
|
|
|
|
|
2011-11-22 06:07:03 +04:00
|
|
|
static void rail_NotifyIconDelete(rdpContext* context, WINDOW_ORDER_INFO* orderInfo)
|
2011-08-23 05:22:05 +04:00
|
|
|
{
|
2011-10-16 08:50:10 +04:00
|
|
|
|
2011-08-23 05:22:05 +04:00
|
|
|
}
|
|
|
|
|
2011-11-22 06:07:03 +04:00
|
|
|
static void rail_MonitoredDesktop(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, MONITORED_DESKTOP_ORDER* monitored_desktop)
|
2011-08-23 23:52:17 +04:00
|
|
|
{
|
2011-10-16 08:50:10 +04:00
|
|
|
|
2011-08-23 23:52:17 +04:00
|
|
|
}
|
|
|
|
|
2012-08-04 02:35:17 +04:00
|
|
|
//This is used to switch FreeRDP back to showing the full desktop under remote app mode
|
|
|
|
//to handle cases where the screen is locked, etc. The rail server informs us that it is
|
|
|
|
//no longer monitoring the desktop. Once the desktop becomes monitored again. The full desktop
|
|
|
|
//window will be automatically destroyed and we will switch back into remote app mode.
|
2011-11-22 06:07:03 +04:00
|
|
|
static void rail_NonMonitoredDesktop(rdpContext* context, WINDOW_ORDER_INFO* orderInfo)
|
2011-08-23 23:52:17 +04:00
|
|
|
{
|
2012-08-04 02:35:17 +04:00
|
|
|
rdpWindow* window;
|
|
|
|
rdpRail* rail = context->rail;
|
|
|
|
|
|
|
|
window = window_list_get_by_id(rail->list, orderInfo->windowId);
|
|
|
|
|
|
|
|
IFCALL(rail->rail_DesktopNonMonitored, rail, window);
|
2011-10-16 08:50:10 +04:00
|
|
|
|
2012-08-04 02:35:17 +04:00
|
|
|
window_list_clear(rail->list);
|
2011-08-23 23:52:17 +04:00
|
|
|
}
|
|
|
|
|
2012-08-04 02:35:17 +04:00
|
|
|
|
|
|
|
|
2011-08-16 08:22:00 +04:00
|
|
|
void rail_register_update_callbacks(rdpRail* rail, rdpUpdate* update)
|
|
|
|
{
|
2011-11-22 06:07:03 +04:00
|
|
|
rdpWindowUpdate* window = update->window;
|
|
|
|
|
|
|
|
window->WindowCreate = rail_WindowCreate;
|
|
|
|
window->WindowUpdate = rail_WindowUpdate;
|
|
|
|
window->WindowDelete = rail_WindowDelete;
|
|
|
|
window->WindowIcon = rail_WindowIcon;
|
|
|
|
window->WindowCachedIcon = rail_WindowCachedIcon;
|
|
|
|
window->NotifyIconCreate = rail_NotifyIconCreate;
|
|
|
|
window->NotifyIconUpdate = rail_NotifyIconUpdate;
|
|
|
|
window->NotifyIconDelete = rail_NotifyIconDelete;
|
|
|
|
window->MonitoredDesktop = rail_MonitoredDesktop;
|
|
|
|
window->NonMonitoredDesktop = rail_NonMonitoredDesktop;
|
2011-08-16 08:22:00 +04:00
|
|
|
}
|
|
|
|
|
2011-08-22 01:32:18 +04:00
|
|
|
rdpRail* rail_new(rdpSettings* settings)
|
2011-08-16 07:37:43 +04:00
|
|
|
{
|
|
|
|
rdpRail* rail;
|
|
|
|
|
2012-11-22 04:22:41 +04:00
|
|
|
rail = (rdpRail*) malloc(sizeof(rdpRail));
|
2011-08-16 07:37:43 +04:00
|
|
|
|
|
|
|
if (rail != NULL)
|
|
|
|
{
|
2012-11-22 04:22:41 +04:00
|
|
|
ZeroMemory(rail, sizeof(rdpRail));
|
|
|
|
|
2011-08-22 01:32:18 +04:00
|
|
|
rail->settings = settings;
|
|
|
|
rail->cache = icon_cache_new(rail);
|
2011-08-17 10:14:02 +04:00
|
|
|
rail->list = window_list_new(rail);
|
2012-11-22 04:22:41 +04:00
|
|
|
|
|
|
|
rail->clrconv = (CLRCONV*) malloc(sizeof(CLRCONV));
|
|
|
|
ZeroMemory(rail->clrconv, sizeof(CLRCONV));
|
2011-08-16 07:37:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return rail;
|
|
|
|
}
|
|
|
|
|
|
|
|
void rail_free(rdpRail* rail)
|
|
|
|
{
|
|
|
|
if (rail != NULL)
|
|
|
|
{
|
2011-08-22 01:32:18 +04:00
|
|
|
icon_cache_free(rail->cache);
|
2011-08-18 06:31:27 +04:00
|
|
|
window_list_free(rail->list);
|
2012-10-09 07:21:26 +04:00
|
|
|
free(rail->clrconv);
|
|
|
|
free(rail);
|
2011-08-16 07:37:43 +04:00
|
|
|
}
|
|
|
|
}
|