comparison src/xterm.h @ 86161:3408ab8b4152

* xterm.h (struct scroll_bar): Only use Lisp_Object for lisp data. Turn integer fields into `int'. Merge x_window_low and x_window_high. (SCROLL_BAR_PACK, SCROLL_BAR_UNPACK, SCROLL_BAR_X_WINDOW) (SET_SCROLL_BAR_X_WINDOW): Remove. (SCROLL_BAR_X_WIDGET, SET_SCROLL_BAR_X_WIDGET): Access the new x_window field directly. * xterm.c (x_scroll_bar_create): Use a pseudovector. Don't wrap/unwrap integers into Lisp_Objects. (XTset_vertical_scroll_bar, x_scroll_bar_handle_click) (x_scroll_bar_report_motion): Don't wrap/unwrap integers into Lisp_Objects. (x_term_init): Use SDATA. (x_window_to_scroll_bar, x_create_toolkit_scroll_bar) (x_scroll_bar_set_handle, x_scroll_bar_remove) (XTset_vertical_scroll_bar, x_scroll_bar_expose) (x_scroll_bar_report_motion, x_scroll_bar_clear): * xfns.c (x_set_background_color): * gtkutil.c (xg_create_scroll_bar, xg_set_toolkit_scroll_bar_thumb): Access the new x_window field directly.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Fri, 16 Nov 2007 21:04:30 +0000
parents 719d22550d12
children 107ccd98fa12 53108e6cea98
comparison
equal deleted inserted replaced
86160:1ede747999c6 86161:3408ab8b4152
744 Lisp_Object window; 744 Lisp_Object window;
745 745
746 /* The next and previous in the chain of scroll bars in this frame. */ 746 /* The next and previous in the chain of scroll bars in this frame. */
747 Lisp_Object next, prev; 747 Lisp_Object next, prev;
748 748
749 /* The X window representing this scroll bar. Since this is a full 749 /* Fields from `x_window' down will not be traced by the GC. */
750 32-bit quantity, we store it split into two 32-bit values. */ 750
751 Lisp_Object x_window_low, x_window_high; 751 /* The X window representing this scroll bar. */
752 Window x_window;
752 753
753 /* The position and size of the scroll bar in pixels, relative to the 754 /* The position and size of the scroll bar in pixels, relative to the
754 frame. */ 755 frame. */
755 Lisp_Object top, left, width, height; 756 int top, left, width, height;
756 757
757 /* The starting and ending positions of the handle, relative to the 758 /* The starting and ending positions of the handle, relative to the
758 handle area (i.e. zero is the top position, not 759 handle area (i.e. zero is the top position, not
759 SCROLL_BAR_TOP_BORDER). If they're equal, that means the handle 760 SCROLL_BAR_TOP_BORDER). If they're equal, that means the handle
760 hasn't been drawn yet. 761 hasn't been drawn yet.
763 are drawn; in order to keep handles from becoming invisible when 764 are drawn; in order to keep handles from becoming invisible when
764 editing large files, we establish a minimum height by always 765 editing large files, we establish a minimum height by always
765 drawing handle bottoms VERTICAL_SCROLL_BAR_MIN_HANDLE pixels below 766 drawing handle bottoms VERTICAL_SCROLL_BAR_MIN_HANDLE pixels below
766 where they would be normally; the bottom and top are in a 767 where they would be normally; the bottom and top are in a
767 different co-ordinate system. */ 768 different co-ordinate system. */
768 Lisp_Object start, end; 769 int start, end;
769 770
770 /* If the scroll bar handle is currently being dragged by the user, 771 /* If the scroll bar handle is currently being dragged by the user,
771 this is the number of pixels from the top of the handle to the 772 this is the number of pixels from the top of the handle to the
772 place where the user grabbed it. If the handle isn't currently 773 place where the user grabbed it. If the handle isn't currently
773 being dragged, this is Qnil. */ 774 being dragged, this is Qnil. */
774 Lisp_Object dragging; 775 Lisp_Object dragging;
775 776
776 #ifdef USE_TOOLKIT_SCROLL_BARS 777 /* 1 if the background of the fringe that is adjacent to a scroll
777 /* t if the background of the fringe that is adjacent to a scroll
778 bar is extended to the gap between the fringe and the bar. */ 778 bar is extended to the gap between the fringe and the bar. */
779 Lisp_Object fringe_extended_p; 779 unsigned int fringe_extended_p : 1;
780 #endif
781 }; 780 };
782 781
783 /* The number of elements a vector holding a struct scroll_bar needs. */ 782 /* The number of elements a vector holding a struct scroll_bar needs. */
784 #define SCROLL_BAR_VEC_SIZE \ 783 #define SCROLL_BAR_VEC_SIZE \
785 ((sizeof (struct scroll_bar) \ 784 ((sizeof (struct scroll_bar) \
788 787
789 /* Turning a lisp vector value into a pointer to a struct scroll_bar. */ 788 /* Turning a lisp vector value into a pointer to a struct scroll_bar. */
790 #define XSCROLL_BAR(vec) ((struct scroll_bar *) XVECTOR (vec)) 789 #define XSCROLL_BAR(vec) ((struct scroll_bar *) XVECTOR (vec))
791 790
792 791
793 /* Building a 32-bit C integer from two 16-bit lisp integers. */
794 #define SCROLL_BAR_PACK(low, high) (XINT (high) << 16 | XINT (low))
795
796 /* Setting two lisp integers to the low and high words of a 32-bit C int. */
797 #define SCROLL_BAR_UNPACK(low, high, int32) \
798 (XSETINT ((low), (int32) & 0xffff), \
799 XSETINT ((high), ((int32) >> 16) & 0xffff))
800
801
802 /* Extract the X window id of the scroll bar from a struct scroll_bar. */
803 #define SCROLL_BAR_X_WINDOW(ptr) \
804 ((Window) SCROLL_BAR_PACK ((ptr)->x_window_low, (ptr)->x_window_high))
805
806 /* Store a window id in a struct scroll_bar. */
807 #define SET_SCROLL_BAR_X_WINDOW(ptr, id) \
808 (SCROLL_BAR_UNPACK ((ptr)->x_window_low, (ptr)->x_window_high, (int) id))
809
810 /* Extract the X widget of the scroll bar from a struct scroll_bar. 792 /* Extract the X widget of the scroll bar from a struct scroll_bar.
811 XtWindowToWidget should be fast enough since Xt uses a hash table 793 XtWindowToWidget should be fast enough since Xt uses a hash table
812 to map windows to widgets. */ 794 to map windows to widgets. */
813 795
814 #define SCROLL_BAR_X_WIDGET(dpy, ptr) \ 796 #define SCROLL_BAR_X_WIDGET(dpy, ptr) \
815 XtWindowToWidget (dpy, SCROLL_BAR_X_WINDOW (ptr)) 797 XtWindowToWidget (dpy, ptr->x_window)
816 798
817 /* Store a widget id in a struct scroll_bar. */ 799 /* Store a widget id in a struct scroll_bar. */
818 800
819 #define SET_SCROLL_BAR_X_WIDGET(ptr, w) \ 801 #define SET_SCROLL_BAR_X_WIDGET(ptr, w) \
820 do { \ 802 do { \
821 Window window = XtWindow (w); \ 803 Window window = XtWindow (w); \
822 SET_SCROLL_BAR_X_WINDOW (ptr, window); \ 804 ptr->x_window = window; \
823 } while (0) 805 } while (0)
824 806
825 807
826 /* Return the inside width of a vertical scroll bar, given the outside 808 /* Return the inside width of a vertical scroll bar, given the outside
827 width. */ 809 width. */