From 8c3d9c16f9977cee643a30b6572d6b8fa7cde36b Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 18 Nov 2009 19:50:17 +0000 Subject: [PATCH] explicit window_handle type, for mac --- direct/src/plugin/p3dInstance.cxx | 8 ++++++-- direct/src/plugin/p3dOsxSplashWindow.cxx | 14 +++++++++++--- direct/src/plugin_npapi/ppInstance.cxx | 6 ++++-- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/direct/src/plugin/p3dInstance.cxx b/direct/src/plugin/p3dInstance.cxx index 5d82086775..aca3c631b0 100644 --- a/direct/src/plugin/p3dInstance.cxx +++ b/direct/src/plugin/p3dInstance.cxx @@ -814,7 +814,9 @@ handle_event(P3D_event_data event) { // Need to ensure we have the correct port set, in order to // convert the mouse coordinates successfully via // GlobalToLocal(). - GrafPtr out_port = _wparams.get_parent_window()._port; + const P3D_window_handle &handle = _wparams.get_parent_window(); + assert(handle._window_handle_type == P3D_WHT_osx_port); + GrafPtr out_port = handle._handle._osx_port._port; GrafPtr port_save = NULL; Boolean port_changed = QDSwapPort(out_port, &port_save); @@ -2867,7 +2869,9 @@ paint_window() { return; } - GrafPtr out_port = _wparams.get_parent_window()._port; + const P3D_window_handle &handle = _wparams.get_parent_window(); + assert(handle._window_handle_type == P3D_WHT_osx_port); + GrafPtr out_port = handle._handle._osx_port._port; GrafPtr port_save = NULL; Boolean port_changed = QDSwapPort(out_port, &port_save); diff --git a/direct/src/plugin/p3dOsxSplashWindow.cxx b/direct/src/plugin/p3dOsxSplashWindow.cxx index 0a4ebb2b9e..3275da26fc 100644 --- a/direct/src/plugin/p3dOsxSplashWindow.cxx +++ b/direct/src/plugin/p3dOsxSplashWindow.cxx @@ -207,7 +207,9 @@ handle_event(P3D_event_data event) { // Need to ensure we have the correct port set, in order to // convert the mouse coordinates successfully via // GlobalToLocal(). - GrafPtr out_port = _wparams.get_parent_window()._port; + const P3D_window_handle &handle = _wparams.get_parent_window(); + assert(handle._window_handle_type == P3D_WHT_osx_port); + GrafPtr out_port = handle._handle._osx_port._port; GrafPtr port_save = NULL; Boolean port_changed = QDSwapPort(out_port, &port_save); @@ -281,7 +283,9 @@ paint_window() { GetPort(&out_port); } else { - out_port = _wparams.get_parent_window()._port; + const P3D_window_handle &handle = _wparams.get_parent_window(); + assert(handle._window_handle_type == P3D_WHT_osx_port); + out_port = handle._handle._osx_port._port; } CGContextRef context; @@ -639,9 +643,13 @@ event_callback(EventHandlerCallRef my_handler, EventRef event) { GetEventParameter(event, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(Point), NULL, (void *)&point); - GrafPtr port = _wparams.get_parent_window()._port; + GrafPtr port; if (_toplevel_window != NULL) { port = GetWindowPort(_toplevel_window); + } else { + const P3D_window_handle &handle = _wparams.get_parent_window(); + assert(handle._window_handle_type == P3D_WHT_osx_port); + port = handle._handle._osx_port._port; } GrafPtr port_save = NULL; Boolean port_changed = QDSwapPort(port, &port_save); diff --git a/direct/src/plugin_npapi/ppInstance.cxx b/direct/src/plugin_npapi/ppInstance.cxx index 43dd2d4f94..081d7794cd 100644 --- a/direct/src/plugin_npapi/ppInstance.cxx +++ b/direct/src/plugin_npapi/ppInstance.cxx @@ -1308,7 +1308,8 @@ send_window() { #elif defined(__APPLE__) NP_Port *port = (NP_Port *)_window.window; - parent_window._port = port->port; + parent_window._window_handle_type = P3D_WHT_osx_port; + parent_window._handle._osx_port._port = port->port; /* NP_CGContext *context = (NP_CGContext *)_window.window; parent_window._context = context->context; @@ -1337,7 +1338,8 @@ send_window() { #elif defined(__APPLE__) NP_Port *port = (NP_Port *)_window.window; - parent_window._port = port->port; + parent_window._window_handle_type = P3D_WHT_osx_port; + parent_window._handle._osx_port._port = port->port; /* NP_CGContext *context = (NP_CGContext *)_window.window; parent_window._context = context->context;