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)
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;

View File

@ -188,7 +188,8 @@ engine_gl_glew_args(int argc, char **argv)
}
if (!ok) return 0;
hinstance = GetModuleHandle(0);
hinstance = GetModuleHandle(NULL);
if (!instance) return 0;
wc.style = 0;
wc.lpfnWndProc = MainWndProc;
@ -201,7 +202,8 @@ engine_gl_glew_args(int argc, char **argv)
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 @@ engine_gl_glew_args(int argc, char **argv)
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

View File

@ -262,7 +262,7 @@ engine_software_16_ddraw_args(int argc, char **argv)
{
WNDCLASS wc;
RECT rect;
HINSTANCE hinstance;
HINSTANCE instance;
LPDIRECTDRAW object;
LPDIRECTDRAWSURFACE surface_primary;
LPDIRECTDRAWSURFACE surface_back;
@ -284,20 +284,22 @@ engine_software_16_ddraw_args(int argc, char **argv)
}
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 @@ engine_software_16_ddraw_args(int argc, char **argv)
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 @@ engine_software_16_ddraw_args(int argc, char **argv)
&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 @@ engine_software_16_ddraw_args(int argc, char **argv)
UpdateWindow(window);
return 1;
destroy_window:
DestroyWindow(window);
unregister_class:
UnregisterClass("Evas_Software_16_DDraw_Test", instance);
free_library:
FreeLibrary(instance);
return 0;
}
void

View File

@ -225,6 +225,12 @@ engine_software_ddraw_args(int argc, char **argv)
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;