x11_util.cc 851 B

12345678910111213141516171819202122232425262728293031323334
  1. // Copyright (c) 2012 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "remoting/host/linux/x11_util.h"
  5. #include "base/bind.h"
  6. #include "ui/gfx/x/future.h"
  7. #include "ui/gfx/x/xtest.h"
  8. namespace remoting {
  9. ScopedXGrabServer::ScopedXGrabServer(x11::Connection* connection)
  10. : connection_(connection) {
  11. connection_->GrabServer();
  12. }
  13. ScopedXGrabServer::~ScopedXGrabServer() {
  14. connection_->UngrabServer();
  15. connection_->Flush();
  16. }
  17. bool IgnoreXServerGrabs(x11::Connection* connection, bool ignore) {
  18. if (!connection->xtest()
  19. .GetVersion({x11::Test::major_version, x11::Test::minor_version})
  20. .Sync()) {
  21. return false;
  22. }
  23. connection->xtest().GrabControl({ignore});
  24. return true;
  25. }
  26. } // namespace remoting