add glew opengl and directdraw 16 bits backends, fix cursors, remove duplicated mouse button up event, add states and types, like X, fix window_del and add an window_override_new-like function

SVN revision: 32736
This commit is contained in:
doursse 2007-11-16 19:31:32 +00:00 committed by doursse
parent d9a541eade
commit d0a2686432
8 changed files with 863 additions and 131 deletions

View File

@ -36,25 +36,84 @@ typedef void Ecore_Win32_Direct3D_Object;
typedef void Ecore_Win32_Direct3D_Device;
typedef void Ecore_Win32_Direct3D_Sprite;
typedef void Ecore_Win32_Direct3D_Texture;
typedef void Ecore_Win32_Glew_DC;
/* Window state */
typedef enum
{
/** The window is iconified. */
ECORE_WIN32_WINDOW_STATE_ICONIFIED,
/** The window is a modal dialog box. */
ECORE_WIN32_WINDOW_STATE_MODAL,
/** The window manager should keep the window's position fixed
* even if the virtual desktop scrolls. */
ECORE_WIN32_WINDOW_STATE_STICKY,
/** The window has the maximum vertical size. */
ECORE_WIN32_WINDOW_STATE_MAXIMIZED_VERT,
/** The window has the maximum horizontal size. */
ECORE_WIN32_WINDOW_STATE_MAXIMIZED_HORZ,
/** The window has the maximum horizontal and vertical size. */
ECORE_WIN32_WINDOW_STATE_MAXIMIZED,
/** The window is shaded. */
ECORE_WIN32_WINDOW_STATE_SHADED,
/** The window is invisible (i.e. minimized/iconified) */
ECORE_WIN32_WINDOW_STATE_HIDDEN,
/** The window should fill the entire screen and have no
* window border/decorations */
ECORE_WIN32_WINDOW_STATE_FULLSCREEN,
/* The following are not documented because they are not
* intended for use in applications. */
ECORE_WIN32_WINDOW_STATE_ABOVE,
ECORE_WIN32_WINDOW_STATE_BELOW,
/* FIXME: Documentation */
ECORE_WIN32_WINDOW_STATE_DEMANDS_ATTENTION,
/* Unknown state */
ECORE_WIN32_WINDOW_STATE_UNKNOWN
} Ecore_Win32_Window_State;
/* Window type */
typedef enum
{
/* Desktop feature*/
ECORE_WIN32_WINDOW_TYPE_DESKTOP,
/* Dock window (should be on top of other windows */
ECORE_WIN32_WINDOW_TYPE_DOCK,
/* Toolbar window */
ECORE_WIN32_WINDOW_TYPE_TOOLBAR,
/* Menu window */
ECORE_WIN32_WINDOW_TYPE_MENU,
/* Small persistent utility window, such as a palette or toolbox */
ECORE_WIN32_WINDOW_TYPE_UTILITY,
/* Splash screen window displayed as an application is starting up */
ECORE_WIN32_WINDOW_TYPE_SPLASH,
/* Dialog window */
ECORE_WIN32_WINDOW_TYPE_DIALOG,
/* Normal top-level window */
ECORE_WIN32_WINDOW_TYPE_NORMAL,
/* Unknown type */
ECORE_WIN32_WINDOW_TYPE_UNKNOWN
} Ecore_Win32_Window_Type;
/*cursor shapes */
typedef enum
{
ECORE_WIN32_CURSO_SHAPE_APP_STARTING, /* Standard arrow and small hourglass */
ECORE_WIN32_CURSO_SHAPE_ARROW, /* Standard arrow */
ECORE_WIN32_CURSO_SHAPE_CROSS, /* Crosshair */
ECORE_WIN32_CURSO_SHAPE_HAND, /* Hand */
ECORE_WIN32_CURSO_SHAPE_HELP, /* Arrow and question mark */
ECORE_WIN32_CURSO_SHAPE_I_BEAM, /* I-beam */
ECORE_WIN32_CURSO_SHAPE_NO, /* Slashed circle */
ECORE_WIN32_CURSO_SHAPE_SIZE_ALL, /* Four-pointed arrow pointing north, south, east, and west */
ECORE_WIN32_CURSO_SHAPE_SIZE_NESW, /* Double-pointed arrow pointing northeast and southwest */
ECORE_WIN32_CURSO_SHAPE_SIZE_NS, /* Double-pointed arrow pointing north and south */
ECORE_WIN32_CURSO_SHAPE_SIZE_NWSE, /* Double-pointed arrow pointing northwest and southeast */
ECORE_WIN32_CURSO_SHAPE_SIZE_WE, /* Double-pointed arrow pointing west and east */
ECORE_WIN32_CURSO_SHAPE_UP_ARROW, /* Vertical arrow */
ECORE_WIN32_CURSO_SHAPE_WAIT /* Hourglass */
ECORE_WIN32_CURSOR_SHAPE_APP_STARTING, /* Standard arrow and small hourglass */
ECORE_WIN32_CURSOR_SHAPE_ARROW, /* Standard arrow */
ECORE_WIN32_CURSOR_SHAPE_CROSS, /* Crosshair */
ECORE_WIN32_CURSOR_SHAPE_HAND, /* Hand */
ECORE_WIN32_CURSOR_SHAPE_HELP, /* Arrow and question mark */
ECORE_WIN32_CURSOR_SHAPE_I_BEAM, /* I-beam */
ECORE_WIN32_CURSOR_SHAPE_NO, /* Slashed circle */
ECORE_WIN32_CURSOR_SHAPE_SIZE_ALL, /* Four-pointed arrow pointing north, south, east, and west */
ECORE_WIN32_CURSOR_SHAPE_SIZE_NESW, /* Double-pointed arrow pointing northeast and southwest */
ECORE_WIN32_CURSOR_SHAPE_SIZE_NS, /* Double-pointed arrow pointing north and south */
ECORE_WIN32_CURSOR_SHAPE_SIZE_NWSE, /* Double-pointed arrow pointing northwest and southeast */
ECORE_WIN32_CURSOR_SHAPE_SIZE_WE, /* Double-pointed arrow pointing west and east */
ECORE_WIN32_CURSOR_SHAPE_UP_ARROW, /* Vertical arrow */
ECORE_WIN32_CURSOR_SHAPE_WAIT /* Hourglass */
} Ecore_Win32_Cursor_Shape;
/* Events */
@ -257,6 +316,11 @@ EAPI Ecore_Win32_Window *ecore_win32_window_new(Ecore_Win32_Window *parent,
int y,
int width,
int height);
EAPI Ecore_Win32_Window *ecore_win32_window_override_new(Ecore_Win32_Window *parent,
int x,
int y,
int width,
int height);
EAPI void ecore_win32_window_del(Ecore_Win32_Window *window);
@ -285,20 +349,36 @@ EAPI void ecore_win32_window_size_get(Ecore_Win32_Window *window,
int *height);
EAPI void ecore_win32_window_size_min_set(Ecore_Win32_Window *window,
int min_width,
int min_height);
unsigned int min_width,
unsigned int min_height);
EAPI void ecore_win32_window_size_min_get(Ecore_Win32_Window *window,
unsigned int *min_width,
unsigned int *min_height);
EAPI void ecore_win32_window_size_max_set(Ecore_Win32_Window *window,
int max_width,
int max_height);
unsigned int max_width,
unsigned int max_height);
EAPI void ecore_win32_window_size_max_get(Ecore_Win32_Window *window,
unsigned int *max_width,
unsigned int *max_height);
EAPI void ecore_win32_window_size_base_set(Ecore_Win32_Window *window,
int base_width,
int base_height);
unsigned int base_width,
unsigned int base_height);
EAPI void ecore_win32_window_size_base_get(Ecore_Win32_Window *window,
unsigned int *base_width,
unsigned int *base_height);
EAPI void ecore_win32_window_size_step_set(Ecore_Win32_Window *window,
int step_width,
int step_height);
unsigned int step_width,
unsigned int step_height);
EAPI void ecore_win32_window_size_step_get(Ecore_Win32_Window *window,
unsigned int *step_width,
unsigned int *step_height);
EAPI void ecore_win32_window_show(Ecore_Win32_Window *window);
@ -325,6 +405,17 @@ EAPI void ecore_win32_window_fullscreen_set(Ecore_Win32_Window *window,
EAPI void ecore_win32_window_cursor_set(Ecore_Win32_Window *window,
Ecore_Win32_Cursor *cursor);
EAPI void ecore_win32_window_state_set(Ecore_Win32_Window *window,
Ecore_Win32_Window_State *state,
unsigned int num);
EAPI void ecore_win32_window_state_request_send(Ecore_Win32_Window *window,
Ecore_Win32_Window_State state,
unsigned int set);
EAPI void ecore_win32_window_type_set(Ecore_Win32_Window *window,
Ecore_Win32_Window_Type type);
/* Cursor */
EAPI Ecore_Win32_Cursor *ecore_win32_cursor_new(const void *pixels_and,
@ -344,6 +435,8 @@ EAPI int ecore_win32_cursor_size_get(void);
EAPI int ecore_win32_ddraw_init(Ecore_Win32_Window *window);
EAPI int ecore_win32_ddraw_16_init(Ecore_Win32_Window *window);
EAPI void ecore_win32_ddraw_shutdown(Ecore_Win32_Window *window);
EAPI Ecore_Win32_DDraw_Object *ecore_win32_ddraw_object_get(Ecore_Win32_Window *window);
@ -352,6 +445,8 @@ EAPI Ecore_Win32_DDraw_Surface *ecore_win32_ddraw_surface_primary_get(Ecore_Win3
EAPI Ecore_Win32_DDraw_Surface *ecore_win32_ddraw_surface_back_get(Ecore_Win32_Window *window);
EAPI Ecore_Win32_DDraw_Surface *ecore_win32_ddraw_surface_source_get(Ecore_Win32_Window *window);
EAPI int ecore_win32_ddraw_depth_get(Ecore_Win32_Window *window);
/* Direct3D */
@ -378,4 +473,15 @@ EAPI int ecore_win32_direct3d_depth_get(Ecore_Win32_Wi
}
#endif
/* OpenGL Glew */
EAPI int ecore_win32_glew_init(Ecore_Win32_Window *window);
EAPI void ecore_win32_glew_shutdown(Ecore_Win32_Window *window);
EAPI Ecore_Win32_Glew_DC *ecore_win32_glew_dc_get(Ecore_Win32_Window *window);
EAPI int ecore_win32_glew_depth_get(Ecore_Win32_Window *window);
#endif /* __ECORE_WIN32_H__ */

View File

@ -18,11 +18,12 @@ ecore_win32_cursor.c \
ecore_win32_direct3d.cpp \
ecore_win32_ddraw.c \
ecore_win32_event.c \
ecore_win32_glew.c \
ecore_win32_window.c \
ecore_win32_private.h
libecore_win32_la_LIBADD = \
@ddraw_libs@ @direct3d_libs@ \
@ddraw_libs@ @direct3d_libs@ @glew_libs@ \
-lwsock32 \
$(top_builddir)/src/lib/ecore/libecore.la
@ -37,5 +38,6 @@ ecore_win32_cursor.c \
ecore_win32_direct3d.cpp \
ecore_win32_ddraw.c \
ecore_win32_event.c \
ecore_win32_glew.c \
ecore_win32_window.c \
ecore_win32_private.h

View File

@ -8,17 +8,6 @@
#include "ecore_win32_private.h"
/*
<raster> hmmm
<raster> yeah window's way of doing eventys is very different
<raster> not select + timeout
<raster> to doa timeout u need to queue up a timed message
<raster> for timers
<raster> etc.
*/
/* typedef LRESULT CALLBACK _ecore_win32_event_callback(HWND, UINT, WPARAM, LPARAM); */
Ecore_List *_ecore_win32_windows_list = NULL;
HINSTANCE _ecore_win32_instance = NULL;
double _ecore_win32_double_click_time = 0.25;
@ -147,7 +136,12 @@ _ecore_win32_window_procedure(HWND window,
return 0;
/* Window notifications */
case WM_CREATE:
printf (" * ecore message : create\n");
{
RECT rect;
GetClientRect(window, &rect);
printf (" *** ecore message : create %ld %ld\n",
rect.right - rect.left, rect.bottom - rect.top);
}
_ecore_win32_event_handle_create_notify(data);
return 0;
case WM_DESTROY:
@ -155,7 +149,12 @@ _ecore_win32_window_procedure(HWND window,
_ecore_win32_event_handle_destroy_notify(data);
return 0;
case WM_SHOWWINDOW:
printf (" * ecore message : show\n");
{
RECT rect;
GetClientRect(window, &rect);
printf (" *** ecore message : show %ld %ld\n",
rect.right - rect.left, rect.bottom - rect.top);
}
if ((data->data_param == SW_OTHERUNZOOM) ||
(data->data_param == SW_OTHERUNZOOM))
return 0;
@ -179,15 +178,27 @@ _ecore_win32_window_procedure(HWND window,
case WM_SIZING:
printf (" * ecore message : sizing\n");
_ecore_win32_event_handle_resize(data);
_ecore_win32_event_handle_configure_notify(data);
return TRUE;
case WM_SIZE:
printf (" * ecore message : sized\n");
return 0;
case WM_WINDOWPOSCHANGING:
printf (" * ecore message : WM_WINDOWPOSCHANGING\n");
return 0;
/* case WM_WINDOWPOSCHANGING: */
/* { */
/* RECT rect; */
/* GetClientRect(window, &rect); */
/* printf (" *** ecore message : WINDOWPOSCHANGING %ld %ld\n", */
/* rect.right - rect.left, rect.bottom - rect.top); */
/* } */
/* _ecore_win32_event_handle_configure_notify(data); */
/* return 0; */
case WM_WINDOWPOSCHANGED:
printf (" * ecore message : WM_WINDOWPOSCHANGED\n");
{
RECT rect;
GetClientRect(window, &rect);
printf (" *** ecore message : WINDOWPOSCHANGED %ld %ld\n",
rect.right - rect.left, rect.bottom - rect.top);
}
_ecore_win32_event_handle_configure_notify(data);
return 0;
case WM_ENTERSIZEMOVE :
@ -288,6 +299,7 @@ ecore_win32_init()
return _ecore_win32_init_count;
}
printf (" *** ecore_win32_init\n");
_ecore_win32_instance = GetModuleHandle(0);
if (!_ecore_win32_instance)
return 0;
@ -341,6 +353,17 @@ ecore_win32_init()
ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST = ecore_event_type_new();
}
#ifdef HAVE_OPENGL_GLEW
if (GLEW_VERSION_2_0)
{
printf ("pas 2.0\n");
return 0;
}
else {
printf ("2.0 !!\n");
}
#endif /* HAVE_OPENGL_GLEW */
_ecore_win32_init_count++;
return _ecore_win32_init_count;

View File

@ -21,6 +21,13 @@ ecore_win32_ddraw_init(Ecore_Win32_Window *window)
return 0;
w = (struct _Ecore_Win32_Window *)window;
w->ddraw.surface_source = NULL;
{
RECT rect;
GetClientRect(w->window, &rect);
printf (" *** ecore_win32_ddraw_init %ld %ld\n",
rect.right - rect.left, rect.bottom - rect.top);
}
if (FAILED(DirectDrawCreateEx(0, (void **)&w->ddraw.object,
&IID_IDirectDraw7, NULL)))
@ -81,6 +88,8 @@ ecore_win32_ddraw_init(Ecore_Win32_Window *window)
w->ddraw.depth = pixel_format.dwRGBBitCount;
w->backend = ECORE_WIN32_BACKEND_DIRECTDRAW;
return 1;
no_get_pix_fmt:
@ -100,6 +109,122 @@ ecore_win32_ddraw_init(Ecore_Win32_Window *window)
return 0;
}
EAPI int
ecore_win32_ddraw_16_init(Ecore_Win32_Window *window)
{
#ifdef HAVE_DIRECTDRAW
DDSURFACEDESC2 surface_desc;
DDPIXELFORMAT pixel_format;
RECT rect;
DDSURFACEDESC2 *sd;
void *source;
struct _Ecore_Win32_Window *w;
if (!window)
return 0;
w = (struct _Ecore_Win32_Window *)window;
{
RECT rect;
GetClientRect(w->window, &rect);
printf (" *** ecore_win32_ddraw_init %ld %ld\n",
rect.right - rect.left, rect.bottom - rect.top);
}
w->ddraw.clipper = NULL;
if (FAILED(DirectDrawCreateEx(0, (void **)&w->ddraw.object,
&IID_IDirectDraw7, NULL)))
return 0;
if (FAILED(IDirectDraw7_SetCooperativeLevel(w->ddraw.object,
w->window, DDSCL_NORMAL)))
goto no_coop_level;
memset (&surface_desc, 0, sizeof (surface_desc));
surface_desc.dwSize = sizeof (surface_desc);
surface_desc.dwFlags = DDSD_CAPS;
surface_desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
/* Hack to cleanly remove a warning */
sd = &surface_desc;
if (FAILED(IDirectDraw7_CreateSurface(w->ddraw.object,
(DDSURFACEDESC *)sd,
&w->ddraw.surface_primary,
NULL)))
goto no_primary_surf;
if (!GetClientRect(w->window, &rect))
goto no_get_client;
memset (&surface_desc, 0, sizeof (surface_desc));
surface_desc.dwSize = sizeof (surface_desc);
surface_desc.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH;
surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
surface_desc.dwWidth = rect.right - rect.left;
surface_desc.dwHeight = rect.bottom - rect.top;
/* Hack to cleanly remove a warning */
sd = &surface_desc;
if (FAILED(IDirectDraw7_CreateSurface(w->ddraw.object,
(DDSURFACEDESC *)sd,
&w->ddraw.surface_back,
NULL)))
goto no_back_surf;
ZeroMemory(&pixel_format, sizeof(pixel_format));
pixel_format.dwSize = sizeof(pixel_format);
if (FAILED(IDirectDrawSurface7_GetPixelFormat(w->ddraw.surface_primary,
&pixel_format)))
goto no_get_pix_fmt;
w->ddraw.depth = pixel_format.dwRGBBitCount;
source = malloc((rect.right - rect.left) * (rect.bottom - rect.top) * 2);
if (!source)
goto no_source;
memset (&surface_desc, 0, sizeof (surface_desc));
surface_desc.dwSize = sizeof (surface_desc);
surface_desc.dwFlags =
DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH |
DDSD_LPSURFACE | DDSD_PITCH | DDSD_PIXELFORMAT;
surface_desc.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY;
surface_desc.dwWidth = rect.right - rect.left;
surface_desc.dwHeight = rect.bottom - rect.top;
surface_desc.lPitch = 2 * surface_desc.dwWidth;
surface_desc.lpSurface = source;
surface_desc.ddpfPixelFormat = pixel_format;
/* Hack to cleanly remove a warning */
sd = &surface_desc;
if (FAILED(IDirectDraw7_CreateSurface(w->ddraw.object,
(DDSURFACEDESC *)sd,
&w->ddraw.surface_source,
NULL)))
goto no_source_surf;
w->backend = ECORE_WIN32_BACKEND_DIRECTDRAW_16;
return 1;
no_source_surf:
free(source);
no_source:
no_get_pix_fmt:
/* no need to release the back surface. the next call free its memory */
no_back_surf:
no_get_client:
IDirectDrawSurface7_Release(w->ddraw.surface_primary);
no_primary_surf:
no_coop_level:
IDirectDraw7_Release(w->ddraw.object);
#endif /* HAVE_DIRECTDRAW */
return 0;
}
EAPI void
ecore_win32_ddraw_shutdown(Ecore_Win32_Window *window)
{
@ -117,6 +242,27 @@ ecore_win32_ddraw_shutdown(Ecore_Win32_Window *window)
w->ddraw.surface_primary = NULL;
}
if (w->ddraw.surface_source)
{
DDSURFACEDESC2 surface_desc;
ZeroMemory(&surface_desc, sizeof(surface_desc));
surface_desc.dwSize = sizeof(surface_desc);
if (IDirectDrawSurface7_Lock(w->ddraw.surface_source, NULL,
&surface_desc,
DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR,
NULL) == DD_OK)
{
free(surface_desc.lpSurface);
if (IDirectDrawSurface7_Unlock(w->ddraw.surface_source, NULL) == DD_OK)
{
IDirectDrawSurface7_Release(w->ddraw.surface_source);
}
}
w->ddraw.surface_source = NULL;
}
/* no need to release the back surface. the previous call free its memory */
if (w->ddraw.clipper)
@ -130,6 +276,8 @@ ecore_win32_ddraw_shutdown(Ecore_Win32_Window *window)
IDirectDraw7_Release(w->ddraw.object);
w->ddraw.object = NULL;
}
w->backend = ECORE_WIN32_BACKEND_NONE;
#endif /* HAVE_DIRECTDRAW */
}
@ -163,6 +311,16 @@ ecore_win32_ddraw_surface_back_get(Ecore_Win32_Window *window)
#endif /* HAVE_DIRECTDRAW */
}
EAPI Ecore_Win32_DDraw_Surface *
ecore_win32_ddraw_surface_source_get(Ecore_Win32_Window *window)
{
#ifdef HAVE_DIRECTDRAW
return ((struct _Ecore_Win32_Window *)window)->ddraw.surface_source;
#else
return NULL;
#endif /* HAVE_DIRECTDRAW */
}
EAPI int
ecore_win32_ddraw_depth_get(Ecore_Win32_Window *window)
{

View File

@ -5,6 +5,7 @@
#include "config.h"
#include "ecore_win32_private.h"
#include "Ecore_Win32.h"
#include <cstdio>
extern "C" {
@ -27,6 +28,13 @@ ecore_win32_direct3d_init(Ecore_Win32_Window *window)
w = (struct _Ecore_Win32_Window *)window;
printf ("ecore_win32_direct3d_init debut : %p (%d %d) (%d %d)\n",
w,
w->min_width,
w->min_height,
w->max_width,
w->max_height);
w->d3d.object = Direct3DCreate9 (D3D_SDK_VERSION);
if (!w->d3d.object)
return 0;
@ -96,6 +104,15 @@ ecore_win32_direct3d_init(Ecore_Win32_Window *window)
goto no_supported_depth;
}
w->backend = ECORE_WIN32_BACKEND_DIRECT3D;
printf ("ecore_win32_direct3d_init fin : %p (%d %d) (%d %d)\n",
w,
w->min_width,
w->min_height,
w->max_width,
w->max_height);
return 1;
no_supported_depth:
@ -126,17 +143,24 @@ ecore_win32_direct3d_shutdown(Ecore_Win32_Window *window)
w = (struct _Ecore_Win32_Window *)window;
printf ("0\n");
if (w->d3d.texture)
w->d3d.texture->Release();
if (w->d3d.sprite)
w->d3d.sprite->Release();
printf ("1\n");
// if (w->d3d.sprite)
// w->d3d.sprite->OnLostDevice();
if (w->d3d.device)
w->d3d.device->Release();
printf ("2\n");
// if (w->d3d.device)
// w->d3d.device->Release();
printf ("3\n");
if (w->d3d.object)
w->d3d.object->Release();
printf ("4\n");
w->backend = ECORE_WIN32_BACKEND_NONE;
#endif /* HAVE_DIRECT3D */
}

