diff options
Diffstat (limited to 'src/w32term.c')
| -rw-r--r-- | src/w32term.c | 140 |
1 files changed, 20 insertions, 120 deletions
diff --git a/src/w32term.c b/src/w32term.c index f0d5dc507ac..75a4151e8f2 100644 --- a/src/w32term.c +++ b/src/w32term.c | |||
| @@ -1718,7 +1718,7 @@ x_draw_glyph_string_foreground (s) | |||
| 1718 | else | 1718 | else |
| 1719 | x = s->x; | 1719 | x = s->x; |
| 1720 | 1720 | ||
| 1721 | if (s->for_overlaps_p || (s->background_filled_p && s->hl != DRAW_CURSOR)) | 1721 | if (s->for_overlaps || (s->background_filled_p && s->hl != DRAW_CURSOR)) |
| 1722 | SetBkMode (s->hdc, TRANSPARENT); | 1722 | SetBkMode (s->hdc, TRANSPARENT); |
| 1723 | else | 1723 | else |
| 1724 | SetBkMode (s->hdc, OPAQUE); | 1724 | SetBkMode (s->hdc, OPAQUE); |
| @@ -2599,7 +2599,7 @@ x_draw_glyph_string (s) | |||
| 2599 | /* If S draws into the background of its successor, draw the | 2599 | /* If S draws into the background of its successor, draw the |
| 2600 | background of the successor first so that S can draw into it. | 2600 | background of the successor first so that S can draw into it. |
| 2601 | This makes S->next use XDrawString instead of XDrawImageString. */ | 2601 | This makes S->next use XDrawString instead of XDrawImageString. */ |
| 2602 | if (s->next && s->right_overhang && !s->for_overlaps_p) | 2602 | if (s->next && s->right_overhang && !s->for_overlaps) |
| 2603 | { | 2603 | { |
| 2604 | xassert (s->next->img == NULL); | 2604 | xassert (s->next->img == NULL); |
| 2605 | x_set_glyph_string_gc (s->next); | 2605 | x_set_glyph_string_gc (s->next); |
| @@ -2612,7 +2612,7 @@ x_draw_glyph_string (s) | |||
| 2612 | 2612 | ||
| 2613 | /* Draw relief (if any) in advance for char/composition so that the | 2613 | /* Draw relief (if any) in advance for char/composition so that the |
| 2614 | glyph string can be drawn over it. */ | 2614 | glyph string can be drawn over it. */ |
| 2615 | if (!s->for_overlaps_p | 2615 | if (!s->for_overlaps |
| 2616 | && s->face->box != FACE_NO_BOX | 2616 | && s->face->box != FACE_NO_BOX |
| 2617 | && (s->first_glyph->type == CHAR_GLYPH | 2617 | && (s->first_glyph->type == CHAR_GLYPH |
| 2618 | || s->first_glyph->type == COMPOSITE_GLYPH)) | 2618 | || s->first_glyph->type == COMPOSITE_GLYPH)) |
| @@ -2638,7 +2638,7 @@ x_draw_glyph_string (s) | |||
| 2638 | break; | 2638 | break; |
| 2639 | 2639 | ||
| 2640 | case CHAR_GLYPH: | 2640 | case CHAR_GLYPH: |
| 2641 | if (s->for_overlaps_p) | 2641 | if (s->for_overlaps) |
| 2642 | s->background_filled_p = 1; | 2642 | s->background_filled_p = 1; |
| 2643 | else | 2643 | else |
| 2644 | x_draw_glyph_string_background (s, 0); | 2644 | x_draw_glyph_string_background (s, 0); |
| @@ -2646,7 +2646,7 @@ x_draw_glyph_string (s) | |||
| 2646 | break; | 2646 | break; |
| 2647 | 2647 | ||
| 2648 | case COMPOSITE_GLYPH: | 2648 | case COMPOSITE_GLYPH: |
| 2649 | if (s->for_overlaps_p || s->gidx > 0) | 2649 | if (s->for_overlaps || s->gidx > 0) |
| 2650 | s->background_filled_p = 1; | 2650 | s->background_filled_p = 1; |
| 2651 | else | 2651 | else |
| 2652 | x_draw_glyph_string_background (s, 1); | 2652 | x_draw_glyph_string_background (s, 1); |
| @@ -2657,7 +2657,7 @@ x_draw_glyph_string (s) | |||
| 2657 | abort (); | 2657 | abort (); |
| 2658 | } | 2658 | } |
| 2659 | 2659 | ||
| 2660 | if (!s->for_overlaps_p) | 2660 | if (!s->for_overlaps) |
| 2661 | { | 2661 | { |
| 2662 | /* Draw underline. */ | 2662 | /* Draw underline. */ |
| 2663 | if (s->face->underline_p | 2663 | if (s->face->underline_p |
| @@ -3355,9 +3355,7 @@ construct_drag_n_drop (result, msg, f) | |||
| 3355 | static MSG last_mouse_motion_event; | 3355 | static MSG last_mouse_motion_event; |
| 3356 | static Lisp_Object last_mouse_motion_frame; | 3356 | static Lisp_Object last_mouse_motion_frame; |
| 3357 | 3357 | ||
| 3358 | static void remember_mouse_glyph P_ ((struct frame *, int, int)); | 3358 | static int |
| 3359 | |||
| 3360 | static void | ||
| 3361 | note_mouse_movement (frame, msg) | 3359 | note_mouse_movement (frame, msg) |
| 3362 | FRAME_PTR frame; | 3360 | FRAME_PTR frame; |
| 3363 | MSG *msg; | 3361 | MSG *msg; |
| @@ -3374,13 +3372,14 @@ note_mouse_movement (frame, msg) | |||
| 3374 | frame->mouse_moved = 1; | 3372 | frame->mouse_moved = 1; |
| 3375 | last_mouse_scroll_bar = Qnil; | 3373 | last_mouse_scroll_bar = Qnil; |
| 3376 | note_mouse_highlight (frame, -1, -1); | 3374 | note_mouse_highlight (frame, -1, -1); |
| 3375 | return 1; | ||
| 3377 | } | 3376 | } |
| 3378 | 3377 | ||
| 3379 | /* Has the mouse moved off the glyph it was on at the last sighting? */ | 3378 | /* Has the mouse moved off the glyph it was on at the last sighting? */ |
| 3380 | else if (mouse_x < last_mouse_glyph.left | 3379 | if (mouse_x < last_mouse_glyph.left |
| 3381 | || mouse_x > last_mouse_glyph.right | 3380 | || mouse_x >= last_mouse_glyph.right |
| 3382 | || mouse_y < last_mouse_glyph.top | 3381 | || mouse_y < last_mouse_glyph.top |
| 3383 | || mouse_y > last_mouse_glyph.bottom) | 3382 | || mouse_y >= last_mouse_glyph.bottom) |
| 3384 | { | 3383 | { |
| 3385 | frame->mouse_moved = 1; | 3384 | frame->mouse_moved = 1; |
| 3386 | last_mouse_scroll_bar = Qnil; | 3385 | last_mouse_scroll_bar = Qnil; |
| @@ -3389,8 +3388,11 @@ note_mouse_movement (frame, msg) | |||
| 3389 | gets called when mouse tracking is enabled but we also need | 3388 | gets called when mouse tracking is enabled but we also need |
| 3390 | to keep track of the mouse for help_echo and highlighting at | 3389 | to keep track of the mouse for help_echo and highlighting at |
| 3391 | other times. */ | 3390 | other times. */ |
| 3392 | remember_mouse_glyph (frame, mouse_x, mouse_y); | 3391 | remember_mouse_glyph (frame, mouse_x, mouse_y, &last_mouse_glyph); |
| 3392 | return 1; | ||
| 3393 | } | 3393 | } |
| 3394 | |||
| 3395 | return 0; | ||
| 3394 | } | 3396 | } |
| 3395 | 3397 | ||
| 3396 | 3398 | ||
| @@ -3401,8 +3403,6 @@ note_mouse_movement (frame, msg) | |||
| 3401 | static struct scroll_bar *x_window_to_scroll_bar (); | 3403 | static struct scroll_bar *x_window_to_scroll_bar (); |
| 3402 | static void x_scroll_bar_report_motion (); | 3404 | static void x_scroll_bar_report_motion (); |
| 3403 | static void x_check_fullscreen P_ ((struct frame *)); | 3405 | static void x_check_fullscreen P_ ((struct frame *)); |
| 3404 | static int glyph_rect P_ ((struct frame *f, int, int, RECT *)); | ||
| 3405 | |||
| 3406 | 3406 | ||
| 3407 | static void | 3407 | static void |
| 3408 | redo_mouse_highlight () | 3408 | redo_mouse_highlight () |
| @@ -3421,108 +3421,6 @@ w32_define_cursor (window, cursor) | |||
| 3421 | { | 3421 | { |
| 3422 | PostMessage (window, WM_EMACS_SETCURSOR, (WPARAM) cursor, 0); | 3422 | PostMessage (window, WM_EMACS_SETCURSOR, (WPARAM) cursor, 0); |
| 3423 | } | 3423 | } |
| 3424 | |||
| 3425 | /* Try to determine frame pixel position and size of the glyph under | ||
| 3426 | frame pixel coordinates X/Y on frame F . Return the position and | ||
| 3427 | size in *RECT. Value is non-zero if we could compute these | ||
| 3428 | values. */ | ||
| 3429 | |||
| 3430 | static int | ||
| 3431 | glyph_rect (f, x, y, rect) | ||
| 3432 | struct frame *f; | ||
| 3433 | int x, y; | ||
| 3434 | RECT *rect; | ||
| 3435 | { | ||
| 3436 | Lisp_Object window; | ||
| 3437 | |||
| 3438 | window = window_from_coordinates (f, x, y, 0, &x, &y, 0); | ||
| 3439 | |||
| 3440 | if (!NILP (window)) | ||
| 3441 | { | ||
| 3442 | struct window *w = XWINDOW (window); | ||
| 3443 | struct glyph_row *r = MATRIX_FIRST_TEXT_ROW (w->current_matrix); | ||
| 3444 | struct glyph_row *end = r + w->current_matrix->nrows - 1; | ||
| 3445 | |||
| 3446 | for (; r < end && r->enabled_p; ++r) | ||
| 3447 | if (r->y <= y && r->y + r->height > y) | ||
| 3448 | { | ||
| 3449 | /* Found the row at y. */ | ||
| 3450 | struct glyph *g = r->glyphs[TEXT_AREA]; | ||
| 3451 | struct glyph *end = g + r->used[TEXT_AREA]; | ||
| 3452 | int gx; | ||
| 3453 | |||
| 3454 | rect->top = WINDOW_TO_FRAME_PIXEL_Y (w, r->y); | ||
| 3455 | rect->bottom = rect->top + r->height; | ||
| 3456 | |||
| 3457 | if (x < r->x) | ||
| 3458 | { | ||
| 3459 | /* x is to the left of the first glyph in the row. */ | ||
| 3460 | /* Shouldn't this be a pixel value? | ||
| 3461 | WINDOW_LEFT_EDGE_X (w) seems to be the right value. | ||
| 3462 | ++KFS */ | ||
| 3463 | rect->left = WINDOW_LEFT_EDGE_COL (w); | ||
| 3464 | rect->right = WINDOW_TO_FRAME_PIXEL_X (w, r->x); | ||
| 3465 | return 1; | ||
| 3466 | } | ||
| 3467 | |||
| 3468 | for (gx = r->x; g < end; gx += g->pixel_width, ++g) | ||
| 3469 | if (gx <= x && gx + g->pixel_width > x) | ||
| 3470 | { | ||
| 3471 | /* x is on a glyph. */ | ||
| 3472 | rect->left = WINDOW_TO_FRAME_PIXEL_X (w, gx); | ||
| 3473 | rect->right = rect->left + g->pixel_width; | ||
| 3474 | return 1; | ||
| 3475 | } | ||
| 3476 | |||
| 3477 | /* x is to the right of the last glyph in the row. */ | ||
| 3478 | rect->left = WINDOW_TO_FRAME_PIXEL_X (w, gx); | ||
| 3479 | /* Shouldn't this be a pixel value? | ||
| 3480 | WINDOW_RIGHT_EDGE_X (w) seems to be the right value. | ||
| 3481 | ++KFS */ | ||
| 3482 | rect->right = WINDOW_RIGHT_EDGE_COL (w); | ||
| 3483 | return 1; | ||
| 3484 | } | ||
| 3485 | } | ||
| 3486 | |||
| 3487 | /* The y is not on any row. */ | ||
| 3488 | return 0; | ||
| 3489 | } | ||
| 3490 | |||
| 3491 | /* Record the position of the mouse in last_mouse_glyph. */ | ||
| 3492 | static void | ||
| 3493 | remember_mouse_glyph (f1, gx, gy) | ||
| 3494 | struct frame * f1; | ||
| 3495 | int gx, gy; | ||
| 3496 | { | ||
| 3497 | if (!glyph_rect (f1, gx, gy, &last_mouse_glyph)) | ||
| 3498 | { | ||
| 3499 | int width = FRAME_SMALLEST_CHAR_WIDTH (f1); | ||
| 3500 | int height = FRAME_SMALLEST_FONT_HEIGHT (f1); | ||
| 3501 | |||
| 3502 | /* Arrange for the division in FRAME_PIXEL_X_TO_COL etc. to | ||
| 3503 | round down even for negative values. */ | ||
| 3504 | if (gx < 0) | ||
| 3505 | gx -= width - 1; | ||
| 3506 | if (gy < 0) | ||
| 3507 | gy -= height - 1; | ||
| 3508 | #if 0 | ||
| 3509 | /* This was the original code from XTmouse_position, but it seems | ||
| 3510 | to give the position of the glyph diagonally next to the one | ||
| 3511 | the mouse is over. */ | ||
| 3512 | gx = (gx + width - 1) / width * width; | ||
| 3513 | gy = (gy + height - 1) / height * height; | ||
| 3514 | #else | ||
| 3515 | gx = gx / width * width; | ||
| 3516 | gy = gy / height * height; | ||
| 3517 | #endif | ||
| 3518 | |||
| 3519 | last_mouse_glyph.left = gx; | ||
| 3520 | last_mouse_glyph.top = gy; | ||
| 3521 | last_mouse_glyph.right = gx + width; | ||
| 3522 | last_mouse_glyph.bottom = gy + height; | ||
| 3523 | } | ||
| 3524 | } | ||
| 3525 | |||
| 3526 | /* Return the current position of the mouse. | 3424 | /* Return the current position of the mouse. |
| 3527 | *fp should be a frame which indicates which display to ask about. | 3425 | *fp should be a frame which indicates which display to ask about. |
| 3528 | 3426 | ||
| @@ -3625,7 +3523,7 @@ w32_mouse_position (fp, insist, bar_window, part, x, y, time) | |||
| 3625 | || insist); | 3523 | || insist); |
| 3626 | #else | 3524 | #else |
| 3627 | ScreenToClient (FRAME_W32_WINDOW (f1), &pt); | 3525 | ScreenToClient (FRAME_W32_WINDOW (f1), &pt); |
| 3628 | remember_mouse_glyph (f1, pt.x, pt.y); | 3526 | remember_mouse_glyph (f1, pt.x, pt.y, &last_mouse_glyph); |
| 3629 | #endif | 3527 | #endif |
| 3630 | 3528 | ||
| 3631 | *bar_window = Qnil; | 3529 | *bar_window = Qnil; |
| @@ -4571,6 +4469,7 @@ w32_read_socket (sd, expected, hold_quit) | |||
| 4571 | } | 4469 | } |
| 4572 | 4470 | ||
| 4573 | previous_help_echo_string = help_echo_string; | 4471 | previous_help_echo_string = help_echo_string; |
| 4472 | help_echo_string = Qnil; | ||
| 4574 | 4473 | ||
| 4575 | if (dpyinfo->grabbed && last_mouse_frame | 4474 | if (dpyinfo->grabbed && last_mouse_frame |
| 4576 | && FRAME_LIVE_P (last_mouse_frame)) | 4475 | && FRAME_LIVE_P (last_mouse_frame)) |
| @@ -4609,7 +4508,8 @@ w32_read_socket (sd, expected, hold_quit) | |||
| 4609 | 4508 | ||
| 4610 | last_window=window; | 4509 | last_window=window; |
| 4611 | } | 4510 | } |
| 4612 | note_mouse_movement (f, &msg.msg); | 4511 | if (!note_mouse_movement (f, &msg.msg)) |
| 4512 | help_echo_string = previous_help_echo_string; | ||
| 4613 | } | 4513 | } |
| 4614 | else | 4514 | else |
| 4615 | { | 4515 | { |