x11_extension_delegate.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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_DELEGATE_H_
  5. #define UI_PLATFORM_WINDOW_EXTENSIONS_X11_EXTENSION_DELEGATE_H_
  6. #include "base/component_export.h"
  7. #include "ui/base/buildflags.h"
  8. #include "ui/gfx/geometry/rect.h"
  9. #if BUILDFLAG(USE_ATK)
  10. using AtkKeyEventStruct = struct _AtkKeyEventStruct;
  11. #endif
  12. namespace ui {
  13. class COMPONENT_EXPORT(PLATFORM_WINDOW) X11ExtensionDelegate {
  14. public:
  15. // Notifies if the PlatformWindow looses a mouse grab. This can be useful
  16. // for Wayland or X11. Both of them provide pointer enter and leave
  17. // notifications, which non-ozone X11 (just an example) use to be using to
  18. // notify about lost pointer grab along with explicit grabs. Wayland also
  19. // has this technique. However, explicit grab is available only for popup
  20. // (menu) windows.
  21. virtual void OnLostMouseGrab() = 0;
  22. #if BUILDFLAG(USE_ATK)
  23. // Notifies an ATK key event to be processed. The transient parameter will be
  24. // true if the event target is a transient window (e.g. a modal dialog)
  25. // "hanging" from our window. Return true to stop propagation of the original
  26. // key event.
  27. virtual bool OnAtkKeyEvent(AtkKeyEventStruct* atk_key_event,
  28. bool transient) = 0;
  29. #endif
  30. // Returns true if this window should be in a forced override-redirect state
  31. // (not managed by the window manager).
  32. virtual bool IsOverrideRedirect() const = 0;
  33. // Returns guessed size we will have after the switch to/from fullscreen:
  34. // - (may) avoid transient states
  35. // - works around Flash content which expects to have the size updated
  36. // synchronously.
  37. // See https://crbug.com/361408
  38. // TODO(1096425): remove this and let this managed by X11ScreenOzone that
  39. // Ozone's X11Window should be able to access instead. This delegate method
  40. // is required as non-Ozone/X11 is not able to determine matching display
  41. // as it requires to know bounds in dip.
  42. virtual gfx::Rect GetGuessedFullScreenSizeInPx() const = 0;
  43. protected:
  44. virtual ~X11ExtensionDelegate() = default;
  45. };
  46. } // namespace ui
  47. #endif // UI_PLATFORM_WINDOW_EXTENSIONS_X11_EXTENSION_DELEGATE_H_