View File

@ -443,9 +443,10 @@ _ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg,
e = (Ecore_Win32_Event_Mouse_Wheel *)calloc(1, sizeof(Ecore_Win32_Event_Mouse_Wheel));
if (!e) return;
e->window = window;
e->direction = 0;
/* wheel delta is positive or negative, never 0 */
e->z = GET_WHEEL_DELTA_WPARAM(msg->window_param) > 0 ? 1 : -1;
e->z = GET_WHEEL_DELTA_WPARAM(msg->window_param) > 0 ? -1 : 1;
e->x = GET_X_LPARAM(msg->data_param);
e->y = GET_Y_LPARAM(msg->data_param);
e->time = (double)msg->time / 1000.0;
@ -530,7 +531,7 @@ _ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg,
void
_ecore_win32_event_handle_button_release(Ecore_Win32_Callback_Data *msg,
int button)
int button)
{
Ecore_Win32_Window *window;
@ -584,18 +585,6 @@ _ecore_win32_event_handle_button_release(Ecore_Win32_Callback_Data *msg,
ecore_event_add(ECORE_WIN32_EVENT_MOUSE_BUTTON_UP, e, NULL, NULL);
}
Ecore_Win32_Event_Mouse_Button_Up *e;
e = (Ecore_Win32_Event_Mouse_Button_Up *)calloc(1, sizeof(Ecore_Win32_Event_Mouse_Button_Up));
if (!e) return;
e->window = _ecore_win32_event_window_get(msg->window);
e->button = button;
e->x = GET_X_LPARAM(msg->data_param);
e->y = GET_Y_LPARAM(msg->data_param);
e->time = (double)msg->time / 1000.0;
ecore_event_add(ECORE_WIN32_EVENT_MOUSE_BUTTON_UP, e, NULL, NULL);
printf (" * ecore event button release\n");
}
@ -751,6 +740,7 @@ _ecore_win32_event_handle_create_notify(Ecore_Win32_Callback_Data *msg)
if (!e) return;
e->window = _ecore_win32_event_window_get(msg->window);
e->time = _ecore_win32_event_last_time;
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_CREATE, e, NULL, NULL);
@ -765,6 +755,7 @@ _ecore_win32_event_handle_destroy_notify(Ecore_Win32_Callback_Data *msg)
if (!e) return;
e->window = _ecore_win32_event_window_get(msg->window);
e->time = _ecore_win32_event_last_time;
if (e->window == _ecore_win32_event_last_window) _ecore_win32_event_last_window = NULL;
@ -780,6 +771,7 @@ _ecore_win32_event_handle_map_notify(Ecore_Win32_Callback_Data *msg)
if (!e) return;
e->window = _ecore_win32_event_window_get(msg->window);
e->time = _ecore_win32_event_last_time;
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_SHOW, e, NULL, NULL);
@ -794,6 +786,7 @@ _ecore_win32_event_handle_unmap_notify(Ecore_Win32_Callback_Data *msg)
if (!e) return;
e->window = _ecore_win32_event_window_get(msg->window);
e->time = _ecore_win32_event_last_time;
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_HIDE, e, NULL, NULL);
@ -802,7 +795,7 @@ _ecore_win32_event_handle_unmap_notify(Ecore_Win32_Callback_Data *msg)
void
_ecore_win32_event_handle_configure_notify(Ecore_Win32_Callback_Data *msg)
{
RECT rect;
WINDOWINFO wi;
Ecore_Win32_Event_Window_Configure *e;
WINDOWPOS *window_pos;
@ -810,18 +803,20 @@ _ecore_win32_event_handle_configure_notify(Ecore_Win32_Callback_Data *msg)
if (!e) return;
window_pos = (WINDOWPOS *)msg->data_param;
if (!GetClientRect(window_pos->hwnd, &rect))
wi.cbSize = sizeof(WINDOWINFO);
if (!GetWindowInfo(window_pos->hwnd, &wi))
{
free(e);
return;
}
printf ("_ecore_win32_event_handle_configure_notify\n");
e->window = _ecore_win32_event_window_get(window_pos->hwnd);
e->abovewin = _ecore_win32_event_window_get(window_pos->hwndInsertAfter);
e->x = rect.left;
e->y = rect.top;
e->width = rect.right - rect.left;
e->height = rect.bottom - rect.top;
e->x = wi.rcClient.left;
e->y = wi.rcClient.top;
e->width = wi.rcClient.right - wi.rcClient.left;
e->height = wi.rcClient.bottom - wi.rcClient.top;
e->time = _ecore_win32_event_last_time;
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_CONFIGURE, e, NULL, NULL);

