Enlightenment CVS committal Author : doursse Project : e17 Module : apps/expedite
Dir : e17/apps/expedite/src/bin Modified Files: engine_direct3d.cpp engine_gl_glew.c engine_software_16_ddraw.cpp engine_software_ddraw.cpp Log Message: make the windows non resizable on Windows, fix error management for the glew and software_16_ddraw tests =================================================================== RCS file: /cvs/e/e17/apps/expedite/src/bin/engine_direct3d.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- engine_direct3d.cpp 26 Jun 2008 08:32:00 -0000 1.3 +++ engine_direct3d.cpp 10 Jul 2008 07:01:49 -0000 1.4 @@ -221,6 +221,12 @@ if (!window) goto unregister_class; + /* make the window non resizable */ + style = GetWindowLong(window, GWL_STYLE); + style &= ~WS_THICKFRAME; + if (!SetWindowLong(window, GWL_STYLE, style)) + goto unregister_class; + dc = GetDC(NULL); if (!dc) goto destroy_window; =================================================================== RCS file: /cvs/e/e17/apps/expedite/src/bin/engine_gl_glew.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -3 -r1.3 -r1.4 --- engine_gl_glew.c 26 Jun 2008 08:32:00 -0000 1.3 +++ engine_gl_glew.c 10 Jul 2008 07:01:49 -0000 1.4 @@ -188,7 +188,8 @@ } if (!ok) return 0; - hinstance = GetModuleHandle(0); + hinstance = GetModuleHandle(NULL); + if (!instance) return 0; wc.style = 0; wc.lpfnWndProc = MainWndProc; @@ -201,7 +202,8 @@ wc.lpszMenuName = NULL; wc.lpszClassName = "Evas_Gl_Glew_Test"; - if(!RegisterClass(&wc)) return EXIT_FAILURE; + if(!RegisterClass(&wc)) + goto free_library; rect.left = 0; rect.top = 0; @@ -216,24 +218,41 @@ CW_USEDEFAULT, CW_USEDEFAULT, rect.right - rect.left, rect.bottom - rect.top, NULL, NULL, hinstance, NULL); - if (!window) return 0; + if (!window) + goto unregister_class; - ShowWindow(window, SW_SHOWDEFAULT); - UpdateWindow(window); + /* make the window non resizable */ + style = GetWindowLong(window, GWL_STYLE); + style &= ~WS_THICKFRAME; + if (!SetWindowLong(window, GWL_STYLE, style)) + goto unregister_class; evas_output_method_set(evas, evas_render_method_lookup("gl_glew")); einfo = (Evas_Engine_Info_GL_Glew *)evas_engine_info_get(evas); if (!einfo) { printf("Evas does not support the GL Glew Engine\n"); - return 0; + goto destroy_window; } einfo->info.window = window; einfo->info.depth = depth; evas_engine_info_set(evas, (Evas_Engine_Info *) einfo); + /* the second parameter is ignored, as it's the first call of ShowWindow */ + ShowWindow(window, SW_SHOWDEFAULT); + UpdateWindow(window); + return 1; + + destroy_window: + DestroyWindow(window); + unregister_class: + UnregisterClass("Evas_Gl_Glew_Test", instance); + free_library: + FreeLibrary(instance); + + return 0; } void =================================================================== RCS file: /cvs/e/e17/apps/expedite/src/bin/engine_software_16_ddraw.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -3 -r1.2 -r1.3 --- engine_software_16_ddraw.cpp 25 Jun 2008 06:45:10 -0000 1.2 +++ engine_software_16_ddraw.cpp 10 Jul 2008 07:01:49 -0000 1.3 @@ -262,7 +262,7 @@ { WNDCLASS wc; RECT rect; - HINSTANCE hinstance; + HINSTANCE instance; LPDIRECTDRAW object; LPDIRECTDRAWSURFACE surface_primary; LPDIRECTDRAWSURFACE surface_back; @@ -284,20 +284,22 @@ } if (!ok) return 0; - hinstance = GetModuleHandle(0); + instance = GetModuleHandle(NULL); + if (!instance) return 0; wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = MainWndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; - wc.hInstance = hinstance; + wc.hInstance = instance; wc.hIcon = LoadIcon (NULL, IDI_APPLICATION); wc.hCursor = LoadCursor (NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)(1 + COLOR_BTNFACE); wc.lpszMenuName = NULL; wc.lpszClassName = "Evas_Software_16_DDraw_Test"; - if(!RegisterClass(&wc)) return EXIT_FAILURE; + if(!RegisterClass(&wc)) + goto free_library; style = WS_OVERLAPPEDWINDOW | WS_SIZEBOX; exstyle = 0; @@ -314,8 +316,15 @@ style, CW_USEDEFAULT, CW_USEDEFAULT, rect.right - rect.left, rect.bottom - rect.top, - NULL, NULL, hinstance, NULL); - if (!window) return EXIT_FAILURE; + NULL, NULL, instance, NULL); + if (!window) + goto unregister_class; + + /* make the window non resizable */ + style = GetWindowLong(window, GWL_STYLE); + style &= ~WS_THICKFRAME; + if (!SetWindowLong(window, GWL_STYLE, style)) + goto unregister_class; if (!_directdraw_init(window, win_w, win_h, &object, @@ -323,14 +332,15 @@ &surface_back, &surface_source, &depth)) - return EXIT_FAILURE; + goto destroy_window; evas_output_method_set(evas, evas_render_method_lookup("software_16_ddraw")); einfo = (Evas_Engine_Info_Software_16_DDraw *)evas_engine_info_get(evas); if (!einfo) { - fprintf(stderr, "Evas does not support the 16 bits Software DirectDraw Engine\n"); - return EXIT_FAILURE; + fprintf(stderr, "Evas does not support the 16 bits Software DirectDraw Engine\n"); + /* should shutdown ddraw */ + goto destroy_window; } einfo->info.window = window; @@ -347,6 +357,15 @@ UpdateWindow(window); return 1; + + destroy_window: + DestroyWindow(window); + unregister_class: + UnregisterClass("Evas_Software_16_DDraw_Test", instance); + free_library: + FreeLibrary(instance); + + return 0; } void =================================================================== RCS file: /cvs/e/e17/apps/expedite/src/bin/engine_software_ddraw.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -3 -r1.4 -r1.5 --- engine_software_ddraw.cpp 26 Jun 2008 08:32:00 -0000 1.4 +++ engine_software_ddraw.cpp 10 Jul 2008 07:01:49 -0000 1.5 @@ -225,6 +225,12 @@ if (!window) goto unregister_class; + /* make the window non resizable */ + style = GetWindowLong(window, GWL_STYLE); + style &= ~WS_THICKFRAME; + if (!SetWindowLong(window, GWL_STYLE, style)) + goto unregister_class; + dc = GetDC(NULL); if (!dc) goto destroy_window; ------------------------------------------------------------------------- Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! Studies have shown that voting for your favorite open source project, along with a healthy diet, reduces your potential for chronic lameness and boredom. Vote Now at http://www.sourceforge.net/community/cca08 _______________________________________________ enlightenment-cvs mailing list enlightenment-cvs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs