MD Downloads: prevent search text from overlapping with the cancel search (X)
[chromium-blink-merge.git] / ui / platform_window / x11 / x11_window.h
blobbceb8ad39a05889303c881810ee9549bc7b69c3b
1 // Copyright 2014 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.
5 #ifndef UI_PLATFORM_WINDOW_X11_X11_WINDOW_H_
6 #define UI_PLATFORM_WINDOW_X11_X11_WINDOW_H_
8 #include "ui/events/platform/platform_event_dispatcher.h"
9 #include "ui/gfx/geometry/rect.h"
10 #include "ui/gfx/x/x11_atom_cache.h"
11 #include "ui/platform_window/platform_window.h"
12 #include "ui/platform_window/platform_window_delegate.h"
13 #include "ui/platform_window/x11/x11_window_export.h"
15 typedef struct _XDisplay XDisplay;
16 typedef unsigned long XID;
18 namespace ui {
20 class X11_WINDOW_EXPORT X11Window : public PlatformWindow,
21 public PlatformEventDispatcher {
22 public:
23 explicit X11Window(PlatformWindowDelegate* delegate);
24 ~X11Window() override;
26 private:
27 void Destroy();
29 void ProcessXInput2Event(XEvent* xevent);
31 // PlatformWindow:
32 void Show() override;
33 void Hide() override;
34 void Close() override;
35 void SetBounds(const gfx::Rect& bounds) override;
36 gfx::Rect GetBounds() override;
37 void SetTitle(const base::string16& title) override;
38 void SetCapture() override;
39 void ReleaseCapture() override;
40 void ToggleFullscreen() override;
41 void Maximize() override;
42 void Minimize() override;
43 void Restore() override;
44 void SetCursor(PlatformCursor cursor) override;
45 void MoveCursorTo(const gfx::Point& location) override;
46 void ConfineCursorToBounds(const gfx::Rect& bounds) override;
47 PlatformImeController* GetPlatformImeController() override;
49 // PlatformEventDispatcher:
50 bool CanDispatchEvent(const PlatformEvent& event) override;
51 uint32_t DispatchEvent(const PlatformEvent& event) override;
53 PlatformWindowDelegate* delegate_;
55 XDisplay* xdisplay_;
56 XID xwindow_;
57 XID xroot_window_;
58 X11AtomCache atom_cache_;
60 // Setting the bounds is an asynchronous operation in X11. |requested_bounds_|
61 // is the bounds requested using XConfigureWindow, and |confirmed_bounds_| is
62 // the bounds the X11 server has set on the window.
63 gfx::Rect requested_bounds_;
64 gfx::Rect confirmed_bounds_;
66 bool window_mapped_;
68 DISALLOW_COPY_AND_ASSIGN(X11Window);
71 namespace test {
73 // Sets the value of the |override_redirect| flag when creating an X11 window.
74 // It is necessary to set this flag on for various tests, otherwise the call to
75 // X11Window::Show() blocks because it never receives the MapNotify event. It is
76 // unclear why this is necessary, but might be related to calls to
77 // XInitThreads().
78 X11_WINDOW_EXPORT void SetUseOverrideRedirectWindowByDefault(
79 bool override_redirect);
81 } // namespace test
83 } // namespace ui
85 #endif // UI_PLATFORM_WINDOW_X11_X11_WINDOW_H_