aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGeoff Voelker1998-11-10 20:50:08 +0000
committerGeoff Voelker1998-11-10 20:50:08 +0000
commitf98169a0231db236d7f989c4f6e94504e6d48a71 (patch)
treedd4563e3da9665f2203889857a8c88326bd1efc1 /src
parentbb35543459fabc77cd0d16addba5d1a06a8fe463 (diff)
downloademacs-f98169a0231db236d7f989c4f6e94504e6d48a71.tar.gz
emacs-f98169a0231db236d7f989c4f6e94504e6d48a71.zip
(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.
Diffstat (limited to 'src')
-rw-r--r--src/w32term.c101
1 files changed, 33 insertions, 68 deletions
diff --git a/src/w32term.c b/src/w32term.c
index dcfaf6aac3a..c8538adbeeb 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -3334,36 +3334,6 @@ static Time enter_timestamp;
3334int temp_index; 3334int temp_index;
3335short temp_buffer[100]; 3335short temp_buffer[100];
3336 3336
3337extern 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
3343static void
3344convert_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
3356static int
3357is_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.
@@ -3469,6 +3439,25 @@ w32_read_socket (sd, bufp, numchars, expected)
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);
@@ -3480,8 +3469,7 @@ w32_read_socket (sd, bufp, numchars, expected)
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++;
@@ -3496,41 +3484,17 @@ w32_read_socket (sd, bufp, numchars, expected)
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
@@ -3818,7 +3782,8 @@ w32_read_socket (sd, bufp, numchars, expected)
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