# HG changeset patch # User Gerd Moellmann # Date 974593726 0 # Node ID f41b5f5154b118e30aefac901bccb6c8a0f3752c # Parent e80813d34e112267b74912b5a5f48ce0090e589b (struct scroll_bar): Members x_widget_low, x_widget_high removed. (SCROLL_BAR_X_WIDGET): Get the widget via XtWindowToWidget. Take the X display as additional argument. (SET_SCROLL_BAR_X_WIDGET): Store the window of the widget, since `Widget' is a pointer type that's not easily stored in Lisp_Object form in a portable way. diff -r e80813d34e11 -r f41b5f5154b1 src/xterm.h --- a/src/xterm.h Sat Nov 18 23:56:52 2000 +0000 +++ b/src/xterm.h Sun Nov 19 00:28:46 2000 +0000 @@ -1,5 +1,6 @@ /* Definitions and headers for communication with X protocol. - Copyright (C) 1989, 1993, 1994, 1998, 1999 Free Software Foundation, Inc. + Copyright (C) 1989, 1993, 1994, 1998, 1999, 2000 + Free Software Foundation, Inc. This file is part of GNU Emacs. @@ -690,8 +691,8 @@ We use struct scroll_bar as a template for accessing fields of the vector. */ -struct scroll_bar { - +struct scroll_bar +{ /* These fields are shared by all vectors. */ EMACS_INT size_from_Lisp_Vector_struct; struct Lisp_Vector *next_from_Lisp_Vector_struct; @@ -706,9 +707,6 @@ 32-bit quantity, we store it split into two 32-bit values. */ Lisp_Object x_window_low, x_window_high; - /* Same as above for the widget. */ - Lisp_Object x_widget_low, x_widget_high; - /* The position and size of the scroll bar in pixels, relative to the frame. */ Lisp_Object top, left, width, height; @@ -760,13 +758,20 @@ #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. */ -#define SCROLL_BAR_X_WIDGET(ptr) \ - ((Widget) SCROLL_BAR_PACK ((ptr)->x_widget_low, (ptr)->x_widget_high)) +/* 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)) /* Store a widget id in a struct scroll_bar. */ -#define SET_SCROLL_BAR_X_WIDGET(ptr, w) \ - (SCROLL_BAR_UNPACK ((ptr)->x_widget_low, (ptr)->x_widget_high, (int) w)) + +#define SET_SCROLL_BAR_X_WIDGET(ptr, w) \ + do { \ + Window window = XtWindow (w); \ + SET_SCROLL_BAR_X_WINDOW (ptr, window); \ +} while (0) /* Return the inside width of a vertical scroll bar, given the outside