aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xwin/xlaunch
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xwin/xlaunch')
-rw-r--r--xorg-server/hw/xwin/xlaunch/Makefile79
-rw-r--r--xorg-server/hw/xwin/xlaunch/config.cc480
-rw-r--r--xorg-server/hw/xwin/xlaunch/config.h53
-rw-r--r--xorg-server/hw/xwin/xlaunch/main.cc917
-rw-r--r--xorg-server/hw/xwin/xlaunch/makefile36
-rw-r--r--xorg-server/hw/xwin/xlaunch/resources/dialog.rc50
-rw-r--r--xorg-server/hw/xwin/xlaunch/resources/resources.h146
-rw-r--r--xorg-server/hw/xwin/xlaunch/resources/resources.rc2
-rw-r--r--xorg-server/hw/xwin/xlaunch/resources/strings.rc33
-rw-r--r--xorg-server/hw/xwin/xlaunch/window/makefile4
-rw-r--r--xorg-server/hw/xwin/xlaunch/window/util.cc2
-rw-r--r--xorg-server/hw/xwin/xlaunch/window/util.h4
-rw-r--r--xorg-server/hw/xwin/xlaunch/window/wizard.h1
13 files changed, 904 insertions, 903 deletions
diff --git a/xorg-server/hw/xwin/xlaunch/Makefile b/xorg-server/hw/xwin/xlaunch/Makefile
deleted file mode 100644
index f7cf923df..000000000
--- a/xorg-server/hw/xwin/xlaunch/Makefile
+++ /dev/null
@@ -1,79 +0,0 @@
-#
-# Copyright (c) 2005 Alexander Gottwald
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the "Software"),
-# to deal in the Software without restriction, including without limitation
-# the rights to use, copy, modify, merge, publish, distribute, sublicense,
-# and/or sell copies of the Software, and to permit persons to whom the
-# Software is furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
-# THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
-# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
-# DEALINGS IN THE SOFTWARE.
-#
-# Except as contained in this notice, the name(s) of the above copyright
-# holders shall not be used in advertising or otherwise to promote the sale,
-# use or other dealings in this Software without prior written authorization.
-#
-WINDRES=windres
-
-TARGET=mingw
-#DEBUG_FLAGS=-D_DEBUG
-
-OS_FLAGS_mingw=-mno-cygwin
-OS_FLAGS=$(OS_FLAGS_$(TARGET)) $(DEBUG_FLAGS)
-
-X11_DIR_$(TARGET)=/usr/X11R6
-X11_DIR_mingw=../../../../../exports
-X11_DIR=$(X11_DIR_$(TARGET))
-X11_INCLUDE=-I$(X11_DIR)/include
-X11_LIBDIR=-L$(X11_DIR)/lib
-X11_LIBS_$(TARGET)=-lX11
-X11_LIBS_mingw=-lX11 -lwsock32
-X11_LIBS=$(X11_LIBS_$(TARGET))
-
-PROGRAMFILES:=$(shell cygpath -u $(PROGRAMFILES))
-#MSXML_DIR=$(PROGRAMFILES)/MSXML 4.0
-MSXML_DIR=$(PROGRAMFILES)/Microsoft XML Parser SDK
-MSXML_INCLUDE="-I$(MSXML_DIR)/inc"
-MSXML_LIBDIR="-L$(MSXML_DIR)/lib"
-MSXML_LIBS=
-
-
-CXXFLAGS=-g $(OS_FLAGS) $(X11_INCLUDE) $(MSXML_INCLUDE)
-LDFLAGS=-mwindows $(X11_LIBDIR) $(MSXML_LIBDIR)
-LIBS=-lcomctl32 -lole32 -loleaut32 $(X11_LIBS) $(MSXML_LIBS)
-all:xlaunch.exe
-%.res: %.rc
- $(WINDRES) -O coff -o $@ $<
-
-WINDOW_PARTS=window util dialog wizard
-WINDOW_OBJECTS=$(foreach file,$(WINDOW_PARTS),window/$(file).o)
-
-RESOURCES_IMAGES=resources/multiwindow.bmp resources/fullscreen.bmp \
- resources/windowed.bmp resources/nodecoration.bmp
-
-resources/resources.res: resources/resources.rc resources/resources.h \
- resources/images.rc resources/dialog.rc resources/strings.rc \
- $(RESOURCES_IMAGES)
-xlaunch.exe: $(WINDOW_OBJECTS) main.o config.o resources/resources.res
- $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS)
-
-
-window/dialog.o: window/dialog.cc window/dialog.h window/window.h window/util.h
-window/frame.o: window/frame.cc window/frame.h window/window.h
-window/util.o: window/util.cc window/util.h
-window/window.o: window/window.cc window/window.h window/util.h
-window/wizard.o: window/wizard.cc window/wizard.h window/dialog.h \
- window/window.h window/util.h
-main.o: main.cc window/util.h window/wizard.h window/dialog.h \
- window/window.h resources/resources.h config.h
-config.o: config.cc config.h
diff --git a/xorg-server/hw/xwin/xlaunch/config.cc b/xorg-server/hw/xwin/xlaunch/config.cc
index b6bf65ae3..c7ac398fb 100644
--- a/xorg-server/hw/xwin/xlaunch/config.cc
+++ b/xorg-server/hw/xwin/xlaunch/config.cc
@@ -1,282 +1,198 @@
-/*
- * Copyright (c) 2005 Alexander Gottwald
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
- * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
- * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- *
- * Except as contained in this notice, the name(s) of the above copyright
- * holders shall not be used in advertising or otherwise to promote the sale,
- * use or other dealings in this Software without prior written authorization.
- */
-#include "config.h"
-#include "window/util.h"
-#include <msxml2.h>
-#include <stdexcept>
-
-const CLSID CLSID_DOMDocument40 = {0x88d969c0,0xf192,0x11d4,0xa6,0x5f,0x00,0x40,0x96,0x32,0x51,0xe5};
-const CLSID CLSID_DOMDocument30 = {0xf5078f32,0xc551,0x11d3,0x89,0xb9,0x00,0x00,0xf8,0x1f,0xe2,0x21};
-const IID IID_IXMLDOMDocument2 = {0x2933BF95,0x7B36,0x11d2,0xB2,0x0E,0x00,0xC0,0x4F,0x98,0x3E,0x60};
-
-#define HRCALL(x, msg) if (FAILED(x)) { throw std::runtime_error("OLE Error:" msg " failed"); };
-
-char *wcconvert(const wchar_t *wstr)
-{
- int chars = WideCharToMultiByte(CP_ACP, 0, wstr, -1, NULL, 0, NULL, NULL);
- if (chars == 0)
- throw win32_error("WideCharToMultiByte");
- char *mbstr = new char[chars];
- chars = WideCharToMultiByte(CP_ACP, 0, wstr, -1, mbstr, chars, NULL, NULL);
- if (chars == 0)
- throw win32_error("WideCharToMultiByte");
- return mbstr;
-}
-
-wchar_t *mbconvert(const char *mbstr)
-{
- int chars = MultiByteToWideChar(CP_ACP, 0, mbstr, -1, NULL, 0);
- if (chars == 0)
- throw win32_error("MultiByteToWideChar");
- wchar_t *wstr = new wchar_t[chars];
- chars = MultiByteToWideChar(CP_ACP, 0, mbstr, -1, wstr, chars);
- if (chars == 0)
- throw win32_error("MultiByteToWideChar");
- return wstr;
-}
-
-VARIANT VariantString(const char *filename)
-{
-
- wchar_t *str = mbconvert(filename);
-
- VARIANT var;
- VariantInit(&var);
- V_BSTR(&var) = SysAllocString(str);
- V_VT(&var) = VT_BSTR;
-
- delete [] str;
- return var;
-}
-
-VARIANT VariantString(const wchar_t *str)
-{
- VARIANT var;
- VariantInit(&var);
- V_BSTR(&var) = SysAllocString(str);
- V_VT(&var) = VT_BSTR;
- return var;
-}
-
-IXMLDOMDocument2 *CreateDocument()
-{
- IXMLDOMDocument2 *doc = NULL;
-
- CoInitialize(NULL);
-
- HRCALL(CoCreateInstance(CLSID_DOMDocument40, NULL, CLSCTX_INPROC_SERVER,
- IID_IXMLDOMDocument2, (void**)&doc), "CoCreateInstance");
-
- try {
- HRCALL(doc->put_async(VARIANT_FALSE), "put_async");
- HRCALL(doc->put_validateOnParse(VARIANT_FALSE), "put_validateOnParse");
- HRCALL(doc->put_resolveExternals(VARIANT_FALSE), "put_resolveExternals");
-
- IXMLDOMProcessingInstruction *pi = NULL;
- IXMLDOMElement *root = NULL;
- BSTR xml = SysAllocString(L"xml");
- BSTR ver = SysAllocString(L"version='1.0'");
- HRCALL(doc->createProcessingInstruction(xml,ver, &pi),
- "createProcessingInstruction");
- HRCALL(doc->appendChild(pi, NULL),
- "appendChild");
- pi->Release();
- SysFreeString(xml);
- SysFreeString(ver);
-
- BSTR elemname = SysAllocString(L"XLaunch");
- HRCALL(doc->createElement(elemname, &root), "createElement");
- HRCALL(doc->appendChild(root, NULL), "appendChild");
- SysFreeString(elemname);
- } catch (...)
- {
- doc->Release();
- throw;
- }
- return doc;
-}
-
-void setAttribute(IXMLDOMElement *elem, const wchar_t *name, const wchar_t *value)
-{
- BSTR str = SysAllocString(name);
- VARIANT var = VariantString(value);
- HRCALL(elem->setAttribute(str, var), "setAttribute");
- VariantClear(&var);
- SysFreeString(str);
-}
-
-void setAttribute(IXMLDOMElement *elem, const wchar_t *name, const char *value)
-{
- wchar_t *wstr = mbconvert(value);
- setAttribute(elem, name, wstr);
- delete [] wstr;
- return;
-}
-
-void CConfig::Save(const char *filename)
-{
- IXMLDOMDocument2 *doc = CreateDocument();
- IXMLDOMElement *root = NULL;
-
- HRCALL(doc->get_documentElement(&root), "get_documentElement");
-
- switch (window)
- {
- case MultiWindow:
- setAttribute(root, L"WindowMode", L"MultiWindow");
- break;
- case Fullscreen:
- setAttribute(root, L"WindowMode", L"Fullscreen");
- break;
- default:
- case Windowed:
- setAttribute(root, L"WindowMode", L"Windowed");
- break;
- case Nodecoration:
- setAttribute(root, L"WindowMode", L"Nodecoration");
- break;
- }
- switch (client)
- {
- default:
- case NoClient:
- setAttribute(root, L"ClientMode", L"NoClient");
- break;
- case StartProgram:
- setAttribute(root, L"ClientMode", L"StartProgram");
- break;
- case XDMCP:
- setAttribute(root, L"ClientMode", L"XDMCP");
- break;
- }
- setAttribute(root, L"LocalClient", local?L"True":L"False");
- setAttribute(root, L"Display", display.c_str());
- setAttribute(root, L"Program", program.c_str());
- setAttribute(root, L"RemoteProtocol", protocol.c_str());
- setAttribute(root, L"RemoteHost", host.c_str());
- setAttribute(root, L"RemoteUser", user.c_str());
- setAttribute(root, L"XDMCPHost", xdmcp_host.c_str());
- setAttribute(root, L"XDMCPBroadcast", broadcast?L"True":L"False");
- setAttribute(root, L"XDMCPIndirect", indirect?L"True":L"False");
- setAttribute(root, L"Clipboard", clipboard?L"True":L"False");
- setAttribute(root, L"ExtraParams", extra_params.c_str());
-
- VARIANT var = VariantString(filename);
- HRCALL(doc->save(var), "save");
- VariantClear(&var);
-
-
- root->Release();
- doc->Release();
-}
-
-BOOL getAttribute(IXMLDOMElement *elem, const wchar_t *name, std::string &ret)
-{
- VARIANT var;
- HRCALL(elem->getAttribute((OLECHAR*)name, &var), "getAttribute");
- if (V_VT(&var) != VT_NULL && V_VT(&var) == VT_BSTR)
- {
- char *str = wcconvert(V_BSTR(&var));
- ret = str;
- delete [] str;
- return true;
- }
- return false;
-}
-
-BOOL getAttributeBool(IXMLDOMElement *elem, const wchar_t *name, bool &ret)
-{
- std::string str;
- if (getAttribute(elem, name, str))
- {
- if (str == "True")
- ret = true;
- else
- ret = false;
- return true;
- }
- return false;
-}
-
-
-void CConfig::Load(const char *filename)
-{
- IXMLDOMDocument2 *doc = CreateDocument();
- IXMLDOMElement *root = NULL;
-
- VARIANT var = VariantString(filename);
- VARIANT_BOOL status;
- HRCALL(doc->load(var, &status), "load");
- VariantClear(&var);
-
- if (status == VARIANT_FALSE)
- {
- doc->Release();
- return;
- }
-
- HRCALL(doc->get_documentElement(&root), "get_documentElement");
-
- std::string windowMode;
- std::string clientMode;
-
- if (getAttribute(root, L"WindowMode", windowMode))
- {
- if (windowMode == "MultiWindow")
- window = MultiWindow;
- else if (windowMode == "Fullscreen")
- window = Fullscreen;
- else if (windowMode == "Windowed")
- window = Windowed;
- else if (windowMode == "Nodecoration")
- window = Nodecoration;
- }
- if (getAttribute(root, L"ClientMode", clientMode))
- {
- if (clientMode == "NoClient")
- client = NoClient;
- else if (clientMode == "StartProgram")
- client = StartProgram;
- else if (clientMode == "XDMCP")
- client = XDMCP;
- }
-
- getAttributeBool(root, L"LocalClient", local);
- getAttribute(root, L"Display", display);
- getAttribute(root, L"Program", program);
- getAttribute(root, L"RemoteProtocol", protocol);
- getAttribute(root, L"RemoteHost", host);
- getAttribute(root, L"RemoteUser", user);
- getAttribute(root, L"XDMCPHost", xdmcp_host);
- getAttributeBool(root, L"XDMCPBroadcast", broadcast);
- getAttributeBool(root, L"XDMCPIndirect", indirect);
- getAttributeBool(root, L"Clipboard", clipboard);
- getAttribute(root, L"ExtraParams", extra_params);
-
-
- doc->Release();
-}
-
+/*
+ * Copyright (c) 2005 Alexander Gottwald
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Except as contained in this notice, the name(s) of the above copyright
+ * holders shall not be used in advertising or otherwise to promote the sale,
+ * use or other dealings in this Software without prior written authorization.
+ */
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+#include "config.h"
+#include "window/util.h"
+#include <stdexcept>
+
+xmlDocPtr CreateDocument()
+{
+ xmlDocPtr doc = xmlNewDoc(BAD_CAST "1.0");
+ xmlNodePtr root_node = xmlNewNode(NULL, BAD_CAST "XLaunch");
+ xmlDocSetRootElement(doc, root_node);
+
+ return doc;
+
+}
+
+void setAttribute(xmlNodePtr elem, const char *name, const char *value)
+{
+ xmlNewProp(elem, BAD_CAST name, BAD_CAST value);
+}
+
+void CConfig::Save(const char *filename)
+{
+ xmlDocPtr doc = CreateDocument();
+ xmlNodePtr root = xmlDocGetRootElement(doc);
+
+ switch (window)
+ {
+ case MultiWindow:
+ setAttribute(root, "WindowMode", "MultiWindow");
+ break;
+ case Fullscreen:
+ setAttribute(root, "WindowMode", "Fullscreen");
+ break;
+ default:
+ case Windowed:
+ setAttribute(root, "WindowMode", "Windowed");
+ break;
+ case Nodecoration:
+ setAttribute(root, "WindowMode", "Nodecoration");
+ break;
+ }
+ switch (client)
+ {
+ default:
+ case NoClient:
+ setAttribute(root, "ClientMode", "NoClient");
+ break;
+ case StartProgram:
+ setAttribute(root, "ClientMode", "StartProgram");
+ break;
+ case XDMCP:
+ setAttribute(root, "ClientMode", "XDMCP");
+ break;
+ }
+ setAttribute(root, "LocalClient", local?"True":"False");
+ setAttribute(root, "Display", display.c_str());
+ setAttribute(root, "LocalProgram", localprogram.c_str());
+ setAttribute(root, "RemoteProgram", remoteprogram.c_str());
+ setAttribute(root, "RemotePassword", remotepassword.c_str());
+ setAttribute(root, "RemoteHost", host.c_str());
+ setAttribute(root, "RemoteUser", user.c_str());
+ setAttribute(root, "XDMCPHost", xdmcp_host.c_str());
+ setAttribute(root, "XDMCPBroadcast", broadcast?"True":"False");
+ setAttribute(root, "XDMCPIndirect", indirect?"True":"False");
+ setAttribute(root, "Clipboard", clipboard?"True":"False");
+ setAttribute(root, "ClipboardPrimary", clipboardprimary?"True":"False");
+ setAttribute(root, "ExtraParams", extra_params.c_str());
+ setAttribute(root, "Wgl", wgl?"True":"False");
+ setAttribute(root, "DisableAC", disableac?"True":"False");
+ setAttribute(root, "XDMCPTerminate", xdmcpterminate?"True":"False");
+
+ xmlSaveFormatFileEnc(filename, doc, "UTF-8", 1);
+
+ /*free the document */
+ xmlFreeDoc(doc);
+
+ /*
+ *Free the global variables that may
+ *have been allocated by the parser.
+ */
+ xmlCleanupParser();
+}
+
+BOOL getAttribute(xmlNodePtr elem, const char *name, std::string &ret)
+{
+ char *pVal=(char*)xmlGetProp(elem,BAD_CAST name);
+ if (!pVal)
+ return false;
+ ret=pVal;
+ return true;
+}
+
+BOOL getAttributeBool(xmlNodePtr elem, const char *name, bool &ret)
+{
+ const char *pVal=(char*)xmlGetProp(elem, BAD_CAST name);
+ if (!pVal)
+ return false;
+
+ std::string str(pVal);
+
+ if (str == "True")
+ ret = true;
+ else
+ ret = false;
+ return true;
+}
+
+
+void CConfig::Load(const char *filename)
+{
+ xmlDocPtr doc = xmlReadFile(filename, NULL, 0);
+
+ xmlNodePtr root;
+
+ if (doc == NULL)
+ {
+ return;
+ }
+
+ root = xmlDocGetRootElement(doc);
+
+ std::string windowMode;
+ std::string clientMode;
+
+ if (getAttribute(root, "WindowMode", windowMode))
+ {
+ if (windowMode == "MultiWindow")
+ window = MultiWindow;
+ else if (windowMode == "Fullscreen")
+ window = Fullscreen;
+ else if (windowMode == "Windowed")
+ window = Windowed;
+ else if (windowMode == "Nodecoration")
+ window = Nodecoration;
+ }
+ if (getAttribute(root, "ClientMode", clientMode))
+ {
+ if (clientMode == "NoClient")
+ client = NoClient;
+ else if (clientMode == "StartProgram")
+ client = StartProgram;
+ else if (clientMode == "XDMCP")
+ client = XDMCP;
+ }
+
+ getAttributeBool(root, "LocalClient", local);
+ getAttribute(root, "Display", display);
+ getAttribute(root, "LocalProgram", localprogram);
+ getAttribute(root, "RemoteProgram", remoteprogram);
+ getAttribute(root, "RemotePassword", remotepassword);
+ getAttribute(root, "RemoteHost", host);
+ getAttribute(root, "RemoteUser", user);
+ getAttribute(root, "XDMCPHost", xdmcp_host);
+ getAttributeBool(root, "XDMCPBroadcast", broadcast);
+ getAttributeBool(root, "XDMCPIndirect", indirect);
+ getAttributeBool(root, "Clipboard", clipboard);
+ getAttributeBool(root, "ClipboardPrimary", clipboardprimary);
+ getAttribute(root, "ExtraParams", extra_params);
+ getAttributeBool(root, "Wgl", wgl);
+ getAttributeBool(root, "DisableAC", disableac);
+ getAttributeBool(root, "XDMCPTerminate", xdmcpterminate);
+
+ /*free the document */
+ xmlFreeDoc(doc);
+
+ /*
+ *Free the global variables that may
+ *have been allocated by the parser.
+ */
+ xmlCleanupParser();
+}
+
diff --git a/xorg-server/hw/xwin/xlaunch/config.h b/xorg-server/hw/xwin/xlaunch/config.h
index f0aed3cf1..ecd22fe75 100644
--- a/xorg-server/hw/xwin/xlaunch/config.h
+++ b/xorg-server/hw/xwin/xlaunch/config.h
@@ -22,39 +22,68 @@
* Except as contained in this notice, the name(s) of the above copyright
* holders shall not be used in advertising or otherwise to promote the sale,
* use or other dealings in this Software without prior written authorization.
+ *
+ * Authors: Alexander Gottwald, Colin Harrison
*/
#ifndef __CONFIG_H__
#define __CONFIG_H__
+#define UNICODE
+#define _UNICODE
+
+#define PROG_NUMBER 10
+#define HOST_NUMBER 10
+#define MAX_MESSAGE 256
+#define MAX_CAPTION 128
+#include <windows.h>
#include <string>
+#include <vector>
struct CConfig
{
enum {MultiWindow, Fullscreen, Windowed, Nodecoration} window;
enum {NoClient, StartProgram, XDMCP} client;
bool local;
std::string display;
- std::string protocol;
- std::string program;
+ std::string localprogram;
+ std::string remoteprogram;
+ bool compress;
std::string host;
std::string user;
+ std::string remotepassword;
bool broadcast;
bool indirect;
std::string xdmcp_host;
bool clipboard;
+ bool clipboardprimary;
+ bool wgl;
+ bool disableac;
+ bool xdmcpterminate;
std::string extra_params;
#ifdef _DEBUG
- CConfig() : window(MultiWindow), client(StartProgram), local(false), display("1"),
- protocol("Putty"), program("xterm"), host("lupus"), user("ago"),
- broadcast(false), indirect(false), xdmcp_host("lupus"),
- clipboard(true), extra_params() {};
+ CConfig() : window(MultiWindow), client(NoClient), display("1"),
#else
- CConfig() : window(MultiWindow), client(StartProgram), local(false), display("0"),
- protocol("Putty"), program("xterm"), host(""), user(""),
- broadcast(true), indirect(false), xdmcp_host(""),
- clipboard(true), extra_params() {};
+ CConfig() : window(MultiWindow), client(NoClient), display("0"),
#endif
- void Load(const char* filename);
- void Save(const char* filename);
+ local(false),
+ remotepassword(""),
+ localprogram("xcalc"),
+ remoteprogram("xterm"),
+ compress(false),
+ host(""),
+ user(""),
+ broadcast(false),
+ indirect(false),
+ xdmcp_host(""),
+ clipboard(true),
+ clipboardprimary(true),
+ extra_params(),
+ disableac(true),
+ wgl(true),
+ xdmcpterminate(false)
+ {
+ };
+ void Load(const char * filename);
+ void Save(const char * filename);
};
#endif
diff --git a/xorg-server/hw/xwin/xlaunch/main.cc b/xorg-server/hw/xwin/xlaunch/main.cc
index 2247d3aaf..0a80630f0 100644
--- a/xorg-server/hw/xwin/xlaunch/main.cc
+++ b/xorg-server/hw/xwin/xlaunch/main.cc
@@ -34,6 +34,8 @@
#include <X11/Xlib.h>
+#include <stdlib.h>
+
/// @brief Send WM_ENDSESSION to all program windows.
/// This will shutdown the started xserver
BOOL CALLBACK KillWindowsProc(HWND hwnd, LPARAM lParam)
@@ -48,7 +50,7 @@ class CMyWizard : public CWizard
{
public:
private:
- CConfig config; /// Storage for config options.
+ CConfig config; /// Storage for config options.
public:
/// @brief Constructor.
/// Set wizard pages.
@@ -59,307 +61,339 @@ 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);
}
- virtual void LoadConfig(const char *filename)
- {
- try {
- config.Load(filename);
- } catch (std::runtime_error &e)
- {
- printf("Fehler: %s\n", e.what());
- }
- }
+ virtual void LoadConfig(const char *filename)
+ {
+ try {
+ config.Load(filename);
+ } catch (std::runtime_error &e)
+ {
+ char Message[255];
+ sprintf(Message,"Failure: %s\n", e.what());
+ MessageBox(NULL,Message,"Exception",MB_OK);
+ }
+ }
/// @brief Handle the PSN_WIZNEXT message.
/// @param hwndDlg Handle to active page dialog.
/// @param index Index of current page.
/// @return TRUE if the message was handled. FALSE otherwise.
- virtual BOOL WizardNext(HWND hwndDlg, unsigned index)
- {
+ virtual BOOL WizardNext(HWND hwndDlg, unsigned index)
+ {
#ifdef _DEBUG
- printf("%s %d\n", __FUNCTION__, index);
+ printf("%s %d\n", __FUNCTION__, index);
#endif
- switch (PageID(index))
- {
- case IDD_DISPLAY:
+ switch (PageID(index))
+ {
+ case IDD_DISPLAY:
// Check for select window mode
- if (IsDlgButtonChecked(hwndDlg, IDC_MULTIWINDOW))
- config.window = CConfig::MultiWindow;
- else if (IsDlgButtonChecked(hwndDlg, IDC_FULLSCREEN))
- config.window = CConfig::Fullscreen;
- else if (IsDlgButtonChecked(hwndDlg, IDC_WINDOWED))
- config.window = CConfig::Windowed;
- else if (IsDlgButtonChecked(hwndDlg, IDC_NODECORATION))
- config.window = CConfig::Nodecoration;
- else
- {
- SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
- return TRUE;
- }
+ if (IsDlgButtonChecked(hwndDlg, IDC_MULTIWINDOW))
+ config.window = CConfig::MultiWindow;
+ else if (IsDlgButtonChecked(hwndDlg, IDC_FULLSCREEN))
+ config.window = CConfig::Fullscreen;
+ else if (IsDlgButtonChecked(hwndDlg, IDC_WINDOWED))
+ config.window = CConfig::Windowed;
+ else if (IsDlgButtonChecked(hwndDlg, IDC_NODECORATION))
+ config.window = CConfig::Nodecoration;
+ else
+ {
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
+ return TRUE;
+ }
// Get selected display number
- {
- char buffer[512];
- GetDlgItemText(hwndDlg, IDC_DISPLAY, buffer, 512);
- buffer[511] = 0;
- config.display = buffer;
+ {
+ char buffer[512];
+ GetDlgItemText(hwndDlg, IDC_DISPLAY, buffer, 512);
+ buffer[511] = 0;
+ config.display = buffer;
}
// Check for valid input
if (config.display.empty())
- SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
+ {
+ 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;
- case IDD_CLIENTS:
+ return TRUE;
+ case IDD_CLIENTS:
// Check for select client startup method
- if (IsDlgButtonChecked(hwndDlg, IDC_CLIENT))
- {
- config.client = CConfig::StartProgram;
- SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_PROGRAM);
- } else if (IsDlgButtonChecked(hwndDlg, IDC_XDMCP))
- {
- config.client = CConfig::XDMCP;
- SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_XDMCP);
- } else if (IsDlgButtonChecked(hwndDlg, IDC_CLIENT_NONE))
- {
- config.client = CConfig::NoClient;
- SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_CLIPBOARD);
- } else
- SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
- return TRUE;
- case IDD_PROGRAM:
+ if (IsDlgButtonChecked(hwndDlg, IDC_CLIENT))
+ {
+ config.client = CConfig::StartProgram;
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_PROGRAM);
+ } else if (IsDlgButtonChecked(hwndDlg, IDC_XDMCP))
+ {
+ config.client = CConfig::XDMCP;
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_XDMCP);
+ } else if (IsDlgButtonChecked(hwndDlg, IDC_CLIENT_NONE))
+ {
+ config.client = CConfig::NoClient;
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_EXTRA);
+ } else
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
+ return TRUE;
+ case IDD_PROGRAM:
// Check wether local or remote client should be started
- if (IsDlgButtonChecked(hwndDlg, IDC_CLIENT_LOCAL))
- config.local = true;
- else if (IsDlgButtonChecked(hwndDlg, IDC_CLIENT_REMOTE))
- config.local = false;
- else
- {
- SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
- return TRUE;
- }
+ if (IsDlgButtonChecked(hwndDlg, IDC_CLIENT_LOCAL))
+ config.local = true;
+ else if (IsDlgButtonChecked(hwndDlg, IDC_CLIENT_REMOTE))
+ config.local = false;
+ else
+ {
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
+ return TRUE;
+ }
// Read program, user and host name
- {
- char buffer[512];
- GetDlgItemText(hwndDlg, IDC_CLIENT_USER, buffer, 512);
- buffer[511] = 0;
- config.user = buffer;
- GetDlgItemText(hwndDlg, IDC_CLIENT_HOST, buffer, 512);
- buffer[511] = 0;
- config.host = buffer;
- GetDlgItemText(hwndDlg, IDC_CLIENT_PROGRAM, buffer, 512);
- buffer[511] = 0;
- config.program = buffer;
- }
+ {
+ char buffer[512];
+ GetDlgItemText(hwndDlg, IDC_CLIENT_USER, buffer, 512);
+ buffer[511] = 0;
+ config.user = buffer;
+ GetDlgItemText(hwndDlg, IDC_CLIENT_HOST, buffer, 512);
+ buffer[511] = 0;
+ config.host = buffer;
+ GetDlgItemText(hwndDlg, IDC_CLIENT_PROGRAM, buffer, 512);
+ buffer[511] = 0;
+ config.localprogram = buffer;
+ GetDlgItemText(hwndDlg, IDC_CLIENT_REMOTEPROGRAM, buffer, 512);
+ buffer[511] = 0;
+ config.remoteprogram = buffer;
+ GetDlgItemText(hwndDlg, IDC_CLIENT_PASSWORD, buffer, 512);
+ buffer[511] = 0;
+ config.remotepassword = buffer;
+ }
// Check for valid input
- if (!config.local && (config.host.empty() || config.program.empty()))
- SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
- else
- SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_CLIPBOARD);
- return TRUE;
- case IDD_XDMCP:
+ if (!config.local && (config.host.empty() || config.localprogram.empty() || config.remoteprogram.empty()))
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
+ else
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_EXTRA);
+ return TRUE;
+ case IDD_XDMCP:
// Check for broadcast
- if (IsDlgButtonChecked(hwndDlg, IDC_XDMCP_BROADCAST))
- config.broadcast = true;
- else if (IsDlgButtonChecked(hwndDlg, IDC_XDMCP_QUERY))
- config.broadcast = false;
- else
- {
- SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
- return TRUE;
- }
+ if (IsDlgButtonChecked(hwndDlg, IDC_XDMCP_BROADCAST))
+ config.broadcast = true;
+ else if (IsDlgButtonChecked(hwndDlg, IDC_XDMCP_QUERY))
+ config.broadcast = false;
+ else
+ {
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
+ return TRUE;
+ }
// Check for indirect mode
- if (IsDlgButtonChecked(hwndDlg, IDC_XDMCP_INDIRECT))
- config.indirect = true;
- else
- config.indirect = false;
+ if (IsDlgButtonChecked(hwndDlg, IDC_XDMCP_INDIRECT))
+ config.indirect = true;
+ else
+ config.indirect = false;
// Read hostname
- {
- char buffer[512];
- GetDlgItemText(hwndDlg, IDC_XDMCP_HOST, buffer, 512);
- buffer[511] = 0;
- config.xdmcp_host = buffer;
- }
+ {
+ char buffer[512];
+ GetDlgItemText(hwndDlg, IDC_XDMCP_HOST, buffer, 512);
+ buffer[511] = 0;
+ config.xdmcp_host = buffer;
+ }
// Check for valid input
- if (!config.broadcast && config.xdmcp_host.empty())
- SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
- else
- SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_CLIPBOARD);
- return TRUE;
- case IDD_CLIPBOARD:
+ if (!config.broadcast && config.xdmcp_host.empty())
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, -1);
+ else
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_EXTRA);
+ if (IsDlgButtonChecked(hwndDlg, IDC_XDMCP_TERMINATE))
+ config.xdmcpterminate = true;
+ else
+ config.xdmcpterminate = false;
+ return TRUE;
+ case IDD_EXTRA:
// check for clipboard
if (IsDlgButtonChecked(hwndDlg, IDC_CLIPBOARD))
config.clipboard = true;
else
config.clipboard = false;
+ // check for clipboard primary selection
+ if (IsDlgButtonChecked(hwndDlg, IDC_CLIPBOARDPRIMARY))
+ config.clipboardprimary = true;
+ else
+ config.clipboardprimary = false;
+ // check for wgl
+ if (IsDlgButtonChecked(hwndDlg, IDC_WGL))
+ config.wgl = true;
+ else
+ config.wgl = false;
+ // check for access control
+ if (IsDlgButtonChecked(hwndDlg, IDC_DISABLEAC))
+ config.disableac = true;
+ else
+ config.disableac = false;
// read parameters
- {
- char buffer[512];
- GetDlgItemText(hwndDlg, IDC_EXTRA_PARAMS, buffer, 512);
- buffer[511] = 0;
- config.extra_params = buffer;
- }
+ {
+ char buffer[512];
+ GetDlgItemText(hwndDlg, IDC_EXTRA_PARAMS, buffer, 512);
+ buffer[511] = 0;
+ config.extra_params = buffer;
+ }
SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_FINISH);
return TRUE;
- default:
- break;
- }
- return FALSE;
- }
+ default:
+ break;
+ }
+ return FALSE;
+ }
/// @brief Handle PSN_WIZFINISH message.
/// @param hwndDlg Handle to active page dialog.
/// @param index Index of current page.
/// @return TRUE if the message was handled. FALSE otherwise.
- virtual BOOL WizardFinish(HWND hwndDlg, unsigned index)
- {
+ virtual BOOL WizardFinish(HWND hwndDlg, unsigned index)
+ {
#ifdef _DEBUG
- printf("finish %d\n", index);
+ printf("finish %d\n", index);
#endif
- return FALSE;
- }
+ return FALSE;
+ }
/// @brief Handle PSN_WIZBACK message.
/// Basicly handles switching to proper page (skipping XDMCP or program page
/// if required).
/// @param hwndDlg Handle to active page dialog.
/// @param index Index of current page.
/// @return TRUE if the message was handled. FALSE otherwise.
- virtual BOOL WizardBack(HWND hwndDlg, unsigned index)
- {
- switch (PageID(index))
- {
- case IDD_PROGRAM:
- case IDD_XDMCP:
- SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_CLIENTS);
- return TRUE;
- case IDD_FONTPATH:
- case IDD_CLIPBOARD: // temporary. fontpath is disabled
- switch (config.client)
- {
- case CConfig::NoClient:
- SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_CLIENTS);
- return TRUE;
- case CConfig::StartProgram:
- SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_PROGRAM);
- return TRUE;
- case CConfig::XDMCP:
- SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_XDMCP);
- return TRUE;
- }
- break;
- }
- return FALSE;
- }
+ virtual BOOL WizardBack(HWND hwndDlg, unsigned index)
+ {
+ switch (PageID(index))
+ {
+ case IDD_PROGRAM:
+ case IDD_XDMCP:
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_CLIENTS);
+ return TRUE;
+ case IDD_FONTPATH:
+ case IDD_EXTRA: // temporary. fontpath is disabled
+ switch (config.client)
+ {
+ case CConfig::NoClient:
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_CLIENTS);
+ return TRUE;
+ case CConfig::StartProgram:
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_PROGRAM);
+ return TRUE;
+ case CConfig::XDMCP:
+ SetWindowLong(hwndDlg, DWL_MSGRESULT, IDD_XDMCP);
+ return TRUE;
+ }
+ break;
+ }
+ return FALSE;
+ }
/// @brief Handle PSN_SETACTIVE message.
/// @param hwndDlg Handle to active page dialog.
/// @param index Index of current page.
/// @return TRUE if the message was handled. FALSE otherwise.
- virtual BOOL WizardActivate(HWND hwndDlg, unsigned index)
- {
+ virtual BOOL WizardActivate(HWND hwndDlg, unsigned index)
+ {
#ifdef _DEBUG
- printf("%s %d\n", __FUNCTION__, index);
+ printf("%s %d\n", __FUNCTION__, index);
#endif
- switch (PageID(index))
- {
- case IDD_CLIENTS:
+ switch (PageID(index))
+ {
+ 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);
- break;
- }
- return FALSE;
- }
+ 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;
+ }
protected:
/// @brief Enable or disable the control for remote clients.
/// @param hwndDlg Handle to active page dialog.
/// @param state State of control group.
- void EnableRemoteProgramGroup(HWND hwndDlg, BOOL state)
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_CLIENT_PROTOCOL), state);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CLIENT_HOST), state);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CLIENT_USER), state);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CLIENT_PROTOCOL_DESC), state);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CLIENT_HOST_DESC), state);
- EnableWindow(GetDlgItem(hwndDlg, IDC_CLIENT_USER_DESC), state);
- }
+ void EnableRemoteProgramGroup(HWND hwndDlg, BOOL state)
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLIENT_PASSWORD), state);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLIENT_HOST), state);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLIENT_USER), state);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLIENT_PASSWORD_DESC), state);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLIENT_HOST_DESC), state);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLIENT_USER_DESC), state);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLIENT_REMOTEPROGRAM), state);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLIENT_REMOTEPROGRAM_DESC), state);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLIENT_PROGRAM), !state);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CLIENT_PROGRAM_DESC), !state);
+ }
/// @brief Enable or disable the control for XDMCP connection.
/// @param hwndDlg Handle to active page dialog.
/// @param state State of control group.
- void EnableXDMCPQueryGroup(HWND hwndDlg, BOOL state)
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_XDMCP_HOST), state);
- EnableWindow(GetDlgItem(hwndDlg, IDC_XDMCP_INDIRECT), state);
- }
+ void EnableXDMCPQueryGroup(HWND hwndDlg, BOOL state)
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_XDMCP_HOST), state);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_XDMCP_INDIRECT), state);
+ }
/// @brief Fill program box with default values.
/// @param hwndDlg Handle to active page dialog.
- void FillProgramBox(HWND hwndDlg)
- {
- HWND cbwnd = GetDlgItem(hwndDlg, IDC_CLIENT_PROGRAM);
- if (cbwnd == NULL)
- return;
- SendMessage(cbwnd, CB_RESETCONTENT, 0, 0);
- SendMessage(cbwnd, CB_ADDSTRING, 0, (LPARAM) "xterm");
- SendMessage(cbwnd, CB_ADDSTRING, 0, (LPARAM) "startkde");
- SendMessage(cbwnd, CB_ADDSTRING, 0, (LPARAM) "gnome-session");
- SendMessage(cbwnd, CB_ADDSTRING, 0, (LPARAM) ".xinitrc");
- SendMessage(cbwnd, CB_ADDSTRING, 0, (LPARAM) "wmaker");
- SendMessage(cbwnd, CB_SETCURSEL, 0, 0);
- }
- /// @brief Fill protocol box with default values.
- /// @param hwndDlg Handle to active page dialog.
- void FillProtocolBox(HWND hwndDlg)
- {
- HWND cbwnd = GetDlgItem(hwndDlg, IDC_CLIENT_PROTOCOL);
- if (cbwnd == NULL)
- return;
- SendMessage(cbwnd, CB_RESETCONTENT, 0, 0);
- SendMessage(cbwnd, CB_ADDSTRING, 0, (LPARAM) "Putty");
- //SendMessage(cbwnd, CB_ADDSTRING, 0, (LPARAM) "OpenSSH");
- SendMessage(cbwnd, CB_SETCURSEL, 0, 0);
- }
- void ShowSaveDialog(HWND parent)
- {
- char szTitle[512];
- char szFilter[512];
- char szFileTitle[512];
- char szFile[MAX_PATH];
- HINSTANCE hInst = GetModuleHandle(NULL);
-
- LoadString(hInst, IDS_SAVE_TITLE, szTitle, sizeof(szTitle));
- LoadString(hInst, IDS_SAVE_FILETITLE, szFileTitle, sizeof(szFileTitle));
- LoadString(hInst, IDS_SAVE_FILTER, szFilter, sizeof(szFilter));
- for (unsigned i=0; szFilter[i]; i++)
- if (szFilter[i] == '%')
- szFilter[i] = '\0';
-
- strcpy(szFile, "config.xlaunch");
-
- OPENFILENAME ofn;
- memset(&ofn, 0, sizeof(OPENFILENAME));
- ofn.lStructSize = sizeof(OPENFILENAME);
- ofn.hwndOwner = parent;
- ofn.lpstrFilter = szFilter;
- ofn.lpstrFile= szFile;
- ofn.nMaxFile = sizeof(szFile)/ sizeof(*szFile);
- ofn.lpstrFileTitle = szFileTitle;
- ofn.nMaxFileTitle = sizeof(szFileTitle);
- ofn.lpstrInitialDir = (LPSTR)NULL;
- ofn.Flags = OFN_SHOWHELP | OFN_OVERWRITEPROMPT;
- ofn.lpstrTitle = szTitle;
-
- if (GetSaveFileName(&ofn))
- {
- try {
- config.Save(ofn.lpstrFile);
- } catch (std::runtime_error &e)
- {
- printf("Fehler: %s\n", e.what());
- }
- }
- }
+ void FillProgramBox(HWND hwndDlg)
+ {
+ HWND cbwnd = GetDlgItem(hwndDlg, IDC_CLIENT_PROGRAM);
+ if (cbwnd == NULL)
+ return;
+ SendMessage(cbwnd, CB_RESETCONTENT, 0, 0);
+ SendMessage(cbwnd, CB_ADDSTRING, 0, (LPARAM) "xcalc");
+ SendMessage(cbwnd, CB_ADDSTRING, 0, (LPARAM) "xclock");
+ SendMessage(cbwnd, CB_ADDSTRING, 0, (LPARAM) "xwininfo");
+ SendMessage(cbwnd, CB_SETCURSEL, 0, 0);
+ }
+ void ShowSaveDialog(HWND parent)
+ {
+ char szTitle[512];
+ char szFilter[512];
+ char szFileTitle[512];
+ char szFile[MAX_PATH];
+ HINSTANCE hInst = GetModuleHandle(NULL);
+
+ LoadString(hInst, IDS_SAVE_TITLE, szTitle, sizeof(szTitle));
+ LoadString(hInst, IDS_SAVE_FILETITLE, szFileTitle, sizeof(szFileTitle));
+ LoadString(hInst, IDS_SAVE_FILTER, szFilter, sizeof(szFilter));
+ for (unsigned i=0; szFilter[i]; i++)
+ if (szFilter[i] == '%')
+ szFilter[i] = '\0';
+
+ strcpy(szFile, "config.xlaunch");
+
+ OPENFILENAME ofn;
+ memset(&ofn, 0, sizeof(OPENFILENAME));
+ ofn.lStructSize = sizeof(OPENFILENAME);
+ ofn.hwndOwner = parent;
+ ofn.lpstrFilter = szFilter;
+ ofn.lpstrFile= szFile;
+ ofn.nMaxFile = sizeof(szFile)/ sizeof(*szFile);
+ ofn.lpstrFileTitle = szFileTitle;
+ ofn.nMaxFileTitle = sizeof(szFileTitle);
+ ofn.lpstrInitialDir = (LPSTR)NULL;
+ ofn.Flags = OFN_SHOWHELP | OFN_OVERWRITEPROMPT;
+ ofn.lpstrTitle = szTitle;
+
+ if (GetSaveFileName(&ofn))
+ {
+ try {
+ config.Save(ofn.lpstrFile);
+ } catch (std::runtime_error &e)
+ {
+ char Message[255];
+ sprintf(Message,"Failure: %s\n", e.what());
+ MessageBox(NULL,Message,"Exception",MB_OK);
+ }
+ }
+ }
public:
-
+
/// @brief Handle messages fo the dialog pages.
/// @param hwndDlg Handle of active dialog.
/// @param uMsg Message code.
@@ -376,64 +410,70 @@ class CMyWizard : public CWizard
{
case IDD_DISPLAY:
// Init display dialog. Enable correct check buttons
- switch (config.window)
- {
- default:
- case CConfig::MultiWindow:
- CheckRadioButton(hwndDlg, IDC_MULTIWINDOW, IDC_NODECORATION, IDC_MULTIWINDOW);
- break;
- case CConfig::Fullscreen:
- CheckRadioButton(hwndDlg, IDC_MULTIWINDOW, IDC_NODECORATION, IDC_FULLSCREEN);
- break;
- case CConfig::Windowed:
- CheckRadioButton(hwndDlg, IDC_MULTIWINDOW, IDC_NODECORATION, IDC_WINDOWED);
- break;
- case CConfig::Nodecoration:
- CheckRadioButton(hwndDlg, IDC_MULTIWINDOW, IDC_NODECORATION, IDC_NODECORATION);
- break;
- }
+ switch (config.window)
+ {
+ default:
+ case CConfig::MultiWindow:
+ CheckRadioButton(hwndDlg, IDC_MULTIWINDOW, IDC_NODECORATION, IDC_MULTIWINDOW);
+ break;
+ case CConfig::Fullscreen:
+ CheckRadioButton(hwndDlg, IDC_MULTIWINDOW, IDC_NODECORATION, IDC_FULLSCREEN);
+ break;
+ case CConfig::Windowed:
+ CheckRadioButton(hwndDlg, IDC_MULTIWINDOW, IDC_NODECORATION, IDC_WINDOWED);
+ break;
+ case CConfig::Nodecoration:
+ CheckRadioButton(hwndDlg, IDC_MULTIWINDOW, IDC_NODECORATION, IDC_NODECORATION);
+ break;
+ }
// Set display number
SetDlgItemText(hwndDlg, IDC_DISPLAY, config.display.c_str());
break;
case IDD_CLIENTS:
// Init client dialog. Enable correct check buttons
- switch (config.client)
- {
- default:
- case CConfig::NoClient:
- CheckRadioButton(hwndDlg, IDC_CLIENT_NONE, IDC_CLIENT, IDC_CLIENT_NONE);
- break;
- case CConfig::StartProgram:
- CheckRadioButton(hwndDlg, IDC_CLIENT_NONE, IDC_CLIENT, IDC_CLIENT);
- break;
- case CConfig::XDMCP:
- CheckRadioButton(hwndDlg, IDC_CLIENT_NONE, IDC_CLIENT, IDC_XDMCP);
- break;
- }
+ switch (config.client)
+ {
+ default:
+ case CConfig::NoClient:
+ CheckRadioButton(hwndDlg, IDC_CLIENT_NONE, IDC_CLIENT, IDC_CLIENT_NONE);
+ break;
+ case CConfig::StartProgram:
+ CheckRadioButton(hwndDlg, IDC_CLIENT_NONE, IDC_CLIENT, IDC_CLIENT);
+ break;
+ case CConfig::XDMCP:
+ CheckRadioButton(hwndDlg, IDC_CLIENT_NONE, IDC_CLIENT, IDC_XDMCP);
+ break;
+ }
break;
- case IDD_PROGRAM:
+ case IDD_PROGRAM:
// Init program dialog. Check local and remote buttons
CheckRadioButton(hwndDlg, IDC_CLIENT_LOCAL, IDC_CLIENT_REMOTE, config.local?IDC_CLIENT_LOCAL:IDC_CLIENT_REMOTE);
- EnableRemoteProgramGroup(hwndDlg, config.local?FALSE:TRUE);
+ EnableRemoteProgramGroup(hwndDlg, config.local?FALSE:TRUE);
// Fill combo boxes
- FillProgramBox(hwndDlg);
- FillProtocolBox(hwndDlg);
+ FillProgramBox(hwndDlg);
// Set edit fields
- if (!config.program.empty())
- SetDlgItemText(hwndDlg, IDC_CLIENT_PROGRAM, config.program.c_str());
- SetDlgItemText(hwndDlg, IDC_CLIENT_USER, config.user.c_str());
- SetDlgItemText(hwndDlg, IDC_CLIENT_HOST, config.host.c_str());
- break;
- case IDD_XDMCP:
+ if (!config.localprogram.empty())
+ SetDlgItemText(hwndDlg, IDC_CLIENT_PROGRAM, config.localprogram.c_str());
+ if (!config.remoteprogram.empty())
+ SetDlgItemText(hwndDlg, IDC_CLIENT_REMOTEPROGRAM, config.remoteprogram.c_str());
+ SetDlgItemText(hwndDlg, IDC_CLIENT_USER, config.user.c_str());
+ SetDlgItemText(hwndDlg, IDC_CLIENT_HOST, config.host.c_str());
+ SetDlgItemText(hwndDlg, IDC_CLIENT_PASSWORD, config.remotepassword.c_str());
+ break;
+ case IDD_XDMCP:
// Init XDMCP dialog. Check broadcast and indirect button
CheckRadioButton(hwndDlg, IDC_XDMCP_QUERY, IDC_XDMCP_BROADCAST, config.broadcast?IDC_XDMCP_BROADCAST:IDC_XDMCP_QUERY);
CheckDlgButton(hwndDlg, IDC_XDMCP_INDIRECT, config.indirect?BST_CHECKED:BST_UNCHECKED);
- EnableXDMCPQueryGroup(hwndDlg, config.broadcast?FALSE:TRUE);
+ EnableXDMCPQueryGroup(hwndDlg, config.broadcast?FALSE:TRUE);
// Set hostname
- SetDlgItemText(hwndDlg, IDC_XDMCP_HOST, config.xdmcp_host.c_str());
- break;
- case IDD_CLIPBOARD:
+ SetDlgItemText(hwndDlg, IDC_XDMCP_HOST, config.xdmcp_host.c_str());
+ CheckDlgButton(hwndDlg, IDC_XDMCP_TERMINATE, config.xdmcpterminate?BST_CHECKED:BST_UNCHECKED);
+ break;
+ case IDD_EXTRA:
CheckDlgButton(hwndDlg, IDC_CLIPBOARD, config.clipboard?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_CLIPBOARDPRIMARY, config.clipboardprimary?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_WGL, config.wgl?BST_CHECKED:BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DISABLEAC, config.disableac?BST_CHECKED:BST_UNCHECKED);
SetDlgItemText(hwndDlg, IDC_EXTRA_PARAMS, config.extra_params.c_str());
break;
@@ -453,15 +493,15 @@ class CMyWizard : public CWizard
// Disable unavailable controls
case IDC_CLIENT_REMOTE:
case IDC_CLIENT_LOCAL:
- EnableRemoteProgramGroup(hwndDlg, LOWORD(wParam) == IDC_CLIENT_REMOTE);
+ EnableRemoteProgramGroup(hwndDlg, LOWORD(wParam) == IDC_CLIENT_REMOTE);
+ break;
+ case IDC_XDMCP_QUERY:
+ case IDC_XDMCP_BROADCAST:
+ EnableXDMCPQueryGroup(hwndDlg, LOWORD(wParam) == IDC_XDMCP_QUERY);
+ break;
+ case IDC_FINISH_SAVE:
+ ShowSaveDialog(hwndDlg);
break;
- case IDC_XDMCP_QUERY:
- case IDC_XDMCP_BROADCAST:
- EnableXDMCPQueryGroup(hwndDlg, LOWORD(wParam) == IDC_XDMCP_QUERY);
- break;
- case IDC_FINISH_SAVE:
- ShowSaveDialog(hwndDlg);
- break;
}
}
// pass messages to parent
@@ -489,54 +529,57 @@ class CMyWizard : public CWizard
return NULL;
}
- /// @brief Do the actual start of Xming and clients
- void StartUp()
- {
- std::string buffer;
- std::string client;
+ /// @brief Do the actual start of VCXsrv and clients
+ void StartUp()
+ {
+ std::string buffer;
+ std::string client;
// Construct display strings
- 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
+ std::string display_id = ":" + config.display;
+ std::string display = "DISPLAY=127.0.0.1" + display_id + ".0";
- // Build Xming commandline
- buffer = "Xming " + display_id + " ";
- switch (config.window)
- {
- case CConfig::MultiWindow:
- buffer += "-multiwindow ";
- break;
- case CConfig::Fullscreen:
- buffer += "-fullscreen ";
- break;
- case CConfig::Nodecoration:
- buffer += "-nodecoration ";
- break;
- default:
- break;
- }
+ // Build Xsrv commandline
+ buffer = "vcxsrv " + display_id + " ";
+ switch (config.window)
+ {
+ case CConfig::MultiWindow:
+ buffer += "-multiwindow ";
+ break;
+ case CConfig::Fullscreen:
+ buffer += "-fullscreen ";
+ break;
+ case CConfig::Nodecoration:
+ buffer += "-nodecoration ";
+ break;
+ default:
+ break;
+ }
// Add XDMCP parameter
- if (config.client == CConfig::XDMCP)
- {
- if (config.broadcast)
- buffer += "-broadcast ";
- else
- {
- if (config.indirect)
- buffer += "-indirect ";
- else
- buffer += "-query ";
- buffer += config.xdmcp_host;
- buffer += " ";
- }
- }
+ if (config.client == CConfig::XDMCP)
+ {
+ if (config.broadcast)
+ buffer += "-broadcast ";
+ else
+ {
+ if (config.indirect)
+ buffer += "-indirect ";
+ else
+ buffer += "-query ";
+ buffer += config.xdmcp_host;
+ buffer += " ";
+ }
+ if (config.xdmcpterminate)
+ buffer += "-terminate ";
+ }
if (config.clipboard)
buffer += "-clipboard ";
+ if (!config.clipboardprimary)
+ buffer += "-noclipboardprimary ";
+ if (config.wgl)
+ buffer += "-wgl ";
+ if (config.disableac)
+ buffer += "-ac ";
if (!config.extra_params.empty())
{
buffer += config.extra_params;
@@ -544,52 +587,57 @@ class CMyWizard : public CWizard
}
// Construct client commandline
- if (config.client == CConfig::StartProgram)
- {
- if (!config.local)
- {
- char cmdline[512];
+ if (config.client == CConfig::StartProgram)
+ {
+ if (!config.local)
+ {
+ char cmdline[512];
std::string host = config.host;
+ std::string remotepassword;
if (!config.user.empty())
host = config.user + "@" + config.host;
- if (config.protocol == "Putty")
- snprintf(cmdline,512,"plink -X %s %s",
- host.c_str(),config.program.c_str());
- else
- snprintf(cmdline,512,"ssh -Y %s %s",
- host.c_str(),config.program.c_str());
- client += cmdline;
- } else
- client += config.program.c_str();
- }
+ if (!config.remotepassword.empty())
+ remotepassword=std::string(" -pw ")+config.remotepassword;
+ _snprintf(cmdline,512,"plink -ssh -X%s %s %s",
+ remotepassword.c_str(), host.c_str(),config.remoteprogram.c_str());
+ client += cmdline;
+ }
+ else
+ {
+ client += config.localprogram.c_str();
+ }
+ }
// Prepare program startup
- STARTUPINFO si, sic;
- PROCESS_INFORMATION pi, pic;
- HANDLE handles[2];
- DWORD hcount = 0;
+ STARTUPINFO si, sic;
+ PROCESS_INFORMATION pi, pic;
+ HANDLE handles[2];
+ DWORD hcount = 0;
Display *dpy = NULL;
- ZeroMemory( &si, sizeof(si) );
- si.cb = sizeof(si);
- ZeroMemory( &pi, sizeof(pi) );
- ZeroMemory( &sic, sizeof(sic) );
- sic.cb = sizeof(sic);
- ZeroMemory( &pic, sizeof(pic) );
+ ZeroMemory( &si, sizeof(si) );
+ si.cb = sizeof(si);
+ ZeroMemory( &pi, sizeof(pi) );
+ ZeroMemory( &sic, sizeof(sic) );
+ sic.cb = sizeof(sic);
+ ZeroMemory( &pic, sizeof(pic) );
- // Start Xming process.
+ // Start VCXsrv process.
#ifdef _DEBUG
- printf("%s\n", buffer.c_str());
+ printf("%s\n", buffer.c_str());
#endif
- if( !CreateProcess( NULL, (CHAR*)buffer.c_str(), NULL, NULL,
- FALSE, 0, NULL, NULL, &si, &pi ))
- throw win32_error("CreateProcess failed");
- handles[hcount++] = pi.hProcess;
-
- if (!client.empty())
- {
+ char CurDir[MAX_PATH];
+ GetModuleFileName(NULL,CurDir,MAX_PATH);
+ *strrchr(CurDir,'\\')=0;
+ if( !CreateProcess( NULL, (CHAR*)buffer.c_str(), NULL, NULL,
+ FALSE, 0, NULL, CurDir, &si, &pi ))
+ throw win32_error("CreateProcess failed");
+ handles[hcount++] = pi.hProcess;
+
+ if (!client.empty())
+ {
// Set DISPLAY variable
- SetEnvironmentVariable("DISPLAY",display.c_str());
+ _putenv(display.c_str());
// Wait for server to startup
dpy = WaitForServer(pi.hProcess);
@@ -597,59 +645,62 @@ class CMyWizard : public CWizard
{
while (hcount--)
TerminateProcess(handles[hcount], (DWORD)-1);
- throw std::runtime_error("Connection to server failed");
+ throw std::runtime_error("Connection to server failed");
}
#ifdef _DEBUG
- printf("%s\n", client.c_str());
+ printf("%s\n", client.c_str());
#endif
// Hide a console window
// FIXME: This may make it impossible to enter the password
- sic.dwFlags = STARTF_USESHOWWINDOW;
- sic.wShowWindow = SW_HIDE;
-
- // Start the child process.
- if( !CreateProcess( NULL, (CHAR*)client.c_str(), NULL, NULL,
- FALSE, 0, NULL, NULL, &sic, &pic ))
- {
+ sic.dwFlags = STARTF_USESHOWWINDOW;
+ sic.wShowWindow = SW_HIDE;
+
+ // Start the child process.
+ if( !CreateProcess( NULL, (CHAR*)client.c_str(), NULL, NULL,
+ FALSE, 0, NULL, CurDir, &sic, &pic ))
+ {
DWORD err = GetLastError();
while (hcount--)
TerminateProcess(handles[hcount], (DWORD)-1);
- throw win32_error("CreateProcess failed", err);
- }
- handles[hcount++] = pic.hProcess;
- }
+ throw win32_error("CreateProcess failed", err);
+ }
+ handles[hcount++] = pic.hProcess;
+ }
- // Wait until any child process exits.
- DWORD ret = WaitForMultipleObjects(hcount, handles, FALSE, INFINITE );
+ // Wait until any child process exits.
+ DWORD ret = WaitForMultipleObjects(hcount, handles, FALSE, INFINITE );
#ifdef _DEBUG
- printf("killing process!\n");
+ printf("killing process!\n");
#endif
- // Check if Xming is still running
- DWORD exitcode;
- GetExitCodeProcess(pi.hProcess, &exitcode);
- unsigned counter = 0;
- while (exitcode == STILL_ACTIVE)
- {
- if (++counter > 10)
- TerminateProcess(pi.hProcess, (DWORD)-1);
- else
- // Shutdown Xming (the soft way!)
- EnumThreadWindows(pi.dwThreadId, KillWindowsProc, 0);
- Sleep(500);
- GetExitCodeProcess(pi.hProcess, &exitcode);
- }
- // Kill the client
- TerminateProcess(pic.hProcess, (DWORD)-1);
+ // Check if Xsrv is still running, but only when we started a local program
+ if (config.local)
+ {
+ DWORD exitcode;
+ GetExitCodeProcess(pi.hProcess, &exitcode);
+ unsigned counter = 0;
+ while (exitcode == STILL_ACTIVE)
+ {
+ if (++counter > 10)
+ TerminateProcess(pi.hProcess, (DWORD)-1);
+ else
+ // Shutdown Xsrv (the soft way!)
+ EnumThreadWindows(pi.dwThreadId, KillWindowsProc, 0);
+ Sleep(500);
+ GetExitCodeProcess(pi.hProcess, &exitcode);
+ }
+ // Kill the client
+ TerminateProcess(pic.hProcess, (DWORD)-1);
+ }
- // Close process and thread handles.
- CloseHandle( pi.hProcess );
- CloseHandle( pi.hThread );
- CloseHandle( pic.hProcess );
- CloseHandle( pic.hThread );
- }
+ // Close process and thread handles.
+ CloseHandle( pi.hProcess );
+ CloseHandle( pi.hThread );
+ CloseHandle( pic.hProcess );
+ CloseHandle( pic.hThread );
+ }
};
int main(int argc, char **argv)
@@ -658,39 +709,41 @@ int main(int argc, char **argv)
InitCommonControls();
CMyWizard dialog;
- bool skip_wizard = false;
+ bool skip_wizard = false;
- for (int i = 1; i < argc; i++)
- {
- if (argv[i] == NULL)
- continue;
-
- std::string arg(argv[i]);
- if (arg == "-load" && i + 1 < argc)
- {
- i++;
- dialog.LoadConfig(argv[i]);
- continue;
- }
- if (arg == "-run" && i + 1 < argc)
- {
- i++;
- dialog.LoadConfig(argv[i]);
- skip_wizard = true;
- continue;
- }
- }
+ for (int i = 1; i < argc; i++)
+ {
+ if (argv[i] == NULL)
+ continue;
+
+ std::string arg(argv[i]);
+ if (arg == "-load" && i + 1 < argc)
+ {
+ i++;
+ dialog.LoadConfig(argv[i]);
+ continue;
+ }
+ if (arg == "-run" && i + 1 < argc)
+ {
+ i++;
+ dialog.LoadConfig(argv[i]);
+ skip_wizard = true;
+ continue;
+ }
+ }
- int ret = 0;
+ int ret = 0;
if (skip_wizard || (ret =dialog.ShowModal()) != 0)
- dialog.StartUp();
+ dialog.StartUp();
#ifdef _DEBUG
- printf("return %d\n", ret);
+ printf("return %d\n", ret);
#endif
- return 0;
+ 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;
}
}
diff --git a/xorg-server/hw/xwin/xlaunch/makefile b/xorg-server/hw/xwin/xlaunch/makefile
new file mode 100644
index 000000000..b97d7ecb6
--- /dev/null
+++ b/xorg-server/hw/xwin/xlaunch/makefile
@@ -0,0 +1,36 @@
+INCLUDELIBFILES = window\$(OBJDIR)\window.lib \
+ $(MHMAKECONF)\libx11\src\$(OBJDIR)\libx11.lib \
+ $(MHMAKECONF)\libxcb\src\$(OBJDIR)\libxcb.lib \
+ $(MHMAKECONF)\libxau\$(OBJDIR)\libxau.lib \
+ $(MHMAKECONF)\libx11\src\xlibi18n\$(OBJDIR)\libi18n.lib \
+ $(MHMAKECONF)\libx11\modules\lc\xlocale\$(OBJDIR)\libxlocale.lib \
+ $(MHMAKECONF)\libx11\modules\lc\utf8\$(OBJDIR)\libxlcUTF8Load.lib \
+ $(MHMAKECONF)\libx11\modules\lc\gen\$(OBJDIR)\liblcGenConvLoad.lib \
+ $(MHMAKECONF)\libx11\modules\lc\def\$(OBJDIR)\libxlcDef.lib \
+ $(MHMAKECONF)\libx11\src\xkb\$(OBJDIR)\libxkb.lib \
+ $(MHMAKECONF)\libx11\modules\im\ximcp\$(OBJDIR)\libximcp.lib \
+ $(MHMAKECONF)\libx11\modules\om\generic\$(OBJDIR)\libxomGeneric.lib
+
+CSRCS=config.cc main.cc
+
+INCLUDES += $(MHMAKECONF)\libxml2\include
+
+WINAPP = xlaunch
+
+RESOURCES = resources.rc
+
+$(OBJDIR)\%.res : resources\%.rc $(wildcard resources\*.rc)
+ $(RC) $(RCFLAGS) $(RCDEFINES:%=-d "%") $(RCINCLUDES:%=-i %) -Fo$(relpath $@) $<
+
+LIBDIRS=$(dir $(INCLUDELIBFILES))
+
+load_makefile $(LIBDIRS:%$(OBJDIR)\=%makefile MAKESERVER=$(MAKESERVER) DEBUG=$(DEBUG);)
+
+LINKLIBS += $(MHMAKECONF)\libxml2\lib\libxml2.lib
+
+ifeq ($(DEBUG),1)
+LINKLIBS += $(MHMAKECONF)\pthreads\pthreadVC2d.lib
+else
+LINKLIBS += $(MHMAKECONF)\pthreads\pthreadVC2.lib
+endif
+
diff --git a/xorg-server/hw/xwin/xlaunch/resources/dialog.rc b/xorg-server/hw/xwin/xlaunch/resources/dialog.rc
index 8b00df4ef..d7f1aa46f 100644
--- a/xorg-server/hw/xwin/xlaunch/resources/dialog.rc
+++ b/xorg-server/hw/xwin/xlaunch/resources/dialog.rc
@@ -68,19 +68,25 @@ STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSM
CAPTION STR_CAPTION_PROGRAM
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- LTEXT STR_CLIENT_PROGRAM_DESC,IDC_CLIENT_PROGRAM_DESC,7,14,64,10
- COMBOBOX IDC_CLIENT_PROGRAM,70,12,64,54,CBS_DROPDOWN | WS_VSCROLL
+ AUTORADIOBUTTON STR_CLIENT_LOCAL,IDC_CLIENT_LOCAL,7,14,300,10
+ AUTORADIOBUTTON STR_CLIENT_REMOTE,IDC_CLIENT_REMOTE,7,50,300,10
- AUTORADIOBUTTON STR_CLIENT_LOCAL,IDC_CLIENT_LOCAL,7,28,300,10
- AUTORADIOBUTTON STR_CLIENT_REMOTE,IDC_CLIENT_REMOTE,7,42,300,10
+ LTEXT STR_CLIENT_PROGRAM_DESC,IDC_CLIENT_PROGRAM_DESC,19,28,64,10
+ COMBOBOX IDC_CLIENT_PROGRAM,100,26,64,54,CBS_DROPDOWN | WS_VSCROLL
+
+
+ LTEXT STR_CLIENT_REMOTEPROGRAM_DESC,IDC_CLIENT_REMOTEPROGRAM_DESC,19,64,70,10
+ EDITTEXT IDC_CLIENT_REMOTEPROGRAM,100,62,200,12, WS_BORDER | WS_TABSTOP | ES_AUTOHSCROLL
+
+ LTEXT STR_CLIENT_PASSWORD_DESC,IDC_CLIENT_PASSWORD_DESC,19,78,70,10
+ EDITTEXT IDC_CLIENT_PASSWORD,100,76,64,12, WS_BORDER | WS_TABSTOP | ES_AUTOHSCROLL
- LTEXT STR_CLIENT_PROTOCOL_DESC,IDC_CLIENT_PROTOCOL_DESC,19,56,70,10
- COMBOBOX IDC_CLIENT_PROTOCOL,100,54,64,54,CBS_DROPDOWNLIST | WS_VSCROLL
+
+ LTEXT STR_CLIENT_HOST_DESC,IDC_CLIENT_HOST_DESC,19,92,70,10
+ EDITTEXT IDC_CLIENT_HOST,100,90,64,12, WS_BORDER | WS_TABSTOP | ES_AUTOHSCROLL
- LTEXT STR_CLIENT_HOST_DESC,IDC_CLIENT_HOST_DESC,19,70,70,10
- LTEXT STR_CLIENT_USER_DESC,IDC_CLIENT_USER_DESC,19,84,70,10
- EDITTEXT IDC_CLIENT_HOST,100,68,64,12
- EDITTEXT IDC_CLIENT_USER,100,82,64,12
+ LTEXT STR_CLIENT_USER_DESC,IDC_CLIENT_USER_DESC,19,106,70,10
+ EDITTEXT IDC_CLIENT_USER,100,104,64,12, WS_BORDER | WS_TABSTOP | ES_AUTOHSCROLL
END
IDD_XDMCP DIALOGEX 0, 0, 317, 143
@@ -92,19 +98,29 @@ BEGIN
EDITTEXT IDC_XDMCP_HOST,78,12,64,12
AUTOCHECKBOX STR_XDMCP_INDIRECT,IDC_XDMCP_INDIRECT,19,28,280,10
AUTORADIOBUTTON STR_XDMCP_BROADCAST, IDC_XDMCP_BROADCAST,7,42,300,10
- LTEXT STR_XDMCP_QUERY_DESC,IDC_XDMCP_QUERY_DESC,7,56,300,42
+ LTEXT STR_XDMCP_QUERY_DESC,IDC_XDMCP_QUERY_DESC,7,66,300,42
+ AUTOCHECKBOX STR_XDMCP_TERMINATE,IDC_XDMCP_TERMINATE,7,94,300,10
END
-IDD_CLIPBOARD DIALOGEX 0, 0, 317, 143
+IDD_EXTRA DIALOGEX 0, 0, 317, 143
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_CENTERMOUSE
-CAPTION STR_CAPTION_CLIPBOARD
+CAPTION STR_CAPTION_EXTRA
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
- AUTOCHECKBOX STR_CLIPBOARD,IDC_CLIPBOARD,7,14,300,10
- LTEXT STR_CLIPBOARD_DESC,IDC_CLIPBOARD_DESC,19,28,280,27
+ AUTOCHECKBOX STR_CLIPBOARD,IDC_CLIPBOARD,7,10,300,10
+ LTEXT STR_CLIPBOARD_DESC,IDC_CLIPBOARD_DESC,19,20,280,27
+
+ AUTOCHECKBOX STR_CLIPBOARDPRIMARY,IDC_CLIPBOARDPRIMARY,19,30,300,10
+ LTEXT STR_CLIPBOARDPRIMARY_DESC,IDC_CLIPBOARDPRIMARY_DESC,31,40,280,27
+
+ AUTOCHECKBOX STR_WGL,IDC_WGL,7,52,300,10
+ LTEXT STR_WGL_DESC,IDC_WGL_DESC,19,62,280,27
+
+ AUTOCHECKBOX STR_DISABLEAC,IDC_DISABLEAC,7,82,300,10
+ LTEXT STR_DISABLEAC_DESC,IDC_DISABLEAC_DESC,19,92,280,27
- LTEXT STR_EXTRA_PARAMS_DESC,IDC_EXTRA_PARAMS_DESC,7,56,280,10
- EDITTEXT IDC_EXTRA_PARAMS,7,70,128,12
+ LTEXT STR_EXTRA_PARAMS_DESC,IDC_EXTRA_PARAMS_DESC,7,105,280,10
+ EDITTEXT IDC_EXTRA_PARAMS,7,115,300,12, WS_BORDER | WS_TABSTOP | ES_AUTOHSCROLL
END
IDD_FINISH DIALOGEX 0, 0, 317, 143
diff --git a/xorg-server/hw/xwin/xlaunch/resources/resources.h b/xorg-server/hw/xwin/xlaunch/resources/resources.h
index 470005192..03f3dac1f 100644
--- a/xorg-server/hw/xwin/xlaunch/resources/resources.h
+++ b/xorg-server/hw/xwin/xlaunch/resources/resources.h
@@ -24,76 +24,88 @@
* use or other dealings in this Software without prior written authorization.
*/
-#define IDC_STATIC -1
+#define IDC_STATIC -1
-#define IDD_WELCOME 100
-#define IDD_FINISH 101
-#define IDD_DISPLAY 102
-#define IDD_CLIENTS 103
-#define IDD_PROGRAM 104
-#define IDD_XDMCP 105
-#define IDD_FONTPATH 106
-#define IDD_CLIPBOARD 107
+#define IDD_WELCOME 100
+#define IDD_FINISH 101
+#define IDD_DISPLAY 102
+#define IDD_CLIENTS 103
+#define IDD_PROGRAM 104
+#define IDD_XDMCP 105
+#define IDD_FONTPATH 106
+#define IDD_EXTRA 107
-#define IDS_DISPLAY_TITLE 300
-#define IDS_DISPLAY_SUBTITLE 301
-#define IDS_CLIENTS_TITLE 302
-#define IDS_CLIENTS_SUBTITLE 303
-#define IDS_PROGRAM_TITLE 304
-#define IDS_PROGRAM_SUBTITLE 305
-#define IDS_XDMCP_TITLE 306
-#define IDS_XDMCP_SUBTITLE 307
-#define IDS_FONTPATH_TITLE 308
-#define IDS_FONTPATH_SUBTITLE 309
-#define IDS_FINISH_TITLE 310
-#define IDS_FINISH_SUBTITLE 311
-#define IDS_CLIPBOARD_TITLE 312
-#define IDS_CLIPBOARD_SUBTITLE 313
-#define IDS_SAVE_TITLE 320
-#define IDS_SAVE_FILETITLE 321
-#define IDS_SAVE_FILTER 322
-
-#define IDC_MULTIWINDOW 200
-#define IDC_WINDOWED 201
-#define IDC_FULLSCREEN 202
-#define IDC_NODECORATION 203
-#define IDC_MULTIWINDOW_IMG 204
-#define IDC_WINDOWED_IMG 205
-#define IDC_FULLSCREEN_IMG 206
-#define IDC_NODECORATION_IMG 207
-#define IDC_DISPLAY 208
-#define IDC_DISPLAY_DESC 209
+#define IDI_XLAUNCH 108
+
+#define IDC_MULTIWINDOW 200
+#define IDC_WINDOWED 201
+#define IDC_FULLSCREEN 202
+#define IDC_NODECORATION 203
+#define IDC_MULTIWINDOW_IMG 204
+#define IDC_WINDOWED_IMG 205
+#define IDC_FULLSCREEN_IMG 206
+#define IDC_NODECORATION_IMG 207
+#define IDC_DISPLAY 208
+#define IDC_DISPLAY_DESC 209
-#define IDC_CLIENT_NONE 210
-#define IDC_XDMCP 211
-#define IDC_CLIENT 212
-#define IDC_CLIENT_LOCAL 213
-#define IDC_CLIENT_REMOTE 214
-#define IDC_CLIENT_HOST 215
-#define IDC_CLIENT_USER 216
-#define IDC_CLIENT_PROTOCOL 217
-#define IDC_CLIENT_CONFIGURE 218
-#define IDC_CLIENT_PROGRAM 219
-#define IDC_XDMCP_QUERY 220
-#define IDC_XDMCP_BROADCAST 221
-#define IDC_XDMCP_INDIRECT 222
-#define IDC_XDMCP_HOST 223
-#define IDC_CLIENT_NONE_DESC 224
-#define IDC_XDMCP_DESC 225
-#define IDC_CLIENT_DESC 226
-#define IDC_XDMCP_QUERY_DESC 227
-#define IDC_CLIENT_PROGRAM_DESC 228
-#define IDC_CLIENT_HOST_DESC 229
-#define IDC_CLIENT_USER_DESC 230
-#define IDC_CLIENT_PROTOCOL_DESC 231
+#define IDC_CLIENT_NONE 210
+#define IDC_XDMCP 211
+#define IDC_CLIENT 212
+#define IDC_CLIENT_LOCAL 213
+#define IDC_CLIENT_REMOTE 214
+#define IDC_CLIENT_HOST 215
+#define IDC_CLIENT_USER 216
+#define IDC_CLIENT_PASSWORD 217
+#define IDC_CLIENT_CONFIGURE 218
+#define IDC_CLIENT_PROGRAM 219
+#define IDC_XDMCP_QUERY 220
+#define IDC_XDMCP_BROADCAST 221
+#define IDC_XDMCP_INDIRECT 222
+#define IDC_XDMCP_HOST 223
+#define IDC_CLIENT_NONE_DESC 224
+#define IDC_XDMCP_DESC 225
+#define IDC_CLIENT_DESC 226
+#define IDC_XDMCP_QUERY_DESC 227
+#define IDC_CLIENT_PROGRAM_DESC 228
+#define IDC_CLIENT_HOST_DESC 229
+#define IDC_CLIENT_USER_DESC 230
+#define IDC_CLIENT_PASSWORD_DESC 231
+#define IDC_CLIENT_REMOTEPROGRAM 232
+#define IDC_CLIENT_REMOTEPROGRAM_DESC 233
-#define IDC_FONTPATH_DESC 240
+#define IDC_FONTPATH_DESC 240
-#define IDC_FINISH_DESC 250
-#define IDC_FINISH_SAVE 251
-#define IDC_FINISH_SAVE_DESC 252
+#define IDC_FINISH_DESC 250
+#define IDC_FINISH_SAVE 251
+#define IDC_FINISH_SAVE_DESC 252
-#define IDC_CLIPBOARD 260
-#define IDC_CLIPBOARD_DESC 261
-#define IDC_EXTRA_PARAMS 262
-#define IDC_EXTRA_PARAMS_DESC 263
+#define IDC_CLIPBOARD 260
+#define IDC_CLIPBOARD_DESC 261
+#define IDC_EXTRA_PARAMS 262
+#define IDC_EXTRA_PARAMS_DESC 263
+#define IDC_WGL 264
+#define IDC_WGL_DESC 265
+#define IDC_CLIPBOARDPRIMARY 266
+#define IDC_CLIPBOARDPRIMARY_DESC 267
+#define IDC_DISABLEAC 268
+#define IDC_DISABLEAC_DESC 269
+#define IDC_XDMCP_TERMINATE 270
+
+#define IDS_DISPLAY_TITLE 300
+#define IDS_DISPLAY_SUBTITLE 301
+#define IDS_CLIENTS_TITLE 302
+#define IDS_CLIENTS_SUBTITLE 303
+#define IDS_PROGRAM_TITLE 304
+#define IDS_PROGRAM_SUBTITLE 305
+#define IDS_XDMCP_TITLE 306
+#define IDS_XDMCP_SUBTITLE 307
+#define IDS_FONTPATH_TITLE 308
+#define IDS_FONTPATH_SUBTITLE 309
+#define IDS_FINISH_TITLE 310
+#define IDS_FINISH_SUBTITLE 311
+#define IDS_EXTRA_TITLE 312
+#define IDS_EXTRA_SUBTITLE 313
+#define IDS_SAVE_TITLE 320
+#define IDS_SAVE_FILETITLE 321
+#define IDS_SAVE_FILTER 322
+
diff --git a/xorg-server/hw/xwin/xlaunch/resources/resources.rc b/xorg-server/hw/xwin/xlaunch/resources/resources.rc
index 07fd52f32..e3df4610a 100644
--- a/xorg-server/hw/xwin/xlaunch/resources/resources.rc
+++ b/xorg-server/hw/xwin/xlaunch/resources/resources.rc
@@ -28,3 +28,5 @@
#include "resources.h"
#include "images.rc"
#include "dialog.rc"
+
+IDI_XLAUNCH ICON "..\\..\\X.ico"
diff --git a/xorg-server/hw/xwin/xlaunch/resources/strings.rc b/xorg-server/hw/xwin/xlaunch/resources/strings.rc
index 5a9cd281b..dab2b30af 100644
--- a/xorg-server/hw/xwin/xlaunch/resources/strings.rc
+++ b/xorg-server/hw/xwin/xlaunch/resources/strings.rc
@@ -40,13 +40,15 @@
#define STR_XDMCP_DESC "This will start a remote XDMCP session. Starting local clients later is limited. This option is not available with the ""Multiple windows"" mode."
#define STR_CAPTION_PROGRAM "Start program"
-#define STR_CLIENT_PROGRAM_DESC "Start program"
+#define STR_CLIENT_PROGRAM_DESC "Local program"
#define STR_CLIENT_LOCAL "Start program on this computer"
#define STR_CLIENT_REMOTE "Start program on remote computer"
-#define STR_CLIENT_PROTOCOL_DESC "Connect using"
+#define STR_CLIENT_PASSWORD_DESC "Password"
#define STR_CLIENT_HOST_DESC "Connect to computer"
#define STR_CLIENT_USER_DESC "Login as user"
+#define STR_CLIENT_REMOTEPROGRAM_DESC "Remote program"
+
#define STR_CAPTION_XDMCP "XDMCP settings"
#define STR_XDMCP_QUERY "Connect to host"
@@ -57,18 +59,27 @@
#define STR_CAPTION_FONTPATH "Fontpath settings"
-#define STR_CAPTION_CLIPBOARD "Clipboard settings"
+#define STR_CAPTION_EXTRA "Extra settings"
#define STR_CLIPBOARD "Clipboard"
#define STR_CLIPBOARD_DESC "Start the integrated clipboard manager"
-#define STR_EXTRA_PARAMS_DESC "Additional parameters for Xming"
+#define STR_CLIPBOARDPRIMARY "Primary Selection"
+#define STR_CLIPBOARDPRIMARY_DESC "Also map the PRIMARY selection to the windows clipboard."
+#define STR_WGL "Native opengl"
+#define STR_WGL_DESC "Use the native windows opengl library (wgl). Make sure to export the LIBGL_ALWAYS_INDIRECT environment variable."
+#define STR_EXTRA_PARAMS_DESC "Additional parameters for VcXsrv"
+
+#define STR_DISABLEAC "Disable access control"
+#define STR_DISABLEAC_DESC "Use this when you want vcxsrv to accept connections from all clients."
+
+#define STR_XDMCP_TERMINATE "Terminate on server reset."
#define STR_CAPTION_FINISH "Finish configuration"
-#define STR_FINISH_DESC "Configuration is complete. Clish Finish to start Xming."
+#define STR_FINISH_DESC "Configuration is complete. Click Finish to start VcXsrv."
#define STR_FINISH_SAVE_DESC "You may also save the configuration for later use."
#define STR_FINISH_SAVE "Save configuration"
#define STR_DISPLAY_TITLE "Select display settings"
-#define STR_DISPLAY_SUBTITLE "Choose how Xming display programs"
+#define STR_DISPLAY_SUBTITLE "Choose how VcXsrv display programs"
#define STR_CLIENTS_TITLE "Select how to start clients"
#define STR_CLIENTS_SUBTITLE ""
#define STR_PROGRAM_TITLE "Specify the program to start"
@@ -79,8 +90,8 @@
#define STR_FONTPATH_SUBTITLE ""
#define STR_FINISH_TITLE "Configuration complete"
#define STR_FINISH_SUBTITLE ""
-#define STR_CLIPBOARD_TITLE "Clipboard settings"
-#define STR_CLIPBOARD_SUBTITLE ""
+#define STR_EXTRA_TITLE "Extra settings"
+#define STR_EXTRA_SUBTITLE ""
#define STR_SAVE_TITLE "Save configuration"
#define STR_SAVE_FILETITLE "Filename"
@@ -100,9 +111,9 @@ BEGIN
IDS_FONTPATH_SUBTITLE STR_FONTPATH_SUBTITLE
IDS_FINISH_TITLE STR_FINISH_TITLE
IDS_FINISH_SUBTITLE STR_FINISH_SUBTITLE
- IDS_CLIPBOARD_TITLE STR_CLIPBOARD_TITLE
- IDS_CLIPBOARD_SUBTITLE STR_CLIPBOARD_SUBTITLE
- IDS_SAVE_TITLE STR_SAVE_TITLE
+ IDS_EXTRA_TITLE STR_EXTRA_TITLE
+ IDS_EXTRA_SUBTITLE STR_EXTRA_SUBTITLE
+ IDS_SAVE_TITLE STR_SAVE_TITLE
IDS_SAVE_FILETITLE STR_SAVE_FILETITLE
IDS_SAVE_FILTER STR_SAVE_FILTER
END
diff --git a/xorg-server/hw/xwin/xlaunch/window/makefile b/xorg-server/hw/xwin/xlaunch/window/makefile
new file mode 100644
index 000000000..18a33e728
--- /dev/null
+++ b/xorg-server/hw/xwin/xlaunch/window/makefile
@@ -0,0 +1,4 @@
+CSRCS=dialog.cc util.cc window.cc wizard.cc
+
+LIBRARY = window
+
diff --git a/xorg-server/hw/xwin/xlaunch/window/util.cc b/xorg-server/hw/xwin/xlaunch/window/util.cc
index fb7e87297..6f768348e 100644
--- a/xorg-server/hw/xwin/xlaunch/window/util.cc
+++ b/xorg-server/hw/xwin/xlaunch/window/util.cc
@@ -25,6 +25,8 @@
*/
#include "util.h"
+const char * MessageDebug::notify_names[NOTIFY_NAMES_LEN];
+
std::string win32_error::message(DWORD errorcode)
{
LPVOID lpMsgBuf;
diff --git a/xorg-server/hw/xwin/xlaunch/window/util.h b/xorg-server/hw/xwin/xlaunch/window/util.h
index cd21da657..a1196b115 100644
--- a/xorg-server/hw/xwin/xlaunch/window/util.h
+++ b/xorg-server/hw/xwin/xlaunch/window/util.h
@@ -28,7 +28,7 @@
#include <windows.h>
#include <stdexcept>
-
+#include <string>
class win32_error : public std::runtime_error
{
@@ -39,7 +39,7 @@ class win32_error : public std::runtime_error
};
#define MESSAGE_NAMES_LEN 1024
-#define NOTIFY_NAMES_LEN 0
+#define NOTIFY_NAMES_LEN 1
class MessageDebug
{
protected:
diff --git a/xorg-server/hw/xwin/xlaunch/window/wizard.h b/xorg-server/hw/xwin/xlaunch/window/wizard.h
index a2361c51c..c576cc093 100644
--- a/xorg-server/hw/xwin/xlaunch/window/wizard.h
+++ b/xorg-server/hw/xwin/xlaunch/window/wizard.h
@@ -29,7 +29,6 @@
#include "dialog.h"
#include <vector>
-#define _WIN32_IE 0x0500
#include <prsht.h>
class CWizard : public CBaseDialog