1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
| LRESULT CALLBACK
_ecore_win32_window_procedure(HWND window,
UINT message,
WPARAM window_param,
LPARAM data_param)
{
Ecore_Win32_Callback_Data *data;
POINTS pt;
DWORD coord;
data = (Ecore_Win32_Callback_Data *)malloc(sizeof(Ecore_Win32_Callback_Data));
if (!data) return DefWindowProc(window, message, window_param, data_param);
data->window = window;
data->message = message;
data->window_param = window_param;
data->data_param = data_param;
data->time = GetMessageTime();
coord = GetMessagePos();
pt = MAKEPOINTS(coord);
data->x = pt.x;
data->y = pt.y;
switch (data->message)
{
/* Keyboard input notifications */
case WM_KEYDOWN:
printf (" * ecore message : keystroke down\n");
_ecore_win32_event_handle_key_press(data, 1);
return 0;
case WM_CHAR:
_ecore_win32_event_handle_key_press(data, 0);
return 0;
case WM_KEYUP:
printf (" * ecore message : keystroke up\n");
_ecore_win32_event_handle_key_release(data, 1);
return 0;
case WM_SETFOCUS:
printf (" * ecore message : focus in\n");
_ecore_win32_event_handle_focus_in(data);
return 0;
case WM_KILLFOCUS:
printf (" * ecore message : focus out\n");
_ecore_win32_event_handle_focus_out(data);
return 0;
/* Mouse input notifications */
case WM_LBUTTONDOWN:
printf (" * ecore message : lbuttondown\n");
_ecore_win32_event_handle_button_press(data, 1);
return 0;
case WM_MBUTTONDOWN:
printf (" * ecore message : mbuttondown\n");
_ecore_win32_event_handle_button_press(data, 2);
return 0;
case WM_RBUTTONDOWN:
printf (" * ecore message : rbuttondown\n");
_ecore_win32_event_handle_button_press(data, 3);
return 0;
case WM_LBUTTONUP:
printf (" * ecore message : lbuttonup\n");
_ecore_win32_event_handle_button_release(data, 1);
return 0;
case WM_MBUTTONUP:
printf (" * ecore message : mbuttonup\n");
_ecore_win32_event_handle_button_release(data, 2);
return 0;
case WM_RBUTTONUP:
printf (" * ecore message : rbuttonup\n");
_ecore_win32_event_handle_button_release(data, 3);
return 0;
case WM_MOUSEMOVE:
{
RECT rect;
struct _Ecore_Win32_Window *w = NULL;
ecore_list_first_goto(_ecore_win32_windows_list);
while ((w = ecore_list_next(_ecore_win32_windows_list)))
{
if (w->window == window)
{
ecore_list_remove(_ecore_win32_windows_list);
break;
}
}
if (GetClientRect(window, &rect))
{
POINT pt;
pt.x = GET_X_LPARAM(data_param);
pt.y = GET_Y_LPARAM(data_param);
if (!PtInRect(&rect, pt))
{
if (w->pointer_is_in)
{
w->pointer_is_in = 0;
_ecore_win32_event_handle_leave_notify(data);
}
}
else
{
if (!w->pointer_is_in)
{
w->pointer_is_in = 1;
_ecore_win32_event_handle_enter_notify(data);
}
}
}
_ecore_win32_event_handle_motion_notify(data);
return 0;
}
/* Window notifications */
case WM_CREATE:
printf (" * ecore message : create\n");
_ecore_win32_event_handle_create_notify(data);
return 0;
case WM_DESTROY:
printf (" * ecore message : destroy\n");
_ecore_win32_event_handle_destroy_notify(data);
return 0;
case WM_SHOWWINDOW:
printf (" * ecore message : show\n");
if ((data->data_param == SW_OTHERUNZOOM) ||
(data->data_param == SW_OTHERUNZOOM))
return 0;
if (data->window_param)
_ecore_win32_event_handle_map_notify(data);
else
_ecore_win32_event_handle_unmap_notify(data);
return 0;
case WM_CLOSE:
printf (" * ecore message : close\n");
_ecore_win32_event_handle_delete(data);
return 0;
case WM_MOVING:
printf (" * ecore message : moving\n");
return TRUE;
case WM_MOVE:
printf (" * ecore message : moved\n");
return 0;
case WM_SIZING:
printf (" * ecore message : sizing\n");
_ecore_win32_event_handle_resize(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_WINDOWPOSCHANGED:
printf (" * ecore message : WM_WINDOWPOSCHANGED\n");
return 0;
/* GDI notifications */
case WM_PAINT:
{
RECT rect;
printf (" * ecore message : paint\n");
if (GetUpdateRect(window, &rect, FALSE))
{
PAINTSTRUCT ps;
HDC hdc;
hdc = BeginPaint(window, &ps);
data->update = rect;
_ecore_win32_event_handle_expose(data);
EndPaint(window, &ps);
printf (" * %ld %ld %ld %ld\n",
rect.left,
rect.top,
rect.right - rect.left,
rect.bottom - rect.top);
}
return 0;
}
case WM_SETREDRAW:
printf (" * ecore message : WM_SETREDRAW\n");
return 0;
case WM_SYNCPAINT:
printf (" * ecore message : WM_SYNCPAINT\n");
return 0;
default:
return DefWindowProc(window, message, window_param, data_param);
}
} |
Partager