<div class="gmail_quote">On Wed, Jun 30, 2010 at 8:57 PM, Alon Levy <span dir="ltr">&lt;<a href="mailto:alevy@redhat.com">alevy@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
This has been tested a little, just to get my n900 to run spicec (it does now :)<br>
 * patch adds a --enable-cegui flag, defaults to disabled<br>
 * so default becomes:<br>
  * quit if no -h and -p arguments supplied (instead of showing dialog)<br>
  * if vm quits for any reason we quit (instead of returning to dialog)<br>
<br>
The define is called &quot;HAVE_CEGUI&quot; but should really be USE_GUI or something like that.<br>
<br>
commit 138bdba17a725a4f09400b1399dd652df6dbd254<br>
Author: Alon Levy &lt;<a href="mailto:alevy@redhat.com">alevy@redhat.com</a>&gt;<br>
Date:   Wed Jun 30 20:50:26 2010 +0300<br>
<br>
    CEGUI made optional<br>
<br>
diff --git a/client/application.cpp b/client/application.cpp<br>
index 482215c..9744083 100644<br>
--- a/client/application.cpp<br>
+++ b/client/application.cpp<br>
@@ -24,6 +24,8 @@<br>
 #include &lt;io.h&gt;<br>
 #endif<br>
<br>
+#include &lt;assert.h&gt;<br>
+<br>
 #include &quot;application.h&quot;<br>
 #include &quot;screen.h&quot;<br>
 #include &quot;utils.h&quot;<br>
@@ -42,7 +44,9 @@<br>
 #include &quot;cmd_line_parser.h&quot;<br>
 #include &quot;tunnel_channel.h&quot;<br>
 #include &quot;rect.h&quot;<br>
+#ifdef HAVE_CEGUI<br>
 #include &quot;gui/gui.h&quot;<br>
+#endif<br>
 #include &lt;stdarg.h&gt;<br>
 #include &lt;stdio.h&gt;<br>
 #include &lt;time.h&gt;<br>
@@ -102,6 +106,7 @@ void SwitchHostEvent::response(AbstractProcessLoop&amp; events_loop)<br>
 }<br>
<br>
 //todo: add inactive visual appearance<br>
+#ifdef HAVE_CEGUI<br>
 class GUIBarrier: public ScreenLayer {<br>
 public:<br>
     GUIBarrier(int id)<br>
@@ -147,6 +152,7 @@ private:<br>
     int _id;<br>
     AutoRef&lt;LocalCursor&gt; _cursor;<br>
 };<br>
+#endif // HAVE_CEGUI<br>
<br>
 class InfoLayer: public ScreenLayer {<br>
 public:<br>
@@ -279,6 +285,7 @@ void StickyKeyTimer::response(AbstractProcessLoop&amp; events_loop)<br>
     app-&gt;deactivate_interval_timer(this);<br>
 }<br>
<br>
+#ifdef HAVE_CEGUI<br>
 class GUITimer: public Timer {<br>
 public:<br>
     GUITimer(GUI&amp; gui)<br>
@@ -314,6 +321,7 @@ private:<br>
 };<br>
 #endif<br>
<br>
+#endif // HAVE_CEGUI<br>
<br>
 static MouseHandler default_mouse_handler;<br>
 static KeyHandler default_key_handler;<br>
@@ -330,7 +338,9 @@ enum AppCommands {<br>
     APP_CMD_CONNECT,<br>
     APP_CMD_DISCONNECT,<br>
 #endif<br>
+#ifdef HAVE_CEGUI<br>
     APP_CMD_SHOW_GUI,<br>
+#endif // HAVE_CEGUI<br>
 };<br>
<br>
 Application::Application()<br>
@@ -351,7 +361,9 @@ Application::Application()<br>
     , _monitors (NULL)<br>
     , _title (L&quot;SPICEc:%d&quot;)<br>
     , _sys_key_intercept_mode (false)<br>
+#ifdef HAVE_CEGUI<br>
     , _gui_mode (GUI_MODE_FULL)<br>
