diff options
Diffstat (limited to 'src/w32term.c')
| -rw-r--r-- | src/w32term.c | 54 |
1 files changed, 30 insertions, 24 deletions
diff --git a/src/w32term.c b/src/w32term.c index 6f0065de9eb..7da9433d3f1 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* Implementation of GUI terminal on the Microsoft W32 API. | 1 | /* Implementation of GUI terminal on the Microsoft Windows API. |
| 2 | 2 | ||
| 3 | Copyright (C) 1989, 1993-2012 Free Software Foundation, Inc. | 3 | Copyright (C) 1989, 1993-2012 Free Software Foundation, Inc. |
| 4 | 4 | ||
| @@ -155,6 +155,9 @@ int vertical_scroll_bar_bottom_border; | |||
| 155 | 155 | ||
| 156 | int last_scroll_bar_drag_pos; | 156 | int last_scroll_bar_drag_pos; |
| 157 | 157 | ||
| 158 | /* Keyboard code page - may be changed by language-change events. */ | ||
| 159 | int w32_keyboard_codepage; | ||
| 160 | |||
| 158 | /* Mouse movement. */ | 161 | /* Mouse movement. */ |
| 159 | 162 | ||
| 160 | /* Where the mouse was last time we reported a mouse event. */ | 163 | /* Where the mouse was last time we reported a mouse event. */ |
| @@ -188,9 +191,6 @@ static int volatile input_signal_count; | |||
| 188 | static int input_signal_count; | 191 | static int input_signal_count; |
| 189 | #endif | 192 | #endif |
| 190 | 193 | ||
| 191 | /* Keyboard code page - may be changed by language-change events. */ | ||
| 192 | static int keyboard_codepage; | ||
| 193 | |||
| 194 | static void x_update_window_end (struct window *, int, int); | 194 | static void x_update_window_end (struct window *, int, int); |
| 195 | static void w32_handle_tool_bar_click (struct frame *, | 195 | static void w32_handle_tool_bar_click (struct frame *, |
| 196 | struct input_event *); | 196 | struct input_event *); |
| @@ -2972,7 +2972,7 @@ x_frame_rehighlight (struct w32_display_info *dpyinfo) | |||
| 2972 | : dpyinfo->w32_focus_frame); | 2972 | : dpyinfo->w32_focus_frame); |
| 2973 | if (! FRAME_LIVE_P (dpyinfo->x_highlight_frame)) | 2973 | if (! FRAME_LIVE_P (dpyinfo->x_highlight_frame)) |
| 2974 | { | 2974 | { |
| 2975 | FRAME_FOCUS_FRAME (dpyinfo->w32_focus_frame) = Qnil; | 2975 | FSET (dpyinfo->w32_focus_frame, focus_frame, Qnil); |
| 2976 | dpyinfo->x_highlight_frame = dpyinfo->w32_focus_frame; | 2976 | dpyinfo->x_highlight_frame = dpyinfo->w32_focus_frame; |
| 2977 | } | 2977 | } |
| 2978 | } | 2978 | } |
| @@ -3612,6 +3612,7 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height) | |||
| 3612 | SCROLLINFO si; | 3612 | SCROLLINFO si; |
| 3613 | struct scroll_bar *bar | 3613 | struct scroll_bar *bar |
| 3614 | = XSCROLL_BAR (Fmake_vector (make_number (SCROLL_BAR_VEC_SIZE), Qnil)); | 3614 | = XSCROLL_BAR (Fmake_vector (make_number (SCROLL_BAR_VEC_SIZE), Qnil)); |
| 3615 | Lisp_Object barobj; | ||
| 3615 | 3616 | ||
| 3616 | BLOCK_INPUT; | 3617 | BLOCK_INPUT; |
| 3617 | 3618 | ||
| @@ -3644,7 +3645,8 @@ x_scroll_bar_create (struct window *w, int top, int left, int width, int height) | |||
| 3644 | /* Add bar to its frame's list of scroll bars. */ | 3645 | /* Add bar to its frame's list of scroll bars. */ |
| 3645 | bar->next = FRAME_SCROLL_BARS (f); | 3646 | bar->next = FRAME_SCROLL_BARS (f); |
| 3646 | bar->prev = Qnil; | 3647 | bar->prev = Qnil; |
| 3647 | XSETVECTOR (FRAME_SCROLL_BARS (f), bar); | 3648 | XSETVECTOR (barobj, bar); |
| 3649 | FSET (f, scroll_bars, barobj); | ||
| 3648 | if (! NILP (bar->next)) | 3650 | if (! NILP (bar->next)) |
| 3649 | XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar); | 3651 | XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar); |
| 3650 | 3652 | ||
| @@ -3668,7 +3670,7 @@ x_scroll_bar_remove (struct scroll_bar *bar) | |||
| 3668 | my_destroy_window (f, SCROLL_BAR_W32_WINDOW (bar)); | 3670 | my_destroy_window (f, SCROLL_BAR_W32_WINDOW (bar)); |
| 3669 | 3671 | ||
| 3670 | /* Dissociate this scroll bar from its window. */ | 3672 | /* Dissociate this scroll bar from its window. */ |
| 3671 | XWINDOW (bar->window)->vertical_scroll_bar = Qnil; | 3673 | WSET (XWINDOW (bar->window), vertical_scroll_bar, Qnil); |
| 3672 | 3674 | ||
| 3673 | UNBLOCK_INPUT; | 3675 | UNBLOCK_INPUT; |
| 3674 | } | 3676 | } |
| @@ -3682,6 +3684,7 @@ w32_set_vertical_scroll_bar (struct window *w, | |||
| 3682 | int portion, int whole, int position) | 3684 | int portion, int whole, int position) |
| 3683 | { | 3685 | { |
| 3684 | struct frame *f = XFRAME (w->frame); | 3686 | struct frame *f = XFRAME (w->frame); |
| 3687 | Lisp_Object barobj; | ||
| 3685 | struct scroll_bar *bar; | 3688 | struct scroll_bar *bar; |
| 3686 | int top, height, left, sb_left, width, sb_width; | 3689 | int top, height, left, sb_left, width, sb_width; |
| 3687 | int window_y, window_height; | 3690 | int window_y, window_height; |
| @@ -3804,8 +3807,8 @@ w32_set_vertical_scroll_bar (struct window *w, | |||
| 3804 | bar->fringe_extended_p = fringe_extended_p ? Qt : Qnil; | 3807 | bar->fringe_extended_p = fringe_extended_p ? Qt : Qnil; |
| 3805 | 3808 | ||
| 3806 | w32_set_scroll_bar_thumb (bar, portion, position, whole); | 3809 | w32_set_scroll_bar_thumb (bar, portion, position, whole); |
| 3807 | 3810 | XSETVECTOR (barobj, bar); | |
| 3808 | XSETVECTOR (w->vertical_scroll_bar, bar); | 3811 | WSET (w, vertical_scroll_bar, barobj); |
| 3809 | } | 3812 | } |
| 3810 | 3813 | ||
| 3811 | 3814 | ||
| @@ -3829,12 +3832,12 @@ w32_condemn_scroll_bars (FRAME_PTR frame) | |||
| 3829 | { | 3832 | { |
| 3830 | Lisp_Object bar; | 3833 | Lisp_Object bar; |
| 3831 | bar = FRAME_SCROLL_BARS (frame); | 3834 | bar = FRAME_SCROLL_BARS (frame); |
| 3832 | FRAME_SCROLL_BARS (frame) = XSCROLL_BAR (bar)->next; | 3835 | FSET (frame, scroll_bars, XSCROLL_BAR (bar)->next); |
| 3833 | XSCROLL_BAR (bar)->next = FRAME_CONDEMNED_SCROLL_BARS (frame); | 3836 | XSCROLL_BAR (bar)->next = FRAME_CONDEMNED_SCROLL_BARS (frame); |
| 3834 | XSCROLL_BAR (bar)->prev = Qnil; | 3837 | XSCROLL_BAR (bar)->prev = Qnil; |
| 3835 | if (! NILP (FRAME_CONDEMNED_SCROLL_BARS (frame))) | 3838 | if (! NILP (FRAME_CONDEMNED_SCROLL_BARS (frame))) |
| 3836 | XSCROLL_BAR (FRAME_CONDEMNED_SCROLL_BARS (frame))->prev = bar; | 3839 | XSCROLL_BAR (FRAME_CONDEMNED_SCROLL_BARS (frame))->prev = bar; |
| 3837 | FRAME_CONDEMNED_SCROLL_BARS (frame) = bar; | 3840 | FSET (frame, condemned_scroll_bars, bar); |
| 3838 | } | 3841 | } |
| 3839 | } | 3842 | } |
| 3840 | 3843 | ||
| @@ -3846,6 +3849,7 @@ static void | |||
| 3846 | w32_redeem_scroll_bar (struct window *window) | 3849 | w32_redeem_scroll_bar (struct window *window) |
| 3847 | { | 3850 | { |
| 3848 | struct scroll_bar *bar; | 3851 | struct scroll_bar *bar; |
| 3852 | Lisp_Object barobj; | ||
| 3849 | struct frame *f; | 3853 | struct frame *f; |
| 3850 | 3854 | ||
| 3851 | /* We can't redeem this window's scroll bar if it doesn't have one. */ | 3855 | /* We can't redeem this window's scroll bar if it doesn't have one. */ |
| @@ -3865,7 +3869,7 @@ w32_redeem_scroll_bar (struct window *window) | |||
| 3865 | return; | 3869 | return; |
| 3866 | else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f), | 3870 | else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f), |
| 3867 | window->vertical_scroll_bar)) | 3871 | window->vertical_scroll_bar)) |
| 3868 | FRAME_CONDEMNED_SCROLL_BARS (f) = bar->next; | 3872 | FSET (f, condemned_scroll_bars, bar->next); |
| 3869 | else | 3873 | else |
| 3870 | /* If its prev pointer is nil, it must be at the front of | 3874 | /* If its prev pointer is nil, it must be at the front of |
| 3871 | one or the other! */ | 3875 | one or the other! */ |
| @@ -3879,7 +3883,8 @@ w32_redeem_scroll_bar (struct window *window) | |||
| 3879 | 3883 | ||
| 3880 | bar->next = FRAME_SCROLL_BARS (f); | 3884 | bar->next = FRAME_SCROLL_BARS (f); |
| 3881 | bar->prev = Qnil; | 3885 | bar->prev = Qnil; |
| 3882 | XSETVECTOR (FRAME_SCROLL_BARS (f), bar); | 3886 | XSETVECTOR (barobj, bar); |
| 3887 | FSET (f, scroll_bars, barobj); | ||
| 3883 | if (! NILP (bar->next)) | 3888 | if (! NILP (bar->next)) |
| 3884 | XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar); | 3889 | XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar); |
| 3885 | } | 3890 | } |
| @@ -3896,7 +3901,7 @@ w32_judge_scroll_bars (FRAME_PTR f) | |||
| 3896 | 3901 | ||
| 3897 | /* Clear out the condemned list now so we won't try to process any | 3902 | /* Clear out the condemned list now so we won't try to process any |
| 3898 | more events on the hapless scroll bars. */ | 3903 | more events on the hapless scroll bars. */ |
| 3899 | FRAME_CONDEMNED_SCROLL_BARS (f) = Qnil; | 3904 | FSET (f, condemned_scroll_bars, Qnil); |
| 3900 | 3905 | ||
| 3901 | for (; ! NILP (bar); bar = next) | 3906 | for (; ! NILP (bar); bar = next) |
| 3902 | { | 3907 | { |
| @@ -4235,14 +4240,14 @@ w32_read_socket (struct terminal *terminal, int expected, | |||
| 4235 | 4240 | ||
| 4236 | /* lParam contains the input language ID in its low 16 bits. | 4241 | /* lParam contains the input language ID in its low 16 bits. |
| 4237 | Use it to update our record of the keyboard codepage. */ | 4242 | Use it to update our record of the keyboard codepage. */ |
| 4238 | keyboard_codepage = codepage_for_locale ((LCID)(msg.msg.lParam | 4243 | w32_keyboard_codepage = codepage_for_locale ((LCID)(msg.msg.lParam |
| 4239 | & 0xffff)); | 4244 | & 0xffff)); |
| 4240 | 4245 | ||
| 4241 | if (f) | 4246 | if (f) |
| 4242 | { | 4247 | { |
| 4243 | inev.kind = LANGUAGE_CHANGE_EVENT; | 4248 | inev.kind = LANGUAGE_CHANGE_EVENT; |
| 4244 | XSETFRAME (inev.frame_or_window, f); | 4249 | XSETFRAME (inev.frame_or_window, f); |
| 4245 | inev.code = keyboard_codepage; | 4250 | inev.code = w32_keyboard_codepage; |
| 4246 | inev.modifiers = msg.msg.lParam & 0xffff; | 4251 | inev.modifiers = msg.msg.lParam & 0xffff; |
| 4247 | } | 4252 | } |
| 4248 | break; | 4253 | break; |
| @@ -4308,7 +4313,7 @@ w32_read_socket (struct terminal *terminal, int expected, | |||
| 4308 | { | 4313 | { |
| 4309 | dbcs[0] = dbcs_lead; | 4314 | dbcs[0] = dbcs_lead; |
| 4310 | dbcs_lead = 0; | 4315 | dbcs_lead = 0; |
| 4311 | if (!MultiByteToWideChar (keyboard_codepage, 0, | 4316 | if (!MultiByteToWideChar (w32_keyboard_codepage, 0, |
| 4312 | dbcs, 2, &code, 1)) | 4317 | dbcs, 2, &code, 1)) |
| 4313 | { | 4318 | { |
| 4314 | /* Garbage */ | 4319 | /* Garbage */ |
| @@ -4318,7 +4323,7 @@ w32_read_socket (struct terminal *terminal, int expected, | |||
| 4318 | break; | 4323 | break; |
| 4319 | } | 4324 | } |
| 4320 | } | 4325 | } |
| 4321 | else if (IsDBCSLeadByteEx (keyboard_codepage, | 4326 | else if (IsDBCSLeadByteEx (w32_keyboard_codepage, |
| 4322 | (BYTE) msg.msg.wParam)) | 4327 | (BYTE) msg.msg.wParam)) |
| 4323 | { | 4328 | { |
| 4324 | dbcs_lead = (char) msg.msg.wParam; | 4329 | dbcs_lead = (char) msg.msg.wParam; |
| @@ -4327,7 +4332,7 @@ w32_read_socket (struct terminal *terminal, int expected, | |||
| 4327 | } | 4332 | } |
| 4328 | else | 4333 | else |
| 4329 | { | 4334 | { |
| 4330 | if (!MultiByteToWideChar (keyboard_codepage, 0, | 4335 | if (!MultiByteToWideChar (w32_keyboard_codepage, 0, |
| 4331 | &dbcs[1], 1, &code, 1)) | 4336 | &dbcs[1], 1, &code, 1)) |
| 4332 | { | 4337 | { |
| 4333 | /* What to do with garbage? */ | 4338 | /* What to do with garbage? */ |
| @@ -5488,7 +5493,7 @@ x_set_offset (struct frame *f, register int xoff, register int yoff, | |||
| 5488 | 5493 | ||
| 5489 | 5494 | ||
| 5490 | /* Check if we need to resize the frame due to a fullscreen request. | 5495 | /* Check if we need to resize the frame due to a fullscreen request. |
| 5491 | If so needed, resize the frame. */ | 5496 | If so needed, resize the frame. */ |
| 5492 | static void | 5497 | static void |
| 5493 | x_check_fullscreen (struct frame *f) | 5498 | x_check_fullscreen (struct frame *f) |
| 5494 | { | 5499 | { |
| @@ -5508,7 +5513,7 @@ x_check_fullscreen (struct frame *f) | |||
| 5508 | SET_FRAME_GARBAGED (f); | 5513 | SET_FRAME_GARBAGED (f); |
| 5509 | cancel_mouse_face (f); | 5514 | cancel_mouse_face (f); |
| 5510 | 5515 | ||
| 5511 | /* Wait for the change of frame size to occur */ | 5516 | /* Wait for the change of frame size to occur. */ |
| 5512 | f->want_fullscreen |= FULLSCREEN_WAIT; | 5517 | f->want_fullscreen |= FULLSCREEN_WAIT; |
| 5513 | } | 5518 | } |
| 5514 | } | 5519 | } |
| @@ -6227,7 +6232,7 @@ w32_create_terminal (struct w32_display_info *dpyinfo) | |||
| 6227 | terminal like X does. */ | 6232 | terminal like X does. */ |
| 6228 | terminal->kboard = xmalloc (sizeof (KBOARD)); | 6233 | terminal->kboard = xmalloc (sizeof (KBOARD)); |
| 6229 | init_kboard (terminal->kboard); | 6234 | init_kboard (terminal->kboard); |
| 6230 | KVAR (terminal->kboard, Vwindow_system) = intern ("w32"); | 6235 | KSET (terminal->kboard, Vwindow_system, intern ("w32")); |
| 6231 | terminal->kboard->next_kboard = all_kboards; | 6236 | terminal->kboard->next_kboard = all_kboards; |
| 6232 | all_kboards = terminal->kboard; | 6237 | all_kboards = terminal->kboard; |
| 6233 | /* Don't let the initial kboard remain current longer than necessary. | 6238 | /* Don't let the initial kboard remain current longer than necessary. |
| @@ -6426,7 +6431,8 @@ w32_initialize (void) | |||
| 6426 | 6431 | ||
| 6427 | { | 6432 | { |
| 6428 | DWORD input_locale_id = (DWORD) GetKeyboardLayout (0); | 6433 | DWORD input_locale_id = (DWORD) GetKeyboardLayout (0); |
| 6429 | keyboard_codepage = codepage_for_locale ((LCID) (input_locale_id & 0xffff)); | 6434 | w32_keyboard_codepage = |
| 6435 | codepage_for_locale ((LCID) (input_locale_id & 0xffff)); | ||
| 6430 | } | 6436 | } |
| 6431 | 6437 | ||
| 6432 | /* Create the window thread - it will terminate itself when the app | 6438 | /* Create the window thread - it will terminate itself when the app |