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

Side by Side Diff: ui/views/widget/desktop_root_window_host_linux.h

Issue 10985029: linux_aura: Fix cursors and popup menu location (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 8 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « ui/base/cursor/cursor_loader_x11.h ('k') | ui/views/widget/desktop_root_window_host_linux.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_VIEWS_WIDGET_DESKTOP_ROOT_WINDOW_HOST_LINUX_H_ 5 #ifndef UI_VIEWS_WIDGET_DESKTOP_ROOT_WINDOW_HOST_LINUX_H_
6 #define UI_VIEWS_WIDGET_DESKTOP_ROOT_WINDOW_HOST_LINUX_H_ 6 #define UI_VIEWS_WIDGET_DESKTOP_ROOT_WINDOW_HOST_LINUX_H_
7 7
8 #include <X11/Xlib.h> 8 #include <X11/Xlib.h>
9 9
10 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class. 10 // Get rid of a macro from Xlib.h that conflicts with Aura's RootWindow class.
11 #undef RootWindow 11 #undef RootWindow
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "ui/aura/client/cursor_client.h"
14 #include "ui/aura/root_window_host.h" 15 #include "ui/aura/root_window_host.h"
15 #include "ui/gfx/rect.h" 16 #include "ui/gfx/rect.h"
17 #include "ui/base/cursor/cursor_loader_x11.h"
16 #include "ui/base/x/x11_atom_cache.h" 18 #include "ui/base/x/x11_atom_cache.h"
17 #include "ui/views/widget/desktop_root_window_host.h" 19 #include "ui/views/widget/desktop_root_window_host.h"
18 20
19 namespace aura { 21 namespace aura {
20 class DesktopActivationClient; 22 class DesktopActivationClient;
21 class DesktopDispatcherClient; 23 class DesktopDispatcherClient;
22 class FocusManager; 24 class FocusManager;
23 namespace shared { 25 namespace shared {
24 class CompoundEventFilter; 26 class CompoundEventFilter;
25 class InputMethodEventFilter; 27 class InputMethodEventFilter;
26 } 28 }
27 } 29 }
28 30
29 namespace views { 31 namespace views {
30 class DesktopCaptureClient; 32 class DesktopCaptureClient;
31 class X11WindowEventFilter; 33 class X11WindowEventFilter;
32 34
33 class DesktopRootWindowHostLinux : public DesktopRootWindowHost, 35 class DesktopRootWindowHostLinux : public DesktopRootWindowHost,
34 public aura::RootWindowHost, 36 public aura::RootWindowHost,
37 public aura::client::CursorClient,
35 public MessageLoop::Dispatcher { 38 public MessageLoop::Dispatcher {
36 public: 39 public:
37 DesktopRootWindowHostLinux( 40 DesktopRootWindowHostLinux(
38 internal::NativeWidgetDelegate* native_widget_delegate, 41 internal::NativeWidgetDelegate* native_widget_delegate,
39 const gfx::Rect& initial_bounds); 42 const gfx::Rect& initial_bounds);
40 virtual ~DesktopRootWindowHostLinux(); 43 virtual ~DesktopRootWindowHostLinux();
41 44
42 private: 45 private:
43 // Initializes our X11 surface to draw on. This method performs all 46 // Initializes our X11 surface to draw on. This method performs all
44 // initialization related to talking to the X11 server. 47 // initialization related to talking to the X11 server.
45 void InitX11Window(const Widget::InitParams& params); 48 void InitX11Window(const Widget::InitParams& params);
46 49
47 // Creates an aura::RootWindow to contain the |content_window|, along with 50 // Creates an aura::RootWindow to contain the |content_window|, along with
48 // all aura client objects that direct behavior. 51 // all aura client objects that direct behavior.
49 void InitRootWindow(const Widget::InitParams& params); 52 void InitRootWindow(const Widget::InitParams& params);
50 53
51 // Returns true if there's an X window manager present... in most cases. Some 54 // Returns true if there's an X window manager present... in most cases. Some
52 // window managers (notably, ion3) don't implement enough of ICCCM for us to 55 // window managers (notably, ion3) don't implement enough of ICCCM for us to
53 // detect that they're there. 56 // detect that they're there.
54 bool IsWindowManagerPresent(); 57 bool IsWindowManagerPresent();
55 58
56 // Sends a message to the x11 window manager, enabling or disabling the 59 // Sends a message to the x11 window manager, enabling or disabling the
57 // states |state1| and |state2|. 60 // states |state1| and |state2|.
58 void SetWMSpecState(bool enabled, ::Atom state1, ::Atom state2); 61 void SetWMSpecState(bool enabled, ::Atom state1, ::Atom state2);
59 62
60 // Checks if the window manager has set a specific state. 63 // Checks if the window manager has set a specific state.
61 bool HasWMSpecProperty(const char* property) const; 64 bool HasWMSpecProperty(const char* property) const;
62 65
66 // Sets the cursor on |xwindow_| to |cursor|. Does not check or update
67 // |current_cursor_|.
68 void SetCursorInternal(gfx::NativeCursor cursor);
69
63 // Overridden from DesktopRootWindowHost: 70 // Overridden from DesktopRootWindowHost:
64 virtual void Init(aura::Window* content_window, 71 virtual void Init(aura::Window* content_window,
65 const Widget::InitParams& params) OVERRIDE; 72 const Widget::InitParams& params) OVERRIDE;
66 virtual void Close() OVERRIDE; 73 virtual void Close() OVERRIDE;
67 virtual void CloseNow() OVERRIDE; 74 virtual void CloseNow() OVERRIDE;
68 virtual aura::RootWindowHost* AsRootWindowHost() OVERRIDE; 75 virtual aura::RootWindowHost* AsRootWindowHost() OVERRIDE;
69 virtual void ShowWindowWithState(ui::WindowShowState show_state) OVERRIDE; 76 virtual void ShowWindowWithState(ui::WindowShowState show_state) OVERRIDE;
70 virtual void ShowMaximizedWithBounds( 77 virtual void ShowMaximizedWithBounds(
71 const gfx::Rect& restored_bounds) OVERRIDE; 78 const gfx::Rect& restored_bounds) OVERRIDE;
72 virtual bool IsVisible() const OVERRIDE; 79 virtual bool IsVisible() const OVERRIDE;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 virtual void UnConfineCursor() OVERRIDE; 137 virtual void UnConfineCursor() OVERRIDE;
131 virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE; 138 virtual void MoveCursorTo(const gfx::Point& location) OVERRIDE;
132 virtual void SetFocusWhenShown(bool focus_when_shown) OVERRIDE; 139 virtual void SetFocusWhenShown(bool focus_when_shown) OVERRIDE;
133 virtual bool GrabSnapshot( 140 virtual bool GrabSnapshot(
134 const gfx::Rect& snapshot_bounds, 141 const gfx::Rect& snapshot_bounds,
135 std::vector<unsigned char>* png_representation) OVERRIDE; 142 std::vector<unsigned char>* png_representation) OVERRIDE;
136 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; 143 virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE;
137 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; 144 virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE;
138 virtual void PrepareForShutdown() OVERRIDE; 145 virtual void PrepareForShutdown() OVERRIDE;
139 146
140 // Overridden from Dispatcher overrides: 147 // Overridden from aura::CursorClient:
148 // Note: other methods are just set on aura::RootWindowHost:
149 virtual bool IsCursorVisible() const OVERRIDE;
150 virtual void SetDeviceScaleFactor(float device_scale_factor) OVERRIDE;
151
152 // Overridden from Dispatcher:
141 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE; 153 virtual bool Dispatch(const base::NativeEvent& event) OVERRIDE;
142 154
143 // X11 things 155 // X11 things
144 // The display and the native X window hosting the root window. 156 // The display and the native X window hosting the root window.
145 Display* xdisplay_; 157 Display* xdisplay_;
146 ::Window xwindow_; 158 ::Window xwindow_;
147 159
148 // The native root window. 160 // The native root window.
149 ::Window x_root_window_; 161 ::Window x_root_window_;
150 162
(...skipping 13 matching lines...) Expand all
164 176
165 // The window manager state bits. 177 // The window manager state bits.
166 std::set< ::Atom> window_properties_; 178 std::set< ::Atom> window_properties_;
167 179
168 // aura:: objects that we own. 180 // aura:: objects that we own.
169 scoped_ptr<aura::RootWindow> root_window_; 181 scoped_ptr<aura::RootWindow> root_window_;
170 scoped_ptr<DesktopCaptureClient> capture_client_; 182 scoped_ptr<DesktopCaptureClient> capture_client_;
171 scoped_ptr<aura::DesktopActivationClient> activation_client_; 183 scoped_ptr<aura::DesktopActivationClient> activation_client_;
172 scoped_ptr<aura::DesktopDispatcherClient> dispatcher_client_; 184 scoped_ptr<aura::DesktopDispatcherClient> dispatcher_client_;
173 185
186 // Translates custom bitmaps provided by the webpage into X11 cursors.
187 ui::CursorLoaderX11 cursor_loader_;
188
189 // Current Aura cursor.
190 gfx::NativeCursor current_cursor_;
191
192 // Is the cursor currently shown?
193 bool cursor_shown_;
194
195 // The invisible cursor.
196 ::Cursor invisible_cursor_;
197
174 // Toplevel event filter which dispatches to other event filters. 198 // Toplevel event filter which dispatches to other event filters.
175 aura::shared::CompoundEventFilter* root_window_event_filter_; 199 aura::shared::CompoundEventFilter* root_window_event_filter_;
176 200
177 // An event filter that pre-handles all key events to send them to an IME. 201 // An event filter that pre-handles all key events to send them to an IME.
178 scoped_ptr<aura::shared::InputMethodEventFilter> input_method_filter_; 202 scoped_ptr<aura::shared::InputMethodEventFilter> input_method_filter_;
179 scoped_ptr<X11WindowEventFilter> x11_window_event_filter_; 203 scoped_ptr<X11WindowEventFilter> x11_window_event_filter_;
180 204
181 // TODO(beng): Consider providing an interface to DesktopNativeWidgetAura 205 // TODO(beng): Consider providing an interface to DesktopNativeWidgetAura
182 // instead of providing this route back to Widget. 206 // instead of providing this route back to Widget.
183 internal::NativeWidgetDelegate* native_widget_delegate_; 207 internal::NativeWidgetDelegate* native_widget_delegate_;
184 208
185 aura::RootWindowHostDelegate* root_window_host_delegate_; 209 aura::RootWindowHostDelegate* root_window_host_delegate_;
186 aura::Window* content_window_; 210 aura::Window* content_window_;
187 211
188 DISALLOW_COPY_AND_ASSIGN(DesktopRootWindowHostLinux); 212 DISALLOW_COPY_AND_ASSIGN(DesktopRootWindowHostLinux);
189 }; 213 };
190 214
191 } // namespace views 215 } // namespace views
192 216
193 #endif // UI_VIEWS_WIDGET_DESKTOP_ROOT_WINDOW_HOST_LINUX_H_ 217 #endif // UI_VIEWS_WIDGET_DESKTOP_ROOT_WINDOW_HOST_LINUX_H_
OLDNEW
« no previous file with comments | « ui/base/cursor/cursor_loader_x11.h ('k') | ui/views/widget/desktop_root_window_host_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698