| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium OS 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 #include "window_manager/x11/mock_x_connection.h" | 5 #include "window_manager/x11/mock_x_connection.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <unistd.h> | 8 #include <unistd.h> |
| 9 | 9 |
| 10 #include <list> | 10 #include <list> |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 return true; | 420 return true; |
| 421 } | 421 } |
| 422 | 422 |
| 423 bool MockXConnection::GetWindowBoundingRegion(XWindow xid, ByteMap* bytemap) { | 423 bool MockXConnection::GetWindowBoundingRegion(XWindow xid, ByteMap* bytemap) { |
| 424 WindowInfo* info = GetWindowInfo(xid); | 424 WindowInfo* info = GetWindowInfo(xid); |
| 425 if (!info) | 425 if (!info) |
| 426 return false; | 426 return false; |
| 427 if (info->shape.get()) | 427 if (info->shape.get()) |
| 428 bytemap->Copy(*(info->shape.get())); | 428 bytemap->Copy(*(info->shape.get())); |
| 429 else | 429 else |
| 430 bytemap->SetRectangle(0, 0, info->bounds.width, info->bounds.height, 0xff); | 430 bytemap->SetRectangle( |
| 431 Rect(0, 0, info->bounds.width, info->bounds.height), 0xff); |
| 431 return true; | 432 return true; |
| 432 } | 433 } |
| 433 | 434 |
| 434 bool MockXConnection::SetWindowBoundingRegionToRect(XWindow xid, | 435 bool MockXConnection::SetWindowBoundingRegionToRect(XWindow xid, |
| 435 const Rect& region) { | 436 const Rect& region) { |
| 436 WindowInfo* info = GetWindowInfo(xid); | 437 WindowInfo* info = GetWindowInfo(xid); |
| 437 if (!info) | 438 if (!info) |
| 438 return false; | 439 return false; |
| 439 if (region.x == 0 && region.y == 0 && | 440 if (region.x == 0 && region.y == 0 && |
| 440 region.width == info->bounds.width && | 441 region.width == info->bounds.width && |
| 441 region.height == info->bounds.height) { | 442 region.height == info->bounds.height) { |
| 442 info->shape.reset(NULL); | 443 info->shape.reset(NULL); |
| 443 } else { | 444 } else { |
| 444 if (info->shape.get() == NULL) | 445 if (info->shape.get() == NULL) |
| 445 info->shape.reset(new ByteMap(info->bounds.width, info->bounds.height)); | 446 info->shape.reset(new ByteMap(info->bounds.size())); |
| 446 info->shape->Clear(0); | 447 info->shape->Clear(0); |
| 447 info->shape->SetRectangle( | 448 info->shape->SetRectangle(region, 0xff); |
| 448 region.x, region.y, region.width, region.height, 0xff); | |
| 449 } | 449 } |
| 450 return true; | 450 return true; |
| 451 } | 451 } |
| 452 | 452 |
| 453 bool MockXConnection::RemoveWindowBoundingRegion(XWindow xid) { | 453 bool MockXConnection::RemoveWindowBoundingRegion(XWindow xid) { |
| 454 WindowInfo* info = GetWindowInfo(xid); | 454 WindowInfo* info = GetWindowInfo(xid); |
| 455 if (!info) | 455 if (!info) |
| 456 return false; | 456 return false; |
| 457 if (info->shape.get() == NULL) | 457 if (info->shape.get() == NULL) |
| 458 info->shape.reset(new ByteMap(info->bounds.width, info->bounds.height)); | 458 info->shape.reset(new ByteMap(info->bounds.size())); |
| 459 info->shape->Clear(0); | 459 info->shape->Clear(0); |
| 460 return true; | 460 return true; |
| 461 } | 461 } |
| 462 | 462 |
| 463 bool MockXConnection::SelectRandREventsOnWindow(XWindow xid) { | 463 bool MockXConnection::SelectRandREventsOnWindow(XWindow xid) { |
| 464 WindowInfo* info = GetWindowInfo(xid); | 464 WindowInfo* info = GetWindowInfo(xid); |
| 465 if (!info) | 465 if (!info) |
| 466 return false; | 466 return false; |
| 467 info->randr_events_selected = true; | 467 info->randr_events_selected = true; |
| 468 return true; | 468 return true; |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1056 queued_events_.pop(); | 1056 queued_events_.pop(); |
| 1057 | 1057 |
| 1058 if (connection_pipe_has_data_) { | 1058 if (connection_pipe_has_data_) { |
| 1059 unsigned char data = 0; | 1059 unsigned char data = 0; |
| 1060 PCHECK(HANDLE_EINTR(read(connection_pipe_fds_[0], &data, 1)) == 1); | 1060 PCHECK(HANDLE_EINTR(read(connection_pipe_fds_[0], &data, 1)) == 1); |
| 1061 connection_pipe_has_data_ = false; | 1061 connection_pipe_has_data_ = false; |
| 1062 } | 1062 } |
| 1063 } | 1063 } |
| 1064 | 1064 |
| 1065 } // namespace window_manager | 1065 } // namespace window_manager |
| OLD | NEW |