View File

@ -6,7 +6,9 @@
#define __ECORE_WIN32_PRIVATE_H__
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#ifdef HAVE_DIRECTDRAW
# include <ddraw.h>
#endif /* HAVE_DIRECTDRAW */
@ -15,6 +17,7 @@
# include <d3dx9.h>
#endif /* HAVE_DIRECT3D */
#include "Ecore.h"
#include <Ecore_Data.h>
#include "Ecore_Win32.h"
@ -23,6 +26,15 @@
#define ECORE_WIN32_WINDOW_CLASS "Ecore_Win32_Window_Class"
typedef enum
{
ECORE_WIN32_BACKEND_DIRECTDRAW,
ECORE_WIN32_BACKEND_DIRECTDRAW_16,
ECORE_WIN32_BACKEND_DIRECT3D,
ECORE_WIN32_BACKEND_GLEW,
ECORE_WIN32_BACKEND_NONE
}Ecore_Win32_Backend;
typedef struct _Ecore_Win32_Callback_Data Ecore_Win32_Callback_Data;
struct _Ecore_Win32_Callback_Data
@ -39,13 +51,16 @@ struct _Ecore_Win32_Callback_Data
struct _Ecore_Win32_Window
{
HWND window;
HWND window;
Ecore_Win32_Backend backend;
#ifdef HAVE_DIRECTDRAW
struct {
LPDIRECTDRAW object;
LPDIRECTDRAWSURFACE surface_primary;
LPDIRECTDRAWSURFACE surface_back;
LPDIRECTDRAWSURFACE surface_source;
LPDIRECTDRAWCLIPPER clipper;
int depth;
} ddraw;
@ -53,30 +68,62 @@ struct _Ecore_Win32_Window
#ifdef HAVE_DIRECT3D
struct {
LPDIRECT3D9 object;
LPDIRECT3DDEVICE9 device;
LPD3DXSPRITE sprite;
LPDIRECT3DTEXTURE9 texture;
int depth;
LPDIRECT3D9 object;
LPDIRECT3DDEVICE9 device;
LPD3DXSPRITE sprite;
LPDIRECT3DTEXTURE9 texture;
int depth;
} d3d;
#endif /* HAVE_DIRECT3D */
DWORD style; /* used to go fullscreen to normal */
RECT rect; /* used to go fullscreen to normal */
#ifdef HAVE_OPENGL_GLEW
struct {
HDC dc;
int depth;
} glew;
#endif /* HAVE_OPENGL_GLEW */
unsigned int min_width;
unsigned int min_height;
unsigned int max_width;
unsigned int max_height;
unsigned int base_width;
unsigned int base_height;
unsigned int step_width;
unsigned int step_height;
DWORD style; /* used to go fullscreen to normal */
RECT rect; /* used to go fullscreen to normal */
unsigned int pointer_is_in : 1;
unsigned int borderless : 1;
unsigned int iconified : 1;
unsigned int fullscreen : 1;
unsigned int min_width;
unsigned int min_height;
unsigned int max_width;
unsigned int max_height;
unsigned int base_width;
unsigned int base_height;
unsigned int step_width;
unsigned int step_height;
struct {
unsigned int iconified : 1;
unsigned int modal : 1;
unsigned int sticky : 1;
unsigned int maximized_vert : 1;
unsigned int maximized_horz : 1;
unsigned int shaded : 1;
unsigned int hidden : 1;
unsigned int fullscreen : 1;
unsigned int above : 1;
unsigned int below : 1;
unsigned int demands_attention : 1;
} state;
struct {
unsigned int desktop : 1;
unsigned int dock : 1;
unsigned int toolbar : 1;
unsigned int menu : 1;
unsigned int utility : 1;
unsigned int splash : 1;
unsigned int dialog : 1;
unsigned int normal : 1;
} type;
unsigned int pointer_is_in : 1;
unsigned int borderless : 1;
unsigned int iconified : 1;
unsigned int fullscreen : 1;
};

View File

@ -2,6 +2,8 @@
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#include <stdio.h>
#include <Ecore.h>
#include "ecore_win32_private.h"
@ -17,12 +19,13 @@ enum _Ecore_Win32_Window_Z_Order
};
EAPI Ecore_Win32_Window *
ecore_win32_window_new(Ecore_Win32_Window *parent,
int x,
int y,
int width,
int height)
static Ecore_Win32_Window *
ecore_win32_window_internal_new(Ecore_Win32_Window *parent,
int x,
int y,
int width,
int height,
DWORD style)
{
RECT rect;
struct _Ecore_Win32_Window *w;
@ -33,33 +36,38 @@ ecore_win32_window_new(Ecore_Win32_Window *parent,
if (!w)
return NULL;
printf (" * ecore : new debut : %d %d %d\n",
printf (" *** ecore_win32_window_new : %p %d %d %d\n",
w,
width, height, GetSystemMetrics(SM_CXMIN));
rect.left = 0;
rect.top = 0;
rect.right = width;
rect.bottom = height;
if (!AdjustWindowRect(&rect, WS_OVERLAPPEDWINDOW | WS_SIZEBOX, FALSE))
if (!AdjustWindowRect(&rect, style, FALSE))
{
free(w);
return NULL;
}
printf (" * ecore : new debut : %ld %d\n",
rect.right - rect.left, GetSystemMetrics(SM_CXMIN));
printf (" * ecore : new debut : %ld %d %d\n",
rect.right - rect.left, GetSystemMetrics(SM_CXMIN), GetSystemMetrics(SM_CYMIN));
minimal_width = GetSystemMetrics(SM_CXMIN);
minimal_height = GetSystemMetrics(SM_CYMIN);
if (((rect.right - rect.left) < minimal_width) ||
((rect.bottom - rect.top) < minimal_height))
/* if (((rect.right - rect.left) < minimal_width) || */
/* ((rect.bottom - rect.top) < minimal_height)) */
/* { */
/* fprintf (stderr, "[Ecore] [Win32] ERROR !!\n"); */
/* fprintf (stderr, " Wrong size %ld\n", rect.right - rect.left); */
/* free(w); */
/* return NULL; */
/* } */
if ((rect.right - rect.left) < minimal_width)
{
printf ("[Ecore] [Win32] ERROR !!\n");
printf (" Wrong size %ld\n", rect.right - rect.left);
free(w);
return NULL;
rect.right = rect.left + minimal_width;
}
w->window = CreateWindow(ECORE_WIN32_WINDOW_CLASS, "",
WS_OVERLAPPEDWINDOW | WS_SIZEBOX,
style,
x, y,
rect.right - rect.left,
rect.bottom - rect.top,
@ -79,23 +87,79 @@ ecore_win32_window_new(Ecore_Win32_Window *parent,
return NULL;
}
w->min_width = 0;
w->min_height = 0;
w->max_width = 32767;
w->max_height = 32767;
w->base_width = -1;
w->backend = ECORE_WIN32_BACKEND_NONE;
w->min_width = 0;
w->min_height = 0;
w->max_width = 32767;
w->max_height = 32767;
w->base_width = -1;
w->base_height = -1;
w->step_width = -1;
w->step_width = -1;
w->step_height = -1;
w->state.iconified = 0;
w->state.modal = 0;
w->state.sticky = 0;
w->state.maximized_vert = 0;
w->state.maximized_horz = 0;
w->state.shaded = 0;
w->state.hidden = 0;
w->state.fullscreen = 0;
w->state.above = 0;
w->state.below = 0;
w->state.demands_attention = 0;
w->type.desktop = 0;
w->type.dock = 0;
w->type.toolbar = 0;
w->type.menu = 0;
w->type.utility = 0;
w->type.splash = 0;
w->type.dialog = 0;
w->type.normal = 0;
w->pointer_is_in = 0;
w->borderless = 0;
w->iconified = 0;
w->fullscreen = 0;
w->borderless = 0;
w->iconified = 0;
w->fullscreen = 0;
printf (" *** ecore_win32_window_new fin : (%d %d) (%d %d)\n",
w->min_width,
w->min_height,
w->max_width,
w->max_height);
return w;
}
EAPI Ecore_Win32_Window *
ecore_win32_window_new(Ecore_Win32_Window *parent,
int x,
int y,
int width,
int height)
{
return ecore_win32_window_internal_new(parent,
x, y,
width, height,
WS_OVERLAPPEDWINDOW | WS_SIZEBOX);
}
/* simulate X11 override windows */
EAPI Ecore_Win32_Window *
ecore_win32_window_override_new(Ecore_Win32_Window *parent,
int x,
int y,
int width,
int height)
{
return ecore_win32_window_internal_new(parent,
x, y,
width, height,
WS_POPUP);
}
EAPI void
ecore_win32_window_del(Ecore_Win32_Window *window)
{
@ -112,11 +176,31 @@ ecore_win32_window_del(Ecore_Win32_Window *window)
break;
}
}
ecore_list_remove(_ecore_win32_windows_list);
/* ecore_list_remove(_ecore_win32_windows_list); */
switch (((struct _Ecore_Win32_Window *)window)->backend)
{
case ECORE_WIN32_BACKEND_DIRECTDRAW:
ecore_win32_ddraw_shutdown(window);
break;
case ECORE_WIN32_BACKEND_DIRECTDRAW_16:
/* ecore_win32_ddraw_shutdown(window); */
break;
case ECORE_WIN32_BACKEND_DIRECT3D:
printf ("d3d shut 0 \n");
ecore_win32_direct3d_shutdown(window);
printf ("d3d shut 1 \n");
break;
case ECORE_WIN32_BACKEND_GLEW:
ecore_win32_glew_shutdown(window);
break;
default:
break;
}
ecore_win32_ddraw_shutdown(window);
DestroyWindow(((struct _Ecore_Win32_Window *)window)->window);
free(window);
printf ("ecore_win32_window_del\n");
}
/*
@ -161,6 +245,7 @@ ecore_win32_window_move(Ecore_Win32_Window *window,
if (!window) return;
printf ("ecore_win32_window_move %p : %d %d\n", window, x, y);
w = ((struct _Ecore_Win32_Window *)window)->window;
if (!GetWindowRect(w, &rect))
return;
@ -187,24 +272,40 @@ ecore_win32_window_resize(Ecore_Win32_Window *window,
w = (struct _Ecore_Win32_Window *)window;
if (!GetWindowRect(w->window, &rect)) return;
printf ("ecore_win32_window_resize 0 : %p (%d %d) (%d %d) (%d %d)\n",
w,
w->min_width,
w->min_height,
w->max_width,
w->max_height,
width,
height);
x = rect.left;
y = rect.top;
rect.left = 0;
rect.top = 0;
if (width < w->min_width) width = w->min_width;
if (width > w->max_width) width = w->max_width;
if (height < w->min_height) height = w->min_height;
if (height > w->max_height) height = w->max_height;
/* if (width < w->min_width) width = w->min_width; */
/* if (width > w->max_width) width = w->max_width; */
/* printf ("ecore_win32_window_resize 1 : %d %d %d\n", w->min_height, w->max_height, height); */
/* if (height < w->min_height) height = w->min_height; */
/* printf ("ecore_win32_window_resize 2 : %d %d\n", w->max_height, height); */
/* if (height > w->max_height) height = w->max_height; */
/* printf ("ecore_win32_window_resize 3 : %d %d\n", w->max_height, height); */
rect.right = width;
rect.bottom = height;
style = GetWindowLong(w->window, GWL_STYLE);
if (!AdjustWindowRect(&rect, style, FALSE))
return;
MoveWindow(w->window, x, y,
rect.right - rect.left,
rect.bottom - rect.top,
TRUE);
if (!MoveWindow(w->window, x, y,
rect.right - rect.left,
rect.bottom - rect.top,
FALSE))
{
printf (" MEEERDE !!!\n");
}
printf ("ecore_win32_window_resize 4 : %d %d\n", width, height);
}
EAPI void
@ -220,6 +321,7 @@ ecore_win32_window_move_resize(Ecore_Win32_Window *window,
if (!window) return;
printf ("ecore_win32_window_move_resize 0 : %p %d %d\n", window, width, height);
w = ((struct _Ecore_Win32_Window *)window);
rect.left = 0;
rect.top = 0;
@ -227,6 +329,7 @@ ecore_win32_window_move_resize(Ecore_Win32_Window *window,
if (width > w->max_width) width = w->max_width;
if (height < w->min_height) height = w->min_height;
if (height > w->max_height) height = w->max_height;
printf ("ecore_win32_window_move_resize 1 : %d %d\n", width, height);
rect.right = width;
rect.bottom = height;
style = GetWindowLong(w->window, GWL_STYLE);
@ -250,6 +353,7 @@ ecore_win32_window_geometry_get(Ecore_Win32_Window *window,
int w;
int h;
printf ("ecore_win32_window_geometry_get %p\n", window);
if (!window)
{
if (x) *x = 0;
@ -298,6 +402,7 @@ ecore_win32_window_size_get(Ecore_Win32_Window *window,
{
RECT rect;
printf ("ecore_win32_window_size_get %p\n", window);
if (!window)
{
if (width) *width = GetSystemMetrics(SM_CXSCREEN);
@ -319,60 +424,124 @@ ecore_win32_window_size_get(Ecore_Win32_Window *window,
EAPI void
ecore_win32_window_size_min_set(Ecore_Win32_Window *window,
int min_width,
int min_height)
unsigned int min_width,
unsigned int min_height)
{
struct _Ecore_Win32_Window *w;
if (!window) return;
printf ("ecore_win32_window_size_min_set : %p %d %d\n", window, min_width, min_height);
w = (struct _Ecore_Win32_Window *)window;
w->min_width = min_width;
w->min_height = min_height;
}
EAPI void
ecore_win32_window_size_max_set(Ecore_Win32_Window *window,
int max_width,
int max_height)
ecore_win32_window_size_min_get(Ecore_Win32_Window *window,
unsigned int *min_width,
unsigned int *min_height)
{
struct _Ecore_Win32_Window *w;
if (!window) return;
printf ("ecore_win32_window_size_min_get : %p %d %d\n", window, w->min_width, w->min_height);
w = (struct _Ecore_Win32_Window *)window;
if (min_width) *min_width = w->min_width;
if (min_height) *min_height = w->min_height;
}
EAPI void
ecore_win32_window_size_max_set(Ecore_Win32_Window *window,
unsigned int max_width,
unsigned int max_height)
{
struct _Ecore_Win32_Window *w;
if (!window) return;
printf ("ecore_win32_window_size_max_set : %p %d %d\n", window, max_width, max_height);
w = (struct _Ecore_Win32_Window *)window;
w->max_width = max_width;
w->max_height = max_height;
}
EAPI void
ecore_win32_window_size_base_set(Ecore_Win32_Window *window,
int base_width,
int base_height)
ecore_win32_window_size_max_get(Ecore_Win32_Window *window,
unsigned int *max_width,
unsigned int *max_height)
{
struct _Ecore_Win32_Window *w;
if (!window) return;
printf ("ecore_win32_window_size_max_get : %p %d %d\n", window, w->max_width, w->max_height);
w = (struct _Ecore_Win32_Window *)window;
if (max_width) *max_width = w->max_width;
if (max_height) *max_height = w->max_height;
}
EAPI void
ecore_win32_window_size_base_set(Ecore_Win32_Window *window,
unsigned int base_width,
unsigned int base_height)
{
struct _Ecore_Win32_Window *w;
printf ("ecore_win32_window_size_base_set : %p %d %d\n", window, base_width, base_height);
if (!window) return;
w = (struct _Ecore_Win32_Window *)window;
w->base_width = base_width;
w->base_height = base_height;
}
EAPI void
ecore_win32_window_size_step_set(Ecore_Win32_Window *window,
int step_width,
int step_height)
ecore_win32_window_size_base_get(Ecore_Win32_Window *window,
unsigned int *base_width,
unsigned int *base_height)
{
struct _Ecore_Win32_Window *w;
if (!window) return;
printf ("ecore_win32_window_size_base_get : %p %d %d\n", window, w->base_width, w->base_height);
w = (struct _Ecore_Win32_Window *)window;
if (base_width) *base_width = w->base_width;
if (base_height) *base_height = w->base_height;
}
EAPI void
ecore_win32_window_size_step_set(Ecore_Win32_Window *window,
unsigned int step_width,
unsigned int step_height)
{
struct _Ecore_Win32_Window *w;
printf ("ecore_win32_window_size_step_set : %p %d %d\n", window, step_width, step_height);
if (!window) return;
w = (struct _Ecore_Win32_Window *)window;
w->step_width = step_width;
w->step_height = step_height;
}
EAPI void
ecore_win32_window_size_step_get(Ecore_Win32_Window *window,
unsigned int *step_width,
unsigned int *step_height)
{
struct _Ecore_Win32_Window *w;
if (!window) return;
printf ("ecore_win32_window_size_step_get : %p %d %d\n", window, w->step_width, w->step_height);
w = (struct _Ecore_Win32_Window *)window;
if (step_width) *step_width = w->step_width;
if (step_height) *step_height = w->step_height;
}
/* TODO: ecore_win32_window_shaped_set */
EAPI void
@ -380,6 +549,7 @@ ecore_win32_window_show(Ecore_Win32_Window *window)
{
if (!window) return;
printf (" ** ecore_win32_window_show %p\n", window);
ShowWindow(((struct _Ecore_Win32_Window *)window)->window, SW_SHOWNORMAL);
UpdateWindow(((struct _Ecore_Win32_Window *)window)->window);
}
@ -390,6 +560,7 @@ ecore_win32_window_hide(Ecore_Win32_Window *window)
{
if (!window) return;
printf (" ** ecore_win32_window_hide %p\n", window);
ShowWindow(((struct _Ecore_Win32_Window *)window)->window, SW_HIDE);
}
@ -398,6 +569,7 @@ ecore_win32_window_raise(Ecore_Win32_Window *window)
{
if (!window) return;
printf (" ** ecore_win32_window_raise %p\n", window);
SetWindowPos(((struct _Ecore_Win32_Window *)window)->window,
HWND_TOP, 0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
@ -408,6 +580,7 @@ ecore_win32_window_lower(Ecore_Win32_Window *window)
{
if (!window) return;
printf (" ** ecore_win32_window_lower %p\n", window);
SetWindowPos(((struct _Ecore_Win32_Window *)window)->window,
HWND_BOTTOM, 0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE);
@ -469,6 +642,7 @@ ecore_win32_window_borderless_set(Ecore_Win32_Window *window,
if (!window) return;
printf (" ** ecore_win32_window_borderless_set %p %d\n", window, on);
ew = (struct _Ecore_Win32_Window *)window;
if (((ew->borderless) && (on)) ||
((!ew->borderless) && (!on)))
@ -547,3 +721,206 @@ ecore_win32_window_cursor_set(Ecore_Win32_Window *window,
SetClassLong(((struct _Ecore_Win32_Window *)window)->window,
GCL_HCURSOR, (LONG)cursor);
}
EAPI void
ecore_win32_window_state_set(Ecore_Win32_Window *window,
Ecore_Win32_Window_State *state,
unsigned int num)
{
unsigned int i;
if (!num)
return;
for (i = 0; i < num; i++)
{
switch (state[i])
{
case ECORE_WIN32_WINDOW_STATE_ICONIFIED:
((struct _Ecore_Win32_Window *)window)->state.iconified = 1;
break;
case ECORE_WIN32_WINDOW_STATE_MODAL:
((struct _Ecore_Win32_Window *)window)->state.modal = 1;
break;
case ECORE_WIN32_WINDOW_STATE_STICKY:
((struct _Ecore_Win32_Window *)window)->state.sticky = 1;
break;
case ECORE_WIN32_WINDOW_STATE_MAXIMIZED_VERT:
((struct _Ecore_Win32_Window *)window)->state.maximized_vert = 1;
break;
case ECORE_WIN32_WINDOW_STATE_MAXIMIZED_HORZ:
((struct _Ecore_Win32_Window *)window)->state.maximized_horz = 1;
break;
case ECORE_WIN32_WINDOW_STATE_MAXIMIZED:
((struct _Ecore_Win32_Window *)window)->state.maximized_horz = 1;
((struct _Ecore_Win32_Window *)window)->state.maximized_vert = 1;
break;
case ECORE_WIN32_WINDOW_STATE_SHADED:
((struct _Ecore_Win32_Window *)window)->state.shaded = 1;
break;
case ECORE_WIN32_WINDOW_STATE_HIDDEN:
((struct _Ecore_Win32_Window *)window)->state.hidden = 1;
break;
case ECORE_WIN32_WINDOW_STATE_FULLSCREEN:
((struct _Ecore_Win32_Window *)window)->state.fullscreen = 1;
break;
case ECORE_WIN32_WINDOW_STATE_ABOVE:
((struct _Ecore_Win32_Window *)window)->state.above = 1;
break;
case ECORE_WIN32_WINDOW_STATE_BELOW:
((struct _Ecore_Win32_Window *)window)->state.below = 1;
break;
case ECORE_WIN32_WINDOW_STATE_DEMANDS_ATTENTION:
((struct _Ecore_Win32_Window *)window)->state.demands_attention = 1;
break;
case ECORE_WIN32_WINDOW_STATE_UNKNOWN:
/* nothing to be done */
break;
}
}
}
EAPI void
ecore_win32_window_state_request_send(Ecore_Win32_Window *window,
Ecore_Win32_Window_State state,
unsigned int set)
{
if (!window)
return;
switch (state)
{
case ECORE_WIN32_WINDOW_STATE_ICONIFIED:
if (((struct _Ecore_Win32_Window *)window)->state.iconified)
ecore_win32_window_iconified_set(window, set);
break;
case ECORE_WIN32_WINDOW_STATE_MODAL:
((struct _Ecore_Win32_Window *)window)->state.modal = 1;
break;
case ECORE_WIN32_WINDOW_STATE_STICKY:
((struct _Ecore_Win32_Window *)window)->state.sticky = 1;
break;
case ECORE_WIN32_WINDOW_STATE_MAXIMIZED_VERT:
if (((struct _Ecore_Win32_Window *)window)->state.maximized_vert)
{
RECT rect;
int y;
int height;
if (!SystemParametersInfo(SPI_GETWORKAREA, 0,
&rect, 0))
break;
y = rect.top;
height = rect.bottom - rect.top;
if (!GetClientRect(((struct _Ecore_Win32_Window *)window)->window,
&rect))
break;
MoveWindow(window, rect.left, y,
rect.right - rect.left,
height,
TRUE);
}
break;
case ECORE_WIN32_WINDOW_STATE_MAXIMIZED_HORZ:
if (((struct _Ecore_Win32_Window *)window)->state.maximized_horz)
{
RECT rect;
if (!GetClientRect(((struct _Ecore_Win32_Window *)window)->window,
&rect))
break;
MoveWindow(window, 0, rect.top,
GetSystemMetrics(SM_CXSCREEN),
rect.bottom - rect.top,
TRUE);
}
break;
case ECORE_WIN32_WINDOW_STATE_MAXIMIZED:
if (((struct _Ecore_Win32_Window *)window)->state.maximized_vert &&
((struct _Ecore_Win32_Window *)window)->state.maximized_horz)
{
RECT rect;
if (!SystemParametersInfo(SPI_GETWORKAREA, 0,
&rect, 0))
break;
MoveWindow(window, 0, 0,
GetSystemMetrics(SM_CXSCREEN),
rect.bottom - rect.top,
TRUE);
}
break;
case ECORE_WIN32_WINDOW_STATE_SHADED:
((struct _Ecore_Win32_Window *)window)->state.shaded = 1;
break;
case ECORE_WIN32_WINDOW_STATE_HIDDEN:
((struct _Ecore_Win32_Window *)window)->state.hidden = 1;
break;
case ECORE_WIN32_WINDOW_STATE_FULLSCREEN:
if (((struct _Ecore_Win32_Window *)window)->state.fullscreen)
ecore_win32_window_fullscreen_set(window, set);
break;
case ECORE_WIN32_WINDOW_STATE_ABOVE:
if (((struct _Ecore_Win32_Window *)window)->state.above)
SetWindowPos(((struct _Ecore_Win32_Window *)window)->window,
HWND_TOP,
0, 0,
0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
break;
case ECORE_WIN32_WINDOW_STATE_BELOW:
if (((struct _Ecore_Win32_Window *)window)->state.below)
SetWindowPos(((struct _Ecore_Win32_Window *)window)->window,
HWND_BOTTOM,
0, 0,
0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
break;
case ECORE_WIN32_WINDOW_STATE_DEMANDS_ATTENTION:
((struct _Ecore_Win32_Window *)window)->state.demands_attention = 1;
break;
case ECORE_WIN32_WINDOW_STATE_UNKNOWN:
/* nothing to be done */
break;
}
}
EAPI void
ecore_win32_window_type_set(Ecore_Win32_Window *window,
Ecore_Win32_Window_Type type)
{
switch (type)
{
case ECORE_WIN32_WINDOW_TYPE_DESKTOP:
((struct _Ecore_Win32_Window *)window)->type.desktop = 1;
break;
case ECORE_WIN32_WINDOW_TYPE_DOCK:
((struct _Ecore_Win32_Window *)window)->type.dock = 1;
break;
case ECORE_WIN32_WINDOW_TYPE_TOOLBAR:
((struct _Ecore_Win32_Window *)window)->type.toolbar = 1;
break;
case ECORE_WIN32_WINDOW_TYPE_MENU:
((struct _Ecore_Win32_Window *)window)->type.menu = 1;
break;
case ECORE_WIN32_WINDOW_TYPE_UTILITY:
((struct _Ecore_Win32_Window *)window)->type.utility = 1;
break;
case ECORE_WIN32_WINDOW_TYPE_SPLASH:
((struct _Ecore_Win32_Window *)window)->type.splash = 1;
break;
case ECORE_WIN32_WINDOW_TYPE_DIALOG:
((struct _Ecore_Win32_Window *)window)->type.dialog = 1;
break;
case ECORE_WIN32_WINDOW_TYPE_NORMAL:
((struct _Ecore_Win32_Window *)window)->type.normal = 1;
break;
case ECORE_WIN32_WINDOW_TYPE_UNKNOWN:
((struct _Ecore_Win32_Window *)window)->type.normal = 1;
break;
}
}