| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2009, Google Inc. | 2 * Copyright 2009, Google Inc. |
| 3 * All rights reserved. | 3 * All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 #include "core/cross/client_info.h" | 63 #include "core/cross/client_info.h" |
| 64 #include "core/cross/cursor.h" | 64 #include "core/cross/cursor.h" |
| 65 #include "core/cross/features.h" | 65 #include "core/cross/features.h" |
| 66 #include "core/cross/object_manager.h" | 66 #include "core/cross/object_manager.h" |
| 67 #include "core/cross/error.h" | 67 #include "core/cross/error.h" |
| 68 #include "core/cross/profiler.h" | 68 #include "core/cross/profiler.h" |
| 69 #include "core/cross/render_surface.h" | 69 #include "core/cross/render_surface.h" |
| 70 #include "core/cross/texture.h" | 70 #include "core/cross/texture.h" |
| 71 #include "plugin/cross/main_thread_task_poster.h" | 71 #include "plugin/cross/main_thread_task_poster.h" |
| 72 #include "plugin/cross/np_v8_bridge.h" | 72 #include "plugin/cross/np_v8_bridge.h" |
| 73 #ifdef OS_MACOSX |
| 74 #include "plugin/mac/fullscreen_window_mac.h" |
| 75 #endif |
| 73 #include "client_glue.h" | 76 #include "client_glue.h" |
| 74 #include "third_party/nixysa/static_glue/npapi/common.h" | 77 #include "third_party/nixysa/static_glue/npapi/common.h" |
| 75 | 78 |
| 76 namespace o3d { | 79 namespace o3d { |
| 77 class Client; | 80 class Client; |
| 78 class Renderer; | 81 class Renderer; |
| 79 } | 82 } |
| 80 | 83 |
| 81 // Hashes the NPClass and ObjectBase types so they can be used in a hash_map. | 84 // Hashes the NPClass and ObjectBase types so they can be used in a hash_map. |
| 82 #if defined(COMPILER_GCC) | 85 #if defined(COMPILER_GCC) |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 using o3d::Features; | 130 using o3d::Features; |
| 128 using o3d::EvaluationCounter; | 131 using o3d::EvaluationCounter; |
| 129 using o3d::MainThreadTaskPoster; | 132 using o3d::MainThreadTaskPoster; |
| 130 using o3d::ObjectManager; | 133 using o3d::ObjectManager; |
| 131 using o3d::Profiler; | 134 using o3d::Profiler; |
| 132 using o3d::Renderer; | 135 using o3d::Renderer; |
| 133 using o3d::RenderSurface; | 136 using o3d::RenderSurface; |
| 134 using o3d::RenderDepthStencilSurface; | 137 using o3d::RenderDepthStencilSurface; |
| 135 using o3d::ServiceLocator; | 138 using o3d::ServiceLocator; |
| 136 using o3d::Texture2D; | 139 using o3d::Texture2D; |
| 140 #ifdef OS_MACOSX |
| 141 using o3d::FullscreenWindowMac; |
| 142 #endif |
| 137 | 143 |
| 138 class NPAPIObject: public NPObject { | 144 class NPAPIObject: public NPObject { |
| 139 NPP npp_; | 145 NPP npp_; |
| 140 Id id_; | 146 Id id_; |
| 141 bool mapped_; | 147 bool mapped_; |
| 142 public: | 148 public: |
| 143 explicit NPAPIObject(NPP npp): npp_(npp), id_(0), mapped_(false) {} | 149 explicit NPAPIObject(NPP npp): npp_(npp), id_(0), mapped_(false) {} |
| 144 void Initialize(const ObjectBase *object) { id_ = object->id(); } | 150 void Initialize(const ObjectBase *object) { id_ = object->id(); } |
| 145 NPP npp() const { return npp_; } | 151 NPP npp() const { return npp_; } |
| 146 Id id() const { return id_; } | 152 Id id() const { return id_; } |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 bool got_dblclick() const { return got_dblclick_; } | 232 bool got_dblclick() const { return got_dblclick_; } |
| 227 void set_got_dblclick(bool got_dblclick) { got_dblclick_ = got_dblclick; } | 233 void set_got_dblclick(bool got_dblclick) { got_dblclick_ = got_dblclick; } |
| 228 #elif defined(OS_LINUX) | 234 #elif defined(OS_LINUX) |
| 229 void SetGtkEventSource(GtkWidget *widget); | 235 void SetGtkEventSource(GtkWidget *widget); |
| 230 gboolean OnGtkConfigure(GtkWidget *widget, | 236 gboolean OnGtkConfigure(GtkWidget *widget, |
| 231 GdkEventConfigure *configure_event); | 237 GdkEventConfigure *configure_event); |
| 232 gboolean OnGtkDelete(GtkWidget *widget, | 238 gboolean OnGtkDelete(GtkWidget *widget, |
| 233 GdkEvent *configure); | 239 GdkEvent *configure); |
| 234 void SetDisplay(Display *display); | 240 void SetDisplay(Display *display); |
| 235 #elif defined(OS_MACOSX) | 241 #elif defined(OS_MACOSX) |
| 236 #ifdef O3D_PLUGIN_ENABLE_FULLSCREEN_MSG | 242 FullscreenWindowMac* GetFullscreenMacWindow() { |
| 237 void SetFullscreenOverlayMacWindow(WindowRef window) { | 243 return mac_fullscreen_window_.get(); |
| 238 mac_fullscreen_overlay_window_ = window; | |
| 239 } | 244 } |
| 240 | 245 |
| 241 WindowRef GetFullscreenOverlayMacWindow() { | 246 // Assumes ownership of the passed pointer. Passing NULL deletes the |
| 242 return mac_fullscreen_overlay_window_; | 247 // last non-NULL value set. |
| 243 } | 248 void SetFullscreenMacWindow(FullscreenWindowMac* window) { |
| 244 #endif | 249 mac_fullscreen_window_.reset(window); |
| 245 | |
| 246 void SetFullscreenMacWindow(WindowRef window) { | |
| 247 mac_fullscreen_window_ = window; | |
| 248 } | 250 } |
| 249 | 251 |
| 250 WindowRef GetFullscreenMacWindow() { | 252 WindowRef GetMacWindow() { |
| 251 return mac_fullscreen_window_; | 253 return mac_window_; |
| 252 } | 254 } |
| 253 | 255 |
| 254 bool ScrollIsInProgress() { return scroll_is_in_progress_; } | 256 bool ScrollIsInProgress() { return scroll_is_in_progress_; } |
| 255 void SetScrollIsInProgress(bool state) { scroll_is_in_progress_ = state; } | 257 void SetScrollIsInProgress(bool state) { scroll_is_in_progress_ = state; } |
| 256 bool scroll_is_in_progress_; | 258 bool scroll_is_in_progress_; |
| 257 | 259 |
| 258 bool RendererIsSoftware() {return renderer_is_software_;} | 260 bool RendererIsSoftware() {return renderer_is_software_;} |
| 259 bool SetRendererIsSoftware(bool state); | 261 bool SetRendererIsSoftware(bool state); |
| 260 bool renderer_is_software_; | 262 bool renderer_is_software_; |
| 261 | 263 |
| 264 AGLContext GetMacAGLContext() { |
| 265 return mac_agl_context_; |
| 266 } |
| 267 |
| 262 NPDrawingModel drawing_model_; | 268 NPDrawingModel drawing_model_; |
| 263 NPEventModel event_model_; | 269 NPEventModel event_model_; |
| 264 WindowRef mac_window_; // may be NULL in the Chrome case | 270 WindowRef mac_window_; // may be NULL in the Chrome case |
| 265 // these vars needed for the Safari tab switch detection hack | 271 // these vars needed for the Safari tab switch detection hack |
| 266 CFDateRef last_mac_event_time_; | 272 CFDateRef last_mac_event_time_; |
| 267 void * mac_cocoa_window_; | 273 void * mac_cocoa_window_; |
| 268 void* mac_window_selected_tab_; | 274 void* mac_window_selected_tab_; |
| 269 bool mac_surface_hidden_; | 275 bool mac_surface_hidden_; |
| 270 // end of Safari tab detection vars | 276 // end of Safari tab detection vars |
| 271 GLint last_buffer_rect_[4]; | 277 GLint last_buffer_rect_[4]; |
| 272 Point last_plugin_loc_; | 278 Point last_plugin_loc_; |
| 273 // can be a CGrafPtr, a CGContextRef or NULL depending on drawing_model | 279 // can be a CGrafPtr, a CGContextRef or NULL depending on drawing_model |
| 274 void* mac_2d_context_; | 280 void* mac_2d_context_; |
| 275 // either can be NULL depending on drawing_model | 281 // either can be NULL depending on drawing_model |
| 276 AGLContext mac_agl_context_; | 282 AGLContext mac_agl_context_; |
| 277 CGLContextObj mac_cgl_context_; | 283 CGLContextObj mac_cgl_context_; |
| 278 void *gl_layer_; | 284 void *gl_layer_; |
| 279 // If in Chrome, we actually do all of our rendering offscreen, and | 285 // If in Chrome, we actually do all of our rendering offscreen, and |
| 280 // bootstrap off a 1x1 pbuffer | 286 // bootstrap off a 1x1 pbuffer |
| 281 CGLPBufferObj mac_cgl_pbuffer_; | 287 CGLPBufferObj mac_cgl_pbuffer_; |
| 282 | 288 |
| 283 // Fullscreen related stuff. | 289 // Fullscreen related stuff. |
| 284 | 290 // NULL if not in fullscreen mode. |
| 285 #ifdef O3D_PLUGIN_ENABLE_FULLSCREEN_MSG | 291 scoped_ptr<FullscreenWindowMac> mac_fullscreen_window_; |
| 286 // FullscreenIdle gets repeatedly called while we are in fullscreen mode. | |
| 287 // Currently its only task is to hide the fullscreen message at the right | |
| 288 // time. | |
| 289 void FullscreenIdle(); | |
| 290 double time_to_hide_overlay_; | |
| 291 #endif | |
| 292 WindowRef mac_fullscreen_window_; // NULL if not in fullscreen modee | |
| 293 #ifdef O3D_PLUGIN_ENABLE_FULLSCREEN_MSG | |
| 294 WindowRef mac_fullscreen_overlay_window_; // NULL if not in fullscreen mode | |
| 295 #endif | |
| 296 Ptr mac_fullscreen_state_; | |
| 297 | 292 |
| 298 #endif // OS_MACOSX | 293 #endif // OS_MACOSX |
| 299 #ifdef OS_LINUX | 294 #ifdef OS_LINUX |
| 300 Window window_; | 295 Window window_; |
| 301 Window fullscreen_window_; | 296 Window fullscreen_window_; |
| 302 | 297 |
| 303 // Xt mode | 298 // Xt mode |
| 304 Widget xt_widget_; | 299 Widget xt_widget_; |
| 305 XtAppContext xt_app_context_; | 300 XtAppContext xt_app_context_; |
| 306 XtIntervalId xt_interval_; | 301 XtIntervalId xt_interval_; |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 | 530 |
| 536 bool AllocateOffscreenRenderSurfaces(int width, int height); | 531 bool AllocateOffscreenRenderSurfaces(int width, int height); |
| 537 void DeallocateOffscreenRenderSurfaces(); | 532 void DeallocateOffscreenRenderSurfaces(); |
| 538 }; | 533 }; |
| 539 | 534 |
| 540 } // namespace o3d | 535 } // namespace o3d |
| 541 } // namespace glue | 536 } // namespace glue |
| 542 | 537 |
| 543 | 538 |
| 544 #endif // O3D_PLUGIN_CROSS_O3D_GLUE_H_ | 539 #endif // O3D_PLUGIN_CROSS_O3D_GLUE_H_ |
| OLD | NEW |