Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: ui/ozone/platform/wayland/wayland_window.h

Issue 1712103002: ozone/platform/wayland: Implement pointer handling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/ozone/platform/wayland/wayland_test.cc ('k') | ui/ozone/platform/wayland/wayland_window.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_OZONE_PLATFORM_WAYLAND_WAYLAND_WINDOW_H_ 5 #ifndef UI_OZONE_PLATFORM_WAYLAND_WAYLAND_WINDOW_H_
6 #define UI_OZONE_PLATFORM_WAYLAND_WAYLAND_WINDOW_H_ 6 #define UI_OZONE_PLATFORM_WAYLAND_WAYLAND_WINDOW_H_
7 7
8 #include "ui/events/platform/platform_event_dispatcher.h"
8 #include "ui/gfx/geometry/rect.h" 9 #include "ui/gfx/geometry/rect.h"
9 #include "ui/gfx/native_widget_types.h" 10 #include "ui/gfx/native_widget_types.h"
10 #include "ui/ozone/platform/wayland/wayland_object.h" 11 #include "ui/ozone/platform/wayland/wayland_object.h"
11 #include "ui/platform_window/platform_window.h" 12 #include "ui/platform_window/platform_window.h"
12 13
13 namespace ui { 14 namespace ui {
14 15
15 class WaylandDisplay; 16 class WaylandDisplay;
16 17
17 class WaylandWindow : public PlatformWindow { 18 class WaylandWindow : public PlatformWindow, public PlatformEventDispatcher {
18 public: 19 public:
19 WaylandWindow(PlatformWindowDelegate* delegate, 20 WaylandWindow(PlatformWindowDelegate* delegate,
20 WaylandDisplay* display, 21 WaylandDisplay* display,
21 const gfx::Rect& bounds); 22 const gfx::Rect& bounds);
22 ~WaylandWindow() override; 23 ~WaylandWindow() override;
23 24
25 static WaylandWindow* FromSurface(wl_surface* surface);
26
24 bool Initialize(); 27 bool Initialize();
25 28
26 wl_surface* surface() { return surface_.get(); } 29 wl_surface* surface() { return surface_.get(); }
27 30
28 // Apply the bounds specified in the most recent configure event. This should 31 // Apply the bounds specified in the most recent configure event. This should
29 // be called after processing all pending events in the wayland connection. 32 // be called after processing all pending events in the wayland connection.
30 void ApplyPendingBounds(); 33 void ApplyPendingBounds();
31 34
35 // Set whether this window has pointer focus and should dispatch mouse events.
36 void set_pointer_focus(bool focus) { has_pointer_focus_ = focus; }
37
32 // PlatformWindow 38 // PlatformWindow
33 void Show() override; 39 void Show() override;
34 void Hide() override; 40 void Hide() override;
35 void Close() override; 41 void Close() override;
36 void SetBounds(const gfx::Rect& bounds) override; 42 void SetBounds(const gfx::Rect& bounds) override;
37 gfx::Rect GetBounds() override; 43 gfx::Rect GetBounds() override;
38 void SetTitle(const base::string16& title) override; 44 void SetTitle(const base::string16& title) override;
39 void SetCapture() override; 45 void SetCapture() override;
40 void ReleaseCapture() override; 46 void ReleaseCapture() override;
41 void ToggleFullscreen() override; 47 void ToggleFullscreen() override;
42 void Maximize() override; 48 void Maximize() override;
43 void Minimize() override; 49 void Minimize() override;
44 void Restore() override; 50 void Restore() override;
45 void SetCursor(PlatformCursor cursor) override; 51 void SetCursor(PlatformCursor cursor) override;
46 void MoveCursorTo(const gfx::Point& location) override; 52 void MoveCursorTo(const gfx::Point& location) override;
47 void ConfineCursorToBounds(const gfx::Rect& bounds) override; 53 void ConfineCursorToBounds(const gfx::Rect& bounds) override;
48 PlatformImeController* GetPlatformImeController() override; 54 PlatformImeController* GetPlatformImeController() override;
49 55
56 // PlatformEventDispatcher
57 bool CanDispatchEvent(const PlatformEvent& event) override;
58 uint32_t DispatchEvent(const PlatformEvent& event) override;
59
50 // xdg_surface_listener 60 // xdg_surface_listener
51 static void Configure(void* data, 61 static void Configure(void* data,
52 xdg_surface* obj, 62 xdg_surface* obj,
53 int32_t width, 63 int32_t width,
54 int32_t height, 64 int32_t height,
55 wl_array* states, 65 wl_array* states,
56 uint32_t serial); 66 uint32_t serial);
57 static void Close(void* data, xdg_surface* obj); 67 static void Close(void* data, xdg_surface* obj);
58 68
59 private: 69 private:
60 PlatformWindowDelegate* delegate_; 70 PlatformWindowDelegate* delegate_;
61 WaylandDisplay* display_; 71 WaylandDisplay* display_;
62 72
63 wl::Object<wl_surface> surface_; 73 wl::Object<wl_surface> surface_;
64 wl::Object<xdg_surface> xdg_surface_; 74 wl::Object<xdg_surface> xdg_surface_;
65 75
66 gfx::Rect bounds_; 76 gfx::Rect bounds_;
67 gfx::Rect pending_bounds_; 77 gfx::Rect pending_bounds_;
68 uint32_t pending_configure_serial_; 78 uint32_t pending_configure_serial_;
79 bool has_pointer_focus_ = false;
69 80
70 DISALLOW_COPY_AND_ASSIGN(WaylandWindow); 81 DISALLOW_COPY_AND_ASSIGN(WaylandWindow);
71 }; 82 };
72 83
73 } // namespace ui 84 } // namespace ui
74 85
75 #endif // UI_OZONE_PLATFORM_WAYLAND_WAYLAND_WINDOW_H_ 86 #endif // UI_OZONE_PLATFORM_WAYLAND_WAYLAND_WINDOW_H_
OLDNEW
« no previous file with comments | « ui/ozone/platform/wayland/wayland_test.cc ('k') | ui/ozone/platform/wayland/wayland_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698