2011-08-16 08:22:00 +04:00
|
|
|
/**
|
2012-10-09 07:02:04 +04:00
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
2011-08-16 08:22:00 +04:00
|
|
|
* X11 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:20:53 +04:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2011-10-27 21:29:16 +04:00
|
|
|
#include <X11/Xlib.h>
|
|
|
|
#include <X11/Xutil.h>
|
|
|
|
|
2014-08-18 19:23:13 +04:00
|
|
|
#include <winpr/wlog.h>
|
2012-12-14 08:54:54 +04:00
|
|
|
#include <winpr/print.h>
|
2014-11-12 02:32:18 +03:00
|
|
|
|
2011-08-17 10:14:02 +04:00
|
|
|
#include <freerdp/rail/rail.h>
|
|
|
|
|
2011-08-20 02:46:10 +04:00
|
|
|
#include "xf_window.h"
|
2011-08-16 08:22:00 +04:00
|
|
|
#include "xf_rail.h"
|
|
|
|
|
2014-09-12 19:13:01 +04:00
|
|
|
#define TAG CLIENT_TAG("x11")
|
2014-08-18 19:23:13 +04:00
|
|
|
|
2014-11-12 00:35:30 +03:00
|
|
|
const char* error_code_names[] =
|
|
|
|
{
|
|
|
|
"RAIL_EXEC_S_OK",
|
|
|
|
"RAIL_EXEC_E_HOOK_NOT_LOADED",
|
|
|
|
"RAIL_EXEC_E_DECODE_FAILED",
|
|
|
|
"RAIL_EXEC_E_NOT_IN_ALLOWLIST",
|
|
|
|
"RAIL_EXEC_E_FILE_NOT_FOUND",
|
|
|
|
"RAIL_EXEC_E_FAIL",
|
|
|
|
"RAIL_EXEC_E_SESSION_LOCKED"
|
|
|
|
};
|
|
|
|
|
|
|
|
const char* movetype_names[] =
|
|
|
|
{
|
|
|
|
"(invalid)",
|
|
|
|
"RAIL_WMSZ_LEFT",
|
|
|
|
"RAIL_WMSZ_RIGHT",
|
|
|
|
"RAIL_WMSZ_TOP",
|
|
|
|
"RAIL_WMSZ_TOPLEFT",
|
|
|
|
"RAIL_WMSZ_TOPRIGHT",
|
|
|
|
"RAIL_WMSZ_BOTTOM",
|
|
|
|
"RAIL_WMSZ_BOTTOMLEFT",
|
|
|
|
"RAIL_WMSZ_BOTTOMRIGHT",
|
|
|
|
"RAIL_WMSZ_MOVE",
|
|
|
|
"RAIL_WMSZ_KEYMOVE",
|
|
|
|
"RAIL_WMSZ_KEYSIZE"
|
|
|
|
};
|
|
|
|
|
2014-08-18 21:34:47 +04:00
|
|
|
void xf_rail_enable_remoteapp_mode(xfContext* xfc)
|
2012-01-02 13:27:04 +04:00
|
|
|
{
|
2013-06-13 02:57:25 +04:00
|
|
|
if (!xfc->remote_app)
|
2012-01-02 13:27:04 +04:00
|
|
|
{
|
2013-06-13 02:57:25 +04:00
|
|
|
xfc->remote_app = TRUE;
|
|
|
|
xfc->drawable = DefaultRootWindow(xfc->display);
|
2014-11-12 06:27:33 +03:00
|
|
|
xf_DestroyDesktopWindow(xfc, xfc->window);
|
2013-06-13 02:57:25 +04:00
|
|
|
xfc->window = NULL;
|
2012-01-02 13:27:04 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-08-18 21:34:47 +04:00
|
|
|
void xf_rail_disable_remoteapp_mode(xfContext* xfc)
|
2012-08-04 02:35:17 +04:00
|
|
|
{
|
2013-06-13 02:57:25 +04:00
|
|
|
if (xfc->remote_app)
|
2012-08-14 23:59:11 +04:00
|
|
|
{
|
2013-06-13 02:57:25 +04:00
|
|
|
xfc->remote_app = FALSE;
|
|
|
|
xf_create_window(xfc);
|
2012-08-14 23:59:11 +04:00
|
|
|
}
|
2012-08-04 02:35:17 +04:00
|
|
|
}
|
|
|
|
|
2014-11-13 00:42:32 +03:00
|
|
|
void xf_rail_send_activate(xfContext* xfc, Window xwindow, BOOL enabled)
|
|
|
|
{
|
|
|
|
rdpRail* rail;
|
|
|
|
rdpWindow* rail_window;
|
|
|
|
RAIL_ACTIVATE_ORDER activate;
|
|
|
|
|
|
|
|
rail = ((rdpContext*) xfc)->rail;
|
|
|
|
rail_window = window_list_get_by_extra_id(rail->list, (void*) xwindow);
|
|
|
|
|
|
|
|
if (!rail_window)
|
|
|
|
return;
|
|
|
|
|
|
|
|
activate.windowId = rail_window->windowId;
|
|
|
|
activate.enabled = enabled;
|
|
|
|
|
|
|
|
xfc->rail->ClientActivate(xfc->rail, &activate);
|
|
|
|
}
|
|
|
|
|
|
|
|
void xf_rail_send_client_system_command(xfContext* xfc, UINT32 windowId, UINT16 command)
|
|
|
|
{
|
|
|
|
RAIL_SYSCOMMAND_ORDER syscommand;
|
|
|
|
|
|
|
|
syscommand.windowId = windowId;
|
|
|
|
syscommand.command = command;
|
|
|
|
|
|
|
|
xfc->rail->ClientSystemCommand(xfc->rail, &syscommand);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The position of the X window can become out of sync with the RDP window
|
|
|
|
* if the X window is moved locally by the window manager. In this event
|
|
|
|
* send an update to the RDP server informing it of the new window position
|
|
|
|
* and size.
|
|
|
|
*/
|
|
|
|
void xf_rail_adjust_position(xfContext* xfc, xfAppWindow* appWindow)
|
|
|
|
{
|
|
|
|
#ifdef OLD_X11_RAIL
|
|
|
|
rdpWindow* window;
|
|
|
|
RAIL_WINDOW_MOVE_ORDER windowMove;
|
|
|
|
|
|
|
|
window = appWindow->window;
|
|
|
|
|
|
|
|
if (!appWindow->is_mapped || appWindow->local_move.state != LMS_NOT_ACTIVE)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* If current window position disagrees with RDP window position, send update to RDP server */
|
|
|
|
if (appWindow->x != window->visibleOffsetX ||
|
|
|
|
appWindow->y != window->visibleOffsetY ||
|
|
|
|
appWindow->width != window->windowWidth ||
|
|
|
|
appWindow->height != window->windowHeight)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Although the rail server can give negative window coordinates when updating windowOffsetX and windowOffsetY,
|
|
|
|
* we can only send unsigned integers to the rail server. Therefore, we always bring negative coordinates up to 0
|
|
|
|
* when attempting to adjust the rail window.
|
|
|
|
*/
|
|
|
|
UINT32 offsetX = 0;
|
|
|
|
UINT32 offsetY = 0;
|
|
|
|
|
|
|
|
if (window->windowOffsetX < 0)
|
|
|
|
offsetX = offsetX - window->windowOffsetX;
|
|
|
|
|
|
|
|
if (window->windowOffsetY < 0)
|
|
|
|
offsetY = offsetY - window->windowOffsetY;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* windowOffset corresponds to the window location on the rail server
|
|
|
|
* but our local window is based on the visibleOffset since using the windowOffset
|
|
|
|
* can result in blank areas for a maximized window
|
|
|
|
*/
|
|
|
|
windowMove.windowId = window->windowId;
|
|
|
|
/*
|
|
|
|
* Calculate new offsets for the rail server window
|
|
|
|
* Negative offset correction + rail server window offset + (difference in visibleOffset and new window local offset)
|
|
|
|
*/
|
|
|
|
windowMove.left = offsetX + window->windowOffsetX + (appWindow->x - window->visibleOffsetX);
|
|
|
|
windowMove.top = offsetY + window->windowOffsetY + (appWindow->y - window->visibleOffsetY);
|
|
|
|
windowMove.right = windowMove.left + appWindow->width;
|
|
|
|
windowMove.bottom = windowMove.top + appWindow->height;
|
|
|
|
|
|
|
|
xfc->rail->ClientWindowMove(xfc->rail, &windowMove);
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
UINT32 offsetX = 0;
|
|
|
|
UINT32 offsetY = 0;
|
|
|
|
RAIL_WINDOW_MOVE_ORDER windowMove;
|
|
|
|
|
|
|
|
if (!appWindow->is_mapped || appWindow->local_move.state != LMS_NOT_ACTIVE)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* If current window position disagrees with RDP window position, send update to RDP server */
|
|
|
|
if (appWindow->x != appWindow->visibleOffsetX ||
|
|
|
|
appWindow->y != appWindow->visibleOffsetY ||
|
|
|
|
appWindow->width != appWindow->windowWidth ||
|
|
|
|
appWindow->height != appWindow->windowHeight)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Although the rail server can give negative window coordinates when updating windowOffsetX and windowOffsetY,
|
|
|
|
* we can only send unsigned integers to the rail server. Therefore, we always bring negative coordinates up to 0
|
|
|
|
* when attempting to adjust the rail window.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (appWindow->windowOffsetX < 0)
|
|
|
|
offsetX = offsetX - appWindow->windowOffsetX;
|
|
|
|
|
|
|
|
if (appWindow->windowOffsetY < 0)
|
|
|
|
offsetY = offsetY - appWindow->windowOffsetY;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* windowOffset corresponds to the window location on the rail server
|
|
|
|
* but our local window is based on the visibleOffset since using the windowOffset
|
|
|
|
* can result in blank areas for a maximized window
|
|
|
|
*/
|
|
|
|
windowMove.windowId = appWindow->windowId;
|
|
|
|
/*
|
|
|
|
* Calculate new offsets for the rail server window
|
|
|
|
* Negative offset correction + rail server window offset + (difference in visibleOffset and new window local offset)
|
|
|
|
*/
|
|
|
|
windowMove.left = offsetX + appWindow->windowOffsetX + (appWindow->x - appWindow->visibleOffsetX);
|
|
|
|
windowMove.top = offsetY + appWindow->windowOffsetY + (appWindow->y - appWindow->visibleOffsetY);
|
|
|
|
windowMove.right = windowMove.left + appWindow->width;
|
|
|
|
windowMove.bottom = windowMove.top + appWindow->height;
|
|
|
|
|
|
|
|
xfc->rail->ClientWindowMove(xfc->rail, &windowMove);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void xf_rail_end_local_move(xfContext* xfc, xfAppWindow* appWindow)
|
|
|
|
{
|
|
|
|
#ifdef OLD_X11_RAIL
|
|
|
|
int x, y;
|
|
|
|
int child_x;
|
|
|
|
int child_y;
|
|
|
|
rdpWindow* window;
|
|
|
|
unsigned int mask;
|
|
|
|
Window root_window;
|
|
|
|
Window child_window;
|
|
|
|
RAIL_WINDOW_MOVE_ORDER windowMove;
|
|
|
|
rdpInput* input = xfc->instance->input;
|
|
|
|
|
|
|
|
window = appWindow->window;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Although the rail server can give negative window coordinates when updating windowOffsetX and windowOffsetY,
|
|
|
|
* we can only send unsigned integers to the rail server. Therefore, we always bring negative coordinates up to 0 when
|
|
|
|
* attempting to adjust the rail window.
|
|
|
|
*/
|
|
|
|
UINT32 offsetX = 0;
|
|
|
|
UINT32 offsetY = 0;
|
|
|
|
|
|
|
|
if (window->windowOffsetX < 0)
|
|
|
|
offsetX = offsetX - window->windowOffsetX;
|
|
|
|
|
|
|
|
if (window->windowOffsetY < 0)
|
|
|
|
offsetY = offsetY - window->windowOffsetY;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* For keyboard moves send and explicit update to RDP server
|
|
|
|
*/
|
|
|
|
windowMove.windowId = window->windowId;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Calculate new offsets for the rail server window
|
|
|
|
* Negative offset correction + rail server window offset + (difference in visibleOffset and new window local offset)
|
|
|
|
*/
|
|
|
|
windowMove.left = offsetX + window->windowOffsetX + (appWindow->x - window->visibleOffsetX);
|
|
|
|
windowMove.top = offsetY + window->windowOffsetY + (appWindow->y - window->visibleOffsetY);
|
|
|
|
windowMove.right = windowMove.left + appWindow->width; /* In the update to RDP the position is one past the window */
|
|
|
|
windowMove.bottom = windowMove.top + appWindow->height;
|
|
|
|
|
|
|
|
xfc->rail->ClientWindowMove(xfc->rail, &windowMove);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Simulate button up at new position to end the local move (per RDP spec)
|
|
|
|
*/
|
|
|
|
XQueryPointer(xfc->display, appWindow->handle,
|
|
|
|
&root_window, &child_window, &x, &y, &child_x, &child_y, &mask);
|
|
|
|
|
|
|
|
input->MouseEvent(input, PTR_FLAGS_BUTTON1, x, y);
|
|
|
|
|
|
|
|
/* only send the mouse coordinates if not a keyboard move or size */
|
|
|
|
if ((appWindow->local_move.direction != _NET_WM_MOVERESIZE_MOVE_KEYBOARD) &&
|
|
|
|
(appWindow->local_move.direction != _NET_WM_MOVERESIZE_SIZE_KEYBOARD))
|
|
|
|
{
|
|
|
|
input->MouseEvent(input, PTR_FLAGS_BUTTON1, x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Proactively update the RAIL window dimensions. There is a race condition where
|
|
|
|
* we can start to receive GDI orders for the new window dimensions before we
|
|
|
|
* receive the RAIL ORDER for the new window size. This avoids that race condition.
|
|
|
|
*/
|
|
|
|
window->windowOffsetX = offsetX + window->windowOffsetX + (appWindow->x - window->visibleOffsetX);
|
|
|
|
window->windowOffsetY = offsetY + window->windowOffsetY + (appWindow->y - window->visibleOffsetY);
|
|
|
|
window->windowWidth = appWindow->width;
|
|
|
|
window->windowHeight = appWindow->height;
|
|
|
|
appWindow->local_move.state = LMS_TERMINATING;
|
|
|
|
#else
|
|
|
|
int x, y;
|
|
|
|
int child_x;
|
|
|
|
int child_y;
|
|
|
|
UINT32 offsetX = 0;
|
|
|
|
UINT32 offsetY = 0;
|
|
|
|
unsigned int mask;
|
|
|
|
Window root_window;
|
|
|
|
Window child_window;
|
|
|
|
RAIL_WINDOW_MOVE_ORDER windowMove;
|
|
|
|
rdpInput* input = xfc->instance->input;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Although the rail server can give negative window coordinates when updating windowOffsetX and windowOffsetY,
|
|
|
|
* we can only send unsigned integers to the rail server. Therefore, we always bring negative coordinates up to 0 when
|
|
|
|
* attempting to adjust the rail window.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (appWindow->windowOffsetX < 0)
|
|
|
|
offsetX = offsetX - appWindow->windowOffsetX;
|
|
|
|
|
|
|
|
if (appWindow->windowOffsetY < 0)
|
|
|
|
offsetY = offsetY - appWindow->windowOffsetY;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* For keyboard moves send and explicit update to RDP server
|
|
|
|
*/
|
|
|
|
windowMove.windowId = appWindow->windowId;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Calculate new offsets for the rail server window
|
|
|
|
* Negative offset correction + rail server window offset + (difference in visibleOffset and new window local offset)
|
|
|
|
*/
|
|
|
|
windowMove.left = offsetX + appWindow->windowOffsetX + (appWindow->x - appWindow->visibleOffsetX);
|
|
|
|
windowMove.top = offsetY + appWindow->windowOffsetY + (appWindow->y - appWindow->visibleOffsetY);
|
|
|
|
windowMove.right = windowMove.left + appWindow->width; /* In the update to RDP the position is one past the window */
|
|
|
|
windowMove.bottom = windowMove.top + appWindow->height;
|
|
|
|
|
|
|
|
xfc->rail->ClientWindowMove(xfc->rail, &windowMove);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Simulate button up at new position to end the local move (per RDP spec)
|
|
|
|
*/
|
|
|
|
XQueryPointer(xfc->display, appWindow->handle,
|
|
|
|
&root_window, &child_window, &x, &y, &child_x, &child_y, &mask);
|
|
|
|
|
|
|
|
input->MouseEvent(input, PTR_FLAGS_BUTTON1, x, y);
|
|
|
|
|
|
|
|
/* only send the mouse coordinates if not a keyboard move or size */
|
|
|
|
if ((appWindow->local_move.direction != _NET_WM_MOVERESIZE_MOVE_KEYBOARD) &&
|
|
|
|
(appWindow->local_move.direction != _NET_WM_MOVERESIZE_SIZE_KEYBOARD))
|
|
|
|
{
|
|
|
|
input->MouseEvent(input, PTR_FLAGS_BUTTON1, x, y);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Proactively update the RAIL window dimensions. There is a race condition where
|
|
|
|
* we can start to receive GDI orders for the new window dimensions before we
|
|
|
|
* receive the RAIL ORDER for the new window size. This avoids that race condition.
|
|
|
|
*/
|
|
|
|
appWindow->windowOffsetX = offsetX + appWindow->windowOffsetX + (appWindow->x - appWindow->visibleOffsetX);
|
|
|
|
appWindow->windowOffsetY = offsetY + appWindow->windowOffsetY + (appWindow->y - appWindow->visibleOffsetY);
|
|
|
|
appWindow->windowWidth = appWindow->width;
|
|
|
|
appWindow->windowHeight = appWindow->height;
|
|
|
|
appWindow->local_move.state = LMS_TERMINATING;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
2014-11-12 02:32:18 +03:00
|
|
|
void xf_rail_invalidate_region(xfContext* xfc, REGION16* invalidRegion)
|
|
|
|
{
|
|
|
|
int index;
|
|
|
|
int count;
|
|
|
|
RECTANGLE_16 updateRect;
|
|
|
|
RECTANGLE_16 windowRect;
|
|
|
|
ULONG_PTR* pKeys = NULL;
|
2014-11-12 06:27:33 +03:00
|
|
|
xfAppWindow* appWindow;
|
2014-11-12 02:32:18 +03:00
|
|
|
const RECTANGLE_16* extents;
|
|
|
|
REGION16 windowInvalidRegion;
|
|
|
|
|
|
|
|
region16_init(&windowInvalidRegion);
|
|
|
|
|
|
|
|
count = HashTable_GetKeys(xfc->railWindows, &pKeys);
|
|
|
|
|
|
|
|
for (index = 0; index < count; index++)
|
|
|
|
{
|
2014-11-12 06:27:33 +03:00
|
|
|
appWindow = (xfAppWindow*) HashTable_GetItemValue(xfc->railWindows, (void*) pKeys[index]);
|
2014-11-12 02:32:18 +03:00
|
|
|
|
2014-11-12 06:27:33 +03:00
|
|
|
if (appWindow)
|
2014-11-12 02:32:18 +03:00
|
|
|
{
|
2014-11-12 06:27:33 +03:00
|
|
|
windowRect.left = appWindow->x;
|
|
|
|
windowRect.top = appWindow->y;
|
|
|
|
windowRect.right = appWindow->x + appWindow->width;
|
|
|
|
windowRect.bottom = appWindow->y + appWindow->height;
|
2014-11-12 02:32:18 +03:00
|
|
|
|
|
|
|
region16_clear(&windowInvalidRegion);
|
|
|
|
region16_intersect_rect(&windowInvalidRegion, invalidRegion, &windowRect);
|
|
|
|
|
|
|
|
if (!region16_is_empty(&windowInvalidRegion))
|
|
|
|
{
|
|
|
|
extents = region16_extents(&windowInvalidRegion);
|
|
|
|
|
2014-11-12 06:27:33 +03:00
|
|
|
updateRect.left = extents->left - appWindow->x;
|
|
|
|
updateRect.top = extents->top - appWindow->y;
|
|
|
|
updateRect.right = extents->right - appWindow->x;
|
|
|
|
updateRect.bottom = extents->bottom - appWindow->y;
|
2014-11-12 02:32:18 +03:00
|
|
|
|
2014-11-12 06:27:33 +03:00
|
|
|
if (appWindow)
|
2014-11-12 04:26:47 +03:00
|
|
|
{
|
2014-11-12 06:27:33 +03:00
|
|
|
xf_UpdateWindowArea(xfc, appWindow, updateRect.left, updateRect.top,
|
2014-11-12 04:26:47 +03:00
|
|
|
updateRect.right - updateRect.left,
|
|
|
|
updateRect.bottom - updateRect.top);
|
|
|
|
}
|
2014-11-12 02:32:18 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
region16_uninit(&windowInvalidRegion);
|
|
|
|
}
|
|
|
|
|
|
|
|
void xf_rail_paint(xfContext* xfc, INT32 uleft, INT32 utop, UINT32 uright, UINT32 ubottom)
|
2011-08-17 10:14:02 +04:00
|
|
|
{
|
2014-11-13 00:42:32 +03:00
|
|
|
#ifndef OLD_X11_RAIL
|
|
|
|
REGION16 invalidRegion;
|
|
|
|
RECTANGLE_16 invalidRect;
|
|
|
|
|
|
|
|
invalidRect.left = uleft;
|
|
|
|
invalidRect.top = utop;
|
|
|
|
invalidRect.right = uright;
|
|
|
|
invalidRect.bottom = ubottom;
|
|
|
|
|
|
|
|
region16_init(&invalidRegion);
|
|
|
|
region16_union_rect(&invalidRegion, &invalidRegion, &invalidRect);
|
|
|
|
|
|
|
|
xf_rail_invalidate_region(xfc, &invalidRegion);
|
|
|
|
|
|
|
|
region16_uninit(&invalidRegion);
|
|
|
|
#else
|
2014-11-12 02:32:18 +03:00
|
|
|
rdpRail* rail;
|
2014-08-18 21:34:47 +04:00
|
|
|
rdpWindow* window;
|
2014-11-12 06:27:33 +03:00
|
|
|
xfAppWindow* appWindow;
|
2012-10-09 10:38:39 +04:00
|
|
|
BOOL intersect;
|
2012-10-09 11:26:39 +04:00
|
|
|
UINT32 iwidth, iheight;
|
|
|
|
INT32 ileft, itop;
|
|
|
|
UINT32 iright, ibottom;
|
2014-08-18 19:23:13 +04:00
|
|
|
INT32 wleft, wtop;
|
2012-10-09 11:26:39 +04:00
|
|
|
UINT32 wright, wbottom;
|
2014-11-12 02:32:18 +03:00
|
|
|
|
|
|
|
rail = ((rdpContext*) xfc)->rail;
|
|
|
|
|
2011-08-17 10:14:02 +04:00
|
|
|
window_list_rewind(rail->list);
|
|
|
|
|
|
|
|
while (window_list_has_next(rail->list))
|
|
|
|
{
|
|
|
|
window = window_list_get_next(rail->list);
|
2014-11-12 06:27:33 +03:00
|
|
|
appWindow = (xfAppWindow*) window->extra;
|
2011-08-17 10:14:02 +04:00
|
|
|
|
2014-08-18 19:23:13 +04:00
|
|
|
/* RDP can have zero width or height windows. X cannot, so we ignore these. */
|
2012-01-14 04:07:27 +04:00
|
|
|
|
2014-08-18 19:23:13 +04:00
|
|
|
if ((window->windowWidth == 0) || (window->windowHeight == 0))
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2012-01-14 04:07:27 +04:00
|
|
|
|
2012-08-04 02:35:17 +04:00
|
|
|
wleft = window->visibleOffsetX;
|
|
|
|
wtop = window->visibleOffsetY;
|
|
|
|
wright = window->visibleOffsetX + window->windowWidth - 1;
|
|
|
|
wbottom = window->visibleOffsetY + window->windowHeight - 1;
|
2011-09-23 05:23:01 +04:00
|
|
|
ileft = MAX(uleft, wleft);
|
|
|
|
itop = MAX(utop, wtop);
|
|
|
|
iright = MIN(uright, wright);
|
|
|
|
ibottom = MIN(ubottom, wbottom);
|
|
|
|
iwidth = iright - ileft + 1;
|
|
|
|
iheight = ibottom - itop + 1;
|
2012-10-09 10:31:28 +04:00
|
|
|
intersect = ((iright > ileft) && (ibottom > itop)) ? TRUE : FALSE;
|
2011-08-17 10:14:02 +04:00
|
|
|
|
2011-08-19 20:43:44 +04:00
|
|
|
if (intersect)
|
|
|
|
{
|
2014-11-12 06:27:33 +03:00
|
|
|
xf_UpdateWindowArea(xfc, appWindow, ileft - wleft, itop - wtop, iwidth, iheight);
|
2011-08-19 20:43:44 +04:00
|
|
|
}
|
2011-08-17 10:14:02 +04:00
|
|
|
}
|
2014-11-13 00:42:32 +03:00
|
|
|
#endif
|
2011-09-23 05:23:01 +04:00
|
|
|
}
|
2011-08-19 20:43:44 +04:00
|
|
|
|
2014-11-13 00:42:32 +03:00
|
|
|
#ifdef OLD_X11_RAIL
|
2012-08-04 02:35:17 +04:00
|
|
|
|
2014-08-18 21:34:47 +04:00
|
|
|
static void xf_rail_CreateWindow(rdpRail* rail, rdpWindow* window)
|
2011-08-17 10:14:02 +04:00
|
|
|
{
|
2014-08-18 21:34:47 +04:00
|
|
|
xfContext* xfc;
|
2014-11-12 06:27:33 +03:00
|
|
|
xfAppWindow* appWindow;
|
|
|
|
|
2014-08-18 21:34:47 +04:00
|
|
|
xfc = (xfContext*) rail->extra;
|
2014-11-12 00:35:30 +03:00
|
|
|
|
2013-06-13 02:57:25 +04:00
|
|
|
xf_rail_enable_remoteapp_mode(xfc);
|
2014-11-12 00:35:30 +03:00
|
|
|
|
2014-11-12 06:27:33 +03:00
|
|
|
appWindow = xf_CreateWindow(xfc, window, window->windowOffsetX, window->windowOffsetY,
|
2014-11-12 00:35:30 +03:00
|
|
|
window->windowWidth, window->windowHeight, window->windowId);
|
|
|
|
|
2014-11-12 06:27:33 +03:00
|
|
|
xf_SetWindowStyle(xfc, appWindow, window->style, window->extendedStyle);
|
|
|
|
xf_SetWindowText(xfc, appWindow, window->title);
|
|
|
|
|
|
|
|
window->extra = (void*) appWindow;
|
|
|
|
window->extraId = (void*) appWindow->handle;
|
2011-08-17 10:14:02 +04:00
|
|
|
}
|
|
|
|
|
2014-08-18 21:34:47 +04:00
|
|
|
static void xf_rail_MoveWindow(rdpRail* rail, rdpWindow* window)
|
2011-08-18 06:50:49 +04:00
|
|
|
{
|
2014-08-18 21:34:47 +04:00
|
|
|
xfContext* xfc;
|
2014-11-12 06:27:33 +03:00
|
|
|
xfAppWindow* appWindow;
|
|
|
|
|
2014-08-18 21:34:47 +04:00
|
|
|
xfc = (xfContext*) rail->extra;
|
2014-11-12 06:27:33 +03:00
|
|
|
appWindow = (xfAppWindow*) window->extra;
|
2011-08-18 06:50:49 +04:00
|
|
|
|
2012-11-19 22:26:56 +04:00
|
|
|
/*
|
|
|
|
* The rail server like to set the window to a small size when it is minimized even though it is hidden
|
|
|
|
* in some cases this can cause the window not to restore back to its original size. Therefore we don't
|
|
|
|
* update our local window when that rail window state is minimized
|
|
|
|
*/
|
2014-11-12 06:27:33 +03:00
|
|
|
if (appWindow->rail_state == WINDOW_SHOW_MINIMIZED)
|
2014-08-18 19:23:13 +04:00
|
|
|
return;
|
2012-08-04 02:35:17 +04:00
|
|
|
|
2012-11-19 22:26:56 +04:00
|
|
|
/* Do nothing if window is already in the correct position */
|
2014-11-12 06:27:33 +03:00
|
|
|
if (appWindow->x == window->visibleOffsetX &&
|
|
|
|
appWindow->y == window->visibleOffsetY &&
|
|
|
|
appWindow->width == window->windowWidth &&
|
|
|
|
appWindow->height == window->windowHeight)
|
2014-08-18 19:23:13 +04:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Just ensure entire window area is updated to handle cases where we
|
|
|
|
* have drawn locally before getting new bitmap from the server
|
|
|
|
*/
|
2014-11-12 06:27:33 +03:00
|
|
|
xf_UpdateWindowArea(xfc, appWindow, 0, 0, window->windowWidth, window->windowHeight);
|
2014-08-18 19:23:13 +04:00
|
|
|
return;
|
|
|
|
}
|
2012-08-04 02:35:17 +04:00
|
|
|
|
2014-11-12 06:27:33 +03:00
|
|
|
xf_MoveWindow(xfc, appWindow, window->visibleOffsetX, window->visibleOffsetY,
|
2014-11-12 01:49:29 +03:00
|
|
|
window->windowWidth, window->windowHeight);
|
2011-08-18 06:50:49 +04:00
|
|
|
}
|
|
|
|
|
2014-08-18 21:34:47 +04:00
|
|
|
static void xf_rail_ShowWindow(rdpRail* rail, rdpWindow* window, BYTE state)
|
2011-08-22 07:15:19 +04:00
|
|
|
{
|
2014-08-18 21:34:47 +04:00
|
|
|
xfContext* xfc;
|
2014-11-12 06:27:33 +03:00
|
|
|
xfAppWindow* appWindow;
|
|
|
|
|
2014-08-18 21:34:47 +04:00
|
|
|
xfc = (xfContext*) rail->extra;
|
2014-11-12 06:27:33 +03:00
|
|
|
appWindow = (xfAppWindow*) window->extra;
|
|
|
|
|
|
|
|
xf_ShowWindow(xfc, appWindow, state);
|
2011-08-22 07:15:19 +04:00
|
|
|
}
|
|
|
|
|
2014-08-18 21:34:47 +04:00
|
|
|
static void xf_rail_SetWindowText(rdpRail* rail, rdpWindow* window)
|
2011-08-20 06:21:09 +04:00
|
|
|
{
|
2014-08-18 21:34:47 +04:00
|
|
|
xfContext* xfc;
|
2014-11-12 06:27:33 +03:00
|
|
|
xfAppWindow* appWindow;
|
|
|
|
|
2014-08-18 21:34:47 +04:00
|
|
|
xfc = (xfContext*) rail->extra;
|
2014-11-12 06:27:33 +03:00
|
|
|
appWindow = (xfAppWindow*) window->extra;
|
|
|
|
|
|
|
|
xf_SetWindowText(xfc, appWindow, window->title);
|
2011-08-20 06:21:09 +04:00
|
|
|
}
|
|
|
|
|
2014-08-18 21:34:47 +04:00
|
|
|
static void xf_rail_SetWindowIcon(rdpRail* rail, rdpWindow* window, rdpIcon* icon)
|
2011-08-22 01:32:18 +04:00
|
|
|
{
|
2014-08-18 21:34:47 +04:00
|
|
|
xfContext* xfc;
|
2014-11-12 06:27:33 +03:00
|
|
|
xfAppWindow* appWindow;
|
|
|
|
|
2014-08-18 21:34:47 +04:00
|
|
|
xfc = (xfContext*) rail->extra;
|
2014-11-12 06:27:33 +03:00
|
|
|
appWindow = (xfAppWindow*) window->extra;
|
2014-11-12 00:35:30 +03:00
|
|
|
|
2011-09-14 03:03:06 +04:00
|
|
|
icon->extra = freerdp_icon_convert(icon->entry->bitsColor, NULL, icon->entry->bitsMask,
|
2014-10-22 06:19:11 +04:00
|
|
|
icon->entry->width, icon->entry->height, icon->entry->bpp, rail->clrconv);
|
2014-11-12 00:35:30 +03:00
|
|
|
|
2014-11-12 06:27:33 +03:00
|
|
|
xf_SetWindowIcon(xfc, appWindow, icon);
|
2011-08-22 01:32:18 +04:00
|
|
|
}
|
|
|
|
|
2014-08-18 21:34:47 +04:00
|
|
|
static void xf_rail_SetWindowRects(rdpRail* rail, rdpWindow* window)
|
2011-08-23 00:06:12 +04:00
|
|
|
{
|
2014-08-18 21:34:47 +04:00
|
|
|
xfContext* xfc;
|
2014-11-12 06:27:33 +03:00
|
|
|
xfAppWindow* appWindow;
|
|
|
|
|
2014-08-18 21:34:47 +04:00
|
|
|
xfc = (xfContext*) rail->extra;
|
2014-11-12 06:27:33 +03:00
|
|
|
appWindow = (xfAppWindow*) window->extra;
|
2014-11-12 00:35:30 +03:00
|
|
|
|
2014-11-12 06:27:33 +03:00
|
|
|
xf_SetWindowRects(xfc, appWindow, window->windowRects, window->numWindowRects);
|
2011-08-23 00:06:12 +04:00
|
|
|
}
|
|
|
|
|
2014-08-18 21:34:47 +04:00
|
|
|
static void xf_rail_SetWindowVisibilityRects(rdpRail* rail, rdpWindow* window)
|
2011-08-30 22:21:16 +04:00
|
|
|
{
|
2014-08-18 21:34:47 +04:00
|
|
|
xfContext* xfc;
|
2014-11-12 06:27:33 +03:00
|
|
|
xfAppWindow* appWindow;
|
|
|
|
|
2014-08-18 21:34:47 +04:00
|
|
|
xfc = (xfContext*) rail->extra;
|
2014-11-12 06:27:33 +03:00
|
|
|
appWindow = (xfAppWindow*) window->extra;
|
|
|
|
|
|
|
|
xf_SetWindowVisibilityRects(xfc, appWindow, window->windowRects, window->numWindowRects);
|
2011-08-30 22:21:16 +04:00
|
|
|
}
|
|
|
|
|
2014-08-18 21:34:47 +04:00
|
|
|
static void xf_rail_DestroyWindow(rdpRail* rail, rdpWindow* window)
|
2011-08-18 06:31:27 +04:00
|
|
|
{
|
2014-08-18 21:34:47 +04:00
|
|
|
xfContext* xfc;
|
2014-11-12 06:27:33 +03:00
|
|
|
xfAppWindow* appWindow;
|
|
|
|
|
2014-08-18 21:34:47 +04:00
|
|
|
xfc = (xfContext*) rail->extra;
|
2014-11-12 06:27:33 +03:00
|
|
|
appWindow = (xfAppWindow*) window->extra;
|
|
|
|
|
|
|
|
xf_DestroyWindow(xfc, appWindow);
|
2011-08-18 06:31:27 +04:00
|
|
|
}
|
|
|
|
|
2014-11-12 04:26:47 +03:00
|
|
|
void xf_rail_DesktopNonMonitored(rdpRail* rail, rdpWindow* window)
|
|
|
|
{
|
2014-11-12 06:27:33 +03:00
|
|
|
xfContext* xfc = (xfContext*) rail->extra;
|
2014-11-12 04:26:47 +03:00
|
|
|
xf_rail_disable_remoteapp_mode(xfc);
|
|
|
|
}
|
|
|
|
|
2014-08-18 21:34:47 +04:00
|
|
|
void xf_rail_register_callbacks(xfContext* xfc, rdpRail* rail)
|
2011-08-17 10:14:02 +04:00
|
|
|
{
|
2014-08-18 21:34:47 +04:00
|
|
|
rail->extra = (void*) xfc;
|
2011-08-31 10:01:49 +04:00
|
|
|
rail->rail_CreateWindow = xf_rail_CreateWindow;
|
|
|
|
rail->rail_MoveWindow = xf_rail_MoveWindow;
|
|
|
|
rail->rail_ShowWindow = xf_rail_ShowWindow;
|
|
|
|
rail->rail_SetWindowText = xf_rail_SetWindowText;
|
|
|
|
rail->rail_SetWindowIcon = xf_rail_SetWindowIcon;
|
|
|
|
rail->rail_SetWindowRects = xf_rail_SetWindowRects;
|
|
|
|
rail->rail_SetWindowVisibilityRects = xf_rail_SetWindowVisibilityRects;
|
|
|
|
rail->rail_DestroyWindow = xf_rail_DestroyWindow;
|
2012-08-04 02:35:17 +04:00
|
|
|
rail->rail_DesktopNonMonitored = xf_rail_DesktopNonMonitored;
|
2011-08-17 10:14:02 +04:00
|
|
|
}
|
|
|
|
|
2014-11-13 00:42:32 +03:00
|
|
|
#else
|
2014-11-12 04:26:47 +03:00
|
|
|
|
|
|
|
/* RemoteApp Core Protocol Extension */
|
|
|
|
|
|
|
|
static void xf_rail_window_common(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* windowState)
|
|
|
|
{
|
2014-11-13 00:42:32 +03:00
|
|
|
xfAppWindow* appWindow = NULL;
|
2014-11-12 04:26:47 +03:00
|
|
|
xfContext* xfc = (xfContext*) context;
|
|
|
|
UINT32 fieldFlags = orderInfo->fieldFlags;
|
|
|
|
|
|
|
|
if (fieldFlags & WINDOW_ORDER_STATE_NEW)
|
|
|
|
{
|
2014-11-13 00:42:32 +03:00
|
|
|
appWindow = (xfAppWindow*) calloc(1, sizeof(xfAppWindow));
|
2014-11-12 04:26:47 +03:00
|
|
|
|
2014-11-13 00:42:32 +03:00
|
|
|
if (!appWindow)
|
2014-11-12 04:26:47 +03:00
|
|
|
return;
|
|
|
|
|
2014-11-13 00:42:32 +03:00
|
|
|
appWindow->xfc = xfc;
|
2014-11-12 04:26:47 +03:00
|
|
|
|
2014-11-13 00:42:32 +03:00
|
|
|
appWindow->windowId = orderInfo->windowId;
|
|
|
|
appWindow->dwStyle = windowState->style;
|
|
|
|
appWindow->dwExStyle = windowState->extendedStyle;
|
2014-11-12 04:26:47 +03:00
|
|
|
|
2014-11-13 00:42:32 +03:00
|
|
|
appWindow->x = appWindow->windowOffsetX = windowState->windowOffsetX;
|
|
|
|
appWindow->y = appWindow->windowOffsetY = windowState->windowOffsetY;
|
|
|
|
appWindow->width = appWindow->windowWidth = windowState->windowWidth;
|
|
|
|
appWindow->height = appWindow->windowHeight = windowState->windowHeight;
|
2014-11-12 04:26:47 +03:00
|
|
|
|
|
|
|
if (fieldFlags & WINDOW_ORDER_FIELD_TITLE)
|
|
|
|
{
|
|
|
|
char* title = NULL;
|
|
|
|
|
|
|
|
ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) windowState->titleInfo.string,
|
|
|
|
windowState->titleInfo.length / 2, &title, 0, NULL, NULL);
|
|
|
|
|
2014-11-13 00:42:32 +03:00
|
|
|
appWindow->title = title;
|
2014-11-12 04:26:47 +03:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-11-13 00:42:32 +03:00
|
|
|
appWindow->title = _strdup("RdpRailWindow");
|
2014-11-12 04:26:47 +03:00
|
|
|
}
|
|
|
|
|
2014-11-13 00:42:32 +03:00
|
|
|
xf_AppWindowInit(xfc, appWindow);
|
2014-11-12 04:26:47 +03:00
|
|
|
|
2014-11-13 00:42:32 +03:00
|
|
|
HashTable_Add(xfc->railWindows, (void*) (UINT_PTR) orderInfo->windowId, (void*) appWindow);
|
2014-11-12 04:26:47 +03:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-11-13 00:42:32 +03:00
|
|
|
appWindow = (xfAppWindow*) HashTable_GetItemValue(xfc->railWindows,
|
2014-11-12 04:26:47 +03:00
|
|
|
(void*) (UINT_PTR) orderInfo->windowId);
|
|
|
|
}
|
|
|
|
|
2014-11-13 00:42:32 +03:00
|
|
|
if (!appWindow)
|
2014-11-12 04:26:47 +03:00
|
|
|
return;
|
|
|
|
|
2014-11-13 00:42:32 +03:00
|
|
|
/* Update Parameters */
|
|
|
|
|
2014-11-12 04:26:47 +03:00
|
|
|
if ((fieldFlags & WINDOW_ORDER_FIELD_WND_OFFSET) ||
|
|
|
|
(fieldFlags & WINDOW_ORDER_FIELD_WND_SIZE))
|
|
|
|
{
|
|
|
|
if (fieldFlags & WINDOW_ORDER_FIELD_WND_OFFSET)
|
|
|
|
{
|
2014-11-13 00:42:32 +03:00
|
|
|
appWindow->x = appWindow->windowOffsetX = windowState->windowOffsetX;
|
|
|
|
appWindow->y = appWindow->windowOffsetY = windowState->windowOffsetY;
|
2014-11-12 04:26:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (fieldFlags & WINDOW_ORDER_FIELD_WND_SIZE)
|
|
|
|
{
|
2014-11-13 00:42:32 +03:00
|
|
|
appWindow->width = appWindow->windowWidth = windowState->windowWidth;
|
|
|
|
appWindow->height = appWindow->windowHeight = windowState->windowHeight;
|
2014-11-12 04:26:47 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fieldFlags & WINDOW_ORDER_FIELD_OWNER)
|
|
|
|
{
|
2014-11-13 00:42:32 +03:00
|
|
|
appWindow->ownerWindowId = windowState->ownerWindowId;
|
2014-11-12 04:26:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (fieldFlags & WINDOW_ORDER_FIELD_STYLE)
|
|
|
|
{
|
2014-11-13 00:42:32 +03:00
|
|
|
appWindow->dwStyle = windowState->style;
|
|
|
|
appWindow->dwExStyle = windowState->extendedStyle;
|
2014-11-12 04:26:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (fieldFlags & WINDOW_ORDER_FIELD_SHOW)
|
|
|
|
{
|
2014-11-13 00:42:32 +03:00
|
|
|
appWindow->showState = windowState->showState;
|
2014-11-12 04:26:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (fieldFlags & WINDOW_ORDER_FIELD_TITLE)
|
|
|
|
{
|
|
|
|
char* title = NULL;
|
|
|
|
|
|
|
|
ConvertFromUnicode(CP_UTF8, 0, (WCHAR*) windowState->titleInfo.string,
|
|
|
|
windowState->titleInfo.length / 2, &title, 0, NULL, NULL);
|
|
|
|
|
2014-11-13 00:42:32 +03:00
|
|
|
free(appWindow->title);
|
|
|
|
appWindow->title = title;
|
2014-11-12 04:26:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_OFFSET)
|
|
|
|
{
|
2014-11-13 00:42:32 +03:00
|
|
|
appWindow->clientOffsetX = windowState->clientOffsetX;
|
|
|
|
appWindow->clientOffsetY = windowState->clientOffsetY;
|
2014-11-12 04:26:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_SIZE)
|
|
|
|
{
|
2014-11-13 00:42:32 +03:00
|
|
|
appWindow->clientAreaWidth = windowState->clientAreaWidth;
|
|
|
|
appWindow->clientAreaHeight = windowState->clientAreaHeight;
|
2014-11-12 04:26:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (fieldFlags & WINDOW_ORDER_FIELD_WND_CLIENT_DELTA)
|
|
|
|
{
|
2014-11-13 00:42:32 +03:00
|
|
|
appWindow->windowClientDeltaX = windowState->windowClientDeltaX;
|
|
|
|
appWindow->windowClientDeltaY = windowState->windowClientDeltaY;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fieldFlags & WINDOW_ORDER_FIELD_WND_RECTS)
|
|
|
|
{
|
|
|
|
if (appWindow->windowRects)
|
|
|
|
{
|
|
|
|
free(appWindow->windowRects);
|
|
|
|
appWindow->windowRects = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
appWindow->numWindowRects = windowState->numWindowRects;
|
|
|
|
|
|
|
|
if (appWindow->numWindowRects)
|
|
|
|
{
|
|
|
|
appWindow->windowRects = (RECTANGLE_16*) calloc(appWindow->numWindowRects, sizeof(RECTANGLE_16));
|
|
|
|
|
|
|
|
if (!appWindow->windowRects)
|
|
|
|
return;
|
|
|
|
|
|
|
|
CopyMemory(appWindow->windowRects, windowState->windowRects,
|
|
|
|
appWindow->numWindowRects * sizeof(RECTANGLE_16));
|
|
|
|
}
|
|
|
|
}
|
2014-11-12 04:26:47 +03:00
|
|
|
|
2014-11-13 00:42:32 +03:00
|
|
|
if (fieldFlags & WINDOW_ORDER_FIELD_VIS_OFFSET)
|
|
|
|
{
|
|
|
|
appWindow->visibleOffsetX = windowState->visibleOffsetX;
|
|
|
|
appWindow->visibleOffsetY = windowState->visibleOffsetY;
|
2014-11-12 04:26:47 +03:00
|
|
|
}
|
|
|
|
|
2014-11-13 00:42:32 +03:00
|
|
|
if (fieldFlags & WINDOW_ORDER_FIELD_VISIBILITY)
|
2014-11-12 04:26:47 +03:00
|
|
|
{
|
2014-11-13 00:42:32 +03:00
|
|
|
if (appWindow->visibilityRects)
|
|
|
|
{
|
|
|
|
free(appWindow->visibilityRects);
|
|
|
|
appWindow->visibilityRects = NULL;
|
|
|
|
}
|
2014-11-12 04:26:47 +03:00
|
|
|
|
2014-11-13 00:42:32 +03:00
|
|
|
appWindow->numVisibilityRects = windowState->numVisibilityRects;
|
|
|
|
|
|
|
|
if (appWindow->numVisibilityRects)
|
|
|
|
{
|
|
|
|
appWindow->visibilityRects = (RECTANGLE_16*) calloc(appWindow->numVisibilityRects, sizeof(RECTANGLE_16));
|
|
|
|
|
|
|
|
if (!appWindow->visibilityRects)
|
|
|
|
return;
|
|
|
|
|
|
|
|
CopyMemory(appWindow->visibilityRects, windowState->visibilityRects,
|
|
|
|
appWindow->numVisibilityRects * sizeof(RECTANGLE_16));
|
|
|
|
}
|
2014-11-12 04:26:47 +03:00
|
|
|
}
|
|
|
|
|
2014-11-13 00:42:32 +03:00
|
|
|
/* Update Window */
|
|
|
|
|
|
|
|
if (fieldFlags & WINDOW_ORDER_FIELD_STYLE)
|
2014-11-12 04:26:47 +03:00
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-11-13 00:42:32 +03:00
|
|
|
if (fieldFlags & WINDOW_ORDER_FIELD_SHOW)
|
2014-11-12 04:26:47 +03:00
|
|
|
{
|
2014-11-13 00:42:32 +03:00
|
|
|
xf_ShowWindow(xfc, appWindow, appWindow->showState);
|
|
|
|
}
|
2014-11-12 04:26:47 +03:00
|
|
|
|
2014-11-13 00:42:32 +03:00
|
|
|
if (fieldFlags & WINDOW_ORDER_FIELD_TITLE)
|
|
|
|
{
|
|
|
|
xf_SetWindowText(xfc, appWindow, appWindow->title);
|
2014-11-12 04:26:47 +03:00
|
|
|
}
|
|
|
|
|
2014-11-13 00:42:32 +03:00
|
|
|
if ((fieldFlags & WINDOW_ORDER_FIELD_WND_OFFSET) ||
|
|
|
|
(fieldFlags & WINDOW_ORDER_FIELD_WND_SIZE))
|
2014-11-12 04:26:47 +03:00
|
|
|
{
|
2014-11-13 00:42:32 +03:00
|
|
|
/*
|
|
|
|
* The rail server like to set the window to a small size when it is minimized even though it is hidden
|
|
|
|
* in some cases this can cause the window not to restore back to its original size. Therefore we don't
|
|
|
|
* update our local window when that rail window state is minimized
|
|
|
|
*/
|
|
|
|
if (appWindow->rail_state == WINDOW_SHOW_MINIMIZED)
|
|
|
|
return;
|
2014-11-12 04:26:47 +03:00
|
|
|
|
2014-11-13 00:42:32 +03:00
|
|
|
/* Do nothing if window is already in the correct position */
|
|
|
|
if (appWindow->x == appWindow->visibleOffsetX &&
|
|
|
|
appWindow->y == appWindow->visibleOffsetY &&
|
|
|
|
appWindow->width == appWindow->windowWidth &&
|
|
|
|
appWindow->height == appWindow->windowHeight)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Just ensure entire window area is updated to handle cases where we
|
|
|
|
* have drawn locally before getting new bitmap from the server
|
|
|
|
*/
|
|
|
|
xf_UpdateWindowArea(xfc, appWindow, 0, 0, appWindow->windowWidth, appWindow->windowHeight);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
xf_MoveWindow(xfc, appWindow, appWindow->visibleOffsetX, appWindow->visibleOffsetY,
|
|
|
|
appWindow->windowWidth, appWindow->windowHeight);
|
2014-11-12 04:26:47 +03:00
|
|
|
}
|
|
|
|
|
2014-11-13 00:42:32 +03:00
|
|
|
if (fieldFlags & WINDOW_ORDER_FIELD_WND_RECTS)
|
2014-11-12 04:26:47 +03:00
|
|
|
{
|
2014-11-13 00:42:32 +03:00
|
|
|
xf_SetWindowRects(xfc, appWindow, appWindow->windowRects, appWindow->numWindowRects);
|
|
|
|
}
|
2014-11-12 04:26:47 +03:00
|
|
|
|
2014-11-13 00:42:32 +03:00
|
|
|
if (fieldFlags & WINDOW_ORDER_FIELD_VISIBILITY)
|
|
|
|
{
|
|
|
|
xf_SetWindowVisibilityRects(xfc, appWindow, appWindow->visibilityRects, appWindow->numVisibilityRects);
|
2014-11-12 04:26:47 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void xf_rail_window_delete(rdpContext* context, WINDOW_ORDER_INFO* orderInfo)
|
|
|
|
{
|
2014-11-13 00:42:32 +03:00
|
|
|
xfAppWindow* appWindow = NULL;
|
2014-11-12 04:26:47 +03:00
|
|
|
xfContext* xfc = (xfContext*) context;
|
|
|
|
|
2014-11-13 00:42:32 +03:00
|
|
|
appWindow = (xfAppWindow*) HashTable_GetItemValue(xfc->railWindows,
|
2014-11-12 04:26:47 +03:00
|
|
|
(void*) (UINT_PTR) orderInfo->windowId);
|
|
|
|
|
2014-11-13 00:42:32 +03:00
|
|
|
if (!appWindow)
|
2014-11-12 04:26:47 +03:00
|
|
|
return;
|
|
|
|
|
|
|
|
HashTable_Remove(xfc->railWindows, (void*) (UINT_PTR) orderInfo->windowId);
|
|
|
|
|
2014-11-13 00:42:32 +03:00
|
|
|
xf_DestroyWindow(xfc, appWindow);
|
|
|
|
|
|
|
|
free(appWindow->title);
|
|
|
|
free(appWindow->windowRects);
|
|
|
|
free(appWindow->visibilityRects);
|
|
|
|
|
|
|
|
free(appWindow);
|
2014-11-12 04:26:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
static void xf_rail_window_icon(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_ICON_ORDER* windowIcon)
|
|
|
|
{
|
|
|
|
BOOL bigIcon;
|
2014-11-12 06:27:33 +03:00
|
|
|
xfAppWindow* railWindow;
|
2014-11-12 04:26:47 +03:00
|
|
|
xfContext* xfc = (xfContext*) context;
|
|
|
|
|
2014-11-12 06:27:33 +03:00
|
|
|
railWindow = (xfAppWindow*) HashTable_GetItemValue(xfc->railWindows,
|
2014-11-12 04:26:47 +03:00
|
|
|
(void*) (UINT_PTR) orderInfo->windowId);
|
|
|
|
|
|
|
|
if (!railWindow)
|
|
|
|
return;
|
|
|
|
|
|
|
|
bigIcon = (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_ICON_BIG) ? TRUE : FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void xf_rail_window_cached_icon(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, WINDOW_CACHED_ICON_ORDER* windowCachedIcon)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void xf_rail_notify_icon_common(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notifyIconState)
|
|
|
|
{
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_VERSION)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_TIP)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_INFO_TIP)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_NOTIFY_STATE)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_ICON)
|
|
|
|
{
|
2014-11-13 00:42:32 +03:00
|
|
|
|
2014-11-12 04:26:47 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (orderInfo->fieldFlags & WINDOW_ORDER_CACHED_ICON)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void xf_rail_notify_icon_create(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notifyIconState)
|
|
|
|
{
|
|
|
|
xf_rail_notify_icon_common(context, orderInfo, notifyIconState);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void xf_rail_notify_icon_update(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notifyIconState)
|
|
|
|
{
|
|
|
|
xf_rail_notify_icon_common(context, orderInfo, notifyIconState);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void xf_rail_notify_icon_delete(rdpContext* context, WINDOW_ORDER_INFO* orderInfo)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void xf_rail_monitored_desktop(rdpContext* context, WINDOW_ORDER_INFO* orderInfo, MONITORED_DESKTOP_ORDER* monitoredDesktop)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
static void xf_rail_non_monitored_desktop(rdpContext* context, WINDOW_ORDER_INFO* orderInfo)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void xf_rail_register_update_callbacks(rdpUpdate* update)
|
|
|
|
{
|
|
|
|
rdpWindowUpdate* window = update->window;
|
|
|
|
|
|
|
|
window->WindowCreate = xf_rail_window_common;
|
|
|
|
window->WindowUpdate = xf_rail_window_common;
|
|
|
|
window->WindowDelete = xf_rail_window_delete;
|
|
|
|
window->WindowIcon = xf_rail_window_icon;
|
|
|
|
window->WindowCachedIcon = xf_rail_window_cached_icon;
|
|
|
|
window->NotifyIconCreate = xf_rail_notify_icon_create;
|
|
|
|
window->NotifyIconUpdate = xf_rail_notify_icon_update;
|
|
|
|
window->NotifyIconDelete = xf_rail_notify_icon_delete;
|
|
|
|
window->MonitoredDesktop = xf_rail_monitored_desktop;
|
|
|
|
window->NonMonitoredDesktop = xf_rail_non_monitored_desktop;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
2014-11-12 01:49:29 +03:00
|
|
|
/* RemoteApp Virtual Channel Extension */
|
|
|
|
|
|
|
|
static int xf_rail_server_execute_result(RailClientContext* context, RAIL_EXEC_RESULT_ORDER* execResult)
|
2011-08-19 18:10:08 +04:00
|
|
|
{
|
2014-11-12 01:49:29 +03:00
|
|
|
xfContext* xfc = (xfContext*) context->custom;
|
2011-08-19 18:10:08 +04:00
|
|
|
|
2014-11-12 01:49:29 +03:00
|
|
|
if (execResult->execResult != RAIL_EXEC_S_OK)
|
2011-08-19 18:10:08 +04:00
|
|
|
{
|
2014-09-12 19:13:01 +04:00
|
|
|
WLog_ERR(TAG, "RAIL exec error: execResult=%s NtError=0x%X\n",
|
2014-11-12 01:49:29 +03:00
|
|
|
error_code_names[execResult->execResult], execResult->rawResult);
|
|
|
|
xfc->disconnect = TRUE;
|
2012-01-02 13:27:04 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-06-13 02:57:25 +04:00
|
|
|
xf_rail_enable_remoteapp_mode(xfc);
|
2011-08-19 18:10:08 +04:00
|
|
|
}
|
2014-11-12 01:49:29 +03:00
|
|
|
|
|
|
|
return 1;
|
2011-08-19 18:10:08 +04:00
|
|
|
}
|
|
|
|
|
2014-11-12 01:49:29 +03:00
|
|
|
static int xf_rail_server_system_param(RailClientContext* context, RAIL_SYSPARAM_ORDER* sysparam)
|
2011-08-20 02:46:10 +04:00
|
|
|
{
|
2014-11-12 01:49:29 +03:00
|
|
|
return 1;
|
2011-08-20 02:46:10 +04:00
|
|
|
}
|
|
|
|
|
2014-11-12 01:49:29 +03:00
|
|
|
static int xf_rail_server_handshake(RailClientContext* context, RAIL_HANDSHAKE_ORDER* handshake)
|
2011-08-20 02:46:10 +04:00
|
|
|
{
|
2014-11-12 01:49:29 +03:00
|
|
|
RAIL_EXEC_ORDER exec;
|
|
|
|
RAIL_SYSPARAM_ORDER sysparam;
|
|
|
|
RAIL_HANDSHAKE_ORDER clientHandshake;
|
|
|
|
RAIL_CLIENT_STATUS_ORDER clientStatus;
|
|
|
|
xfContext* xfc = (xfContext*) context->custom;
|
|
|
|
rdpSettings* settings = xfc->settings;
|
|
|
|
|
|
|
|
clientHandshake.buildNumber = 0x00001DB0;
|
|
|
|
context->ClientHandshake(context, &clientHandshake);
|
|
|
|
|
|
|
|
ZeroMemory(&clientStatus, sizeof(RAIL_CLIENT_STATUS_ORDER));
|
|
|
|
clientStatus.flags = RAIL_CLIENTSTATUS_ALLOWLOCALMOVESIZE;
|
|
|
|
context->ClientInformation(context, &clientStatus);
|
2011-09-01 02:02:22 +04:00
|
|
|
|
2014-11-12 01:49:29 +03:00
|
|
|
if (settings->RemoteAppLanguageBarSupported)
|
2011-09-01 02:02:22 +04:00
|
|
|
{
|
2014-11-12 01:49:29 +03:00
|
|
|
RAIL_LANGBAR_INFO_ORDER langBarInfo;
|
|
|
|
langBarInfo.languageBarStatus = 0x00000008; /* TF_SFT_HIDDEN */
|
|
|
|
context->ClientLanguageBarInfo(context, &langBarInfo);
|
2011-09-01 02:02:22 +04:00
|
|
|
}
|
2011-08-20 02:46:10 +04:00
|
|
|
|
2014-11-12 01:49:29 +03:00
|
|
|
ZeroMemory(&sysparam, sizeof(RAIL_SYSPARAM_ORDER));
|
2011-09-01 02:02:22 +04:00
|
|
|
|
2014-11-12 01:49:29 +03:00
|
|
|
sysparam.params = 0;
|
2014-11-12 00:35:30 +03:00
|
|
|
|
2014-11-12 01:49:29 +03:00
|
|
|
sysparam.params |= SPI_MASK_SET_HIGH_CONTRAST;
|
|
|
|
sysparam.highContrast.colorScheme.string = NULL;
|
|
|
|
sysparam.highContrast.colorScheme.length = 0;
|
|
|
|
sysparam.highContrast.flags = 0x7E;
|
2011-09-01 02:02:22 +04:00
|
|
|
|
2014-11-12 01:49:29 +03:00
|
|
|
sysparam.params |= SPI_MASK_SET_MOUSE_BUTTON_SWAP;
|
|
|
|
sysparam.mouseButtonSwap = FALSE;
|
2011-11-29 01:50:08 +04:00
|
|
|
|
2014-11-12 01:49:29 +03:00
|
|
|
sysparam.params |= SPI_MASK_SET_KEYBOARD_PREF;
|
|
|
|
sysparam.keyboardPref = FALSE;
|
2011-08-20 02:46:10 +04:00
|
|
|
|
2014-11-12 01:49:29 +03:00
|
|
|
sysparam.params |= SPI_MASK_SET_DRAG_FULL_WINDOWS;
|
|
|
|
sysparam.dragFullWindows = FALSE;
|
|
|
|
|
|
|
|
sysparam.params |= SPI_MASK_SET_KEYBOARD_CUES;
|
|
|
|
sysparam.keyboardCues = FALSE;
|
|
|
|
|
|
|
|
sysparam.params |= SPI_MASK_SET_WORK_AREA;
|
|
|
|
sysparam.workArea.left = 0;
|
|
|
|
sysparam.workArea.top = 0;
|
|
|
|
sysparam.workArea.right = settings->DesktopWidth;
|
|
|
|
sysparam.workArea.bottom = settings->DesktopHeight;
|
|
|
|
|
|
|
|
sysparam.dragFullWindows = FALSE;
|
|
|
|
|
|
|
|
context->ClientSystemParam(context, &sysparam);
|
|
|
|
|
|
|
|
ZeroMemory(&exec, sizeof(RAIL_EXEC_ORDER));
|
2014-11-12 00:35:30 +03:00
|
|
|
|
2014-11-12 01:49:29 +03:00
|
|
|
exec.RemoteApplicationProgram = settings->RemoteApplicationProgram;
|
|
|
|
exec.RemoteApplicationWorkingDir = settings->ShellWorkingDirectory;
|
|
|
|
exec.RemoteApplicationArguments = settings->RemoteApplicationCmdLine;
|
2014-11-12 00:35:30 +03:00
|
|
|
|
2014-11-12 01:49:29 +03:00
|
|
|
context->ClientExecute(context, &exec);
|
|
|
|
|
|
|
|
return 1;
|
2011-08-20 02:46:10 +04:00
|
|
|
}
|
|
|
|
|
2014-11-12 01:49:29 +03:00
|
|
|
static int xf_rail_server_handshake_ex(RailClientContext* context, RAIL_HANDSHAKE_EX_ORDER* handshakeEx)
|
2011-08-20 02:46:10 +04:00
|
|
|
{
|
2014-11-12 01:49:29 +03:00
|
|
|
return 1;
|
2011-08-20 02:46:10 +04:00
|
|
|
}
|
|
|
|
|
2014-11-12 01:49:29 +03:00
|
|
|
static int xf_rail_server_local_move_size(RailClientContext* context, RAIL_LOCALMOVESIZE_ORDER* localMoveSize)
|
2011-08-18 05:33:22 +04:00
|
|
|
{
|
2014-11-12 01:49:29 +03:00
|
|
|
rdpRail* rail;
|
|
|
|
int x = 0, y = 0;
|
|
|
|
int direction = 0;
|
|
|
|
Window child_window;
|
|
|
|
rdpWindow* rail_window;
|
2014-11-12 06:27:33 +03:00
|
|
|
xfAppWindow* appWindow;
|
2014-11-12 01:49:29 +03:00
|
|
|
xfContext* xfc = (xfContext*) context->custom;
|
|
|
|
|
|
|
|
rail = ((rdpContext*) xfc)->rail;
|
|
|
|
|
|
|
|
rail_window = window_list_get_by_id(rail->list, localMoveSize->windowId);
|
|
|
|
|
|
|
|
if (!rail_window)
|
|
|
|
return -1;
|
|
|
|
|
2014-11-12 06:27:33 +03:00
|
|
|
appWindow = (xfAppWindow*) rail_window->extra;
|
2014-11-12 01:49:29 +03:00
|
|
|
|
|
|
|
switch (localMoveSize->moveSizeType)
|
2011-08-18 05:33:22 +04:00
|
|
|
{
|
2014-11-12 01:49:29 +03:00
|
|
|
case RAIL_WMSZ_LEFT:
|
|
|
|
direction = _NET_WM_MOVERESIZE_SIZE_LEFT;
|
|
|
|
x = localMoveSize->posX;
|
|
|
|
y = localMoveSize->posY;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RAIL_WMSZ_RIGHT:
|
|
|
|
direction = _NET_WM_MOVERESIZE_SIZE_RIGHT;
|
|
|
|
x = localMoveSize->posX;
|
|
|
|
y = localMoveSize->posY;
|
2011-08-18 05:33:22 +04:00
|
|
|
break;
|
2014-08-18 21:34:47 +04:00
|
|
|
|
2014-11-12 01:49:29 +03:00
|
|
|
case RAIL_WMSZ_TOP:
|
|
|
|
direction = _NET_WM_MOVERESIZE_SIZE_TOP;
|
|
|
|
x = localMoveSize->posX;
|
|
|
|
y = localMoveSize->posY;
|
2011-08-19 18:10:08 +04:00
|
|
|
break;
|
2014-08-18 21:34:47 +04:00
|
|
|
|
2014-11-12 01:49:29 +03:00
|
|
|
case RAIL_WMSZ_TOPLEFT:
|
|
|
|
direction = _NET_WM_MOVERESIZE_SIZE_TOPLEFT;
|
|
|
|
x = localMoveSize->posX;
|
|
|
|
y = localMoveSize->posY;
|
2011-08-20 02:46:10 +04:00
|
|
|
break;
|
2014-08-18 21:34:47 +04:00
|
|
|
|
2014-11-12 01:49:29 +03:00
|
|
|
case RAIL_WMSZ_TOPRIGHT:
|
|
|
|
direction = _NET_WM_MOVERESIZE_SIZE_TOPRIGHT;
|
|
|
|
x = localMoveSize->posX;
|
|
|
|
y = localMoveSize->posY;
|
2011-08-20 02:46:10 +04:00
|
|
|
break;
|
2014-08-18 21:34:47 +04:00
|
|
|
|
2014-11-12 01:49:29 +03:00
|
|
|
case RAIL_WMSZ_BOTTOM:
|
|
|
|
direction = _NET_WM_MOVERESIZE_SIZE_BOTTOM;
|
|
|
|
x = localMoveSize->posX;
|
|
|
|
y = localMoveSize->posY;
|
2011-08-20 02:46:10 +04:00
|
|
|
break;
|
2014-08-18 21:34:47 +04:00
|
|
|
|
2014-11-12 01:49:29 +03:00
|
|
|
case RAIL_WMSZ_BOTTOMLEFT:
|
|
|
|
direction = _NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT;
|
|
|
|
x = localMoveSize->posX;
|
|
|
|
y = localMoveSize->posY;
|
2011-08-20 02:46:10 +04:00
|
|
|
break;
|
2014-08-18 21:34:47 +04:00
|
|
|
|
2014-11-12 01:49:29 +03:00
|
|
|
case RAIL_WMSZ_BOTTOMRIGHT:
|
|
|
|
direction = _NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT;
|
|
|
|
x = localMoveSize->posX;
|
|
|
|
y = localMoveSize->posY;
|
2011-08-20 02:46:10 +04:00
|
|
|
break;
|
2014-08-18 21:34:47 +04:00
|
|
|
|
2014-11-12 01:49:29 +03:00
|
|
|
case RAIL_WMSZ_MOVE:
|
|
|
|
direction = _NET_WM_MOVERESIZE_MOVE;
|
2014-11-12 06:27:33 +03:00
|
|
|
XTranslateCoordinates(xfc->display, appWindow->handle,
|
2014-11-12 01:49:29 +03:00
|
|
|
RootWindowOfScreen(xfc->screen),
|
|
|
|
localMoveSize->posX, localMoveSize->posY, &x, &y, &child_window);
|
2011-08-18 05:33:22 +04:00
|
|
|
break;
|
2014-11-12 01:49:29 +03:00
|
|
|
|
|
|
|
case RAIL_WMSZ_KEYMOVE:
|
|
|
|
direction = _NET_WM_MOVERESIZE_MOVE_KEYBOARD;
|
|
|
|
x = localMoveSize->posX;
|
|
|
|
y = localMoveSize->posY;
|
|
|
|
/* FIXME: local keyboard moves not working */
|
|
|
|
return 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case RAIL_WMSZ_KEYSIZE:
|
|
|
|
direction = _NET_WM_MOVERESIZE_SIZE_KEYBOARD;
|
|
|
|
x = localMoveSize->posX;
|
|
|
|
y = localMoveSize->posY;
|
|
|
|
/* FIXME: local keyboard moves not working */
|
|
|
|
return 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (localMoveSize->isMoveSizeStart)
|
|
|
|
{
|
2014-11-12 06:27:33 +03:00
|
|
|
xf_StartLocalMoveSize(xfc, appWindow, direction, x, y);
|
2011-08-18 05:33:22 +04:00
|
|
|
}
|
2014-11-12 01:49:29 +03:00
|
|
|
else
|
|
|
|
{
|
2014-11-12 06:27:33 +03:00
|
|
|
xf_EndLocalMoveSize(xfc, appWindow);
|
2014-11-12 01:49:29 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int xf_rail_server_min_max_info(RailClientContext* context, RAIL_MINMAXINFO_ORDER* minMaxInfo)
|
|
|
|
{
|
|
|
|
rdpRail* rail;
|
2014-11-12 06:27:33 +03:00
|
|
|
xfAppWindow* appWindow;
|
2014-11-12 01:49:29 +03:00
|
|
|
rdpWindow* rail_window;
|
|
|
|
xfContext* xfc = (xfContext*) context->custom;
|
|
|
|
|
|
|
|
rail = ((rdpContext*) xfc)->rail;
|
|
|
|
|
|
|
|
rail_window = window_list_get_by_id(rail->list, minMaxInfo->windowId);
|
|
|
|
|
|
|
|
if (!rail_window)
|
|
|
|
return -1;
|
|
|
|
|
2014-11-12 06:27:33 +03:00
|
|
|
appWindow = (xfAppWindow*) rail_window->extra;
|
2014-11-12 01:49:29 +03:00
|
|
|
|
2014-11-12 06:27:33 +03:00
|
|
|
xf_SetWindowMinMaxInfo(xfc, appWindow,
|
2014-11-12 01:49:29 +03:00
|
|
|
minMaxInfo->maxWidth, minMaxInfo->maxHeight,
|
|
|
|
minMaxInfo->maxPosX, minMaxInfo->maxPosY,
|
|
|
|
minMaxInfo->minTrackWidth, minMaxInfo->minTrackHeight,
|
|
|
|
minMaxInfo->maxTrackWidth, minMaxInfo->maxTrackHeight);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int xf_rail_server_language_bar_info(RailClientContext* context, RAIL_LANGBAR_INFO_ORDER* langBarInfo)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int xf_rail_server_get_appid_response(RailClientContext* context, RAIL_GET_APPID_RESP_ORDER* getAppIdResp)
|
|
|
|
{
|
|
|
|
return 1;
|
2011-08-16 08:22:00 +04:00
|
|
|
}
|
2014-11-12 00:35:30 +03:00
|
|
|
|
|
|
|
int xf_rail_init(xfContext* xfc, RailClientContext* rail)
|
|
|
|
{
|
|
|
|
rdpContext* context = (rdpContext*) xfc;
|
|
|
|
|
|
|
|
xfc->rail = rail;
|
|
|
|
|
|
|
|
context->rail = rail_new(context->settings);
|
|
|
|
rail_register_update_callbacks(context->rail, context->update);
|
|
|
|
|
2014-11-13 00:42:32 +03:00
|
|
|
#ifdef OLD_X11_RAIL
|
2014-11-12 00:35:30 +03:00
|
|
|
xf_rail_register_callbacks(xfc, context->rail);
|
2014-11-13 00:42:32 +03:00
|
|
|
#else
|
|
|
|
xf_rail_register_update_callbacks(context->update);
|
|
|
|
#endif
|
2014-11-12 01:49:29 +03:00
|
|
|
|
2014-11-12 04:26:47 +03:00
|
|
|
rail->custom = (void*) xfc;
|
|
|
|
|
|
|
|
rail->ServerExecuteResult = xf_rail_server_execute_result;
|
|
|
|
rail->ServerSystemParam = xf_rail_server_system_param;
|
|
|
|
rail->ServerHandshake = xf_rail_server_handshake;
|
|
|
|
rail->ServerHandshakeEx = xf_rail_server_handshake_ex;
|
|
|
|
rail->ServerLocalMoveSize = xf_rail_server_local_move_size;
|
|
|
|
rail->ServerMinMaxInfo = xf_rail_server_min_max_info;
|
|
|
|
rail->ServerLanguageBarInfo = xf_rail_server_language_bar_info;
|
|
|
|
rail->ServerGetAppIdResponse = xf_rail_server_get_appid_response;
|
2014-11-12 00:35:30 +03:00
|
|
|
|
2014-11-13 00:42:32 +03:00
|
|
|
xfc->railWindows = HashTable_New(TRUE);
|
|
|
|
|
2014-11-12 00:35:30 +03:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int xf_rail_uninit(xfContext* xfc, RailClientContext* rail)
|
|
|
|
{
|
|
|
|
rdpContext* context = (rdpContext*) xfc;
|
|
|
|
|
|
|
|
if (xfc->rail)
|
|
|
|
{
|
|
|
|
xfc->rail->custom = NULL;
|
|
|
|
xfc->rail = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (context->rail)
|
|
|
|
{
|
|
|
|
rail_free(context->rail);
|
|
|
|
context->rail = NULL;
|
|
|
|
}
|
|
|
|
|
2014-11-13 00:42:32 +03:00
|
|
|
if (xfc->railWindows)
|
|
|
|
{
|
|
|
|
HashTable_Free(xfc->railWindows);
|
|
|
|
xfc->railWindows = NULL;
|
|
|
|
}
|
|
|
|
|
2014-11-12 00:35:30 +03:00
|
|
|
return 1;
|
|
|
|
}
|