diff options
author | David Walter Seikel | 2012-01-23 23:30:42 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-23 23:30:42 +1000 |
commit | 825a3d837a33f226c879cd02ad15c3fba57e8b2c (patch) | |
tree | 75f57bd9c4253508d338dc79ba8e57a7abc42255 /libraries/ecore/src/lib/ecore_win32/ecore_win32_event.c | |
parent | Add ability to disable the test harness, or the Lua compile test. (diff) | |
download | SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.zip SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.tar.gz SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.tar.bz2 SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.tar.xz |
Update the EFL to what I'm actually using, coz I'm using some stuff not yet released.
Diffstat (limited to 'libraries/ecore/src/lib/ecore_win32/ecore_win32_event.c')
-rw-r--r-- | libraries/ecore/src/lib/ecore_win32/ecore_win32_event.c | 192 |
1 files changed, 128 insertions, 64 deletions
diff --git a/libraries/ecore/src/lib/ecore_win32/ecore_win32_event.c b/libraries/ecore/src/lib/ecore_win32/ecore_win32_event.c index 63356d3..388776c 100644 --- a/libraries/ecore/src/lib/ecore_win32/ecore_win32_event.c +++ b/libraries/ecore/src/lib/ecore_win32/ecore_win32_event.c | |||
@@ -45,18 +45,18 @@ static void _ecore_win32_event_free_key_down(void *data, | |||
45 | static void _ecore_win32_event_free_key_up(void *data, | 45 | static void _ecore_win32_event_free_key_up(void *data, |
46 | void *ev); | 46 | void *ev); |
47 | 47 | ||
48 | static int _ecore_win32_event_keystroke_get(int key, | 48 | static int _ecore_win32_event_keystroke_get(Ecore_Win32_Callback_Data *msg, |
49 | int is_extended, | 49 | Eina_Bool is_down, |
50 | Eina_Bool is_down, | 50 | char **keyname, |
51 | char **keyname, | 51 | char **keysymbol, |
52 | char **keysymbol, | 52 | char **keycompose, |
53 | char **keycompose, | 53 | unsigned int *modifiers); |
54 | unsigned int *modifiers); | ||
55 | 54 | ||
56 | static int _ecore_win32_event_char_get(int key, | 55 | static int _ecore_win32_event_char_get(int key, |
57 | char **keyname, | 56 | char **keyname, |
58 | char **keysymbol, | 57 | char **keysymbol, |
59 | char **keycompose); | 58 | char **keycompose, |
59 | unsigned int *modifiers); | ||
60 | 60 | ||
61 | 61 | ||
62 | /***** Global functions definitions *****/ | 62 | /***** Global functions definitions *****/ |
@@ -74,8 +74,7 @@ _ecore_win32_event_handle_key_press(Ecore_Win32_Callback_Data *msg, | |||
74 | 74 | ||
75 | if (is_keystroke) | 75 | if (is_keystroke) |
76 | { | 76 | { |
77 | if (!_ecore_win32_event_keystroke_get(msg->window_param, | 77 | if (!_ecore_win32_event_keystroke_get(msg, |
78 | msg->data_param & 0x01000000, | ||
79 | EINA_TRUE, | 78 | EINA_TRUE, |
80 | (char **)&e->keyname, | 79 | (char **)&e->keyname, |
81 | (char **)&e->key, | 80 | (char **)&e->key, |
@@ -91,7 +90,8 @@ _ecore_win32_event_handle_key_press(Ecore_Win32_Callback_Data *msg, | |||
91 | if (!_ecore_win32_event_char_get(LOWORD(msg->window_param), | 90 | if (!_ecore_win32_event_char_get(LOWORD(msg->window_param), |
92 | (char **)&e->keyname, | 91 | (char **)&e->keyname, |
93 | (char **)&e->key, | 92 | (char **)&e->key, |
94 | (char **)&e->string)) | 93 | (char **)&e->string, |
94 | &e->modifiers)) | ||
95 | { | 95 | { |
96 | free(e); | 96 | free(e); |
97 | return; | 97 | return; |
@@ -105,7 +105,7 @@ _ecore_win32_event_handle_key_press(Ecore_Win32_Callback_Data *msg, | |||
105 | return; | 105 | return; |
106 | } | 106 | } |
107 | e->event_window = e->window; | 107 | e->event_window = e->window; |
108 | e->timestamp = msg->time; | 108 | e->timestamp = msg->timestamp; |
109 | 109 | ||
110 | _ecore_win32_event_last_time = e->timestamp; | 110 | _ecore_win32_event_last_time = e->timestamp; |
111 | 111 | ||
@@ -122,18 +122,19 @@ _ecore_win32_event_handle_key_release(Ecore_Win32_Callback_Data *msg) | |||
122 | e = (Ecore_Event_Key *)calloc(1, sizeof(Ecore_Event_Key)); | 122 | e = (Ecore_Event_Key *)calloc(1, sizeof(Ecore_Event_Key)); |
123 | if (!e) return; | 123 | if (!e) return; |
124 | 124 | ||
125 | if (!_ecore_win32_event_keystroke_get(LOWORD(msg->window_param), | 125 | if (!_ecore_win32_event_keystroke_get(msg, |
126 | msg->data_param & 0x01000000, | ||
127 | EINA_FALSE, | 126 | EINA_FALSE, |
128 | (char **)&e->keyname, | 127 | (char **)&e->keyname, |
129 | (char **)&e->key, | 128 | (char **)&e->key, |
130 | (char **)&e->string, | 129 | (char **)&e->string, |
131 | &e->modifiers)) | 130 | &e->modifiers)) |
132 | { | 131 | { |
133 | if (!_ecore_win32_event_char_get(LOWORD(msg->window_param), | 132 | if (msg->discard_ctrl || |
133 | !_ecore_win32_event_char_get(LOWORD(msg->window_param), | ||
134 | (char **)&e->keyname, | 134 | (char **)&e->keyname, |
135 | (char **)&e->key, | 135 | (char **)&e->key, |
136 | (char **)&e->string)) | 136 | (char **)&e->string, |
137 | &e->modifiers)) | ||
137 | { | 138 | { |
138 | free(e); | 139 | free(e); |
139 | return; | 140 | return; |
@@ -147,7 +148,7 @@ _ecore_win32_event_handle_key_release(Ecore_Win32_Callback_Data *msg) | |||
147 | return; | 148 | return; |
148 | } | 149 | } |
149 | e->event_window = e->window; | 150 | e->event_window = e->window; |
150 | e->timestamp = msg->time; | 151 | e->timestamp = msg->timestamp; |
151 | 152 | ||
152 | _ecore_win32_event_last_time = e->timestamp; | 153 | _ecore_win32_event_last_time = e->timestamp; |
153 | 154 | ||
@@ -178,7 +179,7 @@ _ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg, | |||
178 | e->z = GET_WHEEL_DELTA_WPARAM(msg->window_param) > 0 ? -1 : 1; | 179 | e->z = GET_WHEEL_DELTA_WPARAM(msg->window_param) > 0 ? -1 : 1; |
179 | e->x = GET_X_LPARAM(msg->data_param); | 180 | e->x = GET_X_LPARAM(msg->data_param); |
180 | e->y = GET_Y_LPARAM(msg->data_param); | 181 | e->y = GET_Y_LPARAM(msg->data_param); |
181 | e->timestamp = msg->time; | 182 | e->timestamp = msg->timestamp; |
182 | 183 | ||
183 | _ecore_win32_event_last_time = e->timestamp; | 184 | _ecore_win32_event_last_time = e->timestamp; |
184 | _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; | 185 | _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; |
@@ -197,7 +198,7 @@ _ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg, | |||
197 | e->event_window = e->window; | 198 | e->event_window = e->window; |
198 | e->x = GET_X_LPARAM(msg->data_param); | 199 | e->x = GET_X_LPARAM(msg->data_param); |
199 | e->y = GET_Y_LPARAM(msg->data_param); | 200 | e->y = GET_Y_LPARAM(msg->data_param); |
200 | e->timestamp = msg->time; | 201 | e->timestamp = msg->timestamp; |
201 | 202 | ||
202 | _ecore_win32_event_last_time = e->timestamp; | 203 | _ecore_win32_event_last_time = e->timestamp; |
203 | _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; | 204 | _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; |
@@ -224,7 +225,7 @@ _ecore_win32_event_handle_button_press(Ecore_Win32_Callback_Data *msg, | |||
224 | e->buttons = button; | 225 | e->buttons = button; |
225 | e->x = GET_X_LPARAM(msg->data_param); | 226 | e->x = GET_X_LPARAM(msg->data_param); |
226 | e->y = GET_Y_LPARAM(msg->data_param); | 227 | e->y = GET_Y_LPARAM(msg->data_param); |
227 | e->timestamp = msg->time; | 228 | e->timestamp = msg->timestamp; |
228 | 229 | ||
229 | if (((e->timestamp - _ecore_win32_mouse_down_last_time) <= (unsigned long)(1000 * _ecore_win32_double_click_time)) && | 230 | if (((e->timestamp - _ecore_win32_mouse_down_last_time) <= (unsigned long)(1000 * _ecore_win32_double_click_time)) && |
230 | (e->window == (Ecore_Window)_ecore_win32_mouse_down_last_window)) | 231 | (e->window == (Ecore_Window)_ecore_win32_mouse_down_last_window)) |
@@ -279,7 +280,7 @@ _ecore_win32_event_handle_button_release(Ecore_Win32_Callback_Data *msg, | |||
279 | e->event_window = e->window; | 280 | e->event_window = e->window; |
280 | e->x = GET_X_LPARAM(msg->data_param); | 281 | e->x = GET_X_LPARAM(msg->data_param); |
281 | e->y = GET_Y_LPARAM(msg->data_param); | 282 | e->y = GET_Y_LPARAM(msg->data_param); |
282 | e->timestamp = msg->time; | 283 | e->timestamp = msg->timestamp; |
283 | 284 | ||
284 | _ecore_win32_event_last_time = e->timestamp; | 285 | _ecore_win32_event_last_time = e->timestamp; |
285 | _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; | 286 | _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; |
@@ -298,7 +299,7 @@ _ecore_win32_event_handle_button_release(Ecore_Win32_Callback_Data *msg, | |||
298 | e->buttons = button; | 299 | e->buttons = button; |
299 | e->x = GET_X_LPARAM(msg->data_param); | 300 | e->x = GET_X_LPARAM(msg->data_param); |
300 | e->y = GET_Y_LPARAM(msg->data_param); | 301 | e->y = GET_Y_LPARAM(msg->data_param); |
301 | e->timestamp = msg->time; | 302 | e->timestamp = msg->timestamp; |
302 | 303 | ||
303 | _ecore_win32_mouse_up_count++; | 304 | _ecore_win32_mouse_up_count++; |
304 | 305 | ||
@@ -334,7 +335,7 @@ _ecore_win32_event_handle_motion_notify(Ecore_Win32_Callback_Data *msg) | |||
334 | e->event_window = e->window; | 335 | e->event_window = e->window; |
335 | e->x = GET_X_LPARAM(msg->data_param); | 336 | e->x = GET_X_LPARAM(msg->data_param); |
336 | e->y = GET_Y_LPARAM(msg->data_param); | 337 | e->y = GET_Y_LPARAM(msg->data_param); |
337 | e->timestamp = msg->time; | 338 | e->timestamp = msg->timestamp; |
338 | 339 | ||
339 | ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL); | 340 | ecore_event_add(ECORE_EVENT_MOUSE_MOVE, e, NULL, NULL); |
340 | } | 341 | } |
@@ -354,7 +355,7 @@ _ecore_win32_event_handle_enter_notify(Ecore_Win32_Callback_Data *msg) | |||
354 | e->event_window = e->window; | 355 | e->event_window = e->window; |
355 | e->x = msg->x; | 356 | e->x = msg->x; |
356 | e->y = msg->y; | 357 | e->y = msg->y; |
357 | e->timestamp = msg->time; | 358 | e->timestamp = msg->timestamp; |
358 | 359 | ||
359 | _ecore_win32_event_last_time = e->timestamp; | 360 | _ecore_win32_event_last_time = e->timestamp; |
360 | _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; | 361 | _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; |
@@ -371,9 +372,9 @@ _ecore_win32_event_handle_enter_notify(Ecore_Win32_Callback_Data *msg) | |||
371 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); | 372 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); |
372 | e->x = msg->x; | 373 | e->x = msg->x; |
373 | e->y = msg->y; | 374 | e->y = msg->y; |
374 | e->time = msg->time ; | 375 | e->timestamp = msg->timestamp ; |
375 | 376 | ||
376 | _ecore_win32_event_last_time = e->time; | 377 | _ecore_win32_event_last_time = e->timestamp; |
377 | 378 | ||
378 | ecore_event_add(ECORE_WIN32_EVENT_MOUSE_IN, e, NULL, NULL); | 379 | ecore_event_add(ECORE_WIN32_EVENT_MOUSE_IN, e, NULL, NULL); |
379 | } | 380 | } |
@@ -394,7 +395,7 @@ _ecore_win32_event_handle_leave_notify(Ecore_Win32_Callback_Data *msg) | |||
394 | e->event_window = e->window; | 395 | e->event_window = e->window; |
395 | e->x = msg->x; | 396 | e->x = msg->x; |
396 | e->y = msg->y; | 397 | e->y = msg->y; |
397 | e->timestamp = msg->time; | 398 | e->timestamp = msg->timestamp; |
398 | 399 | ||
399 | _ecore_win32_event_last_time = e->timestamp; | 400 | _ecore_win32_event_last_time = e->timestamp; |
400 | _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; | 401 | _ecore_win32_event_last_window = (Ecore_Win32_Window *)e->window; |
@@ -411,9 +412,9 @@ _ecore_win32_event_handle_leave_notify(Ecore_Win32_Callback_Data *msg) | |||
411 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); | 412 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); |
412 | e->x = msg->x; | 413 | e->x = msg->x; |
413 | e->y = msg->y; | 414 | e->y = msg->y; |
414 | e->time = msg->time; | 415 | e->timestamp = msg->timestamp; |
415 | 416 | ||
416 | _ecore_win32_event_last_time = e->time; | 417 | _ecore_win32_event_last_time = e->timestamp; |
417 | 418 | ||
418 | ecore_event_add(ECORE_WIN32_EVENT_MOUSE_OUT, e, NULL, NULL); | 419 | ecore_event_add(ECORE_WIN32_EVENT_MOUSE_OUT, e, NULL, NULL); |
419 | } | 420 | } |
@@ -431,8 +432,8 @@ _ecore_win32_event_handle_focus_in(Ecore_Win32_Callback_Data *msg) | |||
431 | 432 | ||
432 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); | 433 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); |
433 | 434 | ||
434 | e->time = _ecore_win32_event_last_time; | 435 | e->timestamp = _ecore_win32_event_last_time; |
435 | _ecore_win32_event_last_time = e->time; | 436 | _ecore_win32_event_last_time = e->timestamp; |
436 | 437 | ||
437 | ecore_event_add(ECORE_WIN32_EVENT_WINDOW_FOCUS_IN, e, NULL, NULL); | 438 | ecore_event_add(ECORE_WIN32_EVENT_WINDOW_FOCUS_IN, e, NULL, NULL); |
438 | } | 439 | } |
@@ -449,8 +450,8 @@ _ecore_win32_event_handle_focus_out(Ecore_Win32_Callback_Data *msg) | |||
449 | 450 | ||
450 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); | 451 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); |
451 | 452 | ||
452 | e->time = _ecore_win32_event_last_time; | 453 | e->timestamp = _ecore_win32_event_last_time; |
453 | _ecore_win32_event_last_time = e->time; | 454 | _ecore_win32_event_last_time = e->timestamp; |
454 | 455 | ||
455 | ecore_event_add(ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT, e, NULL, NULL); | 456 | ecore_event_add(ECORE_WIN32_EVENT_WINDOW_FOCUS_OUT, e, NULL, NULL); |
456 | } | 457 | } |
@@ -472,7 +473,7 @@ _ecore_win32_event_handle_expose(Ecore_Win32_Callback_Data *msg) | |||
472 | e->width = msg->update.right - msg->update.left; | 473 | e->width = msg->update.right - msg->update.left; |
473 | e->height = msg->update.bottom - msg->update.top; | 474 | e->height = msg->update.bottom - msg->update.top; |
474 | 475 | ||
475 | e->time = _ecore_win32_event_last_time; | 476 | e->timestamp = _ecore_win32_event_last_time; |
476 | 477 | ||
477 | ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DAMAGE, e, NULL, NULL); | 478 | ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DAMAGE, e, NULL, NULL); |
478 | } | 479 | } |
@@ -489,7 +490,7 @@ _ecore_win32_event_handle_create_notify(Ecore_Win32_Callback_Data *msg) | |||
489 | 490 | ||
490 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); | 491 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); |
491 | 492 | ||
492 | e->time = _ecore_win32_event_last_time; | 493 | e->timestamp = _ecore_win32_event_last_time; |
493 | 494 | ||
494 | ecore_event_add(ECORE_WIN32_EVENT_WINDOW_CREATE, e, NULL, NULL); | 495 | ecore_event_add(ECORE_WIN32_EVENT_WINDOW_CREATE, e, NULL, NULL); |
495 | } | 496 | } |
@@ -506,7 +507,7 @@ _ecore_win32_event_handle_destroy_notify(Ecore_Win32_Callback_Data *msg) | |||
506 | 507 | ||
507 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); | 508 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); |
508 | 509 | ||
509 | e->time = _ecore_win32_event_last_time; | 510 | e->timestamp = _ecore_win32_event_last_time; |
510 | if (e->window == _ecore_win32_event_last_window) _ecore_win32_event_last_window = NULL; | 511 | if (e->window == _ecore_win32_event_last_window) _ecore_win32_event_last_window = NULL; |
511 | 512 | ||
512 | ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DESTROY, e, NULL, NULL); | 513 | ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DESTROY, e, NULL, NULL); |
@@ -524,7 +525,7 @@ _ecore_win32_event_handle_map_notify(Ecore_Win32_Callback_Data *msg) | |||
524 | 525 | ||
525 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); | 526 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); |
526 | 527 | ||
527 | e->time = _ecore_win32_event_last_time; | 528 | e->timestamp = _ecore_win32_event_last_time; |
528 | 529 | ||
529 | ecore_event_add(ECORE_WIN32_EVENT_WINDOW_SHOW, e, NULL, NULL); | 530 | ecore_event_add(ECORE_WIN32_EVENT_WINDOW_SHOW, e, NULL, NULL); |
530 | } | 531 | } |
@@ -541,7 +542,7 @@ _ecore_win32_event_handle_unmap_notify(Ecore_Win32_Callback_Data *msg) | |||
541 | 542 | ||
542 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); | 543 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); |
543 | 544 | ||
544 | e->time = _ecore_win32_event_last_time; | 545 | e->timestamp = _ecore_win32_event_last_time; |
545 | 546 | ||
546 | ecore_event_add(ECORE_WIN32_EVENT_WINDOW_HIDE, e, NULL, NULL); | 547 | ecore_event_add(ECORE_WIN32_EVENT_WINDOW_HIDE, e, NULL, NULL); |
547 | } | 548 | } |
@@ -572,7 +573,7 @@ _ecore_win32_event_handle_configure_notify(Ecore_Win32_Callback_Data *msg) | |||
572 | e->y = wi.rcClient.top; | 573 | e->y = wi.rcClient.top; |
573 | e->width = wi.rcClient.right - wi.rcClient.left; | 574 | e->width = wi.rcClient.right - wi.rcClient.left; |
574 | e->height = wi.rcClient.bottom - wi.rcClient.top; | 575 | e->height = wi.rcClient.bottom - wi.rcClient.top; |
575 | e->time = _ecore_win32_event_last_time; | 576 | e->timestamp = _ecore_win32_event_last_time; |
576 | 577 | ||
577 | ecore_event_add(ECORE_WIN32_EVENT_WINDOW_CONFIGURE, e, NULL, NULL); | 578 | ecore_event_add(ECORE_WIN32_EVENT_WINDOW_CONFIGURE, e, NULL, NULL); |
578 | } | 579 | } |
@@ -594,7 +595,7 @@ _ecore_win32_event_handle_resize(Ecore_Win32_Callback_Data *msg) | |||
594 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); | 595 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); |
595 | e->width = rect.right - rect.left; | 596 | e->width = rect.right - rect.left; |
596 | e->height = rect.bottom - rect.top; | 597 | e->height = rect.bottom - rect.top; |
597 | e->time = _ecore_win32_event_last_time; | 598 | e->timestamp = _ecore_win32_event_last_time; |
598 | 599 | ||
599 | ecore_event_add(ECORE_WIN32_EVENT_WINDOW_RESIZE, e, NULL, NULL); | 600 | ecore_event_add(ECORE_WIN32_EVENT_WINDOW_RESIZE, e, NULL, NULL); |
600 | } | 601 | } |
@@ -610,7 +611,7 @@ _ecore_win32_event_handle_delete_request(Ecore_Win32_Callback_Data *msg) | |||
610 | if (!e) return; | 611 | if (!e) return; |
611 | 612 | ||
612 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); | 613 | e->window = (void *)GetWindowLongPtr(msg->window, GWLP_USERDATA); |
613 | e->time = _ecore_win32_event_last_time; | 614 | e->timestamp = _ecore_win32_event_last_time; |
614 | 615 | ||
615 | ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST, e, NULL, NULL); | 616 | ecore_event_add(ECORE_WIN32_EVENT_WINDOW_DELETE_REQUEST, e, NULL, NULL); |
616 | } | 617 | } |
@@ -645,24 +646,28 @@ _ecore_win32_event_free_key_up(void *data __UNUSED__, | |||
645 | } | 646 | } |
646 | 647 | ||
647 | static int | 648 | static int |
648 | _ecore_win32_event_keystroke_get(int key, | 649 | _ecore_win32_event_keystroke_get(Ecore_Win32_Callback_Data *msg, |
649 | int is_extended, | ||
650 | Eina_Bool is_down, | 650 | Eina_Bool is_down, |
651 | char **keyname, | 651 | char **keyname, |
652 | char **keysymbol, | 652 | char **keysymbol, |
653 | char **keycompose, | 653 | char **keycompose, |
654 | unsigned int *modifiers) | 654 | unsigned int *modifiers) |
655 | { | 655 | { |
656 | WCHAR buf[3]; | ||
657 | char delete_string[2] = { 0x7f, 0 }; | ||
656 | char *kn = NULL; | 658 | char *kn = NULL; |
657 | char *ks = NULL; | 659 | char *ks = NULL; |
658 | char *kc = NULL; | 660 | char *kc = NULL; |
661 | int key; | ||
662 | int is_extended; | ||
663 | |||
664 | key = msg->window_param; | ||
665 | is_extended = msg->data_param & 0x01000000; | ||
659 | 666 | ||
660 | *keyname = NULL; | 667 | *keyname = NULL; |
661 | *keysymbol = NULL; | 668 | *keysymbol = NULL; |
662 | *keycompose = NULL; | 669 | *keycompose = NULL; |
663 | 670 | ||
664 | |||
665 | printf("vk key 0x%x\n", key); | ||
666 | switch (key) | 671 | switch (key) |
667 | { | 672 | { |
668 | /* Keystroke */ | 673 | /* Keystroke */ |
@@ -751,7 +756,6 @@ _ecore_win32_event_keystroke_get(int key, | |||
751 | } | 756 | } |
752 | break; | 757 | break; |
753 | case VK_RIGHT: | 758 | case VK_RIGHT: |
754 | printf("vk val 0x%x (right)\n", VK_RIGHT); | ||
755 | if (is_extended) | 759 | if (is_extended) |
756 | { | 760 | { |
757 | kn = "Right"; | 761 | kn = "Right"; |
@@ -798,8 +802,7 @@ _ecore_win32_event_keystroke_get(int key, | |||
798 | { | 802 | { |
799 | kn = "Delete"; | 803 | kn = "Delete"; |
800 | ks = "Delete"; | 804 | ks = "Delete"; |
801 | /* FIXME: kc is wrong, here */ | 805 | kc = delete_string; |
802 | kc = "Delete"; | ||
803 | } | 806 | } |
804 | else | 807 | else |
805 | { | 808 | { |
@@ -830,7 +833,7 @@ _ecore_win32_event_keystroke_get(int key, | |||
830 | ks = "Shift_R"; | 833 | ks = "Shift_R"; |
831 | kc = ""; | 834 | kc = ""; |
832 | } | 835 | } |
833 | *modifiers |= ECORE_EVENT_MODIFIER_SHIFT; | 836 | *modifiers &= ~ECORE_EVENT_MODIFIER_SHIFT; |
834 | } | 837 | } |
835 | else /* is_up */ | 838 | else /* is_up */ |
836 | { | 839 | { |
@@ -852,7 +855,7 @@ _ecore_win32_event_keystroke_get(int key, | |||
852 | kc = ""; | 855 | kc = ""; |
853 | _ecore_win32_key_mask &= ~ECORE_WIN32_KEY_MASK_RSHIFT; | 856 | _ecore_win32_key_mask &= ~ECORE_WIN32_KEY_MASK_RSHIFT; |
854 | } | 857 | } |
855 | *modifiers &= ~ECORE_EVENT_MODIFIER_SHIFT; | 858 | *modifiers |= ECORE_EVENT_MODIFIER_SHIFT; |
856 | } | 859 | } |
857 | break; | 860 | break; |
858 | } | 861 | } |
@@ -860,6 +863,9 @@ _ecore_win32_event_keystroke_get(int key, | |||
860 | { | 863 | { |
861 | SHORT res; | 864 | SHORT res; |
862 | 865 | ||
866 | if (msg->discard_ctrl) | ||
867 | return 0; | ||
868 | |||
863 | if (is_down) | 869 | if (is_down) |
864 | { | 870 | { |
865 | res = GetKeyState(VK_LCONTROL); | 871 | res = GetKeyState(VK_LCONTROL); |
@@ -1113,11 +1119,53 @@ _ecore_win32_event_keystroke_get(int key, | |||
1113 | kc = ""; | 1119 | kc = ""; |
1114 | break; | 1120 | break; |
1115 | default: | 1121 | default: |
1116 | /* other non keystroke characters */ | 1122 | { |
1117 | return 0; | 1123 | /* other non keystroke characters */ |
1124 | BYTE kbd_state[256]; | ||
1125 | int res; | ||
1126 | |||
1127 | if (is_down) | ||
1128 | return 0; | ||
1129 | |||
1130 | if (!GetKeyboardState(kbd_state)) | ||
1131 | return 0; | ||
1132 | |||
1133 | res = ToUnicode(msg->window_param, | ||
1134 | MapVirtualKey(msg->window_param, 2), | ||
1135 | kbd_state, buf, 3, 0); | ||
1136 | if (res == 1) | ||
1137 | { | ||
1138 | /* FIXME: might be troublesome for non european languages */ | ||
1139 | /* in that case, UNICODE should be used, I guess */ | ||
1140 | buf[1] = '\0'; | ||
1141 | kn = (char *)buf; | ||
1142 | ks = (char *)buf; | ||
1143 | kc = (char *)buf; | ||
1144 | |||
1145 | res = GetAsyncKeyState(VK_SHIFT); | ||
1146 | if (res & 0x8000) | ||
1147 | *modifiers |= ECORE_EVENT_MODIFIER_SHIFT; | ||
1148 | else | ||
1149 | *modifiers &= ~ECORE_EVENT_MODIFIER_SHIFT; | ||
1150 | |||
1151 | res = GetKeyState(VK_CONTROL); | ||
1152 | if (res & 0x8000) | ||
1153 | *modifiers |= ECORE_EVENT_MODIFIER_CTRL; | ||
1154 | else | ||
1155 | *modifiers &= ~ECORE_EVENT_MODIFIER_CTRL; | ||
1156 | |||
1157 | res = GetKeyState(VK_MENU); | ||
1158 | if (res & 0x8000) | ||
1159 | *modifiers |= ECORE_EVENT_MODIFIER_ALT; | ||
1160 | else | ||
1161 | *modifiers &= ~ECORE_EVENT_MODIFIER_ALT; | ||
1162 | |||
1163 | break; | ||
1164 | } | ||
1165 | return 0; | ||
1166 | } | ||
1118 | } | 1167 | } |
1119 | 1168 | ||
1120 | printf("sortie...\n"); | ||
1121 | *keyname = strdup(kn); | 1169 | *keyname = strdup(kn); |
1122 | if (!*keyname) return 0; | 1170 | if (!*keyname) return 0; |
1123 | *keysymbol = strdup(ks); | 1171 | *keysymbol = strdup(ks); |
@@ -1141,28 +1189,27 @@ _ecore_win32_event_keystroke_get(int key, | |||
1141 | return 0; | 1189 | return 0; |
1142 | } | 1190 | } |
1143 | } | 1191 | } |
1144 | printf("sortie 2 ...\n"); | ||
1145 | 1192 | ||
1146 | return 1; | 1193 | return 1; |
1147 | } | 1194 | } |
1148 | 1195 | ||
1149 | static int | 1196 | static int |
1150 | _ecore_win32_event_char_get(int key, | 1197 | _ecore_win32_event_char_get(int key, |
1151 | char **keyname, | 1198 | char **keyname, |
1152 | char **keysymbol, | 1199 | char **keysymbol, |
1153 | char **keycompose) | 1200 | char **keycompose, |
1201 | unsigned int *modifiers) | ||
1154 | { | 1202 | { |
1155 | char *kn = NULL; | 1203 | char *kn = NULL; |
1156 | char *ks = NULL; | 1204 | char *ks = NULL; |
1157 | char *kc = NULL; | 1205 | char *kc = NULL; |
1158 | char buf[2]; | 1206 | char buf[2]; |
1207 | SHORT res; | ||
1159 | 1208 | ||
1160 | *keyname = NULL; | 1209 | *keyname = NULL; |
1161 | *keysymbol = NULL; | 1210 | *keysymbol = NULL; |
1162 | *keycompose = NULL; | 1211 | *keycompose = NULL; |
1163 | 1212 | ||
1164 | printf("char key 0x%x\n", key); | ||
1165 | |||
1166 | switch (key) | 1213 | switch (key) |
1167 | { | 1214 | { |
1168 | case VK_PROCESSKEY: | 1215 | case VK_PROCESSKEY: |
@@ -1200,7 +1247,6 @@ _ecore_win32_event_char_get(int key, | |||
1200 | break; | 1247 | break; |
1201 | default: | 1248 | default: |
1202 | /* displayable characters */ | 1249 | /* displayable characters */ |
1203 | printf (" * key : %d\n", key); | ||
1204 | buf[0] = key; | 1250 | buf[0] = key; |
1205 | buf[1] = '\0'; | 1251 | buf[1] = '\0'; |
1206 | kn = buf; | 1252 | kn = buf; |
@@ -1227,5 +1273,23 @@ _ecore_win32_event_char_get(int key, | |||
1227 | return 0; | 1273 | return 0; |
1228 | } | 1274 | } |
1229 | 1275 | ||
1276 | res = GetAsyncKeyState(VK_SHIFT); | ||
1277 | if (res & 0x8000) | ||
1278 | *modifiers |= ECORE_EVENT_MODIFIER_SHIFT; | ||
1279 | else | ||
1280 | *modifiers &= ~ECORE_EVENT_MODIFIER_SHIFT; | ||
1281 | |||
1282 | res = GetKeyState(VK_CONTROL); | ||
1283 | if (res & 0x8000) | ||
1284 | *modifiers |= ECORE_EVENT_MODIFIER_CTRL; | ||
1285 | else | ||
1286 | *modifiers &= ~ECORE_EVENT_MODIFIER_CTRL; | ||
1287 | |||
1288 | res = GetKeyState(VK_MENU); | ||
1289 | if (res & 0x8000) | ||
1290 | *modifiers |= ECORE_EVENT_MODIFIER_ALT; | ||
1291 | else | ||
1292 | *modifiers &= ~ECORE_EVENT_MODIFIER_ALT; | ||
1293 | |||
1230 | return 1; | 1294 | return 1; |
1231 | } | 1295 | } |