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 |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 UI_EXPORT bool ChangeWindowDesktop(XID window, XID destination); | 295 UI_EXPORT bool ChangeWindowDesktop(XID window, XID destination); |
296 | 296 |
297 // Enable the default X error handlers. These will log the error and abort | 297 // Enable the default X error handlers. These will log the error and abort |
298 // the process if called. Use SetX11ErrorHandlers() from x11_util_internal.h | 298 // the process if called. Use SetX11ErrorHandlers() from x11_util_internal.h |
299 // to set your own error handlers. | 299 // to set your own error handlers. |
300 UI_EXPORT void SetDefaultX11ErrorHandlers(); | 300 UI_EXPORT void SetDefaultX11ErrorHandlers(); |
301 | 301 |
302 // Return true if a given window is in full-screen mode. | 302 // Return true if a given window is in full-screen mode. |
303 UI_EXPORT bool IsX11WindowFullScreen(XID window); | 303 UI_EXPORT bool IsX11WindowFullScreen(XID window); |
304 | 304 |
305 // Return true if event type is MotionNotify. | |
306 UI_EXPORT bool IsMotionEvent(XEvent* event); | |
307 | |
308 // Returns the mapped button. | |
309 int GetMappedButton(int button); | |
310 | |
311 // Updates button mapping. This is usually called when a MappingNotify event is | |
312 // received. | |
313 UI_EXPORT void UpdateButtonMap(); | |
314 | |
315 // Initializes a XEvent that holds XKeyEvent for testing. Note that ui::EF_ | |
316 // flags should be passed as |flags|, not the native ones in <X11/X.h>. | |
317 UI_EXPORT void InitXKeyEventForTesting(EventType type, | |
318 KeyboardCode key_code, | |
319 int flags, | |
320 XEvent* event); | |
321 | |
322 // Manages a piece of X11 allocated memory as a RefCountedMemory segment. This | 305 // Manages a piece of X11 allocated memory as a RefCountedMemory segment. This |
323 // object takes ownership over the passed in memory and will free it with the | 306 // object takes ownership over the passed in memory and will free it with the |
324 // X11 allocator when done. | 307 // X11 allocator when done. |
325 class UI_EXPORT XRefcountedMemory : public base::RefCountedMemory { | 308 class UI_EXPORT XRefcountedMemory : public base::RefCountedMemory { |
326 public: | 309 public: |
327 XRefcountedMemory(unsigned char* x11_data, size_t length) | 310 XRefcountedMemory(unsigned char* x11_data, size_t length) |
328 : x11_data_(length ? x11_data : NULL), | 311 : x11_data_(length ? x11_data : NULL), |
329 length_(length) { | 312 length_(length) { |
330 } | 313 } |
331 | 314 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 private: | 377 private: |
395 ::Cursor cursor_; | 378 ::Cursor cursor_; |
396 XDisplay* display_; | 379 XDisplay* display_; |
397 | 380 |
398 DISALLOW_COPY_AND_ASSIGN(XScopedCursor); | 381 DISALLOW_COPY_AND_ASSIGN(XScopedCursor); |
399 }; | 382 }; |
400 | 383 |
401 } // namespace ui | 384 } // namespace ui |
402 | 385 |
403 #endif // UI_BASE_X_X11_UTIL_H_ | 386 #endif // UI_BASE_X_X11_UTIL_H_ |
OLD | NEW |