x11_extension.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Copyright 2019 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. #ifndef UI_PLATFORM_WINDOW_EXTENSIONS_X11_EXTENSION_H_
  5. #define UI_PLATFORM_WINDOW_EXTENSIONS_X11_EXTENSION_H_
  6. #include "base/component_export.h"
  7. #include "ui/gfx/geometry/rect.h"
  8. namespace ui {
  9. class PlatformWindow;
  10. class X11ExtensionDelegate;
  11. // Linux extensions that linux platforms can use to extend the platform windows
  12. // APIs. Please refer to README for more details.
  13. //
  14. // The extension mustn't be called until PlatformWindow is initialized.
  15. class COMPONENT_EXPORT(PLATFORM_WINDOW) X11Extension {
  16. public:
  17. // Returns whether an XSync extension is available at the current platform.
  18. virtual bool IsSyncExtensionAvailable() const = 0;
  19. // Returns a best-effort guess as to whether the WM is tiling (true) or
  20. // stacking (false).
  21. virtual bool IsWmTiling() const = 0;
  22. // Handles CompleteSwapAfterResize event coming from the compositor observer.
  23. virtual void OnCompleteSwapAfterResize() = 0;
  24. // Returns the current bounds in terms of the X11 Root Window including the
  25. // borders provided by the window manager (if any).
  26. virtual gfx::Rect GetXRootWindowOuterBounds() const = 0;
  27. // Asks X11 to lower the Xwindow down the stack so that it does not obscure
  28. // any sibling windows.
  29. virtual void LowerXWindow() = 0;
  30. // Forces this window to be unmanaged by the window manager if
  31. // |override_redirect| is true.
  32. virtual void SetOverrideRedirect(bool override_redirect) = 0;
  33. // Returns true if SetOverrideRedirect() would be compatible with the WM.
  34. virtual bool CanResetOverrideRedirect() const = 0;
  35. virtual void SetX11ExtensionDelegate(X11ExtensionDelegate* delegate) = 0;
  36. protected:
  37. virtual ~X11Extension();
  38. // Sets the pointer to the extension as a property of the PlatformWindow.
  39. void SetX11Extension(PlatformWindow* platform_window,
  40. X11Extension* x11_extensions);
  41. };
  42. COMPONENT_EXPORT(PLATFORM_WINDOW)
  43. X11Extension* GetX11Extension(const PlatformWindow& platform_window);
  44. } // namespace ui
  45. #endif // UI_PLATFORM_WINDOW_EXTENSIONS_X11_EXTENSION_H_