+#endif // HAVE_CEGUI<br>
     , _during_host_switch(false)<br>
     , _state (DISCONNECTED)<br>
 {<br>
@@ -371,7 +383,9 @@ Application::Application()<br>
     _commands_map[&quot;connect&quot;] = APP_CMD_CONNECT;<br>
     _commands_map[&quot;disconnect&quot;] = APP_CMD_DISCONNECT;<br>
 #endif<br>
+#ifdef HAVE_CEGUI<br>
     _commands_map[&quot;show-gui&quot;] = APP_CMD_SHOW_GUI;<br>
+#endif // HAVE_CEGUI<br>
<br>
     _canvas_types.resize(1);<br>
 #ifdef WIN32<br>
@@ -391,7 +405,9 @@ Application::Application()<br>
                                                           &quot;,connect=shift+f5&quot;<br>
                                                           &quot;,disconnect=shift+f6&quot;<br>
 #endif<br>
+#ifdef HAVE_CEGUI<br>
                                                           &quot;,show-gui=shift+f7&quot;<br>
+#endif // HAVE_CEGUI<br>
                                                           , _commands_map));<br>
     _hot_keys = parser-&gt;get();<br>
<br>
@@ -402,6 +418,7 @@ Application::Application()<br>
     _sticky_info.key  = REDKEY_INVALID;<br>
     _sticky_info.timer.reset(new StickyKeyTimer());<br>
<br>
+#ifdef HAVE_CEGUI<br>
     _gui.reset(new GUI(*this, DISCONNECTED));<br>
     _gui_timer.reset(new GUITimer(*_gui.get()));<br>
     activate_interval_timer(*_gui_timer, 1000 / 30);<br>
@@ -409,6 +426,7 @@ Application::Application()<br>
     _gui_test_timer.reset(new TestTimer(*this));<br>
     activate_interval_timer(*_gui_test_timer, 1000 * 30);<br>
 #endif<br>
+#endif // HAVE_CEGUI<br>
     for (int i = SPICE_CHANNEL_MAIN; i &lt; SPICE_END_CHANNEL; i++) {<br>
         _peer_con_opt[i] = RedPeer::ConnectionOptions::CON_OP_BOTH;<br>
     }<br>
