diff options
Diffstat (limited to 'xorg-server/hw/xwin/xlaunch/main.cc')
-rw-r--r-- | xorg-server/hw/xwin/xlaunch/main.cc | 71 |
1 files changed, 48 insertions, 23 deletions
diff --git a/xorg-server/hw/xwin/xlaunch/main.cc b/xorg-server/hw/xwin/xlaunch/main.cc index 2247d3aaf..26a132756 100644 --- a/xorg-server/hw/xwin/xlaunch/main.cc +++ b/xorg-server/hw/xwin/xlaunch/main.cc @@ -34,6 +34,9 @@ #include <X11/Xlib.h> +#ifdef _MSC_VER +#define snprintf _snprintf +#endif /// @brief Send WM_ENDSESSION to all program windows. /// This will shutdown the started xserver BOOL CALLBACK KillWindowsProc(HWND hwnd, LPARAM lParam) @@ -59,7 +62,7 @@ class CMyWizard : public CWizard AddPage(IDD_PROGRAM, IDS_PROGRAM_TITLE, IDS_PROGRAM_SUBTITLE); AddPage(IDD_XDMCP, IDS_XDMCP_TITLE, IDS_XDMCP_SUBTITLE); //AddPage(IDD_FONTPATH, IDS_FONTPATH_TITLE, IDS_FONTPATH_SUBTITLE); - AddPage(IDD_CLIPBOARD, IDS_CLIPBOARD_TITLE, IDS_CLIPBOARD_SUBTITLE); + AddPage(IDD_EXTRA, IDS_EXTRA_TITLE, IDS_EXTRA_SUBTITLE); AddPage(IDD_FINISH, IDS_FINISH_TITLE, IDS_FINISH_SUBTITLE); } @@ -69,7 +72,9 @@ class CMyWizard : public CWizard config.Load(filename); } catch (std::runtime_error &e) { - printf("Fehler: %s\n", e.what()); + char Message[255]; + sprintf(Message,"Failure: %s\n", e.what()); + MessageBox(NULL,Message,"Exception",MB_OK); } } @@ -108,7 +113,10 @@ class CMyWizard : public CWizard } // Check for valid input if (config.display.empty()) + { + MessageBox(hwndDlg,"Please fill in a display number.","Error",MB_OK); SetWindowLong(hwndDlg, DWL_MSGRESULT, -1); + } else SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_CLIENTS); return TRUE; @@ -125,7 +133,7 @@ class CMyWizard : public CWizard } else if (IsDlgButtonChecked(hwndDlg, IDC_CLIENT_NONE)) { config.client = CConfig::NoClient; - SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_CLIPBOARD); + SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_EXTRA); } else SetWindowLong(hwndDlg, DWL_MSGRESULT, -1); return TRUE; @@ -157,7 +165,7 @@ class CMyWizard : public CWizard if (!config.local && (config.host.empty() || config.program.empty())) SetWindowLong(hwndDlg, DWL_MSGRESULT, -1); else - SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_CLIPBOARD); + SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_EXTRA); return TRUE; case IDD_XDMCP: // Check for broadcast @@ -186,14 +194,19 @@ class CMyWizard : public CWizard if (!config.broadcast && config.xdmcp_host.empty()) SetWindowLong(hwndDlg, DWL_MSGRESULT, -1); else - SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_CLIPBOARD); + SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_EXTRA); return TRUE; - case IDD_CLIPBOARD: + case IDD_EXTRA: // check for clipboard if (IsDlgButtonChecked(hwndDlg, IDC_CLIPBOARD)) config.clipboard = true; else config.clipboard = false; + // check for wgl + if (IsDlgButtonChecked(hwndDlg, IDC_WGL)) + config.wgl = true; + else + config.wgl = false; // read parameters { char buffer[512]; @@ -234,7 +247,7 @@ class CMyWizard : public CWizard SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_CLIENTS); return TRUE; case IDD_FONTPATH: - case IDD_CLIPBOARD: // temporary. fontpath is disabled + case IDD_EXTRA: // temporary. fontpath is disabled switch (config.client) { case CConfig::NoClient: @@ -264,8 +277,18 @@ class CMyWizard : public CWizard { case IDD_CLIENTS: // Enable or disable XDMCP radiobutton and text - EnableWindow(GetDlgItem(hwndDlg, IDC_XDMCP), config.window != CConfig::MultiWindow); - EnableWindow(GetDlgItem(hwndDlg, IDC_XDMCP_DESC), config.window != CConfig::MultiWindow); + if (config.window != CConfig::MultiWindow) + { + EnableWindow(GetDlgItem(hwndDlg, IDC_XDMCP), true); + EnableWindow(GetDlgItem(hwndDlg, IDC_XDMCP_DESC), true); + } + else + { + if (IsDlgButtonChecked(hwndDlg, IDC_XDMCP)) + CheckRadioButton(hwndDlg, IDC_CLIENT_NONE, IDC_CLIENT, IDC_CLIENT_NONE); + EnableWindow(GetDlgItem(hwndDlg, IDC_XDMCP), false); + EnableWindow(GetDlgItem(hwndDlg, IDC_XDMCP_DESC), false); + } break; } return FALSE; @@ -354,7 +377,9 @@ class CMyWizard : public CWizard config.Save(ofn.lpstrFile); } catch (std::runtime_error &e) { - printf("Fehler: %s\n", e.what()); + char Message[255]; + sprintf(Message,"Failure: %s\n", e.what()); + MessageBox(NULL,Message,"Exception",MB_OK); } } } @@ -432,8 +457,9 @@ class CMyWizard : public CWizard // Set hostname SetDlgItemText(hwndDlg, IDC_XDMCP_HOST, config.xdmcp_host.c_str()); break; - case IDD_CLIPBOARD: + case IDD_EXTRA: CheckDlgButton(hwndDlg, IDC_CLIPBOARD, config.clipboard?BST_CHECKED:BST_UNCHECKED); + CheckDlgButton(hwndDlg, IDC_WGL, config.wgl?BST_CHECKED:BST_UNCHECKED); SetDlgItemText(hwndDlg, IDC_EXTRA_PARAMS, config.extra_params.c_str()); break; @@ -489,7 +515,7 @@ class CMyWizard : public CWizard return NULL; } - /// @brief Do the actual start of Xming and clients + /// @brief Do the actual start of VCXsrv and clients void StartUp() { std::string buffer; @@ -499,13 +525,8 @@ class CMyWizard : public CWizard std::string display_id = ":" + config.display; std::string display = "localhost" + display_id + ":0"; -#ifdef _DEBUG - // Debug only: Switch to Xming installation directory - SetCurrentDirectory("C:\\Programme\\Xming"); -#endif - - // Build Xming commandline - buffer = "Xming " + display_id + " "; + // Build Xsrv commandline + buffer = "vcxsrv " + display_id + " "; switch (config.window) { case CConfig::MultiWindow: @@ -537,6 +558,8 @@ class CMyWizard : public CWizard } if (config.clipboard) buffer += "-clipboard "; + if (config.wgl) + buffer += "-wgl "; if (!config.extra_params.empty()) { buffer += config.extra_params; @@ -577,7 +600,7 @@ class CMyWizard : public CWizard sic.cb = sizeof(sic); ZeroMemory( &pic, sizeof(pic) ); - // Start Xming process. + // Start VCXsrv process. #ifdef _DEBUG printf("%s\n", buffer.c_str()); #endif @@ -627,7 +650,7 @@ class CMyWizard : public CWizard #ifdef _DEBUG printf("killing process!\n"); #endif - // Check if Xming is still running + // Check if Xsrv is still running DWORD exitcode; GetExitCodeProcess(pi.hProcess, &exitcode); unsigned counter = 0; @@ -636,7 +659,7 @@ class CMyWizard : public CWizard if (++counter > 10) TerminateProcess(pi.hProcess, (DWORD)-1); else - // Shutdown Xming (the soft way!) + // Shutdown Xsrv (the soft way!) EnumThreadWindows(pi.dwThreadId, KillWindowsProc, 0); Sleep(500); GetExitCodeProcess(pi.hProcess, &exitcode); @@ -690,7 +713,9 @@ int main(int argc, char **argv) return 0; } catch (std::runtime_error &e) { - printf("Fehler: %s\n", e.what()); + char Message[255]; + sprintf(Message,"Failure: %s\n", e.what()); + MessageBox(NULL,Message,"Exception",MB_OK); return -1; } } |