| 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 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 style |= WS_CHILD; | 713 style |= WS_CHILD; |
| 714 ::SetWindowLongPtr(content_hwnd, GWL_STYLE, style); | 714 ::SetWindowLongPtr(content_hwnd, GWL_STYLE, style); |
| 715 ::SetParent(content_hwnd, containing_hwnd); | 715 ::SetParent(content_hwnd, containing_hwnd); |
| 716 BOOL res = ::SetWindowPos(content_hwnd, containing_hwnd, | 716 BOOL res = ::SetWindowPos(content_hwnd, containing_hwnd, |
| 717 0, 0, width, height, | 717 0, 0, width, height, |
| 718 SWP_NOZORDER | SWP_ASYNCWINDOWPOS); | 718 SWP_NOZORDER | SWP_ASYNCWINDOWPOS); |
| 719 DCHECK(res); | 719 DCHECK(res); |
| 720 ::ShowWindow(content_hwnd, SW_SHOW); | 720 ::ShowWindow(content_hwnd, SW_SHOW); |
| 721 } | 721 } |
| 722 | 722 |
| 723 // Get the screen rect of the monitor the window is on, in virtual screen |
| 724 // coordinates. |
| 725 // Return true on success, false on failure. |
| 726 bool GetScreenRect(HWND hwnd, |
| 727 RECT* rect) { |
| 728 HMONITOR monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONULL); |
| 729 if (monitor == NULL) |
| 730 return false; |
| 731 |
| 732 MONITORINFO monitor_info; |
| 733 monitor_info.cbSize = sizeof(monitor_info); |
| 734 if (GetMonitorInfo(monitor, &monitor_info)) { |
| 735 *rect = monitor_info.rcMonitor; |
| 736 return true; |
| 737 } else { |
| 738 return false; |
| 739 } |
| 740 } |
| 741 |
| 723 } // namespace anonymous | 742 } // namespace anonymous |
| 724 | 743 |
| 725 #if defined(O3D_INTERNAL_PLUGIN) | 744 #if defined(O3D_INTERNAL_PLUGIN) |
| 726 namespace o3d { | 745 namespace o3d { |
| 727 #else | 746 #else |
| 728 extern "C" { | 747 extern "C" { |
| 729 #endif | 748 #endif |
| 730 | 749 |
| 731 NPError OSCALL NP_Initialize(NPNetscapeFuncs *browserFuncs) { | 750 NPError OSCALL NP_Initialize(NPNetscapeFuncs *browserFuncs) { |
| 732 HANDLE_CRASHES; | 751 HANDLE_CRASHES; |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 951 ::ShowWindow(GetContentHWnd(), SW_HIDE); | 970 ::ShowWindow(GetContentHWnd(), SW_HIDE); |
| 952 ::SetParent(GetContentHWnd(), NULL); | 971 ::SetParent(GetContentHWnd(), NULL); |
| 953 // Remove WS_CHILD from the window style | 972 // Remove WS_CHILD from the window style |
| 954 LONG_PTR style = ::GetWindowLongPtr(GetContentHWnd(), GWL_STYLE); | 973 LONG_PTR style = ::GetWindowLongPtr(GetContentHWnd(), GWL_STYLE); |
| 955 style &= ~WS_CHILD; | 974 style &= ~WS_CHILD; |
| 956 ::SetWindowLongPtr(GetContentHWnd(), GWL_STYLE, style); | 975 ::SetWindowLongPtr(GetContentHWnd(), GWL_STYLE, style); |
| 957 ::ShowWindow(GetContentHWnd(), SW_SHOW); | 976 ::ShowWindow(GetContentHWnd(), SW_SHOW); |
| 958 // We need to resize the full-screen window to the desired size of | 977 // We need to resize the full-screen window to the desired size of |
| 959 // the display mode early, before calling | 978 // the display mode early, before calling |
| 960 // Renderer::GoFullscreen(). | 979 // Renderer::GoFullscreen(). |
| 961 o3d::DisplayMode mode; | 980 RECT screen_rect; |
| 962 if (GetDisplayMode(fullscreen_region_mode_id_, &mode)) { | 981 if (GetScreenRect(GetPluginHWnd(), &screen_rect)) { |
| 963 ::SetWindowPos(GetContentHWnd(), HWND_TOP, 0, 0, | 982 ::SetWindowPos(GetContentHWnd(), HWND_TOP, |
| 964 mode.width(), mode.height(), | 983 screen_rect.left, screen_rect.top, |
| 984 screen_rect.right - screen_rect.left + 1, |
| 985 screen_rect.bottom - screen_rect.top + 1, |
| 965 SWP_NOZORDER | SWP_NOREPOSITION | SWP_ASYNCWINDOWPOS); | 986 SWP_NOZORDER | SWP_NOREPOSITION | SWP_ASYNCWINDOWPOS); |
| 966 DisplayWindowWindows display; | 987 DisplayWindowWindows display; |
| 967 display.set_hwnd(GetContentHWnd()); | 988 display.set_hwnd(GetContentHWnd()); |
| 968 if (renderer_->GoFullscreen(display, | 989 if (renderer_->GoFullscreen(display, |
| 969 fullscreen_region_mode_id_)) { | 990 fullscreen_region_mode_id_)) { |
| 970 fullscreen_ = true; | 991 fullscreen_ = true; |
| 971 client()->SendResizeEvent(renderer_->width(), renderer_->height(), | 992 client()->SendResizeEvent(renderer_->width(), renderer_->height(), |
| 972 true); | 993 true); |
| 973 success = true; | 994 success = true; |
| 974 } | 995 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 994 if (!renderer_->CancelFullscreen(display, prev_width_, prev_height_)) { | 1015 if (!renderer_->CancelFullscreen(display, prev_width_, prev_height_)) { |
| 995 LOG(FATAL) << "Failed to get the renderer out of fullscreen mode!"; | 1016 LOG(FATAL) << "Failed to get the renderer out of fullscreen mode!"; |
| 996 } | 1017 } |
| 997 ReplaceContentWindow(GetContentHWnd(), GetPluginHWnd(), | 1018 ReplaceContentWindow(GetContentHWnd(), GetPluginHWnd(), |
| 998 prev_width_, prev_height_); | 1019 prev_width_, prev_height_); |
| 999 client()->SendResizeEvent(prev_width_, prev_height_, false); | 1020 client()->SendResizeEvent(prev_width_, prev_height_, false); |
| 1000 } | 1021 } |
| 1001 } | 1022 } |
| 1002 } // namespace _o3d | 1023 } // namespace _o3d |
| 1003 } // namespace glue | 1024 } // namespace glue |
| OLD | NEW |