@@ -416,12 +434,14 @@ Application::Application()<br>
<br>
 Application::~Application()<br>
 {<br>
+#ifdef HAVE_CEGUI<br>
     deactivate_interval_timer(*_gui_timer);<br>
 #ifdef GUI_DEMO<br>
     deactivate_interval_timer(*_gui_test_timer);<br>
 #endif<br>
     destroyed_gui_barriers();<br>
     _gui-&gt;set_screen(NULL);<br>
+#endif // HAVE_CEGUI<br>
<br>
     if (_info_layer-&gt;screen()) {<br>
         _main_screen-&gt;detach_layer(*_info_layer);<br>
@@ -511,7 +531,11 @@ void Application::remove_mouse_handler(MouseHandler&amp; handler)<br>
<br>
 void Application::capture_mouse()<br>
 {<br>
-    if (!_active_screen || _gui-&gt;screen()) {<br>
+    if (!_active_screen<br>
+#ifdef HAVE_CEGUI<br>
+        || _gui-&gt;screen()<br>
+#endif // HAVE_CEGUI<br>
+        ) {<br>
         return;<br>
     }<br>
     _active_screen-&gt;capture_mouse();<br>
@@ -568,11 +592,15 @@ void Application::switch_host(const std::string&amp; host, int port, int sport,<br>
<br>
 int Application::run()<br>
 {<br>
+#ifdef HAVE_CEGUI<br>
     if (_gui_mode != GUI_MODE_FULL) {<br>
         connect();<br>
     }<br>
<br>
     show_gui();<br>
+#else<br>
+    connect();<br>
+#endif // HAVE_GUI<br>
     _exit_code = ProcessLoop::run();<br>
     return _exit_code;<br>
 }<br>
@@ -630,7 +658,9 @@ RedScreen* Application::get_screen(int id)<br>
             size.y = SCREEN_INIT_HEIGHT;<br>
         }<br>
         screen = _screens[id] = new RedScreen(*this, id, _title, size.x, size.y);<br>
+#ifdef HAVE_CEGUI<br>
         create_gui_barrier(*screen, id);<br>
+#endif // HAVE_CEGUI<br>
<br>
         if (id != 0) {<br>
             if (_full_screen) {<br>
@@ -658,6 +688,7 @@ RedScreen* Application::get_screen(int id)<br>
     return screen;<br>
 }<br>
<br>
+#ifdef HAVE_CEGUI<br>
 void Application::attach_gui_barriers()<br>
 {<br>
     GUIBarriers::iterator iter = _gui_barriers.begin();<br>
@@ -710,12 +741,15 @@ void Application::destroyed_gui_barrier(int id)<br>
         }<br>
     }<br>
 }<br>
+#endif // HAVE_CEGUI<br>
<br>
 void Application::on_screen_destroyed(int id, bool was_captured)<br>
 {<br>
     bool reposition = false;<br>
<br>
+#ifdef HAVE_CEGUI<br>
     destroyed_gui_barrier(id);<br>
+#endif // HAVE_CEGUI<br>
<br>
     if ((int)_screens.size() &lt; id + 1 || !_screens[id]) {<br>
         THROW(&quot;no screen&quot;);<br>
@@ -772,10 +806,12 @@ void Application::set_state(State state)<br>
         return;<br>
     }<br>
     _state = state;<br>
+#ifdef HAVE_CEGUI<br>
     _gui-&gt;set_state(_state);<br>
     if (_gui-&gt;screen() &amp;&amp; !_gui-&gt;is_visible()) {<br>
         hide_gui();<br>
     }<br>
+#endif // HAVE_CEGUI<br>
     reset_sticky();<br>
 }<br>
<br>
@@ -789,7 +825,11 @@ void Application::on_connected()<br>
 void Application::on_disconnected(int error_code)<br>
 {<br>
     bool host_switch = _during_host_switch &amp;&amp; (error_code == SPICEC_ERROR_CODE_SUCCESS);<br>
-    if (_gui_mode != GUI_MODE_FULL &amp;&amp; !host_switch) {<br>
+    if (<br>
+#ifdef HAVE_CEGUI<br>
+    _gui_mode != GUI_MODE_FULL &amp;&amp;<br>
+#endif // HAVE_CEGUI<br>
+    !host_switch) {<br>
         _during_host_switch = false;<br>
         ProcessLoop::quit(error_code);<br>
         return;<br>
@@ -884,6 +924,7 @@ void Application::message_box_test()<br>
<br>
 #endif<br>
<br>
+#ifdef HAVE_CEGUI<br>
 void Application::show_gui()<br>
 {<br>
     if (_gui-&gt;screen() || !_gui-&gt;prepare_dialog()) {<br>
@@ -906,6 +947,7 @@ void Application::hide_gui()<br>
     detach_gui_barriers();<br>
     show_info_layer();<br>
 }<br>
+#endif // HAVE_CEGUI<br>
<br>
 void Application::do_command(int command)<br>
 {<br>
@@ -936,9 +978,11 @@ void Application::do_command(int command)<br>
         do_disconnect();<br>
         break;<br>
 #endif<br>
+#ifdef HAVE_CEGUI<br>
     case APP_CMD_SHOW_GUI:<br>
         show_gui();<br>
         break;<br>
+#endif // HAVE_CEGUI<br>
     }<br>
 }<br>
<br>
@@ -1661,7 +1705,11 @@ void Application::hide_me()<br>
<br>
 bool Application::is_disconnect_allowed()<br>
 {<br>
+#ifdef HAVE_CEGUI<br>
     return _gui_mode == GUI_MODE_FULL;<br>
+#else // HAVE_CEGUI<br>
+    return true; // XXX???<br>
+#endif // HAVE_CEGUI<br>
 }<br>
<br>
 const std::string&amp; Application::get_host()<br>
@@ -1910,14 +1958,18 @@ bool Application::process_cmd_line(int argc, char** argv)<br>
         SPICE_OPT_CANVAS_TYPE,<br>
     };<br>
<br>
+#ifdef HAVE_CEGUI<br>
     if (argc == 1) {<br>
         _gui_mode = GUI_MODE_FULL;<br>
         register_channels();<br>
         _main_screen-&gt;show(true, NULL);<br>
         return true;<br>
     }<br>
+#endif // HAVE_CEGUI<br>
<br>
+#ifdef HAVE_CEGUI<br>
     _gui_mode = GUI_MODE_ACTIVE_SESSION;<br>
+#endif // HAVE_CEGUI<br>
<br>
     CmdLineParser parser(&quot;Spice client&quot;, false);<br>
<br>
diff --git a/client/application.h b/client/application.h<br>
index 1e48ab5..c9b5198 100644<br>
--- a/client/application.h<br>
+++ b/client/application.h<br>
@@ -35,6 +35,8 @@ class InputsHandler;<br>
 class Monitor;<br>
 class CmdLineParser;<br>
 class Menu;<br>
+<br>
+#ifdef HAVE_CEGUI<br>
 class GUI;<br>
 class GUITimer;<br>
 class GUIBarrier;<br>
@@ -42,6 +44,7 @@ class GUIBarrier;<br>
 #ifdef GUI_DEMO<br>
 class TestTimer;<br>
 #endif<br>
+#endif // HAVE_CEGUI<br>
<br>
<br>
 class ConnectedEvent: public Event {<br>
@@ -131,7 +134,9 @@ typedef struct StickyInfo {<br>
<br>
<br>
 typedef std::list&lt;KeyHandler*&gt; KeyHandlersStack;<br>
+#ifdef HAVE_CEGUI<br>
 typedef std::list&lt;GUIBarrier*&gt; GUIBarriers;<br>
+#endif // HAVE_CEGUI<br>
<br>
 class Application : public ProcessLoop,<br>
                     public Platform::EventListener,<br>
@@ -147,11 +152,13 @@ public:<br>
         DISCONECTING,<br>
     };<br>
<br>
+#ifdef HAVE_CEGUI<br>
     enum GuiMode {<br>
         GUI_MODE_FULL,<br>
         GUI_MODE_ACTIVE_SESSION,<br>
         GUI_MODE_MINIMAL,<br>
     };<br>
+#endif // HAVE_CEGUI<br>
<br>
     Application();<br>
     virtual ~Application();<br>
@@ -272,6 +279,7 @@ private:<br>
<br>
     void show_info_layer();<br>
     void hide_info_layer();<br>
+#ifdef HAVE_CEGUI<br>
     void attach_gui_barriers();<br>
     void detach_gui_barriers();<br>
     void show_gui();<br>
@@ -279,6 +287,11 @@ private:<br>
     void create_gui_barrier(RedScreen&amp; screen, int id);<br>
     void destroyed_gui_barrier(int id);<br>
     void destroyed_gui_barriers();<br>
+#else // HAVE_CEGUI<br>
+    void show_gui() {}<br>
+    void hide_gui() {}<br>
+<br>
+#endif // HAVE_CEGUI<br>
<br>
     // returns the press value before operation (i.e., if it was already pressed)<br>
     bool press_key(RedKey key);<br>
@@ -324,6 +337,7 @@ private:<br>
     StickyInfo _sticky_info;<br>
     std::vector&lt;int&gt; _canvas_types;<br>
     AutoRef&lt;Menu&gt; _app_menu;<br>
+#ifdef HAVE_CEGUI<br>
     std::auto_ptr&lt;GUI&gt; _gui;<br>
     AutoRef&lt;GUITimer&gt; _gui_timer;<br>
     GUIBarriers _gui_barriers;<br>
@@ -331,6 +345,7 @@ private:<br>
 #ifdef GUI_DEMO<br>
     AutoRef&lt;TestTimer&gt; _gui_test_timer;<br>
 #endif<br>
+#endif // HAVE_CEGUI<br>
     bool _during_host_switch;<br>
<br>
     State _state;<br>
diff --git a/client/gui/gui.h b/client/gui/gui.h<br>
index d51a8c8..624fe83 100644<br>
--- a/client/gui/gui.h<br>
+++ b/client/gui/gui.h<br>
@@ -22,7 +22,9 @@ public:<br>
     void set_screen(RedScreen* screen); //show and hide<br>
<br>
     Application&amp; get_application() { return _app;}<br>
+#ifdef HAVE_CEGUI<br>
     CEGUI::System&amp; gui_system() { return *_gui_system;}<br>
+#endif // HAVE_CEGUI<br>
<br>
     void set_state(Application::State state);<br>
     bool is_visible() { return !!_dialog;}<br>
@@ -87,8 +89,10 @@ private:<br>
     Application&amp; _app;<br>
     Application::State _state;<br>
     RedPixmapSw* _pixmap;<br>
+#ifdef HAVE_CEGUI<br>
     CEGUI::SoftRenderer* _renderer;<br>
     CEGUI::System* _gui_system;<br>
+#endif // HAVE_CEGUI<br>
     Dialog* _dialog;<br>
     uint64_t _prev_time;<br>
     TabFactorys _tab_factorys;<br>
@@ -100,7 +104,9 @@ class GUI::Tab {<br>
 public:<br>
     virtual ~Tab() {}<br>
<br>
+#ifdef HAVE_CEGUI<br>
     virtual CEGUI::Window&amp; get_root_window() = 0;<br>
+#endif // HAVE_CEGUI<br>
     virtual const std::string&amp; get_name() = 0;<br>
 };<br>
<br>
diff --git a/client/hot_keys.cpp b/client/hot_keys.cpp<br>
index 1d3c874..d6564b7 100644<br>
--- a/client/hot_keys.cpp<br>
+++ b/client/hot_keys.cpp<br>
@@ -138,7 +138,9 @@ void HotKeysParser::add_hotkey(const std::string&amp; hotkey, const CommandsMap&amp; com<br>
     CommandsMap::const_iterator command = commands_map.find(command_name);<br>
<br>
     if (commands_map.find(command_name) == commands_map.end()) {<br>
-        THROW(&quot;invalid action bname&quot;);<br>
+        char buf[1000];<br>
+        sprintf(buf, &quot;invalid action bname %s&quot;, command_name.c_str());<br>
+        THROW(buf);<br>
     }<br>
     int command_id = commands_map.find(command_name)-&gt;second;<br>
     std::string keys = hotkey.substr(key_start + 1);<br>
diff --git a/client/x11/Makefile.am b/client/x11/Makefile.am<br>
index eaa0314..8cd4cd3 100644<br>
--- a/client/x11/Makefile.am<br>
+++ b/client/x11/Makefile.am<br>
@@ -116,15 +116,22 @@ RED_COMMON_SRCS =                                 \<br>
        $(CLIENT_DIR)/zlib_decoder.cpp                  \<br>
        $(CLIENT_DIR)/zlib_decoder.h                    \<br>
        $(CLIENT_DIR)/icon.h                            \<br>
+       $(NULL)<br>
+<br>
+if SUPPORT_CEGUI<br>
+RED_CEGUI_SRCS =                                                       \<br>
        $(CLIENT_DIR)/gui/softrenderer.h                \<br>
        $(CLIENT_DIR)/gui/softrenderer.cpp              \<br>
        $(CLIENT_DIR)/gui/softtexture.h                 \<br>
        $(CLIENT_DIR)/gui/softtexture.cpp               \<br>
        $(CLIENT_DIR)/gui/resource_provider.h           \<br>
-       $(CLIENT_DIR)/gui/resource_provider.cpp         \<br>
+       $(CLIENT_DIR)/gui/resource_provider.cpp \<br>
        $(CLIENT_DIR)/gui/gui.h                         \<br>
-       $(CLIENT_DIR)/gui/gui.cpp                       \<br>
-       $(NULL)<br>
+       $(CLIENT_DIR)/gui/gui.cpp<br>
+else<br>
+RED_CEGUI_SRCS =<br>
+endif<br>
+<br>
<br>
 if SUPPORT_GL<br>
 RED_OGL_SRCS =                                         \<br>
@@ -167,6 +174,7 @@ spicec_SOURCES =                    \<br>
        x_icon.h                        \<br>
        x_platform.h                    \<br>
        $(RED_COMMON_SRCS)              \<br>
+       $(RED_CEGUI_SRCS)               \<br>
        $(RED_OGL_SRCS)                 \<br>
        $(NULL)<br>
<br>
diff --git a/<a href="http://configure.ac" target="_blank">configure.ac</a> b/<a href="http://configure.ac" target="_blank">configure.ac</a><br>
index c78d167..a22b87c 100644<br>
--- a/<a href="http://configure.ac" target="_blank">configure.ac</a><br>
+++ b/<a href="http://configure.ac" target="_blank">configure.ac</a><br>
@@ -97,6 +97,12 @@ AC_ARG_ENABLE(tunnel,<br>
 [  have_tunnel=yes])<br>
 AM_CONDITIONAL(SUPPORT_TUNNEL, test &quot;x$have_tunnel&quot; = &quot;xyes&quot;)<br>
<br>
+have_cegui=no<br>
+AC_ARG_ENABLE(cegui,<br>
+[  --enable-cegui         Enable start dialog with CEGUI],<br>
+[  have_cegui=yes])<br>
+AM_CONDITIONAL(SUPPORT_CEGUI, test &quot;x$have_cegui&quot; = &quot;xyes&quot;)<br>
+<br>
 have_opengl=no<br>
 AC_ARG_ENABLE(opengl,<br>
 [  --enable-opengl         Enable opengl requirement / support (not recommended)],<br>
@@ -121,10 +127,13 @@ SPICE_NONPKGCONFIG_LIBS+=&quot; -pthread $LIBM $LIBRT&quot;<br>
<br>
 SPICE_REQUIRES=&quot;&quot;<br>
<br>
-PKG_CHECK_MODULES(CEGUI, CEGUI &gt;= 0.6.0 CEGUI &lt; 0.7.0)<br>
-AC_SUBST(CEGUI_CFLAGS)<br>
-AC_SUBST(CEGUI_LIBS)<br>
-SPICE_REQUIRES+=&quot; CEGUI&quot;<br>
+if test &quot;x$have_cegui&quot; = &quot;xyes&quot;; then<br>
+    PKG_CHECK_MODULES(CEGUI, CEGUI &gt;= 0.6.0 CEGUI &lt; 0.7.0)<br>
+    AC_SUBST(CEGUI_CFLAGS)<br>
+    AC_SUBST(CEGUI_LIBS)<br>
+    SPICE_REQUIRES+=&quot; CEGUI&quot;<br>
+    CEGUI_CFLAGS+=&quot;-DHAVE_CEGUI&quot;<br>
+fi<br>
<br>
 if test &quot;x$have_tunnel&quot; = &quot;xyes&quot;; then<br>
        PKG_CHECK_MODULES(SLIRP, slirp)<br>
@@ -366,5 +375,7 @@ echo &quot;<br>
<br>
         OpenGL:                   ${have_opengl}<br>
<br>
+        CEGUI:                    ${have_cegui}<br>
+<br>
         Now type &#39;make&#39; to build $PACKAGE<br>
 &quot;<br>
diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c<br>
index 715bfb6..539c18e 100644<br>
--- a/server/red_dispatcher.c<br>
+++ b/server/red_dispatcher.c<br>
@@ -29,7 +29,9 @@<br>
 #include &quot;red_worker.h&quot;<br>
 #include &quot;quic.h&quot;<br>
 #include &quot;sw_canvas.h&quot;<br>
+#ifdef USE_OGL<br>
 #include &quot;gl_canvas.h&quot;<br>
+#endif // USE_OGL<br>
 #include &quot;reds.h&quot;<br>
 #include &quot;red_dispatcher.h&quot;<br>
 #include &quot;red_parse_qxl.h&quot;<br>
@@ -496,7 +498,9 @@ RedDispatcher *red_dispatcher_init(QXLInstance *qxl)<br>
<br>
     quic_init();<br>
     sw_canvas_init();<br>
+#ifdef USE_OGL<br>
     gl_canvas_init();<br>
+#endif // USE_OGL<br>
<br>
     if (socketpair(AF_LOCAL, SOCK_STREAM, 0, channels) == -1) {<br>
         red_error(&quot;socketpair failed %s&quot;, strerror(errno));<br>
_______________________________________________<br>
Spice-devel mailing list<br>
<a href="mailto:Spice-devel@lists.freedesktop.org">Spice-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/spice-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/spice-devel</a><br>
</blockquote></div><br><br>Nice, I&#39;ve been wanting to do this myself too :) Btw, did you need to mod anything to get it to run on the n900? Once I&#39;ll have a bit of free time, I will try to get it to run on my n810 and maybe some Android devices aswell.<br>
<br>Rgrds,<br><br>Attila<br><br>