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 #pragma once | 7 #pragma once |
8 | 8 |
9 // This file declares utility functions for X11 (Linux only). | 9 // This file declares utility functions for X11 (Linux only). |
10 // | 10 // |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 // received. | 248 // received. |
249 UI_EXPORT void UpdateButtonMap(); | 249 UI_EXPORT void UpdateButtonMap(); |
250 | 250 |
251 // Initializes a XEvent that holds XKeyEvent for testing. Note that ui::EF_ | 251 // Initializes a XEvent that holds XKeyEvent for testing. Note that ui::EF_ |
252 // flags should be passed as |flags|, not the native ones in <X11/X.h>. | 252 // flags should be passed as |flags|, not the native ones in <X11/X.h>. |
253 UI_EXPORT void InitXKeyEventForTesting(EventType type, | 253 UI_EXPORT void InitXKeyEventForTesting(EventType type, |
254 KeyboardCode key_code, | 254 KeyboardCode key_code, |
255 int flags, | 255 int flags, |
256 XEvent* event); | 256 XEvent* event); |
257 | 257 |
| 258 // Keeps track of a string returned by an X function (e.g. XGetAtomName) and |
| 259 // makes sure it's XFree'd. |
| 260 class UI_EXPORT XScopedString { |
| 261 public: |
| 262 explicit XScopedString(char* str) : string_(str) { } |
| 263 ~XScopedString(); |
| 264 |
| 265 const char* string() const { return string_; } |
| 266 |
| 267 private: |
| 268 char* string_; |
| 269 |
| 270 DISALLOW_COPY_AND_ASSIGN(XScopedString); |
| 271 }; |
| 272 |
258 } // namespace ui | 273 } // namespace ui |
259 | 274 |
260 #endif // UI_BASE_X_X11_UTIL_H_ | 275 #endif // UI_BASE_X_X11_UTIL_H_ |
OLD | NEW |