* Callback given to freerdp_connect() to perform post-connection operations. * It will be called only if the connection was initialized properly, and will continue the * initialization based on the newly created connection. */
| 923 | * initialization based on the newly created connection. |
| 924 | */ |
| 925 | BOOL CBackendFreeRDP::cb_post_connect(freerdp* instance) |
| 926 | { |
| 927 | qDebug(log) << Q_FUNC_INFO; |
| 928 | |
| 929 | rdpContext* context = instance->context; |
| 930 | rdpSettings* settings = instance->context->settings; |
| 931 | rdpUpdate* update = instance->context->update; |
| 932 | CBackendFreeRDP* pThis = ((ClientContext*)instance->context)->pThis; |
| 933 | |
| 934 | const char* pWindowTitle = GetTitle(instance); |
| 935 | if(pWindowTitle) |
| 936 | { |
| 937 | WCHAR* windowTitle = NULL; |
| 938 | #if FREERDP_VERSION_MAJOR >= 3 |
| 939 | windowTitle = ConvertUtf8ToWCharAlloc(pWindowTitle, NULL); |
| 940 | #else |
| 941 | ConvertToUnicode(CP_UTF8, 0, pWindowTitle, -1, &windowTitle, 0); |
| 942 | #endif |
| 943 | if(windowTitle) |
| 944 | { |
| 945 | QString title = QString::fromUtf16((const char16_t*)windowTitle); |
| 946 | delete windowTitle; |
| 947 | if(pThis->m_pParameter->GetServerName().isEmpty()) |
| 948 | emit pThis->sigServerName(title); |
| 949 | } |
| 950 | } |
| 951 | |
| 952 | int desktopWidth = freerdp_settings_get_uint32(settings, FreeRDP_DesktopWidth); |
| 953 | int desktopHeight = freerdp_settings_get_uint32(settings, FreeRDP_DesktopHeight); |
| 954 | emit pThis->sigSetDesktopSize(desktopWidth, desktopHeight); |
| 955 | |
| 956 | if (!gdi_init(instance, PIXEL_FORMAT_BGRA32)) |
| 957 | return FALSE; |
| 958 | |
| 959 | if(!pThis->CreateImage(instance->context)) |
| 960 | return FALSE; |
| 961 | |
| 962 | Q_ASSERT(instance->context->cache); |
| 963 | |
| 964 | // Register cursor pointer |
| 965 | if(pThis->m_Cursor.RegisterPointer(context->graphics)) |
| 966 | return FALSE; |
| 967 | |
| 968 | update->BeginPaint = cb_begin_paint; |
| 969 | update->EndPaint = cb_end_paint; |
| 970 | update->DesktopResize = cb_desktop_resize; |
| 971 | |
| 972 | update->PlaySound = cb_play_bell_sound; |
| 973 | |
| 974 | update->SetKeyboardIndicators = cb_keyboard_set_indicators; |
| 975 | update->SetKeyboardImeStatus = cb_keyboard_set_ime_status; |
| 976 | |
| 977 | emit pThis->sigRunning(); |
| 978 | return TRUE; |
| 979 | } |
| 980 | |
| 981 | void CBackendFreeRDP::cb_post_disconnect(freerdp* instance) |
| 982 | { |
nothing calls this directly
no test coverage detected