OLD | NEW |
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_BASE_X_X11_UTIL_H_ | 5 #ifndef UI_BASE_X_X11_UTIL_H_ |
6 #define UI_BASE_X_X11_UTIL_H_ | 6 #define UI_BASE_X_X11_UTIL_H_ |
7 | 7 |
8 // This file declares utility functions for X11 (Linux only). | 8 // This file declares utility functions for X11 (Linux only). |
9 // | 9 // |
10 // These functions do not require the Xlib headers to be included (which is why | 10 // These functions do not require the Xlib headers to be included (which is why |
11 // we use a void* for Visual*). The Xlib headers are highly polluting so we try | 11 // we use a void* for Visual*). The Xlib headers are highly polluting so we try |
12 // hard to limit their spread into the rest of the code. | 12 // hard to limit their spread into the rest of the code. |
13 | 13 |
14 #include <string> | 14 #include <string> |
15 #include <vector> | 15 #include <vector> |
16 | 16 |
17 #include "base/basictypes.h" | 17 #include "base/basictypes.h" |
18 #include "base/event_types.h" | 18 #include "base/event_types.h" |
19 #include "base/memory/ref_counted_memory.h" | 19 #include "base/memory/ref_counted_memory.h" |
20 #include "ui/base/ui_base_export.h" | 20 #include "ui/base/ui_base_export.h" |
21 #include "ui/events/event_constants.h" | 21 #include "ui/events/event_constants.h" |
22 #include "ui/events/keycodes/keyboard_codes.h" | 22 #include "ui/events/keycodes/keyboard_codes.h" |
23 #include "ui/gfx/point.h" | |
24 #include "ui/gfx/x/x11_types.h" | 23 #include "ui/gfx/x/x11_types.h" |
25 | 24 |
26 typedef unsigned long XSharedMemoryId; // ShmSeg in the X headers. | 25 typedef unsigned long XSharedMemoryId; // ShmSeg in the X headers. |
27 typedef unsigned long Cursor; | 26 typedef unsigned long Cursor; |
28 typedef struct _XcursorImage XcursorImage; | 27 typedef struct _XcursorImage XcursorImage; |
29 typedef union _XEvent XEvent; | 28 typedef union _XEvent XEvent; |
30 | 29 |
31 namespace gfx { | 30 namespace gfx { |
32 class Canvas; | 31 class Canvas; |
| 32 class Insets; |
33 class Point; | 33 class Point; |
34 class Rect; | 34 class Rect; |
35 } | 35 } |
36 class SkBitmap; | 36 class SkBitmap; |
37 | 37 |
38 namespace ui { | 38 namespace ui { |
39 | 39 |
40 // These functions use the default display and this /must/ be called from | 40 // These functions use the default display and this /must/ be called from |
41 // the UI thread. Thus, they don't support multiple displays. | 41 // the UI thread. Thus, they don't support multiple displays. |
42 | 42 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 UI_BASE_EXPORT void SetHideTitlebarWhenMaximizedProperty( | 114 UI_BASE_EXPORT void SetHideTitlebarWhenMaximizedProperty( |
115 XID window, | 115 XID window, |
116 HideTitlebarWhenMaximized property); | 116 HideTitlebarWhenMaximized property); |
117 | 117 |
118 // Clears all regions of X11's default root window by filling black pixels. | 118 // Clears all regions of X11's default root window by filling black pixels. |
119 UI_BASE_EXPORT void ClearX11DefaultRootWindow(); | 119 UI_BASE_EXPORT void ClearX11DefaultRootWindow(); |
120 | 120 |
121 // Returns true if |window| is visible. | 121 // Returns true if |window| is visible. |
122 UI_BASE_EXPORT bool IsWindowVisible(XID window); | 122 UI_BASE_EXPORT bool IsWindowVisible(XID window); |
123 | 123 |
124 // Returns the bounds of |window|. | 124 // Returns the inner bounds of |window| (excluding the non-client area). |
125 UI_BASE_EXPORT bool GetWindowRect(XID window, gfx::Rect* rect); | 125 UI_BASE_EXPORT bool GetInnerWindowBounds(XID window, gfx::Rect* rect); |
| 126 |
| 127 // Returns the non-client area extents of |window|. This is a negative inset; it |
| 128 // represents the negative size of the window border on all sides. |
| 129 // InnerWindowBounds.Inset(WindowExtents) = OuterWindowBounds. |
| 130 // Returns false if the window manager does not provide extents information. |
| 131 UI_BASE_EXPORT bool GetWindowExtents(XID window, gfx::Insets* extents); |
| 132 |
| 133 // Returns the outer bounds of |window| (including the non-client area). |
| 134 UI_BASE_EXPORT bool GetOuterWindowBounds(XID window, gfx::Rect* rect); |
126 | 135 |
127 // Returns true if |window| contains the point |screen_loc|. | 136 // Returns true if |window| contains the point |screen_loc|. |
128 UI_BASE_EXPORT bool WindowContainsPoint(XID window, gfx::Point screen_loc); | 137 UI_BASE_EXPORT bool WindowContainsPoint(XID window, gfx::Point screen_loc); |
129 | 138 |
130 // Return true if |window| has any property with |property_name|. | 139 // Return true if |window| has any property with |property_name|. |
131 UI_BASE_EXPORT bool PropertyExists(XID window, | 140 UI_BASE_EXPORT bool PropertyExists(XID window, |
132 const std::string& property_name); | 141 const std::string& property_name); |
133 | 142 |
134 // Returns the raw bytes from a property with minimal | 143 // Returns the raw bytes from a property with minimal |
135 // interpretation. |out_data| should be freed by XFree() after use. | 144 // interpretation. |out_data| should be freed by XFree() after use. |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 UI_BASE_EXPORT void ResetXCursorCache(); | 374 UI_BASE_EXPORT void ResetXCursorCache(); |
366 | 375 |
367 // Returns the cached XcursorImage for |cursor|. | 376 // Returns the cached XcursorImage for |cursor|. |
368 UI_BASE_EXPORT const XcursorImage* GetCachedXcursorImage(::Cursor cursor); | 377 UI_BASE_EXPORT const XcursorImage* GetCachedXcursorImage(::Cursor cursor); |
369 | 378 |
370 } // namespace test | 379 } // namespace test |
371 | 380 |
372 } // namespace ui | 381 } // namespace ui |
373 | 382 |
374 #endif // UI_BASE_X_X11_UTIL_H_ | 383 #endif // UI_BASE_X_X11_UTIL_H_ |
OLD | NEW |