forked from enlightenment/efl
reorganize header files and fix minor warnings
SVN revision: 34910
This commit is contained in:
parent
a2c9599b9f
commit
6b048a4eb5
|
@ -2,17 +2,211 @@
|
||||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h> /* for printf */
|
||||||
|
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#include <windows.h>
|
||||||
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
|
|
||||||
|
#ifdef HAVE_OPENGL_GLEW
|
||||||
|
# include <GL/glew.h>
|
||||||
|
#endif /* HAVE_OPENGL_GLEW */
|
||||||
|
|
||||||
|
#include "Ecore.h"
|
||||||
|
#include "Ecore_Win32.h"
|
||||||
#include "ecore_win32_private.h"
|
#include "ecore_win32_private.h"
|
||||||
|
|
||||||
|
|
||||||
|
/***** Global declarations *****/
|
||||||
|
|
||||||
HINSTANCE _ecore_win32_instance = NULL;
|
HINSTANCE _ecore_win32_instance = NULL;
|
||||||
double _ecore_win32_double_click_time = 0.25;
|
double _ecore_win32_double_click_time = 0.25;
|
||||||
double _ecore_win32_event_last_time = 0.0;
|
double _ecore_win32_event_last_time = 0.0;
|
||||||
Ecore_Win32_Window *_ecore_win32_event_last_window = NULL;
|
Ecore_Win32_Window *_ecore_win32_event_last_window = NULL;
|
||||||
|
|
||||||
static int _ecore_win32_init_count = 0;
|
int ECORE_WIN32_EVENT_KEY_DOWN = 0;
|
||||||
|
int ECORE_WIN32_EVENT_KEY_UP = 0;
|
||||||
|
int ECORE_WIN32_EVENT_MOUSE_BUTTON_DOWN = 0;
|
||||||
|
int ECORE_WIN32_EVENT_MOUSE_BUTTON_UP = 0;
|
||||||
|
int ECORE_WIN32_EVENT_MOUSE_MOVE = 0;
|
||||||
|
int ECORE_WIN32_EVENT_MOUSE_IN = 0;
|
||||||
|
int ECORE_WIN32_EVENT_MOUSE_OUT = 0;
|
||||||
|
int ECORE_WIN32_EVENT_MOUSE_WHEEL = 0;
|
||||||
|
int ECORE_WIN32_EVENT_WINDOW_FOCUS_IN = 0;
|
||||||
|
int ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT = 0;
|
||||||
|
int ECORE_WIN32_EVENT_WINDOW_DAMAGE = 0;
|
||||||
|
int ECORE_WIN32_EVENT_WINDOW_CREATE = 0;
|
||||||
|
int ECORE_WIN32_EVENT_WINDOW_DESTROY = 0;
|
||||||
|
int ECORE_WIN32_EVENT_WINDOW_SHOW = 0;
|
||||||
|
int ECORE_WIN32_EVENT_WINDOW_HIDE = 0;
|
||||||
|
int ECORE_WIN32_EVENT_WINDOW_CONFIGURE = 0;
|
||||||
|
int ECORE_WIN32_EVENT_WINDOW_RESIZE = 0;
|
||||||
|
int ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/***** Private declarations *****/
|
||||||
|
|
||||||
|
static int _ecore_win32_init_count = 0;
|
||||||
|
|
||||||
|
LRESULT CALLBACK _ecore_win32_window_procedure(HWND window,
|
||||||
|
UINT message,
|
||||||
|
WPARAM window_param,
|
||||||
|
LPARAM data_param);
|
||||||
|
|
||||||
|
|
||||||
|
/***** API *****/
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
ecore_win32_init()
|
||||||
|
{
|
||||||
|
WNDCLASS wc;
|
||||||
|
|
||||||
|
if (_ecore_win32_init_count > 0)
|
||||||
|
{
|
||||||
|
_ecore_win32_init_count++;
|
||||||
|
return _ecore_win32_init_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf (" *** ecore_win32_init\n");
|
||||||
|
_ecore_win32_instance = GetModuleHandle(NULL);
|
||||||
|
if (!_ecore_win32_instance)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
memset (&wc, 0, sizeof (WNDCLASS));
|
||||||
|
wc.style = CS_HREDRAW | CS_VREDRAW;
|
||||||
|
wc.lpfnWndProc = _ecore_win32_window_procedure;
|
||||||
|
wc.cbClsExtra = 0;
|
||||||
|
wc.cbWndExtra = 0;
|
||||||
|
wc.hInstance = _ecore_win32_instance;
|
||||||
|
wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
|
||||||
|
wc.hCursor = LoadCursor (NULL, IDC_ARROW);
|
||||||
|
wc.hbrBackground = (HBRUSH)(1 + COLOR_BTNFACE);
|
||||||
|
wc.lpszMenuName = NULL;
|
||||||
|
wc.lpszClassName = ECORE_WIN32_WINDOW_CLASS;
|
||||||
|
|
||||||
|
if(!RegisterClass(&wc))
|
||||||
|
{
|
||||||
|
FreeLibrary(_ecore_win32_instance);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ECORE_WIN32_EVENT_KEY_DOWN)
|
||||||
|
{
|
||||||
|
ECORE_WIN32_EVENT_KEY_DOWN = ecore_event_type_new();
|
||||||
|
ECORE_WIN32_EVENT_KEY_UP = ecore_event_type_new();
|
||||||
|
ECORE_WIN32_EVENT_MOUSE_BUTTON_DOWN = ecore_event_type_new();
|
||||||
|
ECORE_WIN32_EVENT_MOUSE_BUTTON_UP = ecore_event_type_new();
|
||||||
|
ECORE_WIN32_EVENT_MOUSE_MOVE = ecore_event_type_new();
|
||||||
|
ECORE_WIN32_EVENT_MOUSE_IN = ecore_event_type_new();
|
||||||
|
ECORE_WIN32_EVENT_MOUSE_OUT = ecore_event_type_new();
|
||||||
|
ECORE_WIN32_EVENT_MOUSE_WHEEL = ecore_event_type_new();
|
||||||
|
ECORE_WIN32_EVENT_WINDOW_FOCUS_IN = ecore_event_type_new();
|
||||||
|
ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT = ecore_event_type_new();
|
||||||
|
ECORE_WIN32_EVENT_WINDOW_DAMAGE = ecore_event_type_new();
|
||||||
|
ECORE_WIN32_EVENT_WINDOW_CREATE = ecore_event_type_new();
|
||||||
|
ECORE_WIN32_EVENT_WINDOW_DESTROY = ecore_event_type_new();
|
||||||
|
ECORE_WIN32_EVENT_WINDOW_SHOW = ecore_event_type_new();
|
||||||
|
ECORE_WIN32_EVENT_WINDOW_HIDE = ecore_event_type_new();
|
||||||
|
ECORE_WIN32_EVENT_WINDOW_CONFIGURE = ecore_event_type_new();
|
||||||
|
ECORE_WIN32_EVENT_WINDOW_RESIZE = ecore_event_type_new();
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
ecore_win32_shutdown()
|
||||||
|
{
|
||||||
|
_ecore_win32_init_count++;
|
||||||
|
if (_ecore_win32_init_count > 0) return _ecore_win32_init_count;
|
||||||
|
if (!_ecore_win32_instance) return _ecore_win32_init_count;
|
||||||
|
|
||||||
|
UnregisterClass(ECORE_WIN32_WINDOW_CLASS, _ecore_win32_instance);
|
||||||
|
FreeLibrary(_ecore_win32_instance);
|
||||||
|
_ecore_win32_instance = NULL;
|
||||||
|
|
||||||
|
if (_ecore_win32_init_count < 0) _ecore_win32_init_count = 0;
|
||||||
|
|
||||||
|
return _ecore_win32_init_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
ecore_win32_screen_depth_get()
|
||||||
|
{
|
||||||
|
HDC dc;
|
||||||
|
int depth;
|
||||||
|
|
||||||
|
dc = GetDC(NULL);
|
||||||
|
if (!dc)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
depth = GetDeviceCaps(dc, BITSPIXEL);
|
||||||
|
ReleaseDC(NULL, dc);
|
||||||
|
|
||||||
|
return depth;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the timeout for a double and triple clicks to be flagged.
|
||||||
|
*
|
||||||
|
* This sets the time between clicks before the double_click flag is
|
||||||
|
* set in a button down event. If 3 clicks occur within double this
|
||||||
|
* time, the triple_click flag is also set.
|
||||||
|
*
|
||||||
|
* @param t The time in seconds
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
ecore_win32_double_click_time_set(double t)
|
||||||
|
{
|
||||||
|
if (t < 0.0) t = 0.0;
|
||||||
|
_ecore_win32_double_click_time = t;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the double and triple click flag timeout.
|
||||||
|
*
|
||||||
|
* See @ref ecore_win32_double_click_time_set for more information.
|
||||||
|
*
|
||||||
|
* @return The timeout for double clicks in seconds.
|
||||||
|
*/
|
||||||
|
double
|
||||||
|
ecore_win32_double_click_time_get(void)
|
||||||
|
{
|
||||||
|
return _ecore_win32_double_click_time;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the last event time
|
||||||
|
*/
|
||||||
|
double
|
||||||
|
ecore_win32_current_time_get(void)
|
||||||
|
{
|
||||||
|
return _ecore_win32_event_last_time;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***** Private functions definitions *****/
|
||||||
|
|
||||||
|
|
||||||
LRESULT CALLBACK
|
LRESULT CALLBACK
|
||||||
|
@ -231,191 +425,3 @@ _ecore_win32_window_procedure(HWND window,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Events:
|
|
||||||
|
|
||||||
x * key down
|
|
||||||
* key sys down
|
|
||||||
x * key up
|
|
||||||
* key sys up
|
|
||||||
x * mouse button down left
|
|
||||||
x * mouse button down middle
|
|
||||||
x * mouse button down right
|
|
||||||
x * mouse button up left
|
|
||||||
x * mouse button up middle
|
|
||||||
x * mouse button up right
|
|
||||||
x * mouse move (contains enter)
|
|
||||||
x * mouse leave
|
|
||||||
x * focus in
|
|
||||||
x * focus out
|
|
||||||
x * expose
|
|
||||||
x * create
|
|
||||||
x * destroy
|
|
||||||
x * configure
|
|
||||||
x * resize
|
|
||||||
x * delete
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
EAPI int ECORE_WIN32_EVENT_KEY_DOWN = 0;
|
|
||||||
EAPI int ECORE_WIN32_EVENT_KEY_UP = 0;
|
|
||||||
EAPI int ECORE_WIN32_EVENT_MOUSE_BUTTON_DOWN = 0;
|
|
||||||
EAPI int ECORE_WIN32_EVENT_MOUSE_BUTTON_UP = 0;
|
|
||||||
EAPI int ECORE_WIN32_EVENT_MOUSE_MOVE = 0;
|
|
||||||
EAPI int ECORE_WIN32_EVENT_MOUSE_IN = 0;
|
|
||||||
EAPI int ECORE_WIN32_EVENT_MOUSE_OUT = 0;
|
|
||||||
EAPI int ECORE_WIN32_EVENT_MOUSE_WHEEL = 0;
|
|
||||||
EAPI int ECORE_WIN32_EVENT_WINDOW_FOCUS_IN = 0;
|
|
||||||
EAPI int ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT = 0;
|
|
||||||
EAPI int ECORE_WIN32_EVENT_WINDOW_DAMAGE = 0;
|
|
||||||
EAPI int ECORE_WIN32_EVENT_WINDOW_CREATE = 0;
|
|
||||||
EAPI int ECORE_WIN32_EVENT_WINDOW_DESTROY = 0;
|
|
||||||
EAPI int ECORE_WIN32_EVENT_WINDOW_SHOW = 0;
|
|
||||||
EAPI int ECORE_WIN32_EVENT_WINDOW_HIDE = 0;
|
|
||||||
EAPI int ECORE_WIN32_EVENT_WINDOW_CONFIGURE = 0;
|
|
||||||
EAPI int ECORE_WIN32_EVENT_WINDOW_RESIZE = 0;
|
|
||||||
EAPI int ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST = 0;
|
|
||||||
|
|
||||||
|
|
||||||
EAPI int
|
|
||||||
ecore_win32_init()
|
|
||||||
{
|
|
||||||
WNDCLASS wc;
|
|
||||||
|
|
||||||
if (_ecore_win32_init_count > 0)
|
|
||||||
{
|
|
||||||
_ecore_win32_init_count++;
|
|
||||||
return _ecore_win32_init_count;
|
|
||||||
}
|
|
||||||
|
|
||||||
printf (" *** ecore_win32_init\n");
|
|
||||||
_ecore_win32_instance = GetModuleHandle(NULL);
|
|
||||||
if (!_ecore_win32_instance)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
memset (&wc, 0, sizeof (WNDCLASS));
|
|
||||||
wc.style = CS_HREDRAW | CS_VREDRAW;
|
|
||||||
wc.lpfnWndProc = _ecore_win32_window_procedure;
|
|
||||||
wc.cbClsExtra = 0;
|
|
||||||
wc.cbWndExtra = 0;
|
|
||||||
wc.hInstance = _ecore_win32_instance;
|
|
||||||
wc.hIcon = LoadIcon (NULL, IDI_APPLICATION);
|
|
||||||
wc.hCursor = LoadCursor (NULL, IDC_ARROW);
|
|
||||||
wc.hbrBackground = (HBRUSH)(1 + COLOR_BTNFACE);
|
|
||||||
wc.lpszMenuName = NULL;
|
|
||||||
wc.lpszClassName = ECORE_WIN32_WINDOW_CLASS;
|
|
||||||
|
|
||||||
if(!RegisterClass(&wc))
|
|
||||||
{
|
|
||||||
FreeLibrary(_ecore_win32_instance);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!ECORE_WIN32_EVENT_KEY_DOWN)
|
|
||||||
{
|
|
||||||
ECORE_WIN32_EVENT_KEY_DOWN = ecore_event_type_new();
|
|
||||||
ECORE_WIN32_EVENT_KEY_UP = ecore_event_type_new();
|
|
||||||
ECORE_WIN32_EVENT_MOUSE_BUTTON_DOWN = ecore_event_type_new();
|
|
||||||
ECORE_WIN32_EVENT_MOUSE_BUTTON_UP = ecore_event_type_new();
|
|
||||||
ECORE_WIN32_EVENT_MOUSE_MOVE = ecore_event_type_new();
|
|
||||||
ECORE_WIN32_EVENT_MOUSE_IN = ecore_event_type_new();
|
|
||||||
ECORE_WIN32_EVENT_MOUSE_OUT = ecore_event_type_new();
|
|
||||||
ECORE_WIN32_EVENT_MOUSE_WHEEL = ecore_event_type_new();
|
|
||||||
ECORE_WIN32_EVENT_WINDOW_FOCUS_IN = ecore_event_type_new();
|
|
||||||
ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT = ecore_event_type_new();
|
|
||||||
ECORE_WIN32_EVENT_WINDOW_DAMAGE = ecore_event_type_new();
|
|
||||||
ECORE_WIN32_EVENT_WINDOW_CREATE = ecore_event_type_new();
|
|
||||||
ECORE_WIN32_EVENT_WINDOW_DESTROY = ecore_event_type_new();
|
|
||||||
ECORE_WIN32_EVENT_WINDOW_SHOW = ecore_event_type_new();
|
|
||||||
ECORE_WIN32_EVENT_WINDOW_HIDE = ecore_event_type_new();
|
|
||||||
ECORE_WIN32_EVENT_WINDOW_CONFIGURE = ecore_event_type_new();
|
|
||||||
ECORE_WIN32_EVENT_WINDOW_RESIZE = ecore_event_type_new();
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI int
|
|
||||||
ecore_win32_shutdown()
|
|
||||||
{
|
|
||||||
_ecore_win32_init_count++;
|
|
||||||
if (_ecore_win32_init_count > 0) return _ecore_win32_init_count;
|
|
||||||
if (!_ecore_win32_instance) return _ecore_win32_init_count;
|
|
||||||
|
|
||||||
UnregisterClass(ECORE_WIN32_WINDOW_CLASS, _ecore_win32_instance);
|
|
||||||
FreeLibrary(_ecore_win32_instance);
|
|
||||||
_ecore_win32_instance = NULL;
|
|
||||||
|
|
||||||
if (_ecore_win32_init_count < 0) _ecore_win32_init_count = 0;
|
|
||||||
|
|
||||||
return _ecore_win32_init_count;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI int
|
|
||||||
ecore_win32_screen_depth_get()
|
|
||||||
{
|
|
||||||
HDC dc;
|
|
||||||
int depth;
|
|
||||||
|
|
||||||
dc = GetDC(NULL);
|
|
||||||
if (!dc)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
depth = GetDeviceCaps(dc, BITSPIXEL);
|
|
||||||
ReleaseDC(NULL, dc);
|
|
||||||
|
|
||||||
return depth;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the timeout for a double and triple clicks to be flagged.
|
|
||||||
*
|
|
||||||
* This sets the time between clicks before the double_click flag is
|
|
||||||
* set in a button down event. If 3 clicks occur within double this
|
|
||||||
* time, the triple_click flag is also set.
|
|
||||||
*
|
|
||||||
* @param t The time in seconds
|
|
||||||
*/
|
|
||||||
EAPI void
|
|
||||||
ecore_win32_double_click_time_set(double t)
|
|
||||||
{
|
|
||||||
if (t < 0.0) t = 0.0;
|
|
||||||
_ecore_win32_double_click_time = t;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Retrieves the double and triple click flag timeout.
|
|
||||||
*
|
|
||||||
* See @ref ecore_win32_double_click_time_set for more information.
|
|
||||||
*
|
|
||||||
* @return The timeout for double clicks in seconds.
|
|
||||||
*/
|
|
||||||
EAPI double
|
|
||||||
ecore_win32_double_click_time_get(void)
|
|
||||||
{
|
|
||||||
return _ecore_win32_double_click_time;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the last event time
|
|
||||||
*/
|
|
||||||
EAPI double
|
|
||||||
ecore_win32_current_time_get(void)
|
|
||||||
{
|
|
||||||
return _ecore_win32_event_last_time;
|
|
||||||
}
|
|
||||||
|
|
|
@ -2,9 +2,21 @@
|
||||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#include <windows.h>
|
||||||
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
|
|
||||||
|
#include "Ecore_Win32.h"
|
||||||
#include "ecore_win32_private.h"
|
#include "ecore_win32_private.h"
|
||||||
|
|
||||||
EAPI Ecore_Win32_Cursor *
|
|
||||||
|
/***** API *****/
|
||||||
|
|
||||||
|
Ecore_Win32_Cursor *
|
||||||
ecore_win32_cursor_new(const void *pixels_and,
|
ecore_win32_cursor_new(const void *pixels_and,
|
||||||
const void *pixels_xor,
|
const void *pixels_xor,
|
||||||
int width,
|
int width,
|
||||||
|
@ -33,13 +45,13 @@ ecore_win32_cursor_new(const void *pixels_and,
|
||||||
return cursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI void
|
void
|
||||||
ecore_win32_cursor_free(Ecore_Win32_Cursor *cursor)
|
ecore_win32_cursor_free(Ecore_Win32_Cursor *cursor)
|
||||||
{
|
{
|
||||||
DestroyCursor(cursor);
|
DestroyCursor(cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Ecore_Win32_Cursor *
|
Ecore_Win32_Cursor *
|
||||||
ecore_win32_cursor_shape_get(Ecore_Win32_Cursor_Shape shape)
|
ecore_win32_cursor_shape_get(Ecore_Win32_Cursor_Shape shape)
|
||||||
{
|
{
|
||||||
Ecore_Win32_Cursor *cursor = NULL;
|
Ecore_Win32_Cursor *cursor = NULL;
|
||||||
|
@ -99,7 +111,7 @@ ecore_win32_cursor_shape_get(Ecore_Win32_Cursor_Shape shape)
|
||||||
return cursor;
|
return cursor;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI int
|
int
|
||||||
ecore_win32_cursor_size_get(void)
|
ecore_win32_cursor_size_get(void)
|
||||||
{
|
{
|
||||||
int width;
|
int width;
|
||||||
|
|
|
@ -1,312 +0,0 @@
|
||||||
/*
|
|
||||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include "config.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <cstdio>
|
|
||||||
|
|
||||||
#include "ecore_win32_private.h"
|
|
||||||
#include "Ecore_Win32.h"
|
|
||||||
|
|
||||||
|
|
||||||
EAPI int
|
|
||||||
ecore_win32_ddraw_init(Ecore_Win32_Window *window)
|
|
||||||
{
|
|
||||||
#ifdef HAVE_DIRECTDRAW
|
|
||||||
DDSURFACEDESC surface_desc;
|
|
||||||
DDPIXELFORMAT pixel_format;
|
|
||||||
RECT rect;
|
|
||||||
struct _Ecore_Win32_Window *w;
|
|
||||||
|
|
||||||
if (!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(DirectDrawCreate(NULL, &w->ddraw.object, NULL)))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (FAILED(w->ddraw.object->SetCooperativeLevel(w->window, DDSCL_NORMAL)))
|
|
||||||
goto no_coop_level;
|
|
||||||
|
|
||||||
if (FAILED(w->ddraw.object->CreateClipper(0, &w->ddraw.clipper, NULL)))
|
|
||||||
goto no_clipper;
|
|
||||||
|
|
||||||
if (FAILED(w->ddraw.clipper->SetHWnd(0, w->window)))
|
|
||||||
goto no_clipper_set_window;
|
|
||||||
|
|
||||||
memset (&surface_desc, 0, sizeof (surface_desc));
|
|
||||||
surface_desc.dwSize = sizeof (surface_desc);
|
|
||||||
surface_desc.dwFlags = DDSD_CAPS;
|
|
||||||
surface_desc.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
|
|
||||||
|
|
||||||
if (FAILED(w->ddraw.object->CreateSurface(&surface_desc,
|
|
||||||
&w->ddraw.surface_primary,
|
|
||||||
NULL)))
|
|
||||||
goto no_primary_surf;
|
|
||||||
|
|
||||||
if (FAILED(w->ddraw.surface_primary->SetClipper(w->ddraw.clipper)))
|
|
||||||
goto no_primary_surf_set_clipper;
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
if (FAILED(w->ddraw.object->CreateSurface(&surface_desc,
|
|
||||||
&w->ddraw.surface_back,
|
|
||||||
NULL)))
|
|
||||||
goto no_back_surf;
|
|
||||||
|
|
||||||
ZeroMemory(&pixel_format, sizeof(pixel_format));
|
|
||||||
pixel_format.dwSize = sizeof(pixel_format);
|
|
||||||
|
|
||||||
if (FAILED(w->ddraw.surface_primary->GetPixelFormat(&pixel_format)))
|
|
||||||
goto no_get_pix_fmt;
|
|
||||||
|
|
||||||
w->ddraw.depth = pixel_format.dwRGBBitCount;
|
|
||||||
|
|
||||||
w->backend = ECORE_WIN32_BACKEND_DIRECTDRAW;
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
no_get_pix_fmt:
|
|
||||||
/* no need to release the back surface. the next call free its memory */
|
|
||||||
no_back_surf:
|
|
||||||
no_get_client:
|
|
||||||
no_primary_surf_set_clipper:
|
|
||||||
w->ddraw.surface_primary->Release();
|
|
||||||
no_primary_surf:
|
|
||||||
no_clipper_set_window:
|
|
||||||
w->ddraw.clipper->Release();
|
|
||||||
no_clipper:
|
|
||||||
no_coop_level:
|
|
||||||
w->ddraw.object->Release();
|
|
||||||
#endif /* HAVE_DIRECTDRAW */
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI int
|
|
||||||
ecore_win32_ddraw_16_init(Ecore_Win32_Window *window)
|
|
||||||
{
|
|
||||||
#ifdef HAVE_DIRECTDRAW
|
|
||||||
DDSURFACEDESC surface_desc;
|
|
||||||
DDPIXELFORMAT pixel_format;
|
|
||||||
RECT rect;
|
|
||||||
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(DirectDrawCreate(NULL, &w->ddraw.object, NULL)))
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
if (FAILED(w->ddraw.object->SetCooperativeLevel(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;
|
|
||||||
|
|
||||||
if (FAILED(w->ddraw.object->CreateSurface(&surface_desc,
|
|
||||||
&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;
|
|
||||||
|
|
||||||
if (FAILED(w->ddraw.object->CreateSurface(&surface_desc,
|
|
||||||
&w->ddraw.surface_back,
|
|
||||||
NULL)))
|
|
||||||
goto no_back_surf;
|
|
||||||
|
|
||||||
ZeroMemory(&pixel_format, sizeof(pixel_format));
|
|
||||||
pixel_format.dwSize = sizeof(pixel_format);
|
|
||||||
|
|
||||||
if (FAILED(w->ddraw.surface_primary->GetPixelFormat(&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;
|
|
||||||
|
|
||||||
if (FAILED(w->ddraw.object->CreateSurface(&surface_desc,
|
|
||||||
&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:
|
|
||||||
w->ddraw.surface_primary->Release();
|
|
||||||
no_primary_surf:
|
|
||||||
no_coop_level:
|
|
||||||
w->ddraw.object->Release();
|
|
||||||
#endif /* HAVE_DIRECTDRAW */
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
ecore_win32_ddraw_shutdown(Ecore_Win32_Window *window)
|
|
||||||
{
|
|
||||||
#ifdef HAVE_DIRECTDRAW
|
|
||||||
struct _Ecore_Win32_Window *w;
|
|
||||||
|
|
||||||
if (!window)
|
|
||||||
return;
|
|
||||||
|
|
||||||
w = (struct _Ecore_Win32_Window *)window;
|
|
||||||
|
|
||||||
if (w->ddraw.surface_primary)
|
|
||||||
{
|
|
||||||
w->ddraw.surface_primary->Release();
|
|
||||||
w->ddraw.surface_primary = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (w->ddraw.surface_source)
|
|
||||||
{
|
|
||||||
DDSURFACEDESC surface_desc;
|
|
||||||
|
|
||||||
ZeroMemory(&surface_desc, sizeof(surface_desc));
|
|
||||||
surface_desc.dwSize = sizeof(surface_desc);
|
|
||||||
|
|
||||||
if (w->ddraw.surface_source->Lock(NULL,
|
|
||||||
&surface_desc,
|
|
||||||
DDLOCK_WAIT | DDLOCK_SURFACEMEMORYPTR,
|
|
||||||
NULL) == DD_OK)
|
|
||||||
{
|
|
||||||
free(surface_desc.lpSurface);
|
|
||||||
if (w->ddraw.surface_source->Unlock(NULL) == DD_OK)
|
|
||||||
{
|
|
||||||
w->ddraw.surface_source->Release();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
w->ddraw.surface_source = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* no need to release the back surface. the previous call free its memory */
|
|
||||||
|
|
||||||
if (w->ddraw.clipper)
|
|
||||||
{
|
|
||||||
w->ddraw.clipper->Release();
|
|
||||||
w->ddraw.clipper = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (w->ddraw.object)
|
|
||||||
{
|
|
||||||
w->ddraw.object->Release();
|
|
||||||
w->ddraw.object = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
w->backend = ECORE_WIN32_BACKEND_NONE;
|
|
||||||
#endif /* HAVE_DIRECTDRAW */
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI Ecore_Win32_DDraw_Object *
|
|
||||||
ecore_win32_ddraw_object_get(Ecore_Win32_Window *window)
|
|
||||||
{
|
|
||||||
#ifdef HAVE_DIRECTDRAW
|
|
||||||
return ((struct _Ecore_Win32_Window *)window)->ddraw.object;
|
|
||||||
#else
|
|
||||||
return NULL;
|
|
||||||
#endif /* HAVE_DIRECTDRAW */
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI Ecore_Win32_DDraw_Surface *
|
|
||||||
ecore_win32_ddraw_surface_primary_get(Ecore_Win32_Window *window)
|
|
||||||
{
|
|
||||||
#ifdef HAVE_DIRECTDRAW
|
|
||||||
return ((struct _Ecore_Win32_Window *)window)->ddraw.surface_primary;
|
|
||||||
#else
|
|
||||||
return NULL;
|
|
||||||
#endif /* HAVE_DIRECTDRAW */
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI Ecore_Win32_DDraw_Surface *
|
|
||||||
ecore_win32_ddraw_surface_back_get(Ecore_Win32_Window *window)
|
|
||||||
{
|
|
||||||
#ifdef HAVE_DIRECTDRAW
|
|
||||||
return ((struct _Ecore_Win32_Window *)window)->ddraw.surface_back;
|
|
||||||
#else
|
|
||||||
return NULL;
|
|
||||||
#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)
|
|
||||||
{
|
|
||||||
#ifdef HAVE_DIRECTDRAW
|
|
||||||
return ((struct _Ecore_Win32_Window *)window)->ddraw.depth;
|
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif /* HAVE_DIRECTDRAW */
|
|
||||||
}
|
|
|
@ -1,212 +0,0 @@
|
||||||
/*
|
|
||||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "ecore_win32_private.h"
|
|
||||||
#include "Ecore_Win32.h"
|
|
||||||
#include <cstdio>
|
|
||||||
|
|
||||||
|
|
||||||
EAPI int
|
|
||||||
ecore_win32_direct3d_init(Ecore_Win32_Window *window)
|
|
||||||
{
|
|
||||||
#ifdef HAVE_DIRECT3D
|
|
||||||
D3DPRESENT_PARAMETERS pp;
|
|
||||||
D3DDISPLAYMODE dm;
|
|
||||||
D3DSURFACE_DESC sd;
|
|
||||||
D3DCAPS9 caps;
|
|
||||||
RECT rect;
|
|
||||||
struct _Ecore_Win32_Window *w;
|
|
||||||
DWORD flag;
|
|
||||||
|
|
||||||
if (!window)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
if (FAILED (w->d3d.object->GetAdapterDisplayMode (D3DADAPTER_DEFAULT,
|
|
||||||
&dm)))
|
|
||||||
goto no_get_adapter;
|
|
||||||
|
|
||||||
if (FAILED (w->d3d.object->GetDeviceCaps (D3DADAPTER_DEFAULT,
|
|
||||||
D3DDEVTYPE_HAL,
|
|
||||||
&caps)))
|
|
||||||
goto no_caps;
|
|
||||||
|
|
||||||
if (!GetClientRect(w->window, &rect))
|
|
||||||
goto no_get_client;
|
|
||||||
|
|
||||||
flag = (caps.VertexProcessingCaps != 0)
|
|
||||||
? D3DCREATE_HARDWARE_VERTEXPROCESSING
|
|
||||||
: D3DCREATE_SOFTWARE_VERTEXPROCESSING;
|
|
||||||
|
|
||||||
ZeroMemory(&pp, sizeof(pp));
|
|
||||||
pp.BackBufferWidth = rect.right - rect.left;
|
|
||||||
pp.BackBufferHeight = rect.bottom - rect.top;
|
|
||||||
pp.BackBufferFormat = dm.Format;
|
|
||||||
pp.BackBufferCount = 1;
|
|
||||||
pp.MultiSampleType = D3DMULTISAMPLE_NONE;
|
|
||||||
pp.MultiSampleQuality = 0;
|
|
||||||
pp.SwapEffect = D3DSWAPEFFECT_FLIP;
|
|
||||||
pp.hDeviceWindow = w->window;
|
|
||||||
pp.Windowed = TRUE;
|
|
||||||
pp.EnableAutoDepthStencil = FALSE;
|
|
||||||
pp.FullScreen_RefreshRateInHz = 0;
|
|
||||||
pp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
|
|
||||||
|
|
||||||
if (FAILED(w->d3d.object->CreateDevice (D3DADAPTER_DEFAULT,
|
|
||||||
D3DDEVTYPE_HAL,
|
|
||||||
w->window,
|
|
||||||
flag,
|
|
||||||
&pp,
|
|
||||||
&w->d3d.device)))
|
|
||||||
goto no_device;
|
|
||||||
|
|
||||||
if (FAILED (D3DXCreateSprite (w->d3d.device, &w->d3d.sprite)))
|
|
||||||
goto no_sprite;
|
|
||||||
|
|
||||||
if (FAILED (w->d3d.device->CreateTexture (rect.right - rect.left,
|
|
||||||
rect.bottom - rect.top,
|
|
||||||
1,
|
|
||||||
D3DUSAGE_DYNAMIC,
|
|
||||||
dm.Format,
|
|
||||||
D3DPOOL_DEFAULT,
|
|
||||||
&w->d3d.texture, NULL)))
|
|
||||||
goto no_texture;
|
|
||||||
|
|
||||||
if (FAILED (w->d3d.texture->GetLevelDesc (0, &sd)))
|
|
||||||
goto no_level_desc;
|
|
||||||
|
|
||||||
switch (sd.Format) {
|
|
||||||
case D3DFMT_A8R8G8B8:
|
|
||||||
case D3DFMT_X8R8G8B8:
|
|
||||||
w->d3d.depth = 32;
|
|
||||||
break;
|
|
||||||
case D3DFMT_R5G6B5:
|
|
||||||
w->d3d.depth = 16;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
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:
|
|
||||||
no_level_desc:
|
|
||||||
w->d3d.texture->Release();
|
|
||||||
no_texture:
|
|
||||||
w->d3d.sprite->Release();
|
|
||||||
no_sprite:
|
|
||||||
w->d3d.device->Release();
|
|
||||||
no_device:
|
|
||||||
no_get_client:
|
|
||||||
no_caps:
|
|
||||||
no_get_adapter:
|
|
||||||
w->d3d.object->Release();
|
|
||||||
#endif /* HAVE_DIRECT3D */
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI void
|
|
||||||
ecore_win32_direct3d_shutdown(Ecore_Win32_Window *window)
|
|
||||||
{
|
|
||||||
#ifdef HAVE_DIRECT3D
|
|
||||||
struct _Ecore_Win32_Window *w;
|
|
||||||
|
|
||||||
if (!window)
|
|
||||||
return;
|
|
||||||
|
|
||||||
w = (struct _Ecore_Win32_Window *)window;
|
|
||||||
|
|
||||||
printf ("0\n");
|
|
||||||
if (w->d3d.texture)
|
|
||||||
w->d3d.texture->Release();
|
|
||||||
|
|
||||||
printf ("1\n");
|
|
||||||
// if (w->d3d.sprite)
|
|
||||||
// w->d3d.sprite->OnLostDevice();
|
|
||||||
|
|
||||||
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 */
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI Ecore_Win32_Direct3D_Object *
|
|
||||||
ecore_win32_direct3d_object_get(Ecore_Win32_Window *window)
|
|
||||||
{
|
|
||||||
#ifdef HAVE_DIRECT3D
|
|
||||||
return ((struct _Ecore_Win32_Window *)window)->d3d.object;
|
|
||||||
#else
|
|
||||||
return NULL;
|
|
||||||
#endif /* HAVE_DIRECT3D */
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI Ecore_Win32_Direct3D_Device *
|
|
||||||
ecore_win32_direct3d_device_get(Ecore_Win32_Window *window)
|
|
||||||
{
|
|
||||||
#ifdef HAVE_DIRECT3D
|
|
||||||
return ((struct _Ecore_Win32_Window *)window)->d3d.device;
|
|
||||||
#else
|
|
||||||
return NULL;
|
|
||||||
#endif /* HAVE_DIRECT3D */
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI Ecore_Win32_Direct3D_Sprite *
|
|
||||||
ecore_win32_direct3d_sprite_get(Ecore_Win32_Window *window)
|
|
||||||
{
|
|
||||||
#ifdef HAVE_DIRECT3D
|
|
||||||
return ((struct _Ecore_Win32_Window *)window)->d3d.sprite;
|
|
||||||
#else
|
|
||||||
return NULL;
|
|
||||||
#endif /* HAVE_DIRECT3D */
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI Ecore_Win32_Direct3D_Texture *
|
|
||||||
ecore_win32_direct3d_texture_get(Ecore_Win32_Window *window)
|
|
||||||
{
|
|
||||||
#ifdef HAVE_DIRECT3D
|
|
||||||
return ((struct _Ecore_Win32_Window *)window)->d3d.texture;
|
|
||||||
#else
|
|
||||||
return NULL;
|
|
||||||
#endif /* HAVE_DIRECT3D */
|
|
||||||
}
|
|
||||||
|
|
||||||
EAPI int
|
|
||||||
ecore_win32_direct3d_depth_get(Ecore_Win32_Window *window)
|
|
||||||
{
|
|
||||||
#ifdef HAVE_DIRECT3D
|
|
||||||
return ((struct _Ecore_Win32_Window *)window)->d3d.depth;
|
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif /* HAVE_DIRECT3D */
|
|
||||||
}
|
|
|
@ -2,13 +2,26 @@
|
||||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h> /* for printf */
|
||||||
|
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
|
|
||||||
#include "Ecore.h"
|
#include "Ecore.h"
|
||||||
|
#include "Ecore_Win32.h"
|
||||||
#include "ecore_win32_private.h"
|
#include "ecore_win32_private.h"
|
||||||
|
|
||||||
|
|
||||||
|
/***** Private declarations *****/
|
||||||
|
|
||||||
|
|
||||||
static Ecore_Win32_Window *_ecore_win32_mouse_down_last_window = NULL;
|
static Ecore_Win32_Window *_ecore_win32_mouse_down_last_window = NULL;
|
||||||
static Ecore_Win32_Window *_ecore_win32_mouse_down_last_last_window = NULL;
|
static Ecore_Win32_Window *_ecore_win32_mouse_down_last_last_window = NULL;
|
||||||
static double _ecore_win32_mouse_down_last_time = 0;
|
static double _ecore_win32_mouse_down_last_time = 0;
|
||||||
|
@ -16,318 +29,24 @@ static double _ecore_win32_mouse_down_last_last_time = 0;
|
||||||
static int _ecore_win32_mouse_down_did_triple = 0;
|
static int _ecore_win32_mouse_down_did_triple = 0;
|
||||||
static int _ecore_win32_mouse_up_count = 0;
|
static int _ecore_win32_mouse_up_count = 0;
|
||||||
|
|
||||||
static void
|
static void _ecore_win32_event_free_key_down(void *data,
|
||||||
_ecore_win32_event_free_key_down(void *data,
|
void *ev);
|
||||||
void *ev)
|
|
||||||
{
|
|
||||||
Ecore_Win32_Event_Key_Down *e;
|
|
||||||
|
|
||||||
e = ev;
|
static void _ecore_win32_event_free_key_up(void *data,
|
||||||
if (e->keyname) free(e->keyname);
|
void *ev);
|
||||||
if (e->keysymbol) free(e->keysymbol);
|
|
||||||
if (e->keycompose) free(e->keycompose);
|
|
||||||
free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static int _ecore_win32_event_keystroke_get(int key,
|
||||||
_ecore_win32_event_free_key_up(void *data,
|
char **keyname,
|
||||||
void *ev)
|
char **keysymbol,
|
||||||
{
|
char **keycompose);
|
||||||
Ecore_Win32_Event_Key_Up *e;
|
|
||||||
|
|
||||||
e = ev;
|
static int _ecore_win32_event_char_get(int key,
|
||||||
if (e->keyname) free(e->keyname);
|
char **keyname,
|
||||||
if (e->keysymbol) free(e->keysymbol);
|
char **keysymbol,
|
||||||
if (e->keycompose) free(e->keycompose);
|
char **keycompose);
|
||||||
free(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
_ecore_win32_event_keystroke_get(int key,
|
|
||||||
char **keyname,
|
|
||||||
char **keysymbol,
|
|
||||||
char **keycompose)
|
|
||||||
{
|
|
||||||
char *kn;
|
|
||||||
char *ks;
|
|
||||||
char *kc;
|
|
||||||
|
|
||||||
*keyname = NULL;
|
/***** Global functions definitions *****/
|
||||||
*keysymbol = NULL;
|
|
||||||
*keycompose = NULL;
|
|
||||||
|
|
||||||
switch (key)
|
|
||||||
{
|
|
||||||
/* Keystroke */
|
|
||||||
case VK_PRIOR:
|
|
||||||
kn = "KP_Prior";
|
|
||||||
ks = "KP_Prior";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_NEXT:
|
|
||||||
kn = "KP_Next";
|
|
||||||
ks = "KP_Next";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_END:
|
|
||||||
kn = "KP_End";
|
|
||||||
ks = "KP_End";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_HOME:
|
|
||||||
kn = "KP_Home";
|
|
||||||
ks = "KP_Home";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_LEFT:
|
|
||||||
kn = "KP_Left";
|
|
||||||
ks = "KP_Left";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_UP:
|
|
||||||
kn = "KP_Up";
|
|
||||||
ks = "KP_Up";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_RIGHT:
|
|
||||||
kn = "KP_Right";
|
|
||||||
ks = "KP_Right";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_DOWN:
|
|
||||||
kn = "KP_Down";
|
|
||||||
ks = "KP_Down";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_INSERT:
|
|
||||||
kn = "KP_Insert";
|
|
||||||
ks = "KP_Insert";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_DELETE:
|
|
||||||
kn = "KP_Delete";
|
|
||||||
ks = "KP_Delete";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_F1:
|
|
||||||
kn = "F1";
|
|
||||||
ks = "F1";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_F2:
|
|
||||||
kn = "F2";
|
|
||||||
ks = "F2";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_F3:
|
|
||||||
kn = "F3";
|
|
||||||
ks = "F3";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_F4:
|
|
||||||
kn = "F4";
|
|
||||||
ks = "F4";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_F5:
|
|
||||||
kn = "F5";
|
|
||||||
ks = "F5";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_F6:
|
|
||||||
kn = "F6";
|
|
||||||
ks = "F6";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_F7:
|
|
||||||
kn = "F7";
|
|
||||||
ks = "F7";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_F8:
|
|
||||||
kn = "F8";
|
|
||||||
ks = "F8";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_F9:
|
|
||||||
kn = "F9";
|
|
||||||
ks = "F9";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_F10:
|
|
||||||
kn = "F10";
|
|
||||||
ks = "F10";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_F11:
|
|
||||||
kn = "F11";
|
|
||||||
ks = "F11";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_F12:
|
|
||||||
kn = "F12";
|
|
||||||
ks = "F12";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_F13:
|
|
||||||
kn = "F13";
|
|
||||||
ks = "F13";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_F14:
|
|
||||||
kn = "F14";
|
|
||||||
ks = "F14";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_F15:
|
|
||||||
kn = "F15";
|
|
||||||
ks = "F15";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_F16:
|
|
||||||
kn = "F16";
|
|
||||||
ks = "F16";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_F17:
|
|
||||||
kn = "F17";
|
|
||||||
ks = "F17";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_F18:
|
|
||||||
kn = "F18";
|
|
||||||
ks = "F18";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_F19:
|
|
||||||
kn = "F19";
|
|
||||||
ks = "F19";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_F20:
|
|
||||||
kn = "F20";
|
|
||||||
ks = "F20";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_F21:
|
|
||||||
kn = "F21";
|
|
||||||
ks = "F21";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_F22:
|
|
||||||
kn = "F22";
|
|
||||||
ks = "F22";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_F23:
|
|
||||||
kn = "F23";
|
|
||||||
ks = "F23";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_F24:
|
|
||||||
kn = "F24";
|
|
||||||
ks = "F24";
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
/* other non keystroke characters */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
*keyname = strdup(kn);
|
|
||||||
if (!*keyname) return 0;
|
|
||||||
*keysymbol = strdup(ks);
|
|
||||||
if (!*keysymbol)
|
|
||||||
{
|
|
||||||
free(*keyname);
|
|
||||||
*keyname = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
*keycompose = strdup(kc);
|
|
||||||
if (!*keycompose)
|
|
||||||
{
|
|
||||||
free(*keyname);
|
|
||||||
free(*keysymbol);
|
|
||||||
*keyname = NULL;
|
|
||||||
*keysymbol = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
_ecore_win32_event_char_get(int key,
|
|
||||||
char **keyname,
|
|
||||||
char **keysymbol,
|
|
||||||
char **keycompose)
|
|
||||||
{
|
|
||||||
char kn[32];
|
|
||||||
char ks[32];
|
|
||||||
char *kc;
|
|
||||||
|
|
||||||
*keyname = NULL;
|
|
||||||
*keysymbol = NULL;
|
|
||||||
*keycompose = NULL;
|
|
||||||
|
|
||||||
switch (key)
|
|
||||||
{
|
|
||||||
case VK_BACK:
|
|
||||||
strncpy(kn, "Backspace", 32);
|
|
||||||
strncpy(ks, "Backspace", 32);
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_TAB:
|
|
||||||
strncpy(kn, "Tab", 32);
|
|
||||||
strncpy(ks, "Tab", 32);
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case 0x0a:
|
|
||||||
/* Line feed (Shift + Enter) */
|
|
||||||
strncpy(kn, "LineFeed", 32);
|
|
||||||
strncpy(ks, "LineFeed", 32);
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_RETURN:
|
|
||||||
strncpy(kn, "Return", 32);
|
|
||||||
strncpy(ks, "Return", 32);
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
case VK_ESCAPE:
|
|
||||||
strncpy(kn, "Escape", 32);
|
|
||||||
strncpy(ks, "Escape", 32);
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
/* displayable characters */
|
|
||||||
printf (" * key : %d\n", key);
|
|
||||||
kn[0] = (TCHAR)key;
|
|
||||||
kn[1] = '\0';
|
|
||||||
ks[0] = (TCHAR)key;
|
|
||||||
ks[1] = '\0';
|
|
||||||
kc = "";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
*keyname = strdup(kn);
|
|
||||||
if (!*keyname) return 0;
|
|
||||||
*keysymbol = strdup(ks);
|
|
||||||
if (!*keysymbol)
|
|
||||||
{
|
|
||||||
free(*keyname);
|
|
||||||
*keyname = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
*keycompose = strdup(kc);
|
|
||||||
if (!*keycompose)
|
|
||||||
{
|
|
||||||
free(*keyname);
|
|
||||||
free(*keysymbol);
|
|
||||||
*keyname = NULL;
|
|
||||||
*keysymbol = NULL;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
_ecore_win32_event_handle_key_press(Ecore_Win32_Callback_Data *msg,
|
_ecore_win32_event_handle_key_press(Ecore_Win32_Callback_Data *msg,
|
||||||
|
@ -851,3 +570,319 @@ _ecore_win32_event_handle_delete_request(Ecore_Win32_Callback_Data *msg)
|
||||||
|
|
||||||
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST, e, NULL, NULL);
|
ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST, e, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***** Private functions definitions *****/
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ecore_win32_event_free_key_down(void *data,
|
||||||
|
void *ev)
|
||||||
|
{
|
||||||
|
Ecore_Win32_Event_Key_Down *e;
|
||||||
|
|
||||||
|
e = ev;
|
||||||
|
if (e->keyname) free(e->keyname);
|
||||||
|
if (e->keysymbol) free(e->keysymbol);
|
||||||
|
if (e->keycompose) free(e->keycompose);
|
||||||
|
free(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_ecore_win32_event_free_key_up(void *data,
|
||||||
|
void *ev)
|
||||||
|
{
|
||||||
|
Ecore_Win32_Event_Key_Up *e;
|
||||||
|
|
||||||
|
e = ev;
|
||||||
|
if (e->keyname) free(e->keyname);
|
||||||
|
if (e->keysymbol) free(e->keysymbol);
|
||||||
|
if (e->keycompose) free(e->keycompose);
|
||||||
|
free(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_ecore_win32_event_keystroke_get(int key,
|
||||||
|
char **keyname,
|
||||||
|
char **keysymbol,
|
||||||
|
char **keycompose)
|
||||||
|
{
|
||||||
|
char *kn;
|
||||||
|
char *ks;
|
||||||
|
char *kc;
|
||||||
|
|
||||||
|
*keyname = NULL;
|
||||||
|
*keysymbol = NULL;
|
||||||
|
*keycompose = NULL;
|
||||||
|
|
||||||
|
switch (key)
|
||||||
|
{
|
||||||
|
/* Keystroke */
|
||||||
|
case VK_PRIOR:
|
||||||
|
kn = "KP_Prior";
|
||||||
|
ks = "KP_Prior";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_NEXT:
|
||||||
|
kn = "KP_Next";
|
||||||
|
ks = "KP_Next";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_END:
|
||||||
|
kn = "KP_End";
|
||||||
|
ks = "KP_End";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_HOME:
|
||||||
|
kn = "KP_Home";
|
||||||
|
ks = "KP_Home";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_LEFT:
|
||||||
|
kn = "KP_Left";
|
||||||
|
ks = "KP_Left";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_UP:
|
||||||
|
kn = "KP_Up";
|
||||||
|
ks = "KP_Up";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_RIGHT:
|
||||||
|
kn = "KP_Right";
|
||||||
|
ks = "KP_Right";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_DOWN:
|
||||||
|
kn = "KP_Down";
|
||||||
|
ks = "KP_Down";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_INSERT:
|
||||||
|
kn = "KP_Insert";
|
||||||
|
ks = "KP_Insert";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_DELETE:
|
||||||
|
kn = "KP_Delete";
|
||||||
|
ks = "KP_Delete";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F1:
|
||||||
|
kn = "F1";
|
||||||
|
ks = "F1";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F2:
|
||||||
|
kn = "F2";
|
||||||
|
ks = "F2";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F3:
|
||||||
|
kn = "F3";
|
||||||
|
ks = "F3";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F4:
|
||||||
|
kn = "F4";
|
||||||
|
ks = "F4";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F5:
|
||||||
|
kn = "F5";
|
||||||
|
ks = "F5";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F6:
|
||||||
|
kn = "F6";
|
||||||
|
ks = "F6";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F7:
|
||||||
|
kn = "F7";
|
||||||
|
ks = "F7";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F8:
|
||||||
|
kn = "F8";
|
||||||
|
ks = "F8";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F9:
|
||||||
|
kn = "F9";
|
||||||
|
ks = "F9";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F10:
|
||||||
|
kn = "F10";
|
||||||
|
ks = "F10";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F11:
|
||||||
|
kn = "F11";
|
||||||
|
ks = "F11";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F12:
|
||||||
|
kn = "F12";
|
||||||
|
ks = "F12";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F13:
|
||||||
|
kn = "F13";
|
||||||
|
ks = "F13";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F14:
|
||||||
|
kn = "F14";
|
||||||
|
ks = "F14";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F15:
|
||||||
|
kn = "F15";
|
||||||
|
ks = "F15";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F16:
|
||||||
|
kn = "F16";
|
||||||
|
ks = "F16";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F17:
|
||||||
|
kn = "F17";
|
||||||
|
ks = "F17";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F18:
|
||||||
|
kn = "F18";
|
||||||
|
ks = "F18";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F19:
|
||||||
|
kn = "F19";
|
||||||
|
ks = "F19";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F20:
|
||||||
|
kn = "F20";
|
||||||
|
ks = "F20";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F21:
|
||||||
|
kn = "F21";
|
||||||
|
ks = "F21";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F22:
|
||||||
|
kn = "F22";
|
||||||
|
ks = "F22";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F23:
|
||||||
|
kn = "F23";
|
||||||
|
ks = "F23";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_F24:
|
||||||
|
kn = "F24";
|
||||||
|
ks = "F24";
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
/* other non keystroke characters */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
*keyname = strdup(kn);
|
||||||
|
if (!*keyname) return 0;
|
||||||
|
*keysymbol = strdup(ks);
|
||||||
|
if (!*keysymbol)
|
||||||
|
{
|
||||||
|
free(*keyname);
|
||||||
|
*keyname = NULL;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
*keycompose = strdup(kc);
|
||||||
|
if (!*keycompose)
|
||||||
|
{
|
||||||
|
free(*keyname);
|
||||||
|
free(*keysymbol);
|
||||||
|
*keyname = NULL;
|
||||||
|
*keysymbol = NULL;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
_ecore_win32_event_char_get(int key,
|
||||||
|
char **keyname,
|
||||||
|
char **keysymbol,
|
||||||
|
char **keycompose)
|
||||||
|
{
|
||||||
|
char kn[32];
|
||||||
|
char ks[32];
|
||||||
|
char *kc;
|
||||||
|
|
||||||
|
*keyname = NULL;
|
||||||
|
*keysymbol = NULL;
|
||||||
|
*keycompose = NULL;
|
||||||
|
|
||||||
|
switch (key)
|
||||||
|
{
|
||||||
|
case VK_BACK:
|
||||||
|
strncpy(kn, "Backspace", 32);
|
||||||
|
strncpy(ks, "Backspace", 32);
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_TAB:
|
||||||
|
strncpy(kn, "Tab", 32);
|
||||||
|
strncpy(ks, "Tab", 32);
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case 0x0a:
|
||||||
|
/* Line feed (Shift + Enter) */
|
||||||
|
strncpy(kn, "LineFeed", 32);
|
||||||
|
strncpy(ks, "LineFeed", 32);
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_RETURN:
|
||||||
|
strncpy(kn, "Return", 32);
|
||||||
|
strncpy(ks, "Return", 32);
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
case VK_ESCAPE:
|
||||||
|
strncpy(kn, "Escape", 32);
|
||||||
|
strncpy(ks, "Escape", 32);
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
/* displayable characters */
|
||||||
|
printf (" * key : %d\n", key);
|
||||||
|
kn[0] = (TCHAR)key;
|
||||||
|
kn[1] = '\0';
|
||||||
|
ks[0] = (TCHAR)key;
|
||||||
|
ks[1] = '\0';
|
||||||
|
kc = "";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
*keyname = strdup(kn);
|
||||||
|
if (!*keyname) return 0;
|
||||||
|
*keysymbol = strdup(ks);
|
||||||
|
if (!*keysymbol)
|
||||||
|
{
|
||||||
|
free(*keyname);
|
||||||
|
*keyname = NULL;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
*keycompose = strdup(kc);
|
||||||
|
if (!*keycompose)
|
||||||
|
{
|
||||||
|
free(*keyname);
|
||||||
|
free(*keysymbol);
|
||||||
|
*keyname = NULL;
|
||||||
|
*keysymbol = NULL;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
|
@ -2,11 +2,20 @@
|
||||||
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "config.h"
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdio.h> /* for printf */
|
||||||
|
|
||||||
|
#define WIN32_LEAN_AND_MEAN
|
||||||
|
#include <windows.h>
|
||||||
|
#undef WIN32_LEAN_AND_MEAN
|
||||||
|
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
#include "ecore_win32_private.h"
|
|
||||||
#include "Ecore_Win32.h"
|
#include "Ecore_Win32.h"
|
||||||
#include <stdio.h>
|
#include "ecore_win32_private.h"
|
||||||
|
|
||||||
|
|
||||||
static int _ecore_win32_glew_init = 0;
|
static int _ecore_win32_glew_init = 0;
|
||||||
|
@ -18,9 +27,7 @@ ecore_win32_glew_init(Ecore_Win32_Window *window)
|
||||||
PIXELFORMATDESCRIPTOR pfd;
|
PIXELFORMATDESCRIPTOR pfd;
|
||||||
int format;
|
int format;
|
||||||
|
|
||||||
RECT rect;
|
|
||||||
struct _Ecore_Win32_Window *w;
|
struct _Ecore_Win32_Window *w;
|
||||||
DWORD flag;
|
|
||||||
|
|
||||||
if (!window)
|
if (!window)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -85,7 +92,6 @@ ecore_win32_glew_init(Ecore_Win32_Window *window)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
no_glew_2_0:
|
no_glew_2_0:
|
||||||
no_glew_init:
|
|
||||||
no_format:
|
no_format:
|
||||||
ReleaseDC (w->window, w->glew.dc);
|
ReleaseDC (w->window, w->glew.dc);
|
||||||
no_dc:
|
no_dc:
|
||||||
|
|
|
@ -6,23 +6,6 @@
|
||||||
#define __ECORE_WIN32_PRIVATE_H__
|
#define __ECORE_WIN32_PRIVATE_H__
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include <config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define WIN32_LEAN_AND_MEAN
|
|
||||||
#include <windows.h>
|
|
||||||
#undef WIN32_LEAN_AND_MEAN
|
|
||||||
#ifdef HAVE_OPENGL_GLEW
|
|
||||||
# include <GL/glew.h>
|
|
||||||
#endif /* HAVE_OPENGL_GLEW */
|
|
||||||
|
|
||||||
#include <Ecore.h>
|
|
||||||
#include <Ecore_Data.h>
|
|
||||||
|
|
||||||
#include "Ecore_Win32.h"
|
|
||||||
|
|
||||||
|
|
||||||
#define ECORE_WIN32_WINDOW_CLASS "Ecore_Win32_Window_Class"
|
#define ECORE_WIN32_WINDOW_CLASS "Ecore_Win32_Window_Class"
|
||||||
|
|
||||||
|
|
||||||
|
@ -104,7 +87,6 @@ struct _Ecore_Win32_Window
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
extern Ecore_List *_ecore_win32_windows_list;
|
|
||||||
extern HINSTANCE _ecore_win32_instance;
|
extern HINSTANCE _ecore_win32_instance;
|
||||||
extern double _ecore_win32_double_click_time;
|
extern double _ecore_win32_double_click_time;
|
||||||
extern double _ecore_win32_event_last_time;
|
extern double _ecore_win32_event_last_time;
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue