aboutsummaryrefslogtreecommitdiffstats
path: root/src/w32term.c
diff options
context:
space:
mode:
authorKaroly Lorentey2005-10-12 16:14:04 +0000
committerKaroly Lorentey2005-10-12 16:14:04 +0000
commit734b679135207a8623dc460eb8d108befe080d46 (patch)
treedcf30cc27a815776015688ca275b66671c6406dc /src/w32term.c
parent0ff21b4e57b1dc7c714c21c9eea1a4906630ecf2 (diff)
parentcc9e7d9176843a243ca4217229302c1b396dbb6e (diff)
downloademacs-734b679135207a8623dc460eb8d108befe080d46.tar.gz
emacs-734b679135207a8623dc460eb8d108befe080d46.zip
Merged from miles@gnu.org--gnu-2005 (patch 578-592)
Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-578 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-579 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-580 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-581 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-582 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-583 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-584 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-585 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-586 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-587 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-588 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-589 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-590 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-591 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-592 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-424
Diffstat (limited to 'src/w32term.c')
-rw-r--r--src/w32term.c126
1 files changed, 10 insertions, 116 deletions
diff --git a/src/w32term.c b/src/w32term.c
index eb3d58b41fa..5f268867e8b 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -1567,7 +1567,7 @@ x_draw_glyph_string_foreground (s)
1567 else 1567 else
1568 x = s->x; 1568 x = s->x;
1569 1569
1570 if (s->for_overlaps_p || (s->background_filled_p && s->hl != DRAW_CURSOR)) 1570 if (s->for_overlaps || (s->background_filled_p && s->hl != DRAW_CURSOR))
1571 SetBkMode (s->hdc, TRANSPARENT); 1571 SetBkMode (s->hdc, TRANSPARENT);
1572 else 1572 else
1573 SetBkMode (s->hdc, OPAQUE); 1573 SetBkMode (s->hdc, OPAQUE);
@@ -2448,7 +2448,7 @@ x_draw_glyph_string (s)
2448 /* If S draws into the background of its successor, draw the 2448 /* If S draws into the background of its successor, draw the
2449 background of the successor first so that S can draw into it. 2449 background of the successor first so that S can draw into it.
2450 This makes S->next use XDrawString instead of XDrawImageString. */ 2450 This makes S->next use XDrawString instead of XDrawImageString. */
2451 if (s->next && s->right_overhang && !s->for_overlaps_p) 2451 if (s->next && s->right_overhang && !s->for_overlaps)
2452 { 2452 {
2453 xassert (s->next->img == NULL); 2453 xassert (s->next->img == NULL);
2454 x_set_glyph_string_gc (s->next); 2454 x_set_glyph_string_gc (s->next);
@@ -2461,7 +2461,7 @@ x_draw_glyph_string (s)
2461 2461
2462 /* Draw relief (if any) in advance for char/composition so that the 2462 /* Draw relief (if any) in advance for char/composition so that the
2463 glyph string can be drawn over it. */ 2463 glyph string can be drawn over it. */
2464 if (!s->for_overlaps_p 2464 if (!s->for_overlaps
2465 && s->face->box != FACE_NO_BOX 2465 && s->face->box != FACE_NO_BOX
2466 && (s->first_glyph->type == CHAR_GLYPH 2466 && (s->first_glyph->type == CHAR_GLYPH
2467 || s->first_glyph->type == COMPOSITE_GLYPH)) 2467 || s->first_glyph->type == COMPOSITE_GLYPH))
@@ -2487,7 +2487,7 @@ x_draw_glyph_string (s)
2487 break; 2487 break;
2488 2488
2489 case CHAR_GLYPH: 2489 case CHAR_GLYPH:
2490 if (s->for_overlaps_p) 2490 if (s->for_overlaps)
2491 s->background_filled_p = 1; 2491 s->background_filled_p = 1;
2492 else 2492 else
2493 x_draw_glyph_string_background (s, 0); 2493 x_draw_glyph_string_background (s, 0);
@@ -2495,7 +2495,7 @@ x_draw_glyph_string (s)
2495 break; 2495 break;
2496 2496
2497 case COMPOSITE_GLYPH: 2497 case COMPOSITE_GLYPH:
2498 if (s->for_overlaps_p || s->gidx > 0) 2498 if (s->for_overlaps || s->gidx > 0)
2499 s->background_filled_p = 1; 2499 s->background_filled_p = 1;
2500 else 2500 else
2501 x_draw_glyph_string_background (s, 1); 2501 x_draw_glyph_string_background (s, 1);
@@ -2506,7 +2506,7 @@ x_draw_glyph_string (s)
2506 abort (); 2506 abort ();
2507 } 2507 }
2508 2508
2509 if (!s->for_overlaps_p) 2509 if (!s->for_overlaps)
2510 { 2510 {
2511 /* Draw underline. */ 2511 /* Draw underline. */
2512 if (s->face->underline_p 2512 if (s->face->underline_p
@@ -3204,8 +3204,6 @@ construct_drag_n_drop (result, msg, f)
3204static MSG last_mouse_motion_event; 3204static MSG last_mouse_motion_event;
3205static Lisp_Object last_mouse_motion_frame; 3205static Lisp_Object last_mouse_motion_frame;
3206 3206
3207static void remember_mouse_glyph P_ ((struct frame *, int, int));
3208
3209static void 3207static void
3210note_mouse_movement (frame, msg) 3208note_mouse_movement (frame, msg)
3211 FRAME_PTR frame; 3209 FRAME_PTR frame;
@@ -3227,9 +3225,9 @@ note_mouse_movement (frame, msg)
3227 3225
3228 /* Has the mouse moved off the glyph it was on at the last sighting? */ 3226 /* Has the mouse moved off the glyph it was on at the last sighting? */
3229 else if (mouse_x < last_mouse_glyph.left 3227 else if (mouse_x < last_mouse_glyph.left
3230 || mouse_x > last_mouse_glyph.right 3228 || mouse_x >= last_mouse_glyph.right
3231 || mouse_y < last_mouse_glyph.top 3229 || mouse_y < last_mouse_glyph.top
3232 || mouse_y > last_mouse_glyph.bottom) 3230 || mouse_y >= last_mouse_glyph.bottom)
3233 { 3231 {
3234 frame->mouse_moved = 1; 3232 frame->mouse_moved = 1;
3235 last_mouse_scroll_bar = Qnil; 3233 last_mouse_scroll_bar = Qnil;
@@ -3238,7 +3236,7 @@ note_mouse_movement (frame, msg)
3238 gets called when mouse tracking is enabled but we also need 3236 gets called when mouse tracking is enabled but we also need
3239 to keep track of the mouse for help_echo and highlighting at 3237 to keep track of the mouse for help_echo and highlighting at
3240 other times. */ 3238 other times. */
3241 remember_mouse_glyph (frame, mouse_x, mouse_y); 3239 remember_mouse_glyph (frame, mouse_x, mouse_y, &last_mouse_glyph);
3242 } 3240 }
3243} 3241}
3244 3242
@@ -3250,8 +3248,6 @@ note_mouse_movement (frame, msg)
3250static struct scroll_bar *x_window_to_scroll_bar (); 3248static struct scroll_bar *x_window_to_scroll_bar ();
3251static void x_scroll_bar_report_motion (); 3249static void x_scroll_bar_report_motion ();
3252static void x_check_fullscreen P_ ((struct frame *)); 3250static void x_check_fullscreen P_ ((struct frame *));
3253static int glyph_rect P_ ((struct frame *f, int, int, RECT *));
3254
3255 3251
3256static void 3252static void
3257redo_mouse_highlight () 3253redo_mouse_highlight ()
@@ -3270,108 +3266,6 @@ w32_define_cursor (window, cursor)
3270{ 3266{
3271 PostMessage (window, WM_EMACS_SETCURSOR, (WPARAM) cursor, 0); 3267 PostMessage (window, WM_EMACS_SETCURSOR, (WPARAM) cursor, 0);
3272} 3268}
3273
3274/* Try to determine frame pixel position and size of the glyph under
3275 frame pixel coordinates X/Y on frame F . Return the position and
3276 size in *RECT. Value is non-zero if we could compute these
3277 values. */
3278
3279static int
3280glyph_rect (f, x, y, rect)
3281 struct frame *f;
3282 int x, y;
3283 RECT *rect;
3284{
3285 Lisp_Object window;
3286
3287 window = window_from_coordinates (f, x, y, 0, &x, &y, 0);
3288
3289 if (!NILP (window))
3290 {
3291 struct window *w = XWINDOW (window);
3292 struct glyph_row *r = MATRIX_FIRST_TEXT_ROW (w->current_matrix);
3293 struct glyph_row *end = r + w->current_matrix->nrows - 1;
3294
3295 for (; r < end && r->enabled_p; ++r)
3296 if (r->y <= y && r->y + r->height > y)
3297 {
3298 /* Found the row at y. */
3299 struct glyph *g = r->glyphs[TEXT_AREA];
3300 struct glyph *end = g + r->used[TEXT_AREA];
3301 int gx;
3302
3303 rect->top = WINDOW_TO_FRAME_PIXEL_Y (w, r->y);
3304 rect->bottom = rect->top + r->height;
3305
3306 if (x < r->x)
3307 {
3308 /* x is to the left of the first glyph in the row. */
3309 /* Shouldn't this be a pixel value?
3310 WINDOW_LEFT_EDGE_X (w) seems to be the right value.
3311 ++KFS */
3312 rect->left = WINDOW_LEFT_EDGE_COL (w);
3313 rect->right = WINDOW_TO_FRAME_PIXEL_X (w, r->x);
3314 return 1;
3315 }
3316
3317 for (gx = r->x; g < end; gx += g->pixel_width, ++g)
3318 if (gx <= x && gx + g->pixel_width > x)
3319 {
3320 /* x is on a glyph. */
3321 rect->left = WINDOW_TO_FRAME_PIXEL_X (w, gx);
3322 rect->right = rect->left + g->pixel_width;
3323 return 1;
3324 }
3325
3326 /* x is to the right of the last glyph in the row. */
3327 rect->left = WINDOW_TO_FRAME_PIXEL_X (w, gx);
3328 /* Shouldn't this be a pixel value?
3329 WINDOW_RIGHT_EDGE_X (w) seems to be the right value.
3330 ++KFS */
3331 rect->right = WINDOW_RIGHT_EDGE_COL (w);
3332 return 1;
3333 }
3334 }
3335
3336 /* The y is not on any row. */
3337 return 0;
3338}
3339
3340/* Record the position of the mouse in last_mouse_glyph. */
3341static void
3342remember_mouse_glyph (f1, gx, gy)
3343 struct frame * f1;
3344 int gx, gy;
3345{
3346 if (!glyph_rect (f1, gx, gy, &last_mouse_glyph))
3347 {
3348 int width = FRAME_SMALLEST_CHAR_WIDTH (f1);
3349 int height = FRAME_SMALLEST_FONT_HEIGHT (f1);
3350
3351 /* Arrange for the division in FRAME_PIXEL_X_TO_COL etc. to
3352 round down even for negative values. */
3353 if (gx < 0)
3354 gx -= width - 1;
3355 if (gy < 0)
3356 gy -= height - 1;
3357#if 0
3358 /* This was the original code from XTmouse_position, but it seems
3359 to give the position of the glyph diagonally next to the one
3360 the mouse is over. */
3361 gx = (gx + width - 1) / width * width;
3362 gy = (gy + height - 1) / height * height;
3363#else
3364 gx = gx / width * width;
3365 gy = gy / height * height;
3366#endif
3367
3368 last_mouse_glyph.left = gx;
3369 last_mouse_glyph.top = gy;
3370 last_mouse_glyph.right = gx + width;
3371 last_mouse_glyph.bottom = gy + height;
3372 }
3373}
3374
3375/* Return the current position of the mouse. 3269/* Return the current position of the mouse.
3376 *fp should be a frame which indicates which display to ask about. 3270 *fp should be a frame which indicates which display to ask about.
3377 3271
@@ -3474,7 +3368,7 @@ w32_mouse_position (fp, insist, bar_window, part, x, y, time)
3474 || insist); 3368 || insist);
3475#else 3369#else
3476 ScreenToClient (FRAME_W32_WINDOW (f1), &pt); 3370 ScreenToClient (FRAME_W32_WINDOW (f1), &pt);
3477 remember_mouse_glyph (f1, pt.x, pt.y); 3371 remember_mouse_glyph (f1, pt.x, pt.y, &last_mouse_glyph);
3478#endif 3372#endif
3479 3373
3480 *bar_window = Qnil; 3374 *bar_window = Qnil;