make the windows non resizable on Windows, fix error management for the glew and software_16_ddraw tests

SVN revision: 35050
This commit is contained in:
doursse 2008-07-10 07:01:49 +00:00 committed by doursse
parent ea8c947317
commit 42cf8cbb25
4 changed files with 65 additions and 15 deletions

View File

@ -221,6 +221,12 @@ engine_direct3d_args(int argc, char **argv)
if (!window) if (!window)
goto unregister_class; 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); dc = GetDC(NULL);
if (!dc) if (!dc)
goto destroy_window; goto destroy_window;

View File

@ -188,7 +188,8 @@ engine_gl_glew_args(int argc, char **argv)
} }
if (!ok) return 0; if (!ok) return 0;
hinstance = GetModuleHandle(0); hinstance = GetModuleHandle(NULL);
if (!instance) return 0;
wc.style = 0; wc.style = 0;
wc.lpfnWndProc = MainWndProc; wc.lpfnWndProc = MainWndProc;
@ -201,7 +202,8 @@ engine_gl_glew_args(int argc, char **argv)
wc.lpszMenuName = NULL; wc.lpszMenuName = NULL;
wc.lpszClassName = "Evas_Gl_Glew_Test"; wc.lpszClassName = "Evas_Gl_Glew_Test";
if(!RegisterClass(&wc)) return EXIT_FAILURE; if(!RegisterClass(&wc))
goto free_library;
rect.left = 0; rect.left = 0;
rect.top = 0; rect.top = 0;
@ -216,24 +218,41 @@ engine_gl_glew_args(int argc, char **argv)
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
rect.right - rect.left, rect.bottom - rect.top, rect.right - rect.left, rect.bottom - rect.top,
NULL, NULL, hinstance, NULL); NULL, NULL, hinstance, NULL);
if (!window) return 0; if (!window)
goto unregister_class;
ShowWindow(window, SW_SHOWDEFAULT); /* make the window non resizable */
UpdateWindow(window); 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")); evas_output_method_set(evas, evas_render_method_lookup("gl_glew"));
einfo = (Evas_Engine_Info_GL_Glew *)evas_engine_info_get(evas); einfo = (Evas_Engine_Info_GL_Glew *)evas_engine_info_get(evas);
if (!einfo) if (!einfo)
{ {
printf("Evas does not support the GL Glew Engine\n"); printf("Evas does not support the GL Glew Engine\n");
return 0; goto destroy_window;
} }
einfo->info.window = window; einfo->info.window = window;
einfo->info.depth = depth; einfo->info.depth = depth;
evas_engine_info_set(evas, (Evas_Engine_Info *) einfo); 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; return 1;
destroy_window:
DestroyWindow(window);
unregister_class:
UnregisterClass("Evas_Gl_Glew_Test", instance);
free_library:
FreeLibrary(instance);
return 0;
} }
void void

View File

@ -262,7 +262,7 @@ engine_software_16_ddraw_args(int argc, char **argv)
{ {
WNDCLASS wc; WNDCLASS wc;
RECT rect; RECT rect;
HINSTANCE hinstance; HINSTANCE instance;
LPDIRECTDRAW object; LPDIRECTDRAW object;
LPDIRECTDRAWSURFACE surface_primary; LPDIRECTDRAWSURFACE surface_primary;
LPDIRECTDRAWSURFACE surface_back; LPDIRECTDRAWSURFACE surface_back;
@ -284,20 +284,22 @@ engine_software_16_ddraw_args(int argc, char **argv)
} }
if (!ok) return 0; if (!ok) return 0;
hinstance = GetModuleHandle(0); instance = GetModuleHandle(NULL);
if (!instance) return 0;
wc.style = CS_HREDRAW | CS_VREDRAW; wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = MainWndProc; wc.lpfnWndProc = MainWndProc;
wc.cbClsExtra = 0; wc.cbClsExtra = 0;
wc.cbWndExtra = 0; wc.cbWndExtra = 0;
wc.hInstance = hinstance; wc.hInstance = instance;
wc.hIcon = LoadIcon (NULL, IDI_APPLICATION); wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wc.hCursor = LoadCursor (NULL, IDC_ARROW); wc.hCursor = LoadCursor (NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH)(1 + COLOR_BTNFACE); wc.hbrBackground = (HBRUSH)(1 + COLOR_BTNFACE);
wc.lpszMenuName = NULL; wc.lpszMenuName = NULL;
wc.lpszClassName = "Evas_Software_16_DDraw_Test"; wc.lpszClassName = "Evas_Software_16_DDraw_Test";
if(!RegisterClass(&wc)) return EXIT_FAILURE; if(!RegisterClass(&wc))
goto free_library;
style = WS_OVERLAPPEDWINDOW | WS_SIZEBOX; style = WS_OVERLAPPEDWINDOW | WS_SIZEBOX;
exstyle = 0; exstyle = 0;
@ -314,8 +316,15 @@ engine_software_16_ddraw_args(int argc, char **argv)
style, style,
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
rect.right - rect.left, rect.bottom - rect.top, rect.right - rect.left, rect.bottom - rect.top,
NULL, NULL, hinstance, NULL); NULL, NULL, instance, NULL);
if (!window) return EXIT_FAILURE; 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, if (!_directdraw_init(window, win_w, win_h,
&object, &object,
@ -323,14 +332,15 @@ engine_software_16_ddraw_args(int argc, char **argv)
&surface_back, &surface_back,
&surface_source, &surface_source,
&depth)) &depth))
return EXIT_FAILURE; goto destroy_window;
evas_output_method_set(evas, evas_render_method_lookup("software_16_ddraw")); evas_output_method_set(evas, evas_render_method_lookup("software_16_ddraw"));
einfo = (Evas_Engine_Info_Software_16_DDraw *)evas_engine_info_get(evas); einfo = (Evas_Engine_Info_Software_16_DDraw *)evas_engine_info_get(evas);
if (!einfo) if (!einfo)
{ {
fprintf(stderr, "Evas does not support the 16 bits Software DirectDraw Engine\n"); fprintf(stderr, "Evas does not support the 16 bits Software DirectDraw Engine\n");
return EXIT_FAILURE; /* should shutdown ddraw */
goto destroy_window;
} }
einfo->info.window = window; einfo->info.window = window;
@ -347,6 +357,15 @@ engine_software_16_ddraw_args(int argc, char **argv)
UpdateWindow(window); UpdateWindow(window);
return 1; return 1;
destroy_window:
DestroyWindow(window);
unregister_class:
UnregisterClass("Evas_Software_16_DDraw_Test", instance);
free_library:
FreeLibrary(instance);
return 0;
} }
void void

View File

@ -225,6 +225,12 @@ engine_software_ddraw_args(int argc, char **argv)
if (!window) if (!window)
goto unregister_class; 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); dc = GetDC(NULL);
if (!dc) if (!dc)
goto destroy_window; goto destroy_window;