comparison src/xterm.c @ 9338:873508897cc2

(x_new_focus_frame, construct_mouse_click, construct_menu_click, note_mouse_highlight, XTmouse_position, x_scroll_bar_create, x_scroll_bar_set_handle, x_scroll_bar_move, XTset_vertical_scroll_bar, XTredeem_scroll_bar, x_scroll_bar_handle_click, x_scroll_bar_note_movement, x_scroll_bar_report_motion, XTread_socket, x_make_frame_visible): Use new accessor macros instead of calling XSET directly.
author Karl Heuer <kwzh@gnu.org>
date Tue, 04 Oct 1994 19:46:12 +0000
parents 7b933936a676
children 97cfba406b7b
comparison
equal deleted inserted replaced
9337:7b933936a676 9338:873508897cc2
1451 if (old_focus && old_focus->auto_lower) 1451 if (old_focus && old_focus->auto_lower)
1452 x_lower_frame (old_focus); 1452 x_lower_frame (old_focus);
1453 1453
1454 #if 0 1454 #if 0
1455 selected_frame = frame; 1455 selected_frame = frame;
1456 XSET (XWINDOW (selected_frame->selected_window)->frame, 1456 XSETFRAME (XWINDOW (selected_frame->selected_window)->frame,
1457 Lisp_Frame, selected_frame); 1457 selected_frame);
1458 Fselect_window (selected_frame->selected_window); 1458 Fselect_window (selected_frame->selected_window);
1459 choose_minibuf_frame (); 1459 choose_minibuf_frame ();
1460 #endif /* ! 0 */ 1460 #endif /* ! 0 */
1461 1461
1462 if (x_focus_frame && x_focus_frame->auto_raise) 1462 if (x_focus_frame && x_focus_frame->auto_raise)
1741 #if 0 1741 #if 0
1742 pixel_to_glyph_coords (f, event->x, event->y, &column, &row, NULL, 0); 1742 pixel_to_glyph_coords (f, event->x, event->y, &column, &row, NULL, 0);
1743 XFASTINT (result->x) = column; 1743 XFASTINT (result->x) = column;
1744 XFASTINT (result->y) = row; 1744 XFASTINT (result->y) = row;
1745 #endif 1745 #endif
1746 XSET (result->x, Lisp_Int, event->x); 1746 XSETINT (result->x, event->x);
1747 XSET (result->y, Lisp_Int, event->y); 1747 XSETINT (result->y, event->y);
1748 XSET (result->frame_or_window, Lisp_Frame, f); 1748 XSETFRAME (result->frame_or_window, f);
1749 } 1749 }
1750 } 1750 }
1751 1751
1752 /* Prepare a menu-event in *RESULT for placement in the input queue. */ 1752 /* Prepare a menu-event in *RESULT for placement in the input queue. */
1753 1753
1758 struct frame *f; 1758 struct frame *f;
1759 { 1759 {
1760 /* Make the event type no_event; we'll change that when we decide 1760 /* Make the event type no_event; we'll change that when we decide
1761 otherwise. */ 1761 otherwise. */
1762 result->kind = mouse_click; 1762 result->kind = mouse_click;
1763 XSET (result->code, Lisp_Int, event->button - Button1); 1763 XSETINT (result->code, event->button - Button1);
1764 result->timestamp = event->time; 1764 result->timestamp = event->time;
1765 result->modifiers = (x_x_to_emacs_modifiers (event->state) 1765 result->modifiers = (x_x_to_emacs_modifiers (event->state)
1766 | (event->type == ButtonRelease 1766 | (event->type == ButtonRelease
1767 ? up_modifier 1767 ? up_modifier
1768 : down_modifier)); 1768 : down_modifier));
1769 1769
1770 XSET (result->x, Lisp_Int, event->x); 1770 XSETINT (result->x, event->x);
1771 XSET (result->y, Lisp_Int, -1); 1771 XSETINT (result->y, -1);
1772 XSET (result->frame_or_window, Lisp_Frame, f); 1772 XSETFRAME (result->frame_or_window, f);
1773 } 1773 }
1774 1774
1775 /* Function to report a mouse movement to the mainstream Emacs code. 1775 /* Function to report a mouse movement to the mainstream Emacs code.
1776 The input handler calls this. 1776 The input handler calls this.
1777 1777
1935 1935
1936 /* Yes. Clear the display of the old active region, if any. */ 1936 /* Yes. Clear the display of the old active region, if any. */
1937 clear_mouse_face (); 1937 clear_mouse_face ();
1938 1938
1939 /* Is this char mouse-active? */ 1939 /* Is this char mouse-active? */
1940 XSET (position, Lisp_Int, pos); 1940 XSETINT (position, pos);
1941 1941
1942 len = 10; 1942 len = 10;
1943 overlay_vec = (Lisp_Object *) xmalloc (len * sizeof (Lisp_Object)); 1943 overlay_vec = (Lisp_Object *) xmalloc (len * sizeof (Lisp_Object));
1944 1944
1945 /* Put all the overlays we want in a vector in overlay_vec. 1945 /* Put all the overlays we want in a vector in overlay_vec.
1994 should be active. */ 1994 should be active. */
1995 Lisp_Object before, after, beginning, end; 1995 Lisp_Object before, after, beginning, end;
1996 int ignore; 1996 int ignore;
1997 1997
1998 beginning = Fmarker_position (w->start); 1998 beginning = Fmarker_position (w->start);
1999 XSET (end, Lisp_Int, 1999 XSETINT (end, (BUF_Z (XBUFFER (w->buffer))
2000 (BUF_Z (XBUFFER (w->buffer)) 2000 - XFASTINT (w->window_end_pos)));
2001 - XFASTINT (w->window_end_pos)));
2002 before 2001 before
2003 = Fprevious_single_property_change (make_number (pos + 1), 2002 = Fprevious_single_property_change (make_number (pos + 1),
2004 Qmouse_face, 2003 Qmouse_face,
2005 w->buffer, beginning); 2004 w->buffer, beginning);
2006 after 2005 after
2317 &last_mouse_glyph, x_mouse_grabbed); 2316 &last_mouse_glyph, x_mouse_grabbed);
2318 2317
2319 *bar_window = Qnil; 2318 *bar_window = Qnil;
2320 *part = 0; 2319 *part = 0;
2321 *f = f1; 2320 *f = f1;
2322 XSET (*x, Lisp_Int, win_x); 2321 XSETINT (*x, win_x);
2323 XSET (*y, Lisp_Int, win_y); 2322 XSETINT (*y, win_y);
2324 *time = last_mouse_movement_time; 2323 *time = last_mouse_movement_time;
2325 } 2324 }
2326 } 2325 }
2327 } 2326 }
2328 2327
2418 2417
2419 /* Attributes. */ 2418 /* Attributes. */
2420 mask, &a)); 2419 mask, &a));
2421 } 2420 }
2422 2421
2423 XSET (bar->window, Lisp_Window, window); 2422 XSETWINDOW (bar->window, window);
2424 XSET (bar->top, Lisp_Int, top); 2423 XSETINT (bar->top, top);
2425 XSET (bar->left, Lisp_Int, left); 2424 XSETINT (bar->left, left);
2426 XSET (bar->width, Lisp_Int, width); 2425 XSETINT (bar->width, width);
2427 XSET (bar->height, Lisp_Int, height); 2426 XSETINT (bar->height, height);
2428 XSET (bar->start, Lisp_Int, 0); 2427 XSETINT (bar->start, 0);
2429 XSET (bar->end, Lisp_Int, 0); 2428 XSETINT (bar->end, 0);
2430 bar->dragging = Qnil; 2429 bar->dragging = Qnil;
2431 2430
2432 /* Add bar to its frame's list of scroll bars. */ 2431 /* Add bar to its frame's list of scroll bars. */
2433 bar->next = FRAME_SCROLL_BARS (frame); 2432 bar->next = FRAME_SCROLL_BARS (frame);
2434 bar->prev = Qnil; 2433 bar->prev = Qnil;
2435 XSET (FRAME_SCROLL_BARS (frame), Lisp_Vector, bar); 2434 XSETVECTOR (FRAME_SCROLL_BARS (frame), bar);
2436 if (! NILP (bar->next)) 2435 if (! NILP (bar->next))
2437 XSET (XSCROLL_BAR (bar->next)->prev, Lisp_Vector, bar); 2436 XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar);
2438 2437
2439 XMapWindow (x_current_display, SCROLL_BAR_X_WINDOW (bar)); 2438 XMapWindow (x_current_display, SCROLL_BAR_X_WINDOW (bar));
2440 2439
2441 UNBLOCK_INPUT; 2440 UNBLOCK_INPUT;
2442 2441
2493 else if (end > top_range && ! dragging) 2492 else if (end > top_range && ! dragging)
2494 end = top_range; 2493 end = top_range;
2495 } 2494 }
2496 2495
2497 /* Store the adjusted setting in the scroll bar. */ 2496 /* Store the adjusted setting in the scroll bar. */
2498 XSET (bar->start, Lisp_Int, start); 2497 XSETINT (bar->start, start);
2499 XSET (bar->end, Lisp_Int, end); 2498 XSETINT (bar->end, end);
2500 2499
2501 /* Clip the end position, just for display. */ 2500 /* Clip the end position, just for display. */
2502 if (end > top_range) 2501 if (end > top_range)
2503 end = top_range; 2502 end = top_range;
2504 2503
2569 if (mask) 2568 if (mask)
2570 XConfigureWindow (x_current_display, SCROLL_BAR_X_WINDOW (bar), 2569 XConfigureWindow (x_current_display, SCROLL_BAR_X_WINDOW (bar),
2571 mask, &wc); 2570 mask, &wc);
2572 } 2571 }
2573 2572
2574 XSET (bar->left, Lisp_Int, left); 2573 XSETINT (bar->left, left);
2575 XSET (bar->top, Lisp_Int, top); 2574 XSETINT (bar->top, top);
2576 XSET (bar->width, Lisp_Int, width); 2575 XSETINT (bar->width, width);
2577 XSET (bar->height, Lisp_Int, height); 2576 XSETINT (bar->height, height);
2578 2577
2579 UNBLOCK_INPUT; 2578 UNBLOCK_INPUT;
2580 } 2579 }
2581 2580
2582 /* Destroy the X window for BAR, and set its Emacs window's scroll bar 2581 /* Destroy the X window for BAR, and set its Emacs window's scroll bar
2651 2650
2652 x_scroll_bar_set_handle (bar, start, end, 0); 2651 x_scroll_bar_set_handle (bar, start, end, 0);
2653 } 2652 }
2654 } 2653 }
2655 2654
2656 XSET (window->vertical_scroll_bar, Lisp_Vector, bar); 2655 XSETVECTOR (window->vertical_scroll_bar, bar);
2657 } 2656 }
2658 2657
2659 2658
2660 /* The following three hooks are used when we're doing a thorough 2659 /* The following three hooks are used when we're doing a thorough
2661 redisplay of the frame. We don't explicitly know which scroll bars 2660 redisplay of the frame. We don't explicitly know which scroll bars
2722 if (! NILP (bar->next)) 2721 if (! NILP (bar->next))
2723 XSCROLL_BAR (bar->next)->prev = bar->prev; 2722 XSCROLL_BAR (bar->next)->prev = bar->prev;
2724 2723
2725 bar->next = FRAME_SCROLL_BARS (f); 2724 bar->next = FRAME_SCROLL_BARS (f);
2726 bar->prev = Qnil; 2725 bar->prev = Qnil;
2727 XSET (FRAME_SCROLL_BARS (f), Lisp_Vector, bar); 2726 XSETVECTOR (FRAME_SCROLL_BARS (f), bar);
2728 if (! NILP (bar->next)) 2727 if (! NILP (bar->next))
2729 XSET (XSCROLL_BAR (bar->next)->prev, Lisp_Vector, bar); 2728 XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar);
2730 } 2729 }
2731 } 2730 }
2732 2731
2733 /* Remove all scroll bars on FRAME that haven't been saved since the 2732 /* Remove all scroll bars on FRAME that haven't been saved since the
2734 last call to `*condemn_scroll_bars_hook'. */ 2733 last call to `*condemn_scroll_bars_hook'. */
2830 #if 0 2829 #if 0
2831 /* If the user has just clicked on the handle, record where they're 2830 /* If the user has just clicked on the handle, record where they're
2832 holding it. */ 2831 holding it. */
2833 if (event->type == ButtonPress 2832 if (event->type == ButtonPress
2834 && emacs_event->part == scroll_bar_handle) 2833 && emacs_event->part == scroll_bar_handle)
2835 XSET (bar->dragging, Lisp_Int, y - XINT (bar->start)); 2834 XSETINT (bar->dragging, y - XINT (bar->start));
2836 #endif 2835 #endif
2837 2836
2838 /* If the user has released the handle, set it to its final position. */ 2837 /* If the user has released the handle, set it to its final position. */
2839 if (event->type == ButtonRelease 2838 if (event->type == ButtonRelease
2840 && ! NILP (bar->dragging)) 2839 && ! NILP (bar->dragging))
2851 /* Clicks on the handle are always reported as occurring at the top of 2850 /* Clicks on the handle are always reported as occurring at the top of
2852 the handle. */ 2851 the handle. */
2853 if (emacs_event->part == scroll_bar_handle) 2852 if (emacs_event->part == scroll_bar_handle)
2854 emacs_event->x = bar->start; 2853 emacs_event->x = bar->start;
2855 else 2854 else
2856 XSET (emacs_event->x, Lisp_Int, y); 2855 XSETINT (emacs_event->x, y);
2857 #else 2856 #else
2858 XSET (emacs_event->x, Lisp_Int, y); 2857 XSETINT (emacs_event->x, y);
2859 #endif 2858 #endif
2860 2859
2861 XSET (emacs_event->y, Lisp_Int, top_range); 2860 XSETINT (emacs_event->y, top_range);
2862 } 2861 }
2863 } 2862 }
2864 2863
2865 /* Handle some mouse motion while someone is dragging the scroll bar. 2864 /* Handle some mouse motion while someone is dragging the scroll bar.
2866 2865
2872 XEvent *event; 2871 XEvent *event;
2873 { 2872 {
2874 last_mouse_movement_time = event->xmotion.time; 2873 last_mouse_movement_time = event->xmotion.time;
2875 2874
2876 mouse_moved = 1; 2875 mouse_moved = 1;
2877 XSET (last_mouse_scroll_bar, Lisp_Vector, bar); 2876 XSETVECTOR (last_mouse_scroll_bar, bar);
2878 2877
2879 /* If we're dragging the bar, display it. */ 2878 /* If we're dragging the bar, display it. */
2880 if (! GC_NILP (bar->dragging)) 2879 if (! GC_NILP (bar->dragging))
2881 { 2880 {
2882 /* Where should the handle be now? */ 2881 /* Where should the handle be now? */
2963 else if (win_y < XINT (bar->end) + VERTICAL_SCROLL_BAR_MIN_HANDLE) 2962 else if (win_y < XINT (bar->end) + VERTICAL_SCROLL_BAR_MIN_HANDLE)
2964 *part = scroll_bar_handle; 2963 *part = scroll_bar_handle;
2965 else 2964 else
2966 *part = scroll_bar_below_handle; 2965 *part = scroll_bar_below_handle;
2967 2966
2968 XSET (*x, Lisp_Int, win_y); 2967 XSETINT (*x, win_y);
2969 XSET (*y, Lisp_Int, top_range); 2968 XSETINT (*y, top_range);
2970 2969
2971 mouse_moved = 0; 2970 mouse_moved = 0;
2972 last_mouse_scroll_bar = Qnil; 2971 last_mouse_scroll_bar = Qnil;
2973 } 2972 }
2974 2973
3255 { 3254 {
3256 if (numchars == 0) 3255 if (numchars == 0)
3257 abort (); 3256 abort ();
3258 3257
3259 bufp->kind = delete_window_event; 3258 bufp->kind = delete_window_event;
3260 XSET (bufp->frame_or_window, Lisp_Frame, f); 3259 XSETFRAME (bufp->frame_or_window, f);
3261 bufp++; 3260 bufp++;
3262 3261
3263 count += 1; 3262 count += 1;
3264 numchars -= 1; 3263 numchars -= 1;
3265 } 3264 }
3561 if (temp_index == sizeof temp_buffer / sizeof (short)) 3560 if (temp_index == sizeof temp_buffer / sizeof (short))
3562 temp_index = 0; 3561 temp_index = 0;
3563 temp_buffer[temp_index++] = keysym; 3562 temp_buffer[temp_index++] = keysym;
3564 bufp->kind = non_ascii_keystroke; 3563 bufp->kind = non_ascii_keystroke;
3565 bufp->code = keysym; 3564 bufp->code = keysym;
3566 XSET (bufp->frame_or_window, Lisp_Frame, f); 3565 XSETFRAME (bufp->frame_or_window, f);
3567 bufp->modifiers = x_x_to_emacs_modifiers (modifiers); 3566 bufp->modifiers = x_x_to_emacs_modifiers (modifiers);
3568 bufp->timestamp = event.xkey.time; 3567 bufp->timestamp = event.xkey.time;
3569 bufp++; 3568 bufp++;
3570 count++; 3569 count++;
3571 numchars--; 3570 numchars--;
3579 if (temp_index == sizeof temp_buffer / sizeof (short)) 3578 if (temp_index == sizeof temp_buffer / sizeof (short))
3580 temp_index = 0; 3579 temp_index = 0;
3581 temp_buffer[temp_index++] = copy_buffer[i]; 3580 temp_buffer[temp_index++] = copy_buffer[i];
3582 bufp->kind = ascii_keystroke; 3581 bufp->kind = ascii_keystroke;
3583 bufp->code = copy_buffer[i]; 3582 bufp->code = copy_buffer[i];
3584 XSET (bufp->frame_or_window, Lisp_Frame, f); 3583 XSETFRAME (bufp->frame_or_window, f);
3585 bufp->modifiers = x_x_to_emacs_modifiers (modifiers); 3584 bufp->modifiers = x_x_to_emacs_modifiers (modifiers);
3586 bufp->timestamp = event.xkey.time; 3585 bufp->timestamp = event.xkey.time;
3587 bufp++; 3586 bufp++;
3588 } 3587 }
3589 3588
4958 int count = input_signal_count; 4957 int count = input_signal_count;
4959 4958
4960 /* This must come after we set COUNT. */ 4959 /* This must come after we set COUNT. */
4961 UNBLOCK_INPUT; 4960 UNBLOCK_INPUT;
4962 4961
4963 XSET (frame, Lisp_Frame, f); 4962 XSETFRAME (frame, f);
4964 4963
4965 while (1) 4964 while (1)
4966 { 4965 {
4967 x_sync (frame); 4966 x_sync (frame);
4968 /* Once we have handled input events, 4967 /* Once we have handled input events,