1 /* 2 * Copyright (C) 2011 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 #include "NativeSubWindow.h" 17 #include <stdio.h> 18 19 LRESULT CALLBACK myWndProc(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam) 20 { 21 return DefWindowProc(hwnd, uMsg, wParam, lParam); 22 } 23 24 EGLNativeWindowType createSubWindow(FBNativeWindowType p_window, 25 EGLNativeDisplayType* display_out, 26 int x, int y,int width, int height){ 27 WNDCLASS wc; 28 wc.style = CS_OWNDC |CS_HREDRAW |CS_VREDRAW; // redraw if size changes 29 wc.lpfnWndProc = myWndProc; // points to window procedure 30 wc.cbClsExtra = 0; // no extra class memory 31 wc.cbWndExtra = sizeof(void*); // save extra window memory, to store VasWindow instance 32 wc.hInstance = NULL; // handle to instance 33 wc.hIcon = NULL; // predefined app. icon 34 wc.hCursor = NULL; 35 wc.hbrBackground = NULL; // no background brush 36 wc.lpszMenuName = NULL; // name of menu resource 37 wc.lpszClassName = "subWin"; // name of window class 38 39 RegisterClass(&wc); 40 printf("creating window %d %d %d %d\n",x,y,width,height); 41 EGLNativeWindowType ret = CreateWindowEx( 42 WS_EX_NOPARENTNOTIFY, // do not bother our parent window 43 "subWin", 44 "sub", 45 WS_CHILD|WS_DISABLED, 46 x,y,width,height, 47 p_window, 48 NULL, 49 NULL, 50 NULL); 51 ShowWindow(ret,SW_SHOW); 52 return ret; 53 } 54 55 void destroySubWindow(EGLNativeDisplayType dis,EGLNativeWindowType win){ 56 PostMessage(win, WM_CLOSE, 0, 0); 57 } 58