mirror of
https://github.com/FreeRDP/FreeRDP.git
synced 2024-11-23 18:03:30 +08:00
add windows client assistance request control menu item
This commit is contained in:
parent
09275bf4c7
commit
22bd0a43e6
@ -272,10 +272,24 @@ static BOOL wf_pre_connect(freerdp* instance)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void wf_append_item_to_system_menu(HMENU hMenu, UINT fMask, UINT wID, const wchar_t* text,
|
||||
wfContext* wfc)
|
||||
{
|
||||
MENUITEMINFO item_info = { 0 };
|
||||
item_info.fMask = fMask;
|
||||
item_info.cbSize = sizeof(MENUITEMINFO);
|
||||
item_info.wID = wID;
|
||||
item_info.fType = MFT_STRING;
|
||||
item_info.dwTypeData = _wcsdup(text);
|
||||
item_info.cch = (UINT)_wcslen(text);
|
||||
if (wfc)
|
||||
item_info.dwItemData = (ULONG_PTR)wfc;
|
||||
InsertMenuItem(hMenu, wfc->systemMenuInsertPosition++, TRUE, &item_info);
|
||||
}
|
||||
|
||||
static void wf_add_system_menu(wfContext* wfc)
|
||||
{
|
||||
HMENU hMenu;
|
||||
MENUITEMINFO item_info;
|
||||
|
||||
if (wfc->fullscreen && !wfc->fullscreen_toggle)
|
||||
{
|
||||
@ -288,20 +302,19 @@ static void wf_add_system_menu(wfContext* wfc)
|
||||
}
|
||||
|
||||
hMenu = GetSystemMenu(wfc->hwnd, FALSE);
|
||||
ZeroMemory(&item_info, sizeof(MENUITEMINFO));
|
||||
item_info.fMask = MIIM_CHECKMARKS | MIIM_FTYPE | MIIM_ID | MIIM_STRING | MIIM_DATA;
|
||||
item_info.cbSize = sizeof(MENUITEMINFO);
|
||||
item_info.wID = SYSCOMMAND_ID_SMARTSIZING;
|
||||
item_info.fType = MFT_STRING;
|
||||
item_info.dwTypeData = _wcsdup(_T("Smart sizing"));
|
||||
item_info.cch = (UINT)_wcslen(_T("Smart sizing"));
|
||||
item_info.dwItemData = (ULONG_PTR)wfc;
|
||||
InsertMenuItem(hMenu, 6, TRUE, &item_info);
|
||||
|
||||
wf_append_item_to_system_menu(hMenu,
|
||||
MIIM_CHECKMARKS | MIIM_FTYPE | MIIM_ID | MIIM_STRING | MIIM_DATA,
|
||||
SYSCOMMAND_ID_SMARTSIZING, L"Smart sizing", wfc);
|
||||
|
||||
if (wfc->common.context.settings->SmartSizing)
|
||||
{
|
||||
CheckMenuItem(hMenu, SYSCOMMAND_ID_SMARTSIZING, MF_CHECKED);
|
||||
}
|
||||
|
||||
if (wfc->common.context.settings->RemoteAssistanceMode)
|
||||
wf_append_item_to_system_menu(hMenu, MIIM_FTYPE | MIIM_ID | MIIM_STRING,
|
||||
SYSCOMMAND_ID_REQUEST_CONTROL, L"Request control", wfc);
|
||||
}
|
||||
|
||||
static WCHAR* wf_window_get_title(rdpSettings* settings)
|
||||
@ -1355,6 +1368,13 @@ static int wfreerdp_client_start(rdpContext* context)
|
||||
hWndParent = (HWND)context->settings->ParentWindowId;
|
||||
context->settings->EmbeddedWindow = (hWndParent) ? TRUE : FALSE;
|
||||
wfc->hWndParent = hWndParent;
|
||||
|
||||
/* initial windows system item position where we will insert new menu item
|
||||
* after default 5 items (restore, move, size, minimize, maximize)
|
||||
* gets incremented each time wf_append_item_to_system_menu is called
|
||||
* or maybe could use GetMenuItemCount() to get initial item count ? */
|
||||
wfc->systemMenuInsertPosition = 6;
|
||||
|
||||
wfc->hInstance = hInstance;
|
||||
wfc->cursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wfc->icon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_ICON1));
|
||||
|
@ -56,6 +56,7 @@ extern "C"
|
||||
|
||||
// System menu constants
|
||||
#define SYSCOMMAND_ID_SMARTSIZING 1000
|
||||
#define SYSCOMMAND_ID_REQUEST_CONTROL 1001
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@ -96,6 +97,8 @@ extern "C"
|
||||
LPCTSTR wndClassName;
|
||||
HCURSOR hDefaultCursor;
|
||||
|
||||
UINT systemMenuInsertPosition;
|
||||
|
||||
HWND hwnd;
|
||||
BOOL is_shown;
|
||||
ITaskbarList3* taskBarList;
|
||||
|
@ -690,6 +690,10 @@ LRESULT CALLBACK wf_event_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam
|
||||
wf_send_resize(wfc);
|
||||
}
|
||||
}
|
||||
else if (wParam == SYSCOMMAND_ID_REQUEST_CONTROL)
|
||||
{
|
||||
freerdp_client_encomsp_set_control(wfc->common.encomsp, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
processed = FALSE;
|
||||
|
Loading…
Reference in New Issue
Block a user