diff options
Diffstat (limited to 'src/w32term.c')
| -rw-r--r-- | src/w32term.c | 247 |
1 files changed, 81 insertions, 166 deletions
diff --git a/src/w32term.c b/src/w32term.c index 532ded7cdad..be8ebfe6ab6 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -149,9 +149,6 @@ BOOL (WINAPI *pfnSetLayeredWindowAttributes) (HWND, COLORREF, BYTE, DWORD); | |||
| 149 | #define SM_CYVIRTUALSCREEN 79 | 149 | #define SM_CYVIRTUALSCREEN 79 |
| 150 | #endif | 150 | #endif |
| 151 | 151 | ||
| 152 | /* This is a frame waiting to be autoraised, within w32_read_socket. */ | ||
| 153 | struct frame *pending_autoraise_frame; | ||
| 154 | |||
| 155 | /* The handle of the frame that currently owns the system caret. */ | 152 | /* The handle of the frame that currently owns the system caret. */ |
| 156 | HWND w32_system_caret_hwnd; | 153 | HWND w32_system_caret_hwnd; |
| 157 | int w32_system_caret_height; | 154 | int w32_system_caret_height; |
| @@ -174,31 +171,6 @@ int last_scroll_bar_drag_pos; | |||
| 174 | /* Keyboard code page - may be changed by language-change events. */ | 171 | /* Keyboard code page - may be changed by language-change events. */ |
| 175 | int w32_keyboard_codepage; | 172 | int w32_keyboard_codepage; |
| 176 | 173 | ||
| 177 | /* Mouse movement. */ | ||
| 178 | |||
| 179 | /* Where the mouse was last time we reported a mouse event. */ | ||
| 180 | static RECT last_mouse_glyph; | ||
| 181 | static struct frame *last_mouse_glyph_frame; | ||
| 182 | |||
| 183 | /* The scroll bar in which the last motion event occurred. | ||
| 184 | |||
| 185 | If the last motion event occurred in a scroll bar, we set this | ||
| 186 | so w32_mouse_position can know whether to report a scroll bar motion or | ||
| 187 | an ordinary motion. | ||
| 188 | |||
| 189 | If the last motion event didn't occur in a scroll bar, we set this | ||
| 190 | to Qnil, to tell w32_mouse_position to return an ordinary motion event. */ | ||
| 191 | static Lisp_Object last_mouse_scroll_bar; | ||
| 192 | static int last_mouse_scroll_bar_pos; | ||
| 193 | |||
| 194 | /* This is a hack. We would really prefer that w32_mouse_position would | ||
| 195 | return the time associated with the position it returns, but there | ||
| 196 | doesn't seem to be any way to wrest the time-stamp from the server | ||
| 197 | along with the position query. So, we just keep track of the time | ||
| 198 | of the last movement we received, and return that in hopes that | ||
| 199 | it's somewhat accurate. */ | ||
| 200 | static Time last_mouse_movement_time; | ||
| 201 | |||
| 202 | /* Incremented by w32_read_socket whenever it really tries to read | 174 | /* Incremented by w32_read_socket whenever it really tries to read |
| 203 | events. */ | 175 | events. */ |
| 204 | static int volatile input_signal_count; | 176 | static int volatile input_signal_count; |
| @@ -477,7 +449,7 @@ w32_clear_window (struct frame *f) | |||
| 477 | void | 449 | void |
| 478 | x_set_frame_alpha (struct frame *f) | 450 | x_set_frame_alpha (struct frame *f) |
| 479 | { | 451 | { |
| 480 | struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); | 452 | struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); |
| 481 | double alpha = 1.0; | 453 | double alpha = 1.0; |
| 482 | double alpha_min = 1.0; | 454 | double alpha_min = 1.0; |
| 483 | BYTE opac; | 455 | BYTE opac; |
| @@ -557,7 +529,7 @@ x_display_pixel_width (struct w32_display_info *dpyinfo) | |||
| 557 | static void | 529 | static void |
| 558 | x_update_begin (struct frame *f) | 530 | x_update_begin (struct frame *f) |
| 559 | { | 531 | { |
| 560 | struct w32_display_info *display_info = FRAME_W32_DISPLAY_INFO (f); | 532 | struct w32_display_info *display_info = FRAME_DISPLAY_INFO (f); |
| 561 | 533 | ||
| 562 | if (! FRAME_W32_P (f)) | 534 | if (! FRAME_W32_P (f)) |
| 563 | return; | 535 | return; |
| @@ -1003,14 +975,14 @@ x_set_cursor_gc (struct glyph_string *s) | |||
| 1003 | xgcv.font = s->font; | 975 | xgcv.font = s->font; |
| 1004 | mask = GCForeground | GCBackground | GCFont; | 976 | mask = GCForeground | GCBackground | GCFont; |
| 1005 | 977 | ||
| 1006 | if (FRAME_W32_DISPLAY_INFO (s->f)->scratch_cursor_gc) | 978 | if (FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc) |
| 1007 | XChangeGC (NULL, FRAME_W32_DISPLAY_INFO (s->f)->scratch_cursor_gc, | 979 | XChangeGC (NULL, FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc, |
| 1008 | mask, &xgcv); | 980 | mask, &xgcv); |
| 1009 | else | 981 | else |
| 1010 | FRAME_W32_DISPLAY_INFO (s->f)->scratch_cursor_gc | 982 | FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc |
| 1011 | = XCreateGC (NULL, s->window, mask, &xgcv); | 983 | = XCreateGC (NULL, s->window, mask, &xgcv); |
| 1012 | 984 | ||
| 1013 | s->gc = FRAME_W32_DISPLAY_INFO (s->f)->scratch_cursor_gc; | 985 | s->gc = FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc; |
| 1014 | } | 986 | } |
| 1015 | } | 987 | } |
| 1016 | 988 | ||
| @@ -1052,14 +1024,14 @@ x_set_mouse_face_gc (struct glyph_string *s) | |||
| 1052 | xgcv.font = s->font; | 1024 | xgcv.font = s->font; |
| 1053 | mask = GCForeground | GCBackground | GCFont; | 1025 | mask = GCForeground | GCBackground | GCFont; |
| 1054 | 1026 | ||
| 1055 | if (FRAME_W32_DISPLAY_INFO (s->f)->scratch_cursor_gc) | 1027 | if (FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc) |
| 1056 | XChangeGC (NULL, FRAME_W32_DISPLAY_INFO (s->f)->scratch_cursor_gc, | 1028 | XChangeGC (NULL, FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc, |
| 1057 | mask, &xgcv); | 1029 | mask, &xgcv); |
| 1058 | else | 1030 | else |
| 1059 | FRAME_W32_DISPLAY_INFO (s->f)->scratch_cursor_gc | 1031 | FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc |
| 1060 | = XCreateGC (NULL, s->window, mask, &xgcv); | 1032 | = XCreateGC (NULL, s->window, mask, &xgcv); |
| 1061 | 1033 | ||
| 1062 | s->gc = FRAME_W32_DISPLAY_INFO (s->f)->scratch_cursor_gc; | 1034 | s->gc = FRAME_DISPLAY_INFO (s->f)->scratch_cursor_gc; |
| 1063 | } | 1035 | } |
| 1064 | 1036 | ||
| 1065 | eassert (s->gc != 0); | 1037 | eassert (s->gc != 0); |
| @@ -1623,7 +1595,7 @@ w32_setup_relief_color (struct frame *f, struct relief *relief, double factor, | |||
| 1623 | unsigned long mask = GCForeground; | 1595 | unsigned long mask = GCForeground; |
| 1624 | COLORREF pixel; | 1596 | COLORREF pixel; |
| 1625 | COLORREF background = di->relief_background; | 1597 | COLORREF background = di->relief_background; |
| 1626 | struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); | 1598 | struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); |
| 1627 | 1599 | ||
| 1628 | /* TODO: Free colors (if using palette)? */ | 1600 | /* TODO: Free colors (if using palette)? */ |
| 1629 | 1601 | ||
| @@ -2823,9 +2795,9 @@ x_new_focus_frame (struct w32_display_info *dpyinfo, struct frame *frame) | |||
| 2823 | x_lower_frame (old_focus); | 2795 | x_lower_frame (old_focus); |
| 2824 | 2796 | ||
| 2825 | if (dpyinfo->w32_focus_frame && dpyinfo->w32_focus_frame->auto_raise) | 2797 | if (dpyinfo->w32_focus_frame && dpyinfo->w32_focus_frame->auto_raise) |
| 2826 | pending_autoraise_frame = dpyinfo->w32_focus_frame; | 2798 | dpyinfo->w32_pending_autoraise_frame = dpyinfo->w32_focus_frame; |
| 2827 | else | 2799 | else |
| 2828 | pending_autoraise_frame = 0; | 2800 | dpyinfo->w32_pending_autoraise_frame = NULL; |
| 2829 | } | 2801 | } |
| 2830 | 2802 | ||
| 2831 | x_frame_rehighlight (dpyinfo); | 2803 | x_frame_rehighlight (dpyinfo); |
| @@ -2930,7 +2902,7 @@ w32_frame_rehighlight (struct frame *frame) | |||
| 2930 | { | 2902 | { |
| 2931 | if (! FRAME_W32_P (frame)) | 2903 | if (! FRAME_W32_P (frame)) |
| 2932 | return; | 2904 | return; |
| 2933 | x_frame_rehighlight (FRAME_W32_DISPLAY_INFO (frame)); | 2905 | x_frame_rehighlight (FRAME_DISPLAY_INFO (frame)); |
| 2934 | } | 2906 | } |
| 2935 | 2907 | ||
| 2936 | static void | 2908 | static void |
| @@ -3307,47 +3279,47 @@ queue_notifications (struct input_event *event, W32Msg *msg, struct frame *f, | |||
| 3307 | the mainstream emacs code by setting mouse_moved. If not, ask for | 3279 | the mainstream emacs code by setting mouse_moved. If not, ask for |
| 3308 | another motion event, so we can check again the next time it moves. */ | 3280 | another motion event, so we can check again the next time it moves. */ |
| 3309 | 3281 | ||
| 3310 | static MSG last_mouse_motion_event; | ||
| 3311 | static Lisp_Object last_mouse_motion_frame; | ||
| 3312 | |||
| 3313 | static int | 3282 | static int |
| 3314 | note_mouse_movement (struct frame *frame, MSG *msg) | 3283 | note_mouse_movement (struct frame *frame, MSG *msg) |
| 3315 | { | 3284 | { |
| 3285 | struct w32_display_info *dpyinfo; | ||
| 3316 | int mouse_x = LOWORD (msg->lParam); | 3286 | int mouse_x = LOWORD (msg->lParam); |
| 3317 | int mouse_y = HIWORD (msg->lParam); | 3287 | int mouse_y = HIWORD (msg->lParam); |
| 3318 | 3288 | RECT *r; | |
| 3319 | last_mouse_movement_time = msg->time; | ||
| 3320 | memcpy (&last_mouse_motion_event, msg, sizeof (last_mouse_motion_event)); | ||
| 3321 | XSETFRAME (last_mouse_motion_frame, frame); | ||
| 3322 | 3289 | ||
| 3323 | if (!FRAME_X_OUTPUT (frame)) | 3290 | if (!FRAME_X_OUTPUT (frame)) |
| 3324 | return 0; | 3291 | return 0; |
| 3325 | 3292 | ||
| 3293 | dpyinfo = FRAME_DISPLAY_INFO (frame); | ||
| 3294 | dpyinfo->last_mouse_movement_time = msg->time; | ||
| 3295 | dpyinfo->last_mouse_motion_frame = frame; | ||
| 3296 | dpyinfo->last_mouse_motion_x = mouse_x; | ||
| 3297 | dpyinfo->last_mouse_motion_y = mouse_y; | ||
| 3298 | |||
| 3326 | if (msg->hwnd != FRAME_W32_WINDOW (frame)) | 3299 | if (msg->hwnd != FRAME_W32_WINDOW (frame)) |
| 3327 | { | 3300 | { |
| 3328 | frame->mouse_moved = 1; | 3301 | frame->mouse_moved = 1; |
| 3329 | last_mouse_scroll_bar = Qnil; | 3302 | dpyinfo->last_mouse_scroll_bar = NULL; |
| 3330 | note_mouse_highlight (frame, -1, -1); | 3303 | note_mouse_highlight (frame, -1, -1); |
| 3331 | last_mouse_glyph_frame = 0; | 3304 | dpyinfo->last_mouse_glyph_frame = NULL; |
| 3332 | return 1; | 3305 | return 1; |
| 3333 | } | 3306 | } |
| 3334 | 3307 | ||
| 3335 | /* Has the mouse moved off the glyph it was on at the last sighting? */ | 3308 | /* Has the mouse moved off the glyph it was on at the last sighting? */ |
| 3336 | if (frame != last_mouse_glyph_frame | 3309 | r = &dpyinfo->last_mouse_glyph; |
| 3337 | || mouse_x < last_mouse_glyph.left | 3310 | if (frame != dpyinfo->last_mouse_glyph_frame |
| 3338 | || mouse_x >= last_mouse_glyph.right | 3311 | || mouse_x < r->left || mouse_x >= r->right |
| 3339 | || mouse_y < last_mouse_glyph.top | 3312 | || mouse_y < r->top || mouse_y >= r->bottom) |
| 3340 | || mouse_y >= last_mouse_glyph.bottom) | ||
| 3341 | { | 3313 | { |
| 3342 | frame->mouse_moved = 1; | 3314 | frame->mouse_moved = 1; |
| 3343 | last_mouse_scroll_bar = Qnil; | 3315 | dpyinfo->last_mouse_scroll_bar = NULL; |
| 3344 | note_mouse_highlight (frame, mouse_x, mouse_y); | 3316 | note_mouse_highlight (frame, mouse_x, mouse_y); |
| 3345 | /* Remember the mouse position here, as w32_mouse_position only | 3317 | /* Remember the mouse position here, as w32_mouse_position only |
| 3346 | gets called when mouse tracking is enabled but we also need | 3318 | gets called when mouse tracking is enabled but we also need |
| 3347 | to keep track of the mouse for help_echo and highlighting at | 3319 | to keep track of the mouse for help_echo and highlighting at |
| 3348 | other times. */ | 3320 | other times. */ |
| 3349 | remember_mouse_glyph (frame, mouse_x, mouse_y, &last_mouse_glyph); | 3321 | remember_mouse_glyph (frame, mouse_x, mouse_y, r); |
| 3350 | last_mouse_glyph_frame = frame; | 3322 | dpyinfo->last_mouse_glyph_frame = frame; |
| 3351 | return 1; | 3323 | return 1; |
| 3352 | } | 3324 | } |
| 3353 | 3325 | ||
| @@ -3367,16 +3339,6 @@ static void x_scroll_bar_report_motion (struct frame **, Lisp_Object *, | |||
| 3367 | static void x_check_fullscreen (struct frame *); | 3339 | static void x_check_fullscreen (struct frame *); |
| 3368 | 3340 | ||
| 3369 | static void | 3341 | static void |
| 3370 | redo_mouse_highlight (void) | ||
| 3371 | { | ||
| 3372 | if (!NILP (last_mouse_motion_frame) | ||
| 3373 | && FRAME_LIVE_P (XFRAME (last_mouse_motion_frame))) | ||
| 3374 | note_mouse_highlight (XFRAME (last_mouse_motion_frame), | ||
| 3375 | LOWORD (last_mouse_motion_event.lParam), | ||
| 3376 | HIWORD (last_mouse_motion_event.lParam)); | ||
| 3377 | } | ||
| 3378 | |||
| 3379 | static void | ||
| 3380 | w32_define_cursor (Window window, Cursor cursor) | 3342 | w32_define_cursor (Window window, Cursor cursor) |
| 3381 | { | 3343 | { |
| 3382 | PostMessage (window, WM_EMACS_SETCURSOR, (WPARAM) cursor, 0); | 3344 | PostMessage (window, WM_EMACS_SETCURSOR, (WPARAM) cursor, 0); |
| @@ -3407,10 +3369,11 @@ w32_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window, | |||
| 3407 | unsigned long *time) | 3369 | unsigned long *time) |
| 3408 | { | 3370 | { |
| 3409 | struct frame *f1; | 3371 | struct frame *f1; |
| 3372 | struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (*fp); | ||
| 3410 | 3373 | ||
| 3411 | block_input (); | 3374 | block_input (); |
| 3412 | 3375 | ||
| 3413 | if (! NILP (last_mouse_scroll_bar) && insist == 0) | 3376 | if (dpyinfo->last_mouse_scroll_bar && insist == 0) |
| 3414 | x_scroll_bar_report_motion (fp, bar_window, part, x, y, time); | 3377 | x_scroll_bar_report_motion (fp, bar_window, part, x, y, time); |
| 3415 | else | 3378 | else |
| 3416 | { | 3379 | { |
| @@ -3422,26 +3385,18 @@ w32_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window, | |||
| 3422 | FOR_EACH_FRAME (tail, frame) | 3385 | FOR_EACH_FRAME (tail, frame) |
| 3423 | XFRAME (frame)->mouse_moved = 0; | 3386 | XFRAME (frame)->mouse_moved = 0; |
| 3424 | 3387 | ||
| 3425 | last_mouse_scroll_bar = Qnil; | 3388 | dpyinfo->last_mouse_scroll_bar = NULL; |
| 3426 | 3389 | ||
| 3427 | GetCursorPos (&pt); | 3390 | GetCursorPos (&pt); |
| 3428 | 3391 | ||
| 3429 | /* Now we have a position on the root; find the innermost window | 3392 | /* Now we have a position on the root; find the innermost window |
| 3430 | containing the pointer. */ | 3393 | containing the pointer. */ |
| 3431 | { | 3394 | { |
| 3432 | if (FRAME_W32_DISPLAY_INFO (*fp)->grabbed && last_mouse_frame | 3395 | /* If mouse was grabbed on a frame, give coords for that |
| 3433 | && FRAME_LIVE_P (last_mouse_frame)) | 3396 | frame even if the mouse is now outside it. Otherwise |
| 3434 | { | 3397 | check for window under mouse on one of our frames. */ |
| 3435 | /* If mouse was grabbed on a frame, give coords for that frame | 3398 | f1 = (x_mouse_grabbed (dpyinfo) ? dpyinfo->last_mouse_frame |
| 3436 | even if the mouse is now outside it. */ | 3399 | : x_any_window_to_frame (dpyinfo, WindowFromPoint (pt))); |
| 3437 | f1 = last_mouse_frame; | ||
| 3438 | } | ||
| 3439 | else | ||
| 3440 | { | ||
| 3441 | /* Is window under mouse one of our frames? */ | ||
| 3442 | f1 = x_any_window_to_frame (FRAME_W32_DISPLAY_INFO (*fp), | ||
| 3443 | WindowFromPoint (pt)); | ||
| 3444 | } | ||
| 3445 | 3400 | ||
| 3446 | /* If not, is it one of our scroll bars? */ | 3401 | /* If not, is it one of our scroll bars? */ |
| 3447 | if (! f1) | 3402 | if (! f1) |
| @@ -3468,16 +3423,17 @@ w32_mouse_position (struct frame **fp, int insist, Lisp_Object *bar_window, | |||
| 3468 | on it, i.e. into the same rectangles that matrices on | 3423 | on it, i.e. into the same rectangles that matrices on |
| 3469 | the frame are divided into. */ | 3424 | the frame are divided into. */ |
| 3470 | 3425 | ||
| 3426 | dpyinfo = FRAME_DISPLAY_INFO (f1); | ||
| 3471 | ScreenToClient (FRAME_W32_WINDOW (f1), &pt); | 3427 | ScreenToClient (FRAME_W32_WINDOW (f1), &pt); |
| 3472 | remember_mouse_glyph (f1, pt.x, pt.y, &last_mouse_glyph); | 3428 | remember_mouse_glyph (f1, pt.x, pt.y, &dpyinfo->last_mouse_glyph); |
| 3473 | last_mouse_glyph_frame = f1; | 3429 | dpyinfo->last_mouse_glyph_frame = f1; |
| 3474 | 3430 | ||
| 3475 | *bar_window = Qnil; | 3431 | *bar_window = Qnil; |
| 3476 | *part = 0; | 3432 | *part = 0; |
| 3477 | *fp = f1; | 3433 | *fp = f1; |
| 3478 | XSETINT (*x, pt.x); | 3434 | XSETINT (*x, pt.x); |
| 3479 | XSETINT (*y, pt.y); | 3435 | XSETINT (*y, pt.y); |
| 3480 | *time = last_mouse_movement_time; | 3436 | *time = dpyinfo->last_mouse_movement_time; |
| 3481 | } | 3437 | } |
| 3482 | } | 3438 | } |
| 3483 | } | 3439 | } |
| @@ -3866,8 +3822,7 @@ w32_set_vertical_scroll_bar (struct window *w, | |||
| 3866 | /* Make sure scroll bar is "visible" before moving, to ensure the | 3822 | /* Make sure scroll bar is "visible" before moving, to ensure the |
| 3867 | area of the parent window now exposed will be refreshed. */ | 3823 | area of the parent window now exposed will be refreshed. */ |
| 3868 | my_show_window (f, hwnd, SW_HIDE); | 3824 | my_show_window (f, hwnd, SW_HIDE); |
| 3869 | MoveWindow (hwnd, sb_left + VERTICAL_SCROLL_BAR_WIDTH_TRIM, | 3825 | MoveWindow (hwnd, sb_left, top, sb_width, |
| 3870 | top, sb_width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2, | ||
| 3871 | max (height, 1), TRUE); | 3826 | max (height, 1), TRUE); |
| 3872 | 3827 | ||
| 3873 | si.cbSize = sizeof (si); | 3828 | si.cbSize = sizeof (si); |
| @@ -4037,9 +3992,7 @@ w32_scroll_bar_handle_click (struct scroll_bar *bar, W32Msg *msg, | |||
| 4037 | y = si.nPos; | 3992 | y = si.nPos; |
| 4038 | 3993 | ||
| 4039 | bar->dragging = Qnil; | 3994 | bar->dragging = Qnil; |
| 4040 | 3995 | FRAME_DISPLAY_INFO (f)->last_mouse_scroll_bar_pos = msg->msg.wParam; | |
| 4041 | |||
| 4042 | last_mouse_scroll_bar_pos = msg->msg.wParam; | ||
| 4043 | 3996 | ||
| 4044 | switch (LOWORD (msg->msg.wParam)) | 3997 | switch (LOWORD (msg->msg.wParam)) |
| 4045 | { | 3998 | { |
| @@ -4122,7 +4075,8 @@ x_scroll_bar_report_motion (struct frame **fp, Lisp_Object *bar_window, | |||
| 4122 | Lisp_Object *x, Lisp_Object *y, | 4075 | Lisp_Object *x, Lisp_Object *y, |
| 4123 | unsigned long *time) | 4076 | unsigned long *time) |
| 4124 | { | 4077 | { |
| 4125 | struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar); | 4078 | struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (*fp); |
| 4079 | struct scroll_bar *bar = dpyinfo->last_mouse_scroll_bar; | ||
| 4126 | Window w = SCROLL_BAR_W32_WINDOW (bar); | 4080 | Window w = SCROLL_BAR_W32_WINDOW (bar); |
| 4127 | struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); | 4081 | struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); |
| 4128 | int pos; | 4082 | int pos; |
| @@ -4141,13 +4095,13 @@ x_scroll_bar_report_motion (struct frame **fp, Lisp_Object *bar_window, | |||
| 4141 | pos = si.nPos; | 4095 | pos = si.nPos; |
| 4142 | top_range = si.nMax - si.nPage + 1; | 4096 | top_range = si.nMax - si.nPage + 1; |
| 4143 | 4097 | ||
| 4144 | switch (LOWORD (last_mouse_scroll_bar_pos)) | 4098 | switch (LOWORD (dpyinfo->last_mouse_scroll_bar_pos)) |
| 4145 | { | 4099 | { |
| 4146 | case SB_THUMBPOSITION: | 4100 | case SB_THUMBPOSITION: |
| 4147 | case SB_THUMBTRACK: | 4101 | case SB_THUMBTRACK: |
| 4148 | *part = scroll_bar_handle; | 4102 | *part = scroll_bar_handle; |
| 4149 | if (VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height)) <= 0xffff) | 4103 | if (VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height)) <= 0xffff) |
| 4150 | pos = HIWORD (last_mouse_scroll_bar_pos); | 4104 | pos = HIWORD (dpyinfo->last_mouse_scroll_bar_pos); |
| 4151 | break; | 4105 | break; |
| 4152 | case SB_LINEDOWN: | 4106 | case SB_LINEDOWN: |
| 4153 | *part = scroll_bar_handle; | 4107 | *part = scroll_bar_handle; |
| @@ -4162,9 +4116,9 @@ x_scroll_bar_report_motion (struct frame **fp, Lisp_Object *bar_window, | |||
| 4162 | XSETINT (*y, top_range); | 4116 | XSETINT (*y, top_range); |
| 4163 | 4117 | ||
| 4164 | f->mouse_moved = 0; | 4118 | f->mouse_moved = 0; |
| 4165 | last_mouse_scroll_bar = Qnil; | 4119 | dpyinfo->last_mouse_scroll_bar = NULL; |
| 4166 | 4120 | ||
| 4167 | *time = last_mouse_movement_time; | 4121 | *time = dpyinfo->last_mouse_movement_time; |
| 4168 | 4122 | ||
| 4169 | unblock_input (); | 4123 | unblock_input (); |
| 4170 | } | 4124 | } |
| @@ -4483,11 +4437,8 @@ w32_read_socket (struct terminal *terminal, | |||
| 4483 | previous_help_echo_string = help_echo_string; | 4437 | previous_help_echo_string = help_echo_string; |
| 4484 | help_echo_string = Qnil; | 4438 | help_echo_string = Qnil; |
| 4485 | 4439 | ||
| 4486 | if (dpyinfo->grabbed && last_mouse_frame | 4440 | f = (x_mouse_grabbed (dpyinfo) ? dpyinfo->last_mouse_frame |
| 4487 | && FRAME_LIVE_P (last_mouse_frame)) | 4441 | : x_window_to_frame (dpyinfo, msg.msg.hwnd)); |
| 4488 | f = last_mouse_frame; | ||
| 4489 | else | ||
| 4490 | f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | ||
| 4491 | 4442 | ||
| 4492 | if (hlinfo->mouse_face_hidden) | 4443 | if (hlinfo->mouse_face_hidden) |
| 4493 | { | 4444 | { |
| @@ -4563,11 +4514,8 @@ w32_read_socket (struct terminal *terminal, | |||
| 4563 | int button; | 4514 | int button; |
| 4564 | int up; | 4515 | int up; |
| 4565 | 4516 | ||
| 4566 | if (dpyinfo->grabbed && last_mouse_frame | 4517 | f = (x_mouse_grabbed (dpyinfo) ? dpyinfo->last_mouse_frame |
| 4567 | && FRAME_LIVE_P (last_mouse_frame)) | 4518 | : x_window_to_frame (dpyinfo, msg.msg.hwnd)); |
| 4568 | f = last_mouse_frame; | ||
| 4569 | else | ||
| 4570 | f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | ||
| 4571 | 4519 | ||
| 4572 | if (f) | 4520 | if (f) |
| 4573 | { | 4521 | { |
| @@ -4606,7 +4554,7 @@ w32_read_socket (struct terminal *terminal, | |||
| 4606 | else | 4554 | else |
| 4607 | { | 4555 | { |
| 4608 | dpyinfo->grabbed |= (1 << button); | 4556 | dpyinfo->grabbed |= (1 << button); |
| 4609 | last_mouse_frame = f; | 4557 | dpyinfo->last_mouse_frame = f; |
| 4610 | /* Ignore any mouse motion that happened | 4558 | /* Ignore any mouse motion that happened |
| 4611 | before this event; any subsequent mouse-movement | 4559 | before this event; any subsequent mouse-movement |
| 4612 | Emacs events should reflect only motion after | 4560 | Emacs events should reflect only motion after |
| @@ -4623,11 +4571,8 @@ w32_read_socket (struct terminal *terminal, | |||
| 4623 | case WM_MOUSEWHEEL: | 4571 | case WM_MOUSEWHEEL: |
| 4624 | case WM_MOUSEHWHEEL: | 4572 | case WM_MOUSEHWHEEL: |
| 4625 | { | 4573 | { |
| 4626 | if (dpyinfo->grabbed && last_mouse_frame | 4574 | f = (x_mouse_grabbed (dpyinfo) ? dpyinfo->last_mouse_frame |
| 4627 | && FRAME_LIVE_P (last_mouse_frame)) | 4575 | : x_window_to_frame (dpyinfo, msg.msg.hwnd)); |
| 4628 | f = last_mouse_frame; | ||
| 4629 | else | ||
| 4630 | f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | ||
| 4631 | 4576 | ||
| 4632 | if (f) | 4577 | if (f) |
| 4633 | { | 4578 | { |
| @@ -4644,7 +4589,7 @@ w32_read_socket (struct terminal *terminal, | |||
| 4644 | ButtonPress. */ | 4589 | ButtonPress. */ |
| 4645 | f->mouse_moved = 0; | 4590 | f->mouse_moved = 0; |
| 4646 | } | 4591 | } |
| 4647 | last_mouse_frame = f; | 4592 | dpyinfo->last_mouse_frame = f; |
| 4648 | last_tool_bar_item = -1; | 4593 | last_tool_bar_item = -1; |
| 4649 | } | 4594 | } |
| 4650 | break; | 4595 | break; |
| @@ -4691,13 +4636,7 @@ w32_read_socket (struct terminal *terminal, | |||
| 4691 | f = x_window_to_frame (dpyinfo, msg.msg.hwnd); | 4636 | f = x_window_to_frame (dpyinfo, msg.msg.hwnd); |
| 4692 | 4637 | ||
| 4693 | if (f && !FRAME_ICONIFIED_P (f)) | 4638 | if (f && !FRAME_ICONIFIED_P (f)) |
| 4694 | { | 4639 | x_real_positions (f, &f->left_pos, &f->top_pos); |
| 4695 | int x, y; | ||
| 4696 | |||
| 4697 | x_real_positions (f, &x, &y); | ||
| 4698 | f->left_pos = x; | ||
| 4699 | f->top_pos = y; | ||
| 4700 | } | ||
| 4701 | 4640 | ||
| 4702 | check_visibility = 1; | 4641 | check_visibility = 1; |
| 4703 | break; | 4642 | break; |
| @@ -4709,7 +4648,7 @@ w32_read_socket (struct terminal *terminal, | |||
| 4709 | if (!msg.msg.wParam && msg.msg.hwnd == tip_window) | 4648 | if (!msg.msg.wParam && msg.msg.hwnd == tip_window) |
| 4710 | { | 4649 | { |
| 4711 | tip_window = NULL; | 4650 | tip_window = NULL; |
| 4712 | redo_mouse_highlight (); | 4651 | x_redo_mouse_highlight (dpyinfo); |
| 4713 | } | 4652 | } |
| 4714 | 4653 | ||
| 4715 | /* If window has been obscured or exposed by another window | 4654 | /* If window has been obscured or exposed by another window |
| @@ -4760,16 +4699,12 @@ w32_read_socket (struct terminal *terminal, | |||
| 4760 | 4699 | ||
| 4761 | if (iconified) | 4700 | if (iconified) |
| 4762 | { | 4701 | { |
| 4763 | int x, y; | ||
| 4764 | |||
| 4765 | /* Reset top and left positions of the Window | 4702 | /* Reset top and left positions of the Window |
| 4766 | here since Windows sends a WM_MOVE message | 4703 | here since Windows sends a WM_MOVE message |
| 4767 | BEFORE telling us the Window is minimized | 4704 | BEFORE telling us the Window is minimized |
| 4768 | when the Window is iconified, with 3000,3000 | 4705 | when the Window is iconified, with 3000,3000 |
| 4769 | as the co-ords. */ | 4706 | as the co-ords. */ |
| 4770 | x_real_positions (f, &x, &y); | 4707 | x_real_positions (f, &f->left_pos, &f->top_pos); |
| 4771 | f->left_pos = x; | ||
| 4772 | f->top_pos = y; | ||
| 4773 | 4708 | ||
| 4774 | inev.kind = DEICONIFY_EVENT; | 4709 | inev.kind = DEICONIFY_EVENT; |
| 4775 | XSETFRAME (inev.frame_or_window, f); | 4710 | XSETFRAME (inev.frame_or_window, f); |
| @@ -4982,12 +4917,11 @@ w32_read_socket (struct terminal *terminal, | |||
| 4982 | } | 4917 | } |
| 4983 | 4918 | ||
| 4984 | /* If the focus was just given to an autoraising frame, | 4919 | /* If the focus was just given to an autoraising frame, |
| 4985 | raise it now. */ | 4920 | raise it now. FIXME: handle more than one such frame. */ |
| 4986 | /* ??? This ought to be able to handle more than one such frame. */ | 4921 | if (dpyinfo->w32_pending_autoraise_frame) |
| 4987 | if (pending_autoraise_frame) | ||
| 4988 | { | 4922 | { |
| 4989 | x_raise_frame (pending_autoraise_frame); | 4923 | x_raise_frame (dpyinfo->w32_pending_autoraise_frame); |
| 4990 | pending_autoraise_frame = 0; | 4924 | dpyinfo->w32_pending_autoraise_frame = NULL; |
| 4991 | } | 4925 | } |
| 4992 | 4926 | ||
| 4993 | /* Check which frames are still visible, if we have enqueued any user | 4927 | /* Check which frames are still visible, if we have enqueued any user |
| @@ -5539,13 +5473,13 @@ x_calc_absolute_position (struct frame *f) | |||
| 5539 | /* Treat negative positions as relative to the rightmost bottommost | 5473 | /* Treat negative positions as relative to the rightmost bottommost |
| 5540 | position that fits on the screen. */ | 5474 | position that fits on the screen. */ |
| 5541 | if (flags & XNegative) | 5475 | if (flags & XNegative) |
| 5542 | f->left_pos = (x_display_pixel_width (FRAME_W32_DISPLAY_INFO (f)) | 5476 | f->left_pos = (x_display_pixel_width (FRAME_DISPLAY_INFO (f)) |
| 5543 | - FRAME_PIXEL_WIDTH (f) | 5477 | - FRAME_PIXEL_WIDTH (f) |
| 5544 | + f->left_pos | 5478 | + f->left_pos |
| 5545 | - (left_right_borders_width - 1)); | 5479 | - (left_right_borders_width - 1)); |
| 5546 | 5480 | ||
| 5547 | if (flags & YNegative) | 5481 | if (flags & YNegative) |
| 5548 | f->top_pos = (x_display_pixel_height (FRAME_W32_DISPLAY_INFO (f)) | 5482 | f->top_pos = (x_display_pixel_height (FRAME_DISPLAY_INFO (f)) |
| 5549 | - FRAME_PIXEL_HEIGHT (f) | 5483 | - FRAME_PIXEL_HEIGHT (f) |
| 5550 | + f->top_pos | 5484 | + f->top_pos |
| 5551 | - (top_bottom_borders_height - 1)); | 5485 | - (top_bottom_borders_height - 1)); |
| @@ -5806,7 +5740,7 @@ x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y) | |||
| 5806 | /* focus shifting, raising and lowering. */ | 5740 | /* focus shifting, raising and lowering. */ |
| 5807 | 5741 | ||
| 5808 | void | 5742 | void |
| 5809 | x_focus_on_frame (struct frame *f) | 5743 | x_focus_frame (struct frame *f) |
| 5810 | { | 5744 | { |
| 5811 | struct w32_display_info *dpyinfo = &one_w32_display_info; | 5745 | struct w32_display_info *dpyinfo = &one_w32_display_info; |
| 5812 | 5746 | ||
| @@ -5920,13 +5854,9 @@ w32_frame_raise_lower (struct frame *f, int raise_flag) | |||
| 5920 | void | 5854 | void |
| 5921 | x_make_frame_visible (struct frame *f) | 5855 | x_make_frame_visible (struct frame *f) |
| 5922 | { | 5856 | { |
| 5923 | Lisp_Object type; | ||
| 5924 | |||
| 5925 | block_input (); | 5857 | block_input (); |
| 5926 | 5858 | ||
| 5927 | type = x_icon_type (f); | 5859 | x_set_bitmap_icon (f); |
| 5928 | if (!NILP (type)) | ||
| 5929 | x_bitmap_icon (f, type); | ||
| 5930 | 5860 | ||
| 5931 | if (! FRAME_VISIBLE_P (f)) | 5861 | if (! FRAME_VISIBLE_P (f)) |
| 5932 | { | 5862 | { |
| @@ -6013,8 +5943,8 @@ void | |||
| 6013 | x_make_frame_invisible (struct frame *f) | 5943 | x_make_frame_invisible (struct frame *f) |
| 6014 | { | 5944 | { |
| 6015 | /* Don't keep the highlight on an invisible frame. */ | 5945 | /* Don't keep the highlight on an invisible frame. */ |
| 6016 | if (FRAME_W32_DISPLAY_INFO (f)->x_highlight_frame == f) | 5946 | if (FRAME_DISPLAY_INFO (f)->x_highlight_frame == f) |
| 6017 | FRAME_W32_DISPLAY_INFO (f)->x_highlight_frame = 0; | 5947 | FRAME_DISPLAY_INFO (f)->x_highlight_frame = 0; |
| 6018 | 5948 | ||
| 6019 | block_input (); | 5949 | block_input (); |
| 6020 | 5950 | ||
| @@ -6036,20 +5966,16 @@ x_make_frame_invisible (struct frame *f) | |||
| 6036 | void | 5966 | void |
| 6037 | x_iconify_frame (struct frame *f) | 5967 | x_iconify_frame (struct frame *f) |
| 6038 | { | 5968 | { |
| 6039 | Lisp_Object type; | ||
| 6040 | |||
| 6041 | /* Don't keep the highlight on an invisible frame. */ | 5969 | /* Don't keep the highlight on an invisible frame. */ |
| 6042 | if (FRAME_W32_DISPLAY_INFO (f)->x_highlight_frame == f) | 5970 | if (FRAME_DISPLAY_INFO (f)->x_highlight_frame == f) |
| 6043 | FRAME_W32_DISPLAY_INFO (f)->x_highlight_frame = 0; | 5971 | FRAME_DISPLAY_INFO (f)->x_highlight_frame = 0; |
| 6044 | 5972 | ||
| 6045 | if (FRAME_ICONIFIED_P (f)) | 5973 | if (FRAME_ICONIFIED_P (f)) |
| 6046 | return; | 5974 | return; |
| 6047 | 5975 | ||
| 6048 | block_input (); | 5976 | block_input (); |
| 6049 | 5977 | ||
| 6050 | type = x_icon_type (f); | 5978 | x_set_bitmap_icon (f); |
| 6051 | if (!NILP (type)) | ||
| 6052 | x_bitmap_icon (f, type); | ||
| 6053 | 5979 | ||
| 6054 | /* Simulate the user minimizing the frame. */ | 5980 | /* Simulate the user minimizing the frame. */ |
| 6055 | SendMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_MINIMIZE, 0); | 5981 | SendMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_MINIMIZE, 0); |
| @@ -6066,7 +5992,7 @@ x_iconify_frame (struct frame *f) | |||
| 6066 | void | 5992 | void |
| 6067 | x_free_frame_resources (struct frame *f) | 5993 | x_free_frame_resources (struct frame *f) |
| 6068 | { | 5994 | { |
| 6069 | struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); | 5995 | struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); |
| 6070 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); | 5996 | Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); |
| 6071 | 5997 | ||
| 6072 | block_input (); | 5998 | block_input (); |
| @@ -6116,7 +6042,7 @@ x_free_frame_resources (struct frame *f) | |||
| 6116 | void | 6042 | void |
| 6117 | x_destroy_window (struct frame *f) | 6043 | x_destroy_window (struct frame *f) |
| 6118 | { | 6044 | { |
| 6119 | struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); | 6045 | struct w32_display_info *dpyinfo = FRAME_DISPLAY_INFO (f); |
| 6120 | 6046 | ||
| 6121 | x_free_frame_resources (f); | 6047 | x_free_frame_resources (f); |
| 6122 | dpyinfo->reference_count--; | 6048 | dpyinfo->reference_count--; |
| @@ -6258,11 +6184,6 @@ w32_make_rdb (char *xrm_option) | |||
| 6258 | return buffer; | 6184 | return buffer; |
| 6259 | } | 6185 | } |
| 6260 | 6186 | ||
| 6261 | void | ||
| 6262 | x_flush (struct frame * f) | ||
| 6263 | { /* Nothing to do */ } | ||
| 6264 | |||
| 6265 | |||
| 6266 | extern frame_parm_handler w32_frame_parm_handlers[]; | 6187 | extern frame_parm_handler w32_frame_parm_handlers[]; |
| 6267 | 6188 | ||
| 6268 | static struct redisplay_interface w32_redisplay_interface = | 6189 | static struct redisplay_interface w32_redisplay_interface = |
| @@ -6276,8 +6197,7 @@ static struct redisplay_interface w32_redisplay_interface = | |||
| 6276 | x_after_update_window_line, | 6197 | x_after_update_window_line, |
| 6277 | x_update_window_begin, | 6198 | x_update_window_begin, |
| 6278 | x_update_window_end, | 6199 | x_update_window_end, |
| 6279 | x_flush, | 6200 | 0, /* flush_display */ |
| 6280 | 0, /* flush_display_optional */ | ||
| 6281 | x_clear_window_mouse_face, | 6201 | x_clear_window_mouse_face, |
| 6282 | x_get_glyph_overhangs, | 6202 | x_get_glyph_overhangs, |
| 6283 | x_fix_overlapping_area, | 6203 | x_fix_overlapping_area, |
| @@ -6344,7 +6264,7 @@ w32_create_terminal (struct w32_display_info *dpyinfo) | |||
| 6344 | terminal like X does. */ | 6264 | terminal like X does. */ |
| 6345 | terminal->kboard = xmalloc (sizeof (KBOARD)); | 6265 | terminal->kboard = xmalloc (sizeof (KBOARD)); |
| 6346 | init_kboard (terminal->kboard); | 6266 | init_kboard (terminal->kboard); |
| 6347 | kset_window_system (terminal->kboard, intern ("w32")); | 6267 | kset_window_system (terminal->kboard, Qw32); |
| 6348 | terminal->kboard->next_kboard = all_kboards; | 6268 | terminal->kboard->next_kboard = all_kboards; |
| 6349 | all_kboards = terminal->kboard; | 6269 | all_kboards = terminal->kboard; |
| 6350 | /* Don't let the initial kboard remain current longer than necessary. | 6270 | /* Don't let the initial kboard remain current longer than necessary. |
| @@ -6608,9 +6528,6 @@ syms_of_w32term (void) | |||
| 6608 | staticpro (&w32_display_name_list); | 6528 | staticpro (&w32_display_name_list); |
| 6609 | w32_display_name_list = Qnil; | 6529 | w32_display_name_list = Qnil; |
| 6610 | 6530 | ||
| 6611 | staticpro (&last_mouse_scroll_bar); | ||
| 6612 | last_mouse_scroll_bar = Qnil; | ||
| 6613 | |||
| 6614 | DEFSYM (Qvendor_specific_keysyms, "vendor-specific-keysyms"); | 6531 | DEFSYM (Qvendor_specific_keysyms, "vendor-specific-keysyms"); |
| 6615 | 6532 | ||
| 6616 | DEFSYM (Qadded, "added"); | 6533 | DEFSYM (Qadded, "added"); |
| @@ -6694,8 +6611,6 @@ X toolkit. Possible values are: gtk, motif, xaw, or xaw3d. | |||
| 6694 | With MS Windows or Nextstep, the value is t. */); | 6611 | With MS Windows or Nextstep, the value is t. */); |
| 6695 | Vx_toolkit_scroll_bars = Qt; | 6612 | Vx_toolkit_scroll_bars = Qt; |
| 6696 | 6613 | ||
| 6697 | staticpro (&last_mouse_motion_frame); | 6614 | /* Tell Emacs about this window system. */ |
| 6698 | last_mouse_motion_frame = Qnil; | 6615 | Fprovide (Qw32, Qnil); |
| 6699 | |||
| 6700 | Fprovide (intern_c_string ("w32"), Qnil); | ||
| 6701 | } | 6616 | } |