summaryrefslogtreecommitdiffstats
path: root/remoting/client
diff options
context:
space:
mode:
Diffstat (limited to 'remoting/client')
-rw-r--r--remoting/client/x11_client.cc13
-rw-r--r--remoting/client/x11_view.cc4
-rw-r--r--remoting/client/x11_view.h7
3 files changed, 15 insertions, 9 deletions
diff --git a/remoting/client/x11_client.cc b/remoting/client/x11_client.cc
index 6b8e4e2..0e771a6 100644
--- a/remoting/client/x11_client.cc
+++ b/remoting/client/x11_client.cc
@@ -9,8 +9,9 @@
#include "base/at_exit.h"
#include "base/message_loop.h"
#include "base/stl_util-inl.h"
-#include "remoting/client/host_connection.h"
+#include "remoting/client/jingle_host_connection.h"
#include "remoting/client/client_util.h"
+#include "remoting/jingle_glue/jingle_thread.h"
// Include Xlib at the end because it clashes with ClientMessage defined in
// the protocol buffer.
@@ -22,7 +23,7 @@
namespace remoting {
class X11Client : public base::RefCountedThreadSafe<X11Client>,
- public HostConnection::EventHandler {
+ public HostConnection::HostEventCallback {
public:
X11Client(std::string host_jid, std::string username, std::string auth_token)
: display_(NULL),
@@ -42,11 +43,14 @@ class X11Client : public base::RefCountedThreadSafe<X11Client>,
// Starts the remoting client and the message loop. Returns only after
// the message loop has terminated.
void Run() {
+ // TODO(hclam): Fix the threading issue.
+ network_thread_.Start();
message_loop_.PostTask(FROM_HERE,
NewRunnableMethod(this, &X11Client::DoInitX11));
message_loop_.PostTask(FROM_HERE,
NewRunnableMethod(this, &X11Client::DoInitConnection));
message_loop_.Run();
+ network_thread_.Stop();
}
////////////////////////////////////////////////////////////////////////////
@@ -122,7 +126,7 @@ class X11Client : public base::RefCountedThreadSafe<X11Client>,
// Creates a HostConnection object and connection to the host.
LOG(INFO) << "Connecting...";
- connection_.reset(new HostConnection(new ProtocolDecoder(), this));
+ connection_.reset(new JingleHostConnection(&network_thread_, this));
connection_->Connect(username_, auth_token_, host_jid_);
}
@@ -240,6 +244,7 @@ class X11Client : public base::RefCountedThreadSafe<X11Client>,
scoped_ptr<HostConnection> connection_;
scoped_refptr<ChromotingView> view_;
+ JingleThread network_thread_;
MessageLoop message_loop_;
DISALLOW_COPY_AND_ASSIGN(X11Client);
@@ -251,7 +256,7 @@ int main() {
base::AtExitManager at_exit;
std::string host_jid, username, auth_token;
- if (!remoting::GetLoginInfo(host_jid, username, auth_token)) {
+ if (!remoting::GetLoginInfo(&host_jid, &username, &auth_token)) {
std::cout << "Cannot obtain login info" << std::endl;
return 1;
}
diff --git a/remoting/client/x11_view.cc b/remoting/client/x11_view.cc
index bdb54d4..170a8fa 100644
--- a/remoting/client/x11_view.cc
+++ b/remoting/client/x11_view.cc
@@ -12,7 +12,7 @@
namespace remoting {
-X11View::X11View(Display* display, int window, int width, int height)
+X11View::X11View(Display* display, XID window, int width, int height)
: display_(display),
window_(window),
picture_(0),
@@ -60,7 +60,7 @@ void X11View::Paint() {
XFreeGC(display_, gc);
// Creates the picture representing the pixmap.
- unsigned long picture = XRenderCreatePicture(
+ XID picture = XRenderCreatePicture(
display_, pixmap,
XRenderFindStandardFormat(display_, PictStandardARGB32),
0, NULL);
diff --git a/remoting/client/x11_view.h b/remoting/client/x11_view.h
index 1959e18..f6f8a3d 100644
--- a/remoting/client/x11_view.h
+++ b/remoting/client/x11_view.h
@@ -11,6 +11,7 @@
#include "remoting/client/decoder.h"
#include "remoting/client/chromoting_view.h"
+typedef unsigned long XID;
typedef struct _XDisplay Display;
namespace remoting {
@@ -18,7 +19,7 @@ namespace remoting {
// A ChromotingView implemented using X11 and XRender.
class X11View : public ChromotingView {
public:
- X11View(Display* display, int window, int width, int height);
+ X11View(Display* display, XID window, int width, int height);
virtual ~X11View();
@@ -34,13 +35,13 @@ class X11View : public ChromotingView {
void OnDecodeDone();
Display* display_;
- int window_;
+ XID window_;
int width_;
int height_;
// A picture created in the X server that represents drawing area of the
// window.
- int picture_;
+ XID picture_;
scoped_refptr<media::VideoFrame> frame_;
UpdatedRects update_rects_;