OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 // | 4 // |
5 // This file implements a X11 chromoting client. | 5 // This file implements a X11 chromoting client. |
6 | 6 |
7 #include <iostream> | 7 #include <iostream> |
8 | 8 |
9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 void InitX11() { | 90 void InitX11() { |
91 message_loop_->PostTask(FROM_HERE, | 91 message_loop_->PostTask(FROM_HERE, |
92 NewRunnableMethod(this, &X11Client::DoInitX11)); | 92 NewRunnableMethod(this, &X11Client::DoInitX11)); |
93 } | 93 } |
94 | 94 |
95 void DoInitX11() { | 95 void DoInitX11() { |
96 display_ = XOpenDisplay(NULL); | 96 display_ = XOpenDisplay(NULL); |
97 if (!display_) { | 97 if (!display_) { |
98 std::cout << "Error - cannot open display" << std::endl; | 98 std::cout << "Error - cannot open display" << std::endl; |
99 client_done_->Signal(); | 99 client_done_->Signal(); |
| 100 return; |
100 } | 101 } |
101 | 102 |
102 // Get properties of the screen. | 103 // Get properties of the screen. |
103 int screen = DefaultScreen(display_); | 104 int screen = DefaultScreen(display_); |
104 int root_window = RootWindow(display_, screen); | 105 int root_window = RootWindow(display_, screen); |
105 | 106 |
106 // Creates the window. | 107 // Creates the window. |
107 window_ = XCreateSimpleWindow(display_, root_window, 1, 1, 640, 480, 0, | 108 window_ = XCreateSimpleWindow(display_, root_window, 1, 1, 640, 480, 0, |
108 BlackPixel(display_, screen), | 109 BlackPixel(display_, screen), |
109 BlackPixel(display_, screen)); | 110 BlackPixel(display_, screen)); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 | 252 |
252 client->DestroyX11(); | 253 client->DestroyX11(); |
253 | 254 |
254 // Quit the current message loop. | 255 // Quit the current message loop. |
255 network_thread.message_loop()->PostTask(FROM_HERE, | 256 network_thread.message_loop()->PostTask(FROM_HERE, |
256 new MessageLoop::QuitTask()); | 257 new MessageLoop::QuitTask()); |
257 network_thread.Stop(); | 258 network_thread.Stop(); |
258 | 259 |
259 return 0; | 260 return 0; |
260 } | 261 } |
OLD | NEW |