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

Side by Side Diff: base/gfx/native_widget_types.h

Issue 118469: compile on openbsd: mostly ifdefs and missing includes,... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 6 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
OLDNEW
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008 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 BASE_GFX_NATIVE_WIDGET_TYPES_H_ 5 #ifndef BASE_GFX_NATIVE_WIDGET_TYPES_H_
6 #define BASE_GFX_NATIVE_WIDGET_TYPES_H_ 6 #define BASE_GFX_NATIVE_WIDGET_TYPES_H_
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 10
(...skipping 28 matching lines...) Expand all
39 struct CGContext; 39 struct CGContext;
40 #ifdef __OBJC__ 40 #ifdef __OBJC__
41 @class NSView; 41 @class NSView;
42 @class NSWindow; 42 @class NSWindow;
43 @class NSTextField; 43 @class NSTextField;
44 #else 44 #else
45 class NSView; 45 class NSView;
46 class NSWindow; 46 class NSWindow;
47 class NSTextField; 47 class NSTextField;
48 #endif // __OBJC__ 48 #endif // __OBJC__
49 #elif defined(OS_LINUX) 49 #elif defined(OS_LINUX) || defined(OS_OPENBSD)
50 typedef struct _GdkCursor GdkCursor; 50 typedef struct _GdkCursor GdkCursor;
51 typedef struct _GtkWidget GtkWidget; 51 typedef struct _GtkWidget GtkWidget;
52 typedef struct _GtkWindow GtkWindow; 52 typedef struct _GtkWindow GtkWindow;
53 typedef struct _cairo_surface cairo_surface_t; 53 typedef struct _cairo_surface cairo_surface_t;
54 #endif 54 #endif
55 55
56 namespace gfx { 56 namespace gfx {
57 57
58 #if defined(OS_WIN) 58 #if defined(OS_WIN)
59 typedef HWND NativeView; 59 typedef HWND NativeView;
60 typedef HWND NativeWindow; 60 typedef HWND NativeWindow;
61 typedef HWND NativeEditView; 61 typedef HWND NativeEditView;
62 typedef HDC NativeDrawingContext; 62 typedef HDC NativeDrawingContext;
63 typedef HCURSOR NativeCursor; 63 typedef HCURSOR NativeCursor;
64 typedef HMENU NativeMenu; 64 typedef HMENU NativeMenu;
65 #elif defined(OS_MACOSX) 65 #elif defined(OS_MACOSX)
66 typedef NSView* NativeView; 66 typedef NSView* NativeView;
67 typedef NSWindow* NativeWindow; 67 typedef NSWindow* NativeWindow;
68 typedef NSTextField* NativeEditView; 68 typedef NSTextField* NativeEditView;
69 typedef CGContext* NativeDrawingContext; 69 typedef CGContext* NativeDrawingContext;
70 typedef void* NativeCursor; 70 typedef void* NativeCursor;
71 typedef void* NativeMenu; 71 typedef void* NativeMenu;
72 #elif defined(OS_LINUX) 72 #elif defined(OS_LINUX) || defined(OS_OPENBSD)
73 typedef GtkWidget* NativeView; 73 typedef GtkWidget* NativeView;
74 typedef GtkWindow* NativeWindow; 74 typedef GtkWindow* NativeWindow;
75 typedef GtkWidget* NativeEditView; 75 typedef GtkWidget* NativeEditView;
76 typedef cairo_surface_t* NativeDrawingContext; 76 typedef cairo_surface_t* NativeDrawingContext;
77 typedef GdkCursor* NativeCursor; 77 typedef GdkCursor* NativeCursor;
78 typedef GtkWidget* NativeMenu; 78 typedef GtkWidget* NativeMenu;
79 #endif 79 #endif
80 80
81 // Note: for test_shell we're packing a pointer into the NativeViewId. So, if 81 // Note: for test_shell we're packing a pointer into the NativeViewId. So, if
82 // you make it a type which is smaller than a pointer, you have to fix 82 // you make it a type which is smaller than a pointer, you have to fix
83 // test_shell. 83 // test_shell.
84 // 84 //
85 // See comment at the top of the file for usage. 85 // See comment at the top of the file for usage.
86 typedef intptr_t NativeViewId; 86 typedef intptr_t NativeViewId;
87 87
88 // Convert a NativeViewId to a NativeView. 88 // Convert a NativeViewId to a NativeView.
89 // On Windows, these are both HWNDS so it's just a cast. 89 // On Windows, these are both HWNDS so it's just a cast.
90 // On Mac, for now, we pass the NSView pointer into the renderer 90 // On Mac, for now, we pass the NSView pointer into the renderer
91 // On Linux we use an opaque id 91 // On Linux we use an opaque id
92 #if defined(OS_WIN) || defined(OS_MACOSX) 92 #if defined(OS_WIN) || defined(OS_MACOSX)
93 static inline NativeView NativeViewFromId(NativeViewId id) { 93 static inline NativeView NativeViewFromId(NativeViewId id) {
94 return reinterpret_cast<NativeView>(id); 94 return reinterpret_cast<NativeView>(id);
95 } 95 }
96 #elif defined(OS_LINUX) 96 #elif defined(OS_LINUX) || defined(OS_OPENBSD)
97 // A NativeView on Linux is a GtkWidget*. However, we can't go directly from an 97 // A NativeView on Linux is a GtkWidget*. However, we can't go directly from an
98 // X window ID to a GtkWidget. Thus, functions which handle NativeViewIds from 98 // X window ID to a GtkWidget. Thus, functions which handle NativeViewIds from
99 // the renderer have to use Xlib. This is fine since these functions are 99 // the renderer have to use Xlib. This is fine since these functions are
100 // generally performed on the BACKGROUND_X thread which can't use GTK anyway. 100 // generally performed on the BACKGROUND_X thread which can't use GTK anyway.
101 101
102 #define NativeViewFromId(x) NATIVE_VIEW_FROM_ID_NOT_AVAILIBLE_ON_LINUX 102 #define NativeViewFromId(x) NATIVE_VIEW_FROM_ID_NOT_AVAILIBLE_ON_LINUX
103 103
104 #endif // defined(OS_LINUX) 104 #endif // defined(OS_LINUX) || defined(OS_OPENBSD)
105 105
106 // Convert a NativeView to a NativeViewId. See the comments above 106 // Convert a NativeView to a NativeViewId. See the comments above
107 // NativeViewFromId. 107 // NativeViewFromId.
108 #if defined(OS_WIN) || defined(OS_MACOSX) 108 #if defined(OS_WIN) || defined(OS_MACOSX)
109 static inline NativeViewId IdFromNativeView(NativeView view) { 109 static inline NativeViewId IdFromNativeView(NativeView view) {
110 return reinterpret_cast<NativeViewId>(view); 110 return reinterpret_cast<NativeViewId>(view);
111 } 111 }
112 #elif defined(OS_LINUX) 112 #elif defined(OS_LINUX) || defined(OS_OPENBSD)
113 // Not inlined because it involves pulling too many headers. 113 // Not inlined because it involves pulling too many headers.
114 NativeViewId IdFromNativeView(NativeView view); 114 NativeViewId IdFromNativeView(NativeView view);
115 #endif // defined(OS_LINUX) 115 #endif // defined(OS_LINUX) || defined(OS_OPENBSD)
116 116
117 } // namespace gfx 117 } // namespace gfx
118 118
119 #endif // BASE_GFX_NATIVE_WIDGET_TYPES_H_ 119 #endif // BASE_GFX_NATIVE_WIDGET_TYPES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698