globally remove all trailing whitespace from ardour code base.
[ardour.git] / libs / pbd / base_ui.cc
index 5725d691829d4874e68be9bcfe404c3b40debb91..1b48a19eff912f2d92fb2df7587d6d6627fb4ac7 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2000-2007 Paul Davis 
+    Copyright (C) 2000-2007 Paul Davis
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 
 #include <cstring>
 #include <stdint.h>
+#ifdef COMPILER_MSVC
+#include <io.h>      // Microsoft's nearest equivalent to <unistd.h>
+#else
 #include <unistd.h>
+#endif
 #include <fcntl.h>
 #include <cerrno>
 #include <cstring>
@@ -47,15 +51,10 @@ BaseUI::BaseUI (const string& str)
        : m_context(MainContext::get_default())
        , run_loop_thread (0)
        , _name (str)
-#ifndef WIN32
        , request_channel (true)
-#endif
 {
        base_ui_instance = this;
-
-#ifndef WIN32
-       request_channel.ios()->connect (sigc::mem_fun (*this, &BaseUI::request_handler));
-#endif
+       request_channel.set_receive_handler (sigc::mem_fun (*this, &BaseUI::request_handler));
 
        /* derived class must set _ok */
 }
@@ -120,24 +119,6 @@ BaseUI::quit ()
        }
 }
 
-#ifdef WIN32
-gboolean
-BaseUI::_request_handler (gpointer data)
-{
-       BaseUI* ui = static_cast<BaseUI*>(data);
-       return ui->request_handler ();
-}
-
-bool
-BaseUI::request_handler ()
-{
-       DEBUG_TRACE (DEBUG::EventLoop, "BaseUI::request_handler\n");
-       handle_ui_requests ();
-       // keep calling indefinitely at the timeout interval
-       return true;
-}
-
-#else
 bool
 BaseUI::request_handler (Glib::IOCondition ioc)
 {
@@ -162,17 +143,12 @@ BaseUI::request_handler (Glib::IOCondition ioc)
 
        return true;
 }
-#endif
 
 void
 BaseUI::signal_new_request ()
 {
        DEBUG_TRACE (DEBUG::EventLoop, "BaseUI::signal_new_request\n");
-#ifdef WIN32
-       // handled in timeout, how to signal...?
-#else
        request_channel.wakeup ();
-#endif
 }
 
 /**
@@ -182,13 +158,5 @@ void
 BaseUI::attach_request_source ()
 {
        DEBUG_TRACE (DEBUG::EventLoop, "BaseUI::attach_request_source\n");
-#ifdef WIN32
-       GSource* request_source = g_timeout_source_new(200);
-       g_source_set_callback (request_source, &BaseUI::_request_handler, this, NULL);
-       g_source_attach (request_source, m_context->gobj());
-#else
-       request_channel.ios()->attach (m_context);
-       /* glibmm hack - drop the refptr to the IOSource now before it can hurt */
-       request_channel.drop_ios ();
-#endif
+       request_channel.attach (m_context);
 }