void wf_toggle_fullscreen(wfInfo * wfi) { ShowWindow(wfi->hwnd, SW_HIDE); wfi->fullscreen = !wfi->fullscreen; wf_post_connect(wfi); SetForegroundWindow(wfi->hwnd); }
static int run_wfreerdp(wfInfo * wfi) { rdpInst * inst; void * read_fds[32]; void * write_fds[32]; int read_count; int write_count; int index; HANDLE fds[64]; int fds_count; int gmcode; int alldone; MSG msg; DEBUG("run_wfreerdp:\n"); /* create an instance of the library */ wfi->inst = inst = freerdp_new(wfi->settings); if (inst == NULL) { printf("run_wfreerdp: freerdp_new failed\n"); return 1; } SET_WFI(inst, wfi); if ((inst->version != FREERDP_INTERFACE_VERSION) || (inst->size != sizeof(rdpInst))) { printf("run_wfreerdp: freerdp_new size, version / size do not " "match expecting v %d s %d got v %d s %d\n", FREERDP_INTERFACE_VERSION, sizeof(rdpInst), inst->version, inst->size); return 1; } inst->settings->keyboard_layout = (int)GetKeyboardLayout(0) & 0x0000FFFF; printf("keyboard_layout: 0x%X\n", inst->settings->keyboard_layout); if (wf_pre_connect(wfi) != 0) { printf("run_wfreerdp: wf_pre_connect failed\n"); return 1; } if (freerdp_chanman_pre_connect(wfi->chan_man, inst) != 0) { printf("run_wfreerdp: freerdp_chanman_pre_connect failed\n"); return 1; } /* call connect */ if (inst->rdp_connect(inst) != 0) { printf("run_wfreerdp: inst->rdp_connect failed\n"); return 1; } if (freerdp_chanman_post_connect(wfi->chan_man, inst) != 0) { printf("run_wfreerdp: freerdp_chanman_post_connect failed\n"); return 1; } if (wf_post_connect(wfi) != 0) { printf("run_wfreerdp: wf_post_connect failed\n"); return 1; } /* program main loop */ while (1) { read_count = 0; write_count = 0; /* get libfreerdp fds */ if (inst->rdp_get_fds(inst, read_fds, &read_count, write_fds, &write_count) != 0) { printf("run_wfreerdp: inst->rdp_get_fds failed\n"); break; } /* get channel fds */ if (freerdp_chanman_get_fds(wfi->chan_man, inst, read_fds, &read_count, write_fds, &write_count) != 0) { printf("run_wfreerdp: freerdp_chanman_get_fds failed\n"); break; } fds_count = 0; /* setup read fds */ for (index = 0; index < read_count; index++) { fds[fds_count++] = read_fds[index]; } /* setup write fds */ for (index = 0; index < write_count; index++) { fds[fds_count++] = write_fds[index]; } /* exit if nothing to do */ if (fds_count == 0) { printf("run_wfreerdp: fds_count is zero\n"); break; } /* do the wait */ if (MsgWaitForMultipleObjects(fds_count, fds, FALSE, INFINITE, QS_ALLINPUT) == WAIT_FAILED) { printf("run_wfreerdp: WaitForMultipleObjects failed\n"); break; } /* check the libfreerdp fds */ if (inst->rdp_check_fds(inst) != 0) { printf("run_wfreerdp: inst->rdp_check_fds failed\n"); break; } /* check channel fds */ if (freerdp_chanman_check_fds(wfi->chan_man, inst) != 0) { printf("run_wfreerdp: freerdp_chanman_check_fds failed\n"); break; } alldone = FALSE; while (PeekMessage(&msg, 0, 0, 0, PM_NOREMOVE)) { gmcode = GetMessage(&msg, 0, 0, 0); if (gmcode == 0 || gmcode == -1) { alldone = TRUE; break; } TranslateMessage(&msg); DispatchMessage(&msg); } if (alldone) { break; } } /* cleanup */ wf_uninit(wfi); freerdp_chanman_free(wfi->chan_man); freerdp_free(inst); free(wfi->settings); free(wfi); return 0; }