SVN revision: 39123
This commit is contained in:
Vincent Torri 2009-02-21 15:59:51 +00:00
parent 373d55b48e
commit 776aefddb4
3 changed files with 296 additions and 127 deletions

View File

@ -13,6 +13,8 @@
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#include <Eina.h>
#include "Ecore.h"
#include "Ecore_WinCE.h"
#include "ecore_wince_private.h"
@ -52,6 +54,14 @@ LRESULT CALLBACK _ecore_wince_window_procedure(HWND window,
WPARAM window_param,
LPARAM data_param);
static void _ecore_wince_error_print_cb(Eina_Error_Level level,
const char *file,
const char *fnc,
int line,
const char *fmt,
void *data,
va_list args);
/***** API *****/
@ -60,6 +70,10 @@ ecore_wince_init()
{
WNDCLASS wc;
eina_error_print_cb_set(_ecore_wince_error_print_cb, NULL);
EINA_ERROR_PINFO("initializing ecore_wince (current count: %d)\n", _ecore_wince_init_count);
if (_ecore_wince_init_count > 0)
{
_ecore_wince_init_count++;
@ -68,7 +82,10 @@ ecore_wince_init()
_ecore_wince_instance = GetModuleHandle(NULL);
if (!_ecore_wince_instance)
return 0;
{
EINA_ERROR_PERR("GetModuleHandle() failed\n");
return 0;
}
memset (&wc, 0, sizeof (wc));
wc.style = CS_HREDRAW | CS_VREDRAW;
@ -84,6 +101,7 @@ ecore_wince_init()
if(!RegisterClass(&wc))
{
EINA_ERROR_PERR("RegisterClass() failed\n");
FreeLibrary(_ecore_wince_instance);
return 0;
}
@ -117,6 +135,8 @@ ecore_wince_shutdown()
{
HWND task_bar;
EINA_ERROR_PINFO("shutting down ecore_wince (current count: %d)\n", _ecore_wince_init_count);
_ecore_wince_init_count--;
if (_ecore_wince_init_count > 0) return _ecore_wince_init_count;
if (!_ecore_wince_instance) return _ecore_wince_init_count;
@ -130,8 +150,14 @@ ecore_wince_shutdown()
EnableWindow(task_bar, TRUE);
}
UnregisterClass(ECORE_WINCE_WINDOW_CLASS, _ecore_wince_instance);
FreeLibrary(_ecore_wince_instance);
if (!UnregisterClass(ECORE_WINCE_WINDOW_CLASS, _ecore_wince_instance))
{
EINA_ERROR_PERR("UnregisterClass() failed\n");
}
if (!FreeLibrary(_ecore_wince_instance))
{
EINA_ERROR_PERR("FreeLibrary() failed\n");
}
_ecore_wince_instance = NULL;
if (_ecore_wince_init_count < 0) _ecore_wince_init_count = 0;
@ -207,52 +233,44 @@ _ecore_wince_window_procedure(HWND window,
{
/* Keyboard input notifications */
case WM_HOTKEY:
printf (" * ecore message : keystroke down (hotkey)\n");
_ecore_wince_event_handle_key_press(data);
return 0;
break;
case WM_KEYDOWN:
printf (" * ecore message : keystroke down\n");
_ecore_wince_event_handle_key_press(data);
return 0;
break;
case WM_KEYUP:
printf (" * ecore message : keystroke up\n");
_ecore_wince_event_handle_key_release(data);
return 0;
break;
case WM_SETFOCUS:
printf (" * ecore message : focus in\n");
_ecore_wince_event_handle_focus_in(data);
return 0;
break;
case WM_KILLFOCUS:
printf (" * ecore message : focus out\n");
_ecore_wince_event_handle_focus_out(data);
return 0;
break;
/* Mouse input notifications */
case WM_LBUTTONDOWN:
printf (" * ecore message : lbuttondown\n");
_ecore_wince_event_handle_button_press(data, 1);
return 0;
break;
case WM_LBUTTONUP:
printf (" * ecore message : lbuttonup\n");
_ecore_wince_event_handle_button_release(data, 1);
return 0;
break;
case WM_MOUSEMOVE:
{
RECT rect;
struct _Ecore_WinCE_Window *w = NULL;
w = (struct _Ecore_WinCE_Window *)GetWindowLong(window, GWL_USERDATA);
printf (" * ecore message : mouse move\n");
if (GetClientRect(window, &rect))
{
POINT pt;
printf ("GetClientRect !!\n");
EINA_ERROR_PINFO("mouse in window\n");
pt.x = LOWORD(data_param);
pt.y = HIWORD(data_param);
if (!PtInRect(&rect, pt))
{
printf ("pas dans rect...\n");
if (w->pointer_is_in)
{
w->pointer_is_in = 0;
@ -261,10 +279,8 @@ _ecore_wince_window_procedure(HWND window,
}
else
{
printf ("dans rect... %d\n", w->pointer_is_in);
if (!w->pointer_is_in)
{
printf ("w->pointer_is_in a 0\n");
w->pointer_is_in = 1;
_ecore_wince_event_handle_enter_notify(data);
}
@ -272,65 +288,62 @@ _ecore_wince_window_procedure(HWND window,
}
else
{
printf ("pas de GetClientRect !!\n");
EINA_ERROR_PERR("GetClientRect() failed\n");
}
_ecore_wince_event_handle_motion_notify(data);
return 0;
break;
}
/* Window notifications */
case WM_CREATE:
{
RECT rect;
GetClientRect(window, &rect);
printf (" *** ecore message : create %ld %ld\n",
rect.right - rect.left, rect.bottom - rect.top);
}
_ecore_wince_event_handle_create_notify(data);
return 0;
break;
case WM_DESTROY:
printf (" *** ecore message : destroy\n");
_ecore_wince_event_handle_destroy_notify(data);
return 0;
break;
case WM_SHOWWINDOW:
{
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;
break;
if (data->window_param)
_ecore_wince_event_handle_map_notify(data);
else
_ecore_wince_event_handle_unmap_notify(data);
return 0;
break;
case WM_CLOSE:
printf (" *** ecore message : close\n");
_ecore_wince_event_handle_delete_request(data);
return 0;
break;
/* GDI notifications */
case WM_PAINT:
{
RECT rect;
PAINTSTRUCT paint;
/* printf (" * ecore message : paint\n"); */
if (BeginPaint(window, &paint))
{
/* printf (" * ecore message : painting...\n"); */
data->update = paint.rcPaint;
_ecore_wince_event_handle_expose(data);
EndPaint(window, &paint);
}
return 0;
break;
}
default:
return DefWindowProc(window, message, window_param, data_param);
}
return 0;
}
static void
_ecore_wince_error_print_cb(Eina_Error_Level level __UNUSED__,
const char *file __UNUSED__,
const char *fnc,
int line,
const char *fmt,
void *data __UNUSED__,
va_list args)
{
fprintf(stderr, "[%s:%d] ", fnc, line);
vfprintf(stderr, fmt, args);
}

View File

@ -7,12 +7,13 @@
#endif
#include <stdlib.h>
#include <stdio.h> /* for printf */
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#include <Eina.h>
#include "Ecore.h"
#include "Ecore_WinCE.h"
#include "ecore_wince_private.h"
@ -52,6 +53,8 @@ _ecore_wince_event_handle_key_press(Ecore_WinCE_Callback_Data *msg)
{
Ecore_WinCE_Event_Key_Down *e;
EINA_ERROR_PINFO("key pressed\n");
e = (Ecore_WinCE_Event_Key_Down *)malloc(sizeof(Ecore_WinCE_Event_Key_Down));
if (!e) return;
@ -82,6 +85,8 @@ _ecore_wince_event_handle_key_release(Ecore_WinCE_Callback_Data *msg)
{
Ecore_WinCE_Event_Key_Up *e;
EINA_ERROR_PINFO("key released\n");
e = (Ecore_WinCE_Event_Key_Up *)calloc(1, sizeof(Ecore_WinCE_Event_Key_Up));
if (!e) return;
@ -113,6 +118,8 @@ _ecore_wince_event_handle_button_press(Ecore_WinCE_Callback_Data *msg,
{
Ecore_WinCE_Window *window;
EINA_ERROR_PINFO("mouse button pressed\n");
window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
{
@ -182,7 +189,6 @@ _ecore_wince_event_handle_button_press(Ecore_WinCE_Callback_Data *msg,
ecore_event_add(ECORE_WINCE_EVENT_MOUSE_BUTTON_DOWN, e, NULL, NULL);
}
printf (" * ecore event button press\n");
}
void
@ -191,6 +197,8 @@ _ecore_wince_event_handle_button_release(Ecore_WinCE_Callback_Data *msg,
{
Ecore_WinCE_Window *window;
EINA_ERROR_PINFO("mouse button released\n");
window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
{
@ -240,8 +248,6 @@ _ecore_wince_event_handle_button_release(Ecore_WinCE_Callback_Data *msg,
ecore_event_add(ECORE_WINCE_EVENT_MOUSE_BUTTON_UP, e, NULL, NULL);
}
printf (" * ecore event button release\n");
}
void
@ -249,6 +255,8 @@ _ecore_wince_event_handle_motion_notify(Ecore_WinCE_Callback_Data *msg)
{
Ecore_WinCE_Event_Mouse_Move *e;
EINA_ERROR_PINFO("mouse moved\n");
e = (Ecore_WinCE_Event_Mouse_Move *)calloc(1, sizeof(Ecore_WinCE_Event_Mouse_Move));
if (!e) return;
@ -258,7 +266,6 @@ _ecore_wince_event_handle_motion_notify(Ecore_WinCE_Callback_Data *msg)
e->time = (double)msg->time / 1000.0;
ecore_event_add(ECORE_WINCE_EVENT_MOUSE_MOVE, e, NULL, NULL);
printf (" * ecore event motion notify\n");
}
void
@ -266,8 +273,9 @@ _ecore_wince_event_handle_enter_notify(Ecore_WinCE_Callback_Data *msg)
{
Ecore_WinCE_Window *window;
EINA_ERROR_PINFO("mouse in\n");
window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
/* printf (" * ecore event enter notify 0\n"); */
{
Ecore_WinCE_Event_Mouse_Move *e;
@ -301,7 +309,6 @@ _ecore_wince_event_handle_enter_notify(Ecore_WinCE_Callback_Data *msg)
ecore_event_add(ECORE_WINCE_EVENT_MOUSE_IN, e, NULL, NULL);
}
/* printf (" * ecore event enter notify 1\n"); */
}
void
@ -309,6 +316,8 @@ _ecore_wince_event_handle_leave_notify(Ecore_WinCE_Callback_Data *msg)
{
Ecore_WinCE_Window *window;
EINA_ERROR_PINFO("mouse out\n");
window = (void *)GetWindowLong(msg->window, GWL_USERDATA);
{
@ -343,7 +352,6 @@ _ecore_wince_event_handle_leave_notify(Ecore_WinCE_Callback_Data *msg)
ecore_event_add(ECORE_WINCE_EVENT_MOUSE_OUT, e, NULL, NULL);
}
printf (" * ecore event leave notify\n");
}
void
@ -352,6 +360,8 @@ _ecore_wince_event_handle_focus_in(Ecore_WinCE_Callback_Data *msg)
Ecore_WinCE_Event_Window_Focus_In *e;
struct _Ecore_WinCE_Window *window;
EINA_ERROR_PINFO("focus in\n");
e = (Ecore_WinCE_Event_Window_Focus_In *)calloc(1, sizeof(Ecore_WinCE_Event_Window_Focus_In));
if (!e) return;
@ -379,6 +389,8 @@ _ecore_wince_event_handle_focus_out(Ecore_WinCE_Callback_Data *msg)
Ecore_WinCE_Event_Window_Focus_Out *e;
struct _Ecore_WinCE_Window *window;
EINA_ERROR_PINFO("focus out\n");
e = (Ecore_WinCE_Event_Window_Focus_Out *)calloc(1, sizeof(Ecore_WinCE_Event_Window_Focus_Out));
if (!e) return;
@ -404,6 +416,8 @@ _ecore_wince_event_handle_expose(Ecore_WinCE_Callback_Data *msg)
{
Ecore_WinCE_Event_Window_Damage *e;
EINA_ERROR_PINFO("window expose\n");
e = (Ecore_WinCE_Event_Window_Damage *)calloc(1, sizeof(Ecore_WinCE_Event_Window_Damage));
if (!e) return;
@ -418,7 +432,7 @@ _ecore_wince_event_handle_expose(Ecore_WinCE_Callback_Data *msg)
e->y = msg->update.top;
e->width = msg->update.right - msg->update.left;
e->height = msg->update.bottom - msg->update.top;
printf (" * ecore : event expose %d %d\n", e->width, e->height);
EINA_ERROR_PINFO("window expose size: %dx%d\n", e->width, e->height);
e->time = _ecore_wince_event_last_time;
@ -430,6 +444,8 @@ _ecore_wince_event_handle_create_notify(Ecore_WinCE_Callback_Data *msg)
{
Ecore_WinCE_Event_Window_Create *e;
EINA_ERROR_PINFO("window create notify\n");
e = calloc(1, sizeof(Ecore_WinCE_Event_Window_Create));
if (!e) return;
@ -450,6 +466,8 @@ _ecore_wince_event_handle_destroy_notify(Ecore_WinCE_Callback_Data *msg)
{
Ecore_WinCE_Event_Window_Destroy *e;
EINA_ERROR_PINFO("window destroy notify\n");
e = calloc(1, sizeof(Ecore_WinCE_Event_Window_Destroy));
if (!e) return;
@ -471,6 +489,8 @@ _ecore_wince_event_handle_map_notify(Ecore_WinCE_Callback_Data *msg)
{
Ecore_WinCE_Event_Window_Show *e;
EINA_ERROR_PINFO("window map notify\n");
e = calloc(1, sizeof(Ecore_WinCE_Event_Window_Show));
if (!e) return;
@ -491,6 +511,8 @@ _ecore_wince_event_handle_unmap_notify(Ecore_WinCE_Callback_Data *msg)
{
Ecore_WinCE_Event_Window_Hide *e;
EINA_ERROR_PINFO("window unmap notify\n");
e = calloc(1, sizeof(Ecore_WinCE_Event_Window_Hide));
if (!e) return;
@ -511,6 +533,8 @@ _ecore_wince_event_handle_delete_request(Ecore_WinCE_Callback_Data *msg)
{
Ecore_WinCE_Event_Window_Delete_Request *e;
EINA_ERROR_PINFO("window delete request\n");
e = calloc(1, sizeof(Ecore_WinCE_Event_Window_Delete_Request));
if (!e) return;

View File

@ -11,6 +11,7 @@
#undef WIN32_LEAN_AND_MEAN
#include <Evil.h>
#include <Eina.h>
#include "Ecore_WinCE.h"
#include "ecore_wince_private.h"
@ -36,9 +37,14 @@ ecore_wince_window_new(Ecore_WinCE_Window *parent,
HWND window;
RECT rect;
EINA_ERROR_PINFO("creating window\n");
w = (struct _Ecore_WinCE_Window *)calloc(1, sizeof(struct _Ecore_WinCE_Window));
if (!w)
return NULL;
{
EINA_ERROR_PERR("malloc() failed\n");
return NULL;
}
rect.left = 0;
rect.top = 0;
@ -46,6 +52,7 @@ ecore_wince_window_new(Ecore_WinCE_Window *parent,
rect.bottom = height;
if (!AdjustWindowRectEx(&rect, WS_CAPTION | WS_SYSMENU | WS_VISIBLE, FALSE, WS_EX_TOPMOST))
{
EINA_ERROR_PERR("AdjustWindowRectEx() failed\n");
free(w);
return NULL;
}
@ -60,12 +67,14 @@ ecore_wince_window_new(Ecore_WinCE_Window *parent,
NULL, _ecore_wince_instance, NULL);
if (!window)
{
EINA_ERROR_PERR("CreateWindowEx() failed\n");
free(w);
return NULL;
}
if (!_ecore_wince_hardware_keys_register(window))
{
EINA_ERROR_PERR("_ecore_wince_hardware_keys_register() failed\n");
DestroyWindow(window);
free(w);
return NULL;
@ -76,6 +85,7 @@ ecore_wince_window_new(Ecore_WinCE_Window *parent,
SetLastError(0);
if (!SetWindowLong(window, GWL_USERDATA, (LONG)w) && (GetLastError() != 0))
{
EINA_ERROR_PERR("SetWindowLong() failed\n");
DestroyWindow(window);
free(w);
return NULL;
@ -89,20 +99,17 @@ ecore_wince_window_new(Ecore_WinCE_Window *parent,
void
ecore_wince_window_del(Ecore_WinCE_Window *window)
{
Ecore_WinCE_Window *w;
if (!window) return;
EINA_ERROR_PINFO("destroying window\n");
DestroyWindow(((struct _Ecore_WinCE_Window *)window)->window);
free(window);
fprintf (stderr, "ecore_wince_window_del\n");
}
void *
ecore_wince_window_hwnd_get(Ecore_WinCE_Window *window)
{
struct _Ecore_WinCE_Window *w;
if (!window)
return NULL;
@ -120,15 +127,22 @@ ecore_wince_window_move(Ecore_WinCE_Window *window,
if (!window || ((struct _Ecore_WinCE_Window *)window)->fullscreen)
return;
printf ("ecore_wince_window_move %p : %d %d\n", window, x, y);
EINA_ERROR_PINFO("moving window (%dx%d)\n", x, y);
w = ((struct _Ecore_WinCE_Window *)window)->window;
if (!GetWindowRect(w, &rect))
return;
{
EINA_ERROR_PERR("GetWindowRect() failed\n");
return;
}
MoveWindow(w, x, y,
rect.right - rect.left,
rect.bottom - rect.top,
TRUE);
if (!MoveWindow(w, x, y,
rect.right - rect.left,
rect.bottom - rect.top,
TRUE))
{
EINA_ERROR_PERR("MoveWindow() failed\n");
}
}
void
@ -146,13 +160,14 @@ ecore_wince_window_resize(Ecore_WinCE_Window *window,
if (!window || ((struct _Ecore_WinCE_Window *)window)->fullscreen)
return;
w = (struct _Ecore_WinCE_Window *)window;
if (!GetWindowRect(w->window, &rect)) return;
EINA_ERROR_PINFO("resizing window (%dx%d)\n", width, height);
printf ("ecore_wince_window_resize 0 : %p (%d %d)\n",
w,
width,
height);
w = (struct _Ecore_WinCE_Window *)window;
if (!GetWindowRect(w->window, &rect))
{
EINA_ERROR_PERR("GetWindowRect() failed\n");
return;
}
x = rect.left;
y = rect.top;
@ -160,19 +175,29 @@ ecore_wince_window_resize(Ecore_WinCE_Window *window,
rect.top = 0;
rect.right = width;
rect.bottom = height;
style = GetWindowLong(w->window, GWL_STYLE);
exstyle = GetWindowLong(w->window, GWL_EXSTYLE);
if (!(style = GetWindowLong(w->window, GWL_STYLE)))
{
EINA_ERROR_PERR("GetWindowLong() failed\n");
return;
}
if (!(exstyle = GetWindowLong(w->window, GWL_EXSTYLE)))
{
EINA_ERROR_PERR("GetWindowLong() failed\n");
return;
}
if (!AdjustWindowRectEx(&rect, style, FALSE, exstyle))
return;
{
EINA_ERROR_PERR("AdjustWindowRectEx() failed\n");
return;
}
if (!MoveWindow(w->window, x, y,
rect.right - rect.left,
rect.bottom - rect.top,
FALSE))
{
printf (" MEEERDE !!!\n");
EINA_ERROR_PERR("MoveWindow() failed\n");
}
printf ("ecore_wince_window_resize 4 : %d %d\n", width, height);
}
void
@ -190,22 +215,36 @@ ecore_wince_window_move_resize(Ecore_WinCE_Window *window,
if (!window || ((struct _Ecore_WinCE_Window *)window)->fullscreen)
return;
printf ("ecore_wince_window_move_resize 0 : %p %d %d\n", window, width, height);
EINA_ERROR_PINFO("moving and resizing window (%dx%d %dx%d)\n", x, y, width, height);
w = ((struct _Ecore_WinCE_Window *)window);
rect.left = 0;
rect.top = 0;
printf ("ecore_wince_window_move_resize 1 : %d %d\n", width, height);
rect.right = width;
rect.bottom = height;
style = GetWindowLong(w->window, GWL_STYLE);
exstyle = GetWindowLong(w->window, GWL_EXSTYLE);
if (!(style = GetWindowLong(w->window, GWL_STYLE)))
{
EINA_ERROR_PERR("GetWindowLong() failed\n");
return;
}
if (!(exstyle = GetWindowLong(w->window, GWL_EXSTYLE)))
{
EINA_ERROR_PERR("GetWindowLong() failed\n");
return;
}
if (!AdjustWindowRectEx(&rect, style, FALSE, exstyle))
return;
{
EINA_ERROR_PERR("AdjustWindowRectEx() failed\n");
return;
}
MoveWindow(w->window, x, y,
if (!MoveWindow(w->window, x, y,
rect.right - rect.left,
rect.bottom - rect.top,
TRUE);
TRUE))
{
EINA_ERROR_PERR("MoveWindow() failed\n");
}
}
void
@ -213,10 +252,21 @@ ecore_wince_window_show(Ecore_WinCE_Window *window)
{
if (!window) return;
fprintf (stderr, " ** ecore_wince_window_show %p\n", window);
ShowWindow(((struct _Ecore_WinCE_Window *)window)->window, SW_SHOWNORMAL);
UpdateWindow(((struct _Ecore_WinCE_Window *)window)->window);
SendMessage(((struct _Ecore_WinCE_Window *)window)->window, WM_SHOWWINDOW, 1, 0);
EINA_ERROR_PINFO("showing window\n");
if (!ShowWindow(((struct _Ecore_WinCE_Window *)window)->window, SW_SHOWNORMAL))
{
EINA_ERROR_PERR("ShowWindow() failed\n");
return;
}
if (!UpdateWindow(((struct _Ecore_WinCE_Window *)window)->window))
{
EINA_ERROR_PERR("UpdateWindow() failed\n");
}
if (!SendMessage(((struct _Ecore_WinCE_Window *)window)->window, WM_SHOWWINDOW, 1, 0))
{
EINA_ERROR_PERR("SendMessage() failed\n");
}
}
void
@ -224,9 +274,17 @@ ecore_wince_window_hide(Ecore_WinCE_Window *window)
{
if (!window) return;
fprintf (stderr, " ** ecore_wince_window_hide %p\n", window);
ShowWindow(((struct _Ecore_WinCE_Window *)window)->window, SW_HIDE);
SendMessage(((struct _Ecore_WinCE_Window *)window)->window, WM_SHOWWINDOW, 0, 0);
EINA_ERROR_PINFO("hiding window\n");
if (!ShowWindow(((struct _Ecore_WinCE_Window *)window)->window, SW_HIDE))
{
EINA_ERROR_PERR("ShowWindow() failed\n");
return;
}
if (!SendMessage(((struct _Ecore_WinCE_Window *)window)->window, WM_SHOWWINDOW, 0, 0))
{
EINA_ERROR_PERR("SendMessage() failed\n");
}
}
void
@ -239,10 +297,15 @@ ecore_wince_window_title_set(Ecore_WinCE_Window *window,
if (!title || !title[0]) return;
EINA_ERROR_PINFO("setting window title\n");
wtitle = evil_char_to_wchar(title);
if (!wtitle) return;
SetWindowText(((struct _Ecore_WinCE_Window *)window)->window, wtitle);
if (!SetWindowText(((struct _Ecore_WinCE_Window *)window)->window, wtitle))
{
EINA_ERROR_PERR("SetWindowText() failed\n");
}
free(wtitle);
}
@ -254,6 +317,8 @@ ecore_wince_window_backend_set(Ecore_WinCE_Window *window, int backend)
if (!window)
return;
EINA_ERROR_PINFO("setting backend\n");
w = (struct _Ecore_WinCE_Window *)window;
w->backend = backend;
}
@ -266,6 +331,8 @@ ecore_wince_window_suspend_set(Ecore_WinCE_Window *window, int (*suspend)(int))
if (!window)
return;
EINA_ERROR_PINFO("setting suspend callback\n");
w = (struct _Ecore_WinCE_Window *)window;
w->suspend = suspend;
}
@ -278,6 +345,8 @@ ecore_wince_window_resume_set(Ecore_WinCE_Window *window, int (*resume)(int))
if (!window)
return;
EINA_ERROR_PINFO("setting resume callback\n");
w = (struct _Ecore_WinCE_Window *)window;
w->resume = resume;
}
@ -293,7 +362,8 @@ ecore_wince_window_geometry_get(Ecore_WinCE_Window *window,
int w;
int h;
printf ("ecore_wince_window_geometry_get %p\n", window);
EINA_ERROR_PINFO("getting window geometry\n");
if (!window)
{
if (x) *x = 0;
@ -307,6 +377,8 @@ ecore_wince_window_geometry_get(Ecore_WinCE_Window *window,
if (!GetClientRect(((struct _Ecore_WinCE_Window *)window)->window,
&rect))
{
EINA_ERROR_PERR("GetClientRect() failed\n");
if (x) *x = 0;
if (y) *y = 0;
if (width) *width = 0;
@ -321,6 +393,8 @@ ecore_wince_window_geometry_get(Ecore_WinCE_Window *window,
if (!GetWindowRect(((struct _Ecore_WinCE_Window *)window)->window,
&rect))
{
EINA_ERROR_PERR("GetWindowRect() failed\n");
if (x) *x = 0;
if (y) *y = 0;
if (width) *width = 0;
@ -342,6 +416,8 @@ ecore_wince_window_size_get(Ecore_WinCE_Window *window,
{
RECT rect;
EINA_ERROR_PINFO("getting window size\n");
if (!window)
{
if (width) *width = GetSystemMetrics(SM_CXSCREEN);
@ -353,6 +429,8 @@ ecore_wince_window_size_get(Ecore_WinCE_Window *window,
if (!GetClientRect(((struct _Ecore_WinCE_Window *)window)->window,
&rect))
{
EINA_ERROR_PERR("GetClientRect() failed\n");
if (width) *width = 0;
if (height) *height = 0;
}
@ -368,8 +446,6 @@ ecore_wince_window_fullscreen_set(Ecore_WinCE_Window *window,
struct _Ecore_WinCE_Window *ew;
HWND w;
HWND task_bar;
int width;
int height;
if (!window) return;
@ -378,66 +454,118 @@ ecore_wince_window_fullscreen_set(Ecore_WinCE_Window *window,
((!ew->fullscreen) && (!on)))
return;
EINA_ERROR_PINFO("setting fullscreen: %s\n", on ? "yes" : "no");
ew->fullscreen = !!on;
w = ew->window;
if (on)
{
/* save the position and size of the window */
if (!GetWindowRect(w, &ew->rect)) return;
if (!GetWindowRect(w, &ew->rect))
{
EINA_ERROR_PERR("GetWindowRect() failed\n");
return;
}
/* hide task bar */
task_bar = FindWindow(L"HHTaskBar", NULL);
if (!task_bar) return;
ShowWindow(task_bar, SW_HIDE);
EnableWindow(task_bar, FALSE);
if (!task_bar)
{
EINA_ERROR_PERR("FindWindow() failed\n");
return;
}
if (!ShowWindow(task_bar, SW_HIDE))
{
EINA_ERROR_PERR("ShowWindow() failed\n");
return;
}
if (!EnableWindow(task_bar, FALSE))
{
EINA_ERROR_PERR("EnableWindow() failed\n");
return;
}
/* style: visible + popup */
if (!SetWindowLong(w, GWL_STYLE, WS_POPUP | WS_VISIBLE)) return;
if (!SetWindowLong(w, GWL_STYLE, WS_POPUP | WS_VISIBLE))
{
EINA_ERROR_PERR("SetWindowLong() failed\n");
return;
}
/* resize window to fit the entire screen */
SetWindowPos(w, HWND_TOPMOST,
0, 0,
GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN),
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
if (!SetWindowPos(w, HWND_TOPMOST,
0, 0,
GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN),
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED))
{
EINA_ERROR_PERR("SetWindowLong() failed\n");
return;
}
/*
* It seems that SetWindowPos is not sufficient.
* Call MoveWindow with the correct size and force painting.
* Note that UpdateWindow (forcing repainting) is not sufficient
*/
MoveWindow(w,
0, 0,
GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN),
TRUE);
if (!MoveWindow(w,
0, 0,
GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN),
TRUE))
{
EINA_ERROR_PERR("MoveWindow() failed\n");
}
}
else
{
/* show task bar */
task_bar = FindWindow(L"HHTaskBar", NULL);
if (!task_bar) return;
ShowWindow(task_bar, SW_SHOW);
EnableWindow(task_bar, TRUE);
if (!task_bar)
{
EINA_ERROR_PERR("FindWindow() failed\n");
return;
}
if (!ShowWindow(task_bar, SW_SHOW))
{
EINA_ERROR_PERR("ShowWindow() failed\n");
return;
}
if (!EnableWindow(task_bar, TRUE))
{
EINA_ERROR_PERR("EnableWindow() failed\n");
return;
}
/* style: visible + caption + sysmenu */
if (!SetWindowLong(w, GWL_STYLE, WS_CAPTION | WS_SYSMENU | WS_VISIBLE)) return;
if (!SetWindowLong(w, GWL_STYLE, WS_CAPTION | WS_SYSMENU | WS_VISIBLE))
{
EINA_ERROR_PERR("SetWindowLong() failed\n");
return;
}
/* restaure the position and size of the window */
SetWindowPos(w, HWND_TOPMOST,
ew->rect.left,
ew->rect.top,
ew->rect.right - ew->rect.left,
ew->rect.bottom - ew->rect.top,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
if (!SetWindowPos(w, HWND_TOPMOST,
ew->rect.left,
ew->rect.top,
ew->rect.right - ew->rect.left,
ew->rect.bottom - ew->rect.top,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED))
{
EINA_ERROR_PERR("SetWindowLong() failed\n");
return;
}
/*
* It seems that SetWindowPos is not sufficient.
* Call MoveWindow with the correct size and force painting.
* Note that UpdateWindow (forcing repainting) is not sufficient
*/
MoveWindow(w,
ew->rect.left,
ew->rect.top,
ew->rect.right - ew->rect.left,
ew->rect.bottom - ew->rect.top,
TRUE);
if (!MoveWindow(w,
ew->rect.left,
ew->rect.top,
ew->rect.right - ew->rect.left,
ew->rect.bottom - ew->rect.top,
TRUE))
{
EINA_ERROR_PERR("MoveWindow() failed\n");
}
}
}
@ -453,11 +581,15 @@ _ecore_wince_hardware_keys_register(HWND window)
core_dll = LoadLibrary(L"coredll.dll");
if (!core_dll)
return 0;
{
EINA_ERROR_PERR("LoadLibrary() failed\n");
return 0;
}
unregister_fct = (UnregisterFunc1Proc)GetProcAddress(core_dll, L"UnregisterFunc1");
if (!unregister_fct)
{
EINA_ERROR_PERR("GetProcAddress() failed\n");
FreeLibrary(core_dll);
return 0;
}