summaryrefslogtreecommitdiff
path: root/chromium/ui/base/x/x11_window.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/ui/base/x/x11_window.h')
-rw-r--r--chromium/ui/base/x/x11_window.h66
1 files changed, 37 insertions, 29 deletions
diff --git a/chromium/ui/base/x/x11_window.h b/chromium/ui/base/x/x11_window.h
index feec9b62e6d..c5b0d7227a5 100644
--- a/chromium/ui/base/x/x11_window.h
+++ b/chromium/ui/base/x/x11_window.h
@@ -8,6 +8,7 @@
#include <array>
#include <memory>
#include <string>
+#include <vector>
#include "base/cancelable_callback.h"
#include "base/component_export.h"
@@ -19,8 +20,12 @@
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/geometry/size_f.h"
+#include "ui/gfx/x/event.h"
+#include "ui/gfx/x/sync.h"
#include "ui/gfx/x/x11.h"
#include "ui/gfx/x/x11_types.h"
+#include "ui/gfx/x/xfixes.h"
+#include "ui/gfx/x/xproto.h"
class SkPath;
@@ -107,11 +112,11 @@ class COMPONENT_EXPORT(UI_BASE_X) XWindow {
bool IsActive() const;
void GrabPointer();
void ReleasePointerGrab();
- void StackXWindowAbove(::Window window);
+ void StackXWindowAbove(x11::Window window);
void StackXWindowAtTop();
- bool IsTargetedBy(const XEvent& xev) const;
+ bool IsTargetedBy(const x11::Event& xev) const;
void WmMoveResize(int hittest, const gfx::Point& location) const;
- void ProcessEvent(XEvent* xev);
+ void ProcessEvent(x11::Event* xev);
void SetSize(const gfx::Size& size_in_pixels);
void SetBounds(const gfx::Rect& requested_bounds);
@@ -119,7 +124,7 @@ class COMPONENT_EXPORT(UI_BASE_X) XWindow {
bool IsMinimized() const;
bool IsMaximized() const;
bool IsFullscreen() const;
- gfx::Rect GetOutterBounds() const;
+ gfx::Rect GetOuterBounds() const;
void SetCursor(::Cursor cursor);
bool SetTitle(base::string16 title);
@@ -163,12 +168,14 @@ class COMPONENT_EXPORT(UI_BASE_X) XWindow {
bool has_alpha() const { return visual_has_alpha_; }
base::Optional<int> workspace() const { return workspace_; }
- XDisplay* display() const { return xdisplay_; }
- ::Window window() const { return xwindow_; }
- ::Window root_window() const { return x_root_window_; }
- ::Region shape() const { return window_shape_.get(); }
- XID update_counter() const { return update_counter_; }
- XID extended_update_counter() const { return extended_update_counter_; }
+ x11::Connection* connection() const { return connection_; }
+ x11::Window window() const { return xwindow_; }
+ x11::Window root_window() const { return x_root_window_; }
+ std::vector<x11::Rectangle>* shape() const { return window_shape_.get(); }
+ x11::Sync::Counter update_counter() const { return update_counter_; }
+ x11::Sync::Counter extended_update_counter() const {
+ return extended_update_counter_;
+ }
::Cursor last_cursor() const { return last_cursor_; }
protected:
@@ -178,14 +185,16 @@ class COMPONENT_EXPORT(UI_BASE_X) XWindow {
private:
// Called on an XFocusInEvent, XFocusOutEvent, XIFocusInEvent, or an
// XIFocusOutEvent.
- void OnFocusEvent(bool focus_in, int mode, int detail);
+ void OnFocusEvent(bool focus_in,
+ x11::NotifyMode mode,
+ x11::NotifyDetail detail);
// Called on an XEnterWindowEvent, XLeaveWindowEvent, XIEnterEvent, or an
// XILeaveEvent.
void OnCrossingEvent(bool enter,
bool focus_in_window_or_ancestor,
- int mode,
- int detail);
+ x11::NotifyMode mode,
+ x11::NotifyDetail detail);
// Called when |xwindow_|'s _NET_WM_STATE property is updated.
void OnWMStateUpdated();
@@ -193,7 +202,7 @@ class COMPONENT_EXPORT(UI_BASE_X) XWindow {
// Called when |xwindow_|'s _NET_FRAME_EXTENTS property is updated.
void OnFrameExtentsUpdated();
- void OnConfigureEvent(XEvent* xev);
+ void OnConfigureEvent(const x11::ConfigureNotifyEvent& event);
void OnWorkspaceUpdated();
@@ -215,15 +224,15 @@ class COMPONENT_EXPORT(UI_BASE_X) XWindow {
// be invalid to unset the maximized state by making two calls like
// (_NET_WM_STATE_MAXIMIZED_VERT, x11::None), (_NET_WM_STATE_MAXIMIZED_HORZ,
// x11::None).
- void SetWMSpecState(bool enabled, XAtom state1, XAtom state2);
+ void SetWMSpecState(bool enabled, x11::Atom state1, x11::Atom state2);
// Updates |window_properties_| with |new_window_properties|.
void UpdateWindowProperties(
- const base::flat_set<XAtom>& new_window_properties);
+ const base::flat_set<x11::Atom>& new_window_properties);
void UnconfineCursor();
- void UpdateWindowRegion(XRegion* xregion);
+ void UpdateWindowRegion(std::unique_ptr<std::vector<x11::Rectangle>> region);
void NotifyBoundsChanged(const gfx::Rect& new_bounds_in_px);
@@ -241,23 +250,23 @@ class COMPONENT_EXPORT(UI_BASE_X) XWindow {
virtual void OnXWindowWorkspaceChanged() = 0;
virtual void OnXWindowLostPointerGrab() = 0;
virtual void OnXWindowLostCapture() = 0;
- virtual void OnXWindowSelectionEvent(XEvent* xev) = 0;
- virtual void OnXWindowDragDropEvent(XEvent* xev) = 0;
+ virtual void OnXWindowSelectionEvent(x11::Event* xev) = 0;
+ virtual void OnXWindowDragDropEvent(x11::Event* xev) = 0;
virtual base::Optional<gfx::Size> GetMinimumSizeForXWindow() = 0;
virtual base::Optional<gfx::Size> GetMaximumSizeForXWindow() = 0;
virtual void GetWindowMaskForXWindow(const gfx::Size& size,
SkPath* window_mask) = 0;
// The display and the native X window hosting the root window.
- XDisplay* xdisplay_ = nullptr;
- ::Window xwindow_ = x11::None;
- ::Window x_root_window_ = x11::None;
+ x11::Connection* const connection_;
+ x11::Window xwindow_ = x11::Window::None;
+ x11::Window x_root_window_ = x11::Window::None;
// Events selected on |xwindow_|.
std::unique_ptr<ui::XScopedEventSelector> xwindow_events_;
// The window manager state bits.
- base::flat_set<XAtom> window_properties_;
+ base::flat_set<x11::Atom> window_properties_;
// Is this window able to receive focus?
bool activatable_ = true;
@@ -276,7 +285,7 @@ class COMPONENT_EXPORT(UI_BASE_X) XWindow {
// The bounds of |xwindow_|.
gfx::Rect bounds_in_pixels_;
- VisualID visual_id_ = 0;
+ x11::VisualId visual_id_{};
// Whether we used an ARGB visual for our window.
bool visual_has_alpha_ = false;
@@ -325,8 +334,8 @@ class COMPONENT_EXPORT(UI_BASE_X) XWindow {
// Used for synchronizing between |xwindow_| and desktop compositor during
// resizing.
- XID update_counter_ = x11::None;
- XID extended_update_counter_ = x11::None;
+ x11::Sync::Counter update_counter_{};
+ x11::Sync::Counter extended_update_counter_{};
// Whenever the bounds are set, we keep the previous set of bounds around so
// we can have a better chance of getting the real
@@ -353,8 +362,7 @@ class COMPONENT_EXPORT(UI_BASE_X) XWindow {
gfx::Size max_size_in_pixels_;
// The window shape if the window is non-rectangular.
- gfx::XScopedPtr<XRegion, gfx::XObjectDeleter<XRegion, int, XDestroyRegion>>
- window_shape_;
+ std::unique_ptr<std::vector<x11::Rectangle>> window_shape_;
// Whether |window_shape_| was set via SetShape().
bool custom_window_shape_ = false;
@@ -377,7 +385,7 @@ class COMPONENT_EXPORT(UI_BASE_X) XWindow {
// Keep track of barriers to confine cursor.
bool has_pointer_barriers_ = false;
- std::array<XID, 4> pointer_barriers_;
+ std::array<x11::XFixes::Barrier, 4> pointer_barriers_;
::Cursor last_cursor_ = x11::None;
};