Mercurial > emacs
comparison src/w32term.c @ 23677:70999481c915
(convert_to_key_event): Removed.
(is_dead_key): Copied to w32fns.c.
(w32_read_socket): Generate language_change_event. Modify to work
with keyboard handling changes in w32_wnd_proc.
author | Geoff Voelker <voelker@cs.washington.edu> |
---|---|
date | Tue, 10 Nov 1998 20:50:08 +0000 |
parents | 516fc58a7b7b |
children | b59294a6167e |
comparison
equal
deleted
inserted
replaced
23676:704d2e178bcb | 23677:70999481c915 |
---|---|
3332 /* Record the last 100 characters stored | 3332 /* Record the last 100 characters stored |
3333 to help debug the loss-of-chars-during-GC problem. */ | 3333 to help debug the loss-of-chars-during-GC problem. */ |
3334 int temp_index; | 3334 int temp_index; |
3335 short temp_buffer[100]; | 3335 short temp_buffer[100]; |
3336 | 3336 |
3337 extern int key_event (KEY_EVENT_RECORD *, struct input_event *, int *isdead); | |
3338 | |
3339 /* Map a W32 WM_CHAR message into a KEY_EVENT_RECORD so that | |
3340 we can use the same routines to handle input in both console | |
3341 and window modes. */ | |
3342 | |
3343 static void | |
3344 convert_to_key_event (W32Msg *msgp, KEY_EVENT_RECORD *eventp) | |
3345 { | |
3346 eventp->bKeyDown = TRUE; | |
3347 eventp->wRepeatCount = 1; | |
3348 eventp->wVirtualKeyCode = msgp->msg.wParam; | |
3349 eventp->wVirtualScanCode = (msgp->msg.lParam & 0xFF0000) >> 16; | |
3350 eventp->uChar.AsciiChar = 0; | |
3351 eventp->dwControlKeyState = msgp->dwModifiers; | |
3352 } | |
3353 | |
3354 /* Return nonzero if the virtual key is a dead key. */ | |
3355 | |
3356 static int | |
3357 is_dead_key (int wparam) | |
3358 { | |
3359 unsigned int code = MapVirtualKey (wparam, 2); | |
3360 | |
3361 /* Windows 95 returns 0x8000, NT returns 0x80000000. */ | |
3362 if ((code & 0x8000) || (code & 0x80000000)) | |
3363 return 1; | |
3364 else | |
3365 return 0; | |
3366 } | |
3367 | 3337 |
3368 /* Read events coming from the W32 shell. | 3338 /* Read events coming from the W32 shell. |
3369 This routine is called by the SIGIO handler. | 3339 This routine is called by the SIGIO handler. |
3370 We return as soon as there are no more events to be read. | 3340 We return as soon as there are no more events to be read. |
3371 | 3341 |
3467 msg.rect.bottom - msg.rect.top); | 3437 msg.rect.bottom - msg.rect.top); |
3468 } | 3438 } |
3469 } | 3439 } |
3470 break; | 3440 break; |
3471 | 3441 |
3442 case WM_INPUTLANGCHANGE: | |
3443 /* Generate a language change event. */ | |
3444 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | |
3445 | |
3446 if (f) | |
3447 { | |
3448 if (numchars == 0) | |
3449 abort (); | |
3450 | |
3451 bufp->kind = language_change_event; | |
3452 XSETFRAME (bufp->frame_or_window, f); | |
3453 bufp->code = msg.msg.wParam; | |
3454 bufp->modifiers = msg.msg.lParam & 0xffff; | |
3455 bufp++; | |
3456 count++; | |
3457 numchars--; | |
3458 } | |
3459 break; | |
3460 | |
3472 case WM_KEYDOWN: | 3461 case WM_KEYDOWN: |
3473 case WM_SYSKEYDOWN: | 3462 case WM_SYSKEYDOWN: |
3474 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | 3463 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); |
3475 | 3464 |
3476 if (f && !f->iconified) | 3465 if (f && !f->iconified) |
3478 if (temp_index == sizeof temp_buffer / sizeof (short)) | 3467 if (temp_index == sizeof temp_buffer / sizeof (short)) |
3479 temp_index = 0; | 3468 temp_index = 0; |
3480 temp_buffer[temp_index++] = msg.msg.wParam; | 3469 temp_buffer[temp_index++] = msg.msg.wParam; |
3481 bufp->kind = non_ascii_keystroke; | 3470 bufp->kind = non_ascii_keystroke; |
3482 bufp->code = msg.msg.wParam; | 3471 bufp->code = msg.msg.wParam; |
3483 bufp->modifiers = w32_kbd_mods_to_emacs (msg.dwModifiers, | 3472 bufp->modifiers = msg.dwModifiers; |
3484 msg.msg.wParam); | |
3485 XSETFRAME (bufp->frame_or_window, f); | 3473 XSETFRAME (bufp->frame_or_window, f); |
3486 bufp->timestamp = msg.msg.time; | 3474 bufp->timestamp = msg.msg.time; |
3487 bufp++; | 3475 bufp++; |
3488 numchars--; | 3476 numchars--; |
3489 count++; | 3477 count++; |
3494 case WM_CHAR: | 3482 case WM_CHAR: |
3495 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | 3483 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); |
3496 | 3484 |
3497 if (f && !f->iconified) | 3485 if (f && !f->iconified) |
3498 { | 3486 { |
3499 if (numchars > 1) | 3487 if (temp_index == sizeof temp_buffer / sizeof (short)) |
3500 { | 3488 temp_index = 0; |
3501 int add; | 3489 temp_buffer[temp_index++] = msg.msg.wParam; |
3502 int isdead = 0; | 3490 bufp->kind = ascii_keystroke; |
3503 KEY_EVENT_RECORD key, *keyp = &key; | 3491 bufp->code = msg.msg.wParam; |
3504 | 3492 bufp->modifiers = msg.dwModifiers; |
3505 if (temp_index == sizeof temp_buffer / sizeof (short)) | 3493 XSETFRAME (bufp->frame_or_window, f); |
3506 temp_index = 0; | 3494 bufp->timestamp = msg.msg.time; |
3507 | 3495 bufp++; |
3508 convert_to_key_event (&msg, keyp); | 3496 numchars--; |
3509 add = key_event (keyp, bufp, &isdead); | 3497 count++; |
3510 XSETFRAME (bufp->frame_or_window, f); | |
3511 if (add == -1) | |
3512 { | |
3513 /* The key pressed generated two characters, most likely | |
3514 an accent character and a key that could not be | |
3515 combined with it. Prepend the message on the queue | |
3516 again to process the second character (which is | |
3517 being held internally in key_event), and process | |
3518 the first character now. */ | |
3519 prepend_msg (&msg); | |
3520 add = 1; | |
3521 } | |
3522 | |
3523 if (isdead) | |
3524 break; | |
3525 | |
3526 bufp += add; | |
3527 numchars -= add; | |
3528 count += add; | |
3529 } | |
3530 else | |
3531 { | |
3532 abort (); | |
3533 } | |
3534 } | 3498 } |
3535 break; | 3499 break; |
3536 | 3500 |
3537 case WM_MOUSEMOVE: | 3501 case WM_MOUSEMOVE: |
3538 if (dpyinfo->grabbed && last_mouse_frame | 3502 if (dpyinfo->grabbed && last_mouse_frame |
3816 case WM_COMMAND: | 3780 case WM_COMMAND: |
3817 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | 3781 f = x_window_to_frame (dpyinfo, msg.msg.hwnd); |
3818 | 3782 |
3819 if (f) | 3783 if (f) |
3820 { | 3784 { |
3821 extern void menubar_selection_callback (FRAME_PTR f, void * client_data); | 3785 extern void menubar_selection_callback |
3786 (FRAME_PTR f, void * client_data); | |
3822 menubar_selection_callback (f, (void *)msg.msg.wParam); | 3787 menubar_selection_callback (f, (void *)msg.msg.wParam); |
3823 } | 3788 } |
3824 | 3789 |
3825 check_visibility = 1; | 3790 check_visibility = 1; |
3826 break; | 3791 break; |