x_atom_cache.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /*
  2. * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #ifndef MODULES_DESKTOP_CAPTURE_LINUX_X_ATOM_CACHE_H_
  11. #define MODULES_DESKTOP_CAPTURE_LINUX_X_ATOM_CACHE_H_
  12. #include <X11/X.h>
  13. #include <X11/Xlib.h>
  14. namespace webrtc {
  15. // A cache of Atom. Each Atom object is created on demand.
  16. class XAtomCache final {
  17. public:
  18. explicit XAtomCache(::Display* display);
  19. ~XAtomCache();
  20. ::Display* display() const;
  21. Atom WmState();
  22. Atom WindowType();
  23. Atom WindowTypeNormal();
  24. Atom IccProfile();
  25. private:
  26. // If |*atom| is None, this function uses XInternAtom() to retrieve an Atom.
  27. Atom CreateIfNotExist(Atom* atom, const char* name);
  28. ::Display* const display_;
  29. Atom wm_state_ = None;
  30. Atom window_type_ = None;
  31. Atom window_type_normal_ = None;
  32. Atom icc_profile_ = None;
  33. };
  34. } // namespace webrtc
  35. #endif // MODULES_DESKTOP_CAPTURE_LINUX_X_ATOM_CACHE_H_