Commit 056ce195 authored by Stefan Monnier's avatar Stefan Monnier

* 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.
parent 30f95089
2007-11-16 Stefan Monnier <monnier@iro.umontreal.ca>
* 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.
* alloc.c (ALLOCATE_PSEUDOVECTOR): Move to lisp.h.
(allocate_pseudovector): Make non-static.
* lisp.h (enum pvec_type): New tag PVEC_OTHER.
......
......@@ -2970,10 +2970,9 @@ free_frame_menubar (f)
int xg_ignore_gtk_scrollbar;
/* SET_SCROLL_BAR_X_WINDOW assumes the second argument fits in
32 bits. But we want to store pointers, and they may be larger
than 32 bits. Keep a mapping from integer index to widget pointers
to get around the 32 bit limitation. */
/* Xlib's `Window' fits in 32 bits. But we want to store pointers, and they
may be larger than 32 bits. Keep a mapping from integer index to widget
pointers to get around the 32 bit limitation. */
static struct
{
......@@ -3183,7 +3182,7 @@ xg_create_scroll_bar (f, bar, scroll_callback, scroll_bar_name)
/* Set the cursor to an arrow. */
xg_set_cursor (webox, FRAME_X_DISPLAY_INFO (f)->xg_cursor);
SET_SCROLL_BAR_X_WINDOW (bar, scroll_id);
bar->x_window = scroll_id;
}
/* Make the scroll bar represented by SCROLLBAR_ID visible. */
......@@ -3258,7 +3257,7 @@ xg_set_toolkit_scroll_bar_thumb (bar, portion, position, whole)
struct scroll_bar *bar;
int portion, position, whole;
{
GtkWidget *wscroll = xg_get_widget_from_map (SCROLL_BAR_X_WINDOW (bar));
GtkWidget *wscroll = xg_get_widget_from_map (bar->x_window);
FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window)));
......
......@@ -931,7 +931,7 @@ x_set_background_color (f, arg, oldval)
!NILP (bar);
bar = XSCROLL_BAR (bar)->next)
{
Window window = SCROLL_BAR_X_WINDOW (XSCROLL_BAR (bar));
Window window = XSCROLL_BAR (bar)->x_window;
XSetWindowBackground (dpy, window, bg);
}
}
......
This diff is collapsed.
......@@ -746,13 +746,14 @@ struct scroll_bar
/* The next and previous in the chain of scroll bars in this frame. */
Lisp_Object next, prev;
/* The X window representing this scroll bar. Since this is a full
32-bit quantity, we store it split into two 32-bit values. */
Lisp_Object x_window_low, x_window_high;
/* Fields from `x_window' down will not be traced by the GC. */
/* The X window representing this scroll bar. */
Window x_window;
/* The position and size of the scroll bar in pixels, relative to the
frame. */
Lisp_Object top, left, width, height;
int top, left, width, height;
/* The starting and ending positions of the handle, relative to the
handle area (i.e. zero is the top position, not
......@@ -765,7 +766,7 @@ struct scroll_bar
drawing handle bottoms VERTICAL_SCROLL_BAR_MIN_HANDLE pixels below
where they would be normally; the bottom and top are in a
different co-ordinate system. */
Lisp_Object start, end;
int start, end;
/* If the scroll bar handle is currently being dragged by the user,
this is the number of pixels from the top of the handle to the
......@@ -773,11 +774,9 @@ struct scroll_bar
being dragged, this is Qnil. */
Lisp_Object dragging;
#ifdef USE_TOOLKIT_SCROLL_BARS
/* t if the background of the fringe that is adjacent to a scroll
/* 1 if the background of the fringe that is adjacent to a scroll
bar is extended to the gap between the fringe and the bar. */
Lisp_Object fringe_extended_p;
#endif
unsigned int fringe_extended_p : 1;
};
/* The number of elements a vector holding a struct scroll_bar needs. */
......@@ -790,36 +789,19 @@ struct scroll_bar
#define XSCROLL_BAR(vec) ((struct scroll_bar *) XVECTOR (vec))
/* Building a 32-bit C integer from two 16-bit lisp integers. */
#define SCROLL_BAR_PACK(low, high) (XINT (high) << 16 | XINT (low))
/* Setting two lisp integers to the low and high words of a 32-bit C int. */
#define SCROLL_BAR_UNPACK(low, high, int32) \
(XSETINT ((low), (int32) & 0xffff), \
XSETINT ((high), ((int32) >> 16) & 0xffff))
/* Extract the X window id of the scroll bar from a struct scroll_bar. */
#define SCROLL_BAR_X_WINDOW(ptr) \
((Window) SCROLL_BAR_PACK ((ptr)->x_window_low, (ptr)->x_window_high))
/* Store a window id in a struct scroll_bar. */
#define SET_SCROLL_BAR_X_WINDOW(ptr, id) \
(SCROLL_BAR_UNPACK ((ptr)->x_window_low, (ptr)->x_window_high, (int) id))
/* Extract the X widget of the scroll bar from a struct scroll_bar.
XtWindowToWidget should be fast enough since Xt uses a hash table
to map windows to widgets. */
#define SCROLL_BAR_X_WIDGET(dpy, ptr) \
XtWindowToWidget (dpy, SCROLL_BAR_X_WINDOW (ptr))
XtWindowToWidget (dpy, ptr->x_window)
/* Store a widget id in a struct scroll_bar. */
#define SET_SCROLL_BAR_X_WIDGET(ptr, w) \
do { \
Window window = XtWindow (w); \
SET_SCROLL_BAR_X_WINDOW (ptr, window); \
ptr->x_window = window; \
} while (0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment