| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_GFX_X_X11_UTIL_H_ | 5 #ifndef UI_GFX_X_X11_UTIL_H_ |
| 6 #define UI_GFX_X_X11_UTIL_H_ | 6 #define UI_GFX_X_X11_UTIL_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include <memory> |
| 11 |
| 11 #include "ui/gfx/gfx_export.h" | 12 #include "ui/gfx/gfx_export.h" |
| 12 | 13 |
| 13 typedef unsigned long XAtom; | 14 typedef unsigned long XAtom; |
| 14 typedef unsigned long XID; | 15 typedef unsigned long XID; |
| 15 typedef struct _XImage XImage; | 16 typedef struct _XImage XImage; |
| 16 typedef struct _XGC *GC; | 17 typedef struct _XGC *GC; |
| 17 typedef struct _XDisplay XDisplay; | 18 typedef struct _XDisplay XDisplay; |
| 18 typedef struct __GLXFBConfigRec *GLXFBConfig; | 19 typedef struct __GLXFBConfigRec *GLXFBConfig; |
| 19 typedef XID GLXWindow; | 20 typedef XID GLXWindow; |
| 20 typedef XID GLXDrawable; | 21 typedef XID GLXDrawable; |
| 21 | 22 |
| 22 extern "C" { | 23 extern "C" { |
| 23 int XFree(void*); | 24 int XFree(void*); |
| 24 } | 25 } |
| 25 | 26 |
| 26 namespace gfx { | 27 namespace gfx { |
| 27 | 28 |
| 28 template <class T, class R, R (*F)(T*)> | 29 template <class T, class R, R (*F)(T*)> |
| 29 struct XObjectDeleter { | 30 struct XObjectDeleter { |
| 30 inline void operator()(void* ptr) const { F(static_cast<T*>(ptr)); } | 31 inline void operator()(void* ptr) const { F(static_cast<T*>(ptr)); } |
| 31 }; | 32 }; |
| 32 | 33 |
| 33 template <class T, class D = XObjectDeleter<void, int, XFree>> | 34 template <class T, class D = XObjectDeleter<void, int, XFree>> |
| 34 using XScopedPtr = scoped_ptr<T, D>; | 35 using XScopedPtr = std::unique_ptr<T, D>; |
| 35 | 36 |
| 36 // TODO(oshima|evan): This assume there is one display and doesn't work | 37 // TODO(oshima|evan): This assume there is one display and doesn't work |
| 37 // undef multiple displays/monitor environment. Remove this and change the | 38 // undef multiple displays/monitor environment. Remove this and change the |
| 38 // chrome codebase to get the display from window. | 39 // chrome codebase to get the display from window. |
| 39 GFX_EXPORT XDisplay* GetXDisplay(); | 40 GFX_EXPORT XDisplay* GetXDisplay(); |
| 40 | 41 |
| 41 // This opens a new X11 XDisplay*, taking command line arguments into account. | 42 // This opens a new X11 XDisplay*, taking command line arguments into account. |
| 42 GFX_EXPORT XDisplay* OpenNewXDisplay(); | 43 GFX_EXPORT XDisplay* OpenNewXDisplay(); |
| 43 | 44 |
| 44 // Return the number of bits-per-pixel for a pixmap of the given depth | 45 // Return the number of bits-per-pixel for a pixmap of the given depth |
| (...skipping 28 matching lines...) Expand all Loading... |
| 73 int src_y, | 74 int src_y, |
| 74 int dst_x, | 75 int dst_x, |
| 75 int dst_y, | 76 int dst_y, |
| 76 int copy_width, | 77 int copy_width, |
| 77 int copy_height); | 78 int copy_height); |
| 78 | 79 |
| 79 } // namespace gfx | 80 } // namespace gfx |
| 80 | 81 |
| 81 #endif // UI_GFX_X_X11_UTIL_H_ | 82 #endif // UI_GFX_X_X11_UTIL_H_ |
| 82 | 83 |
| OLD | NEW |