From: Gerd Moellmann Date: Sun, 19 Nov 2000 00:28:46 +0000 (+0000) Subject: (struct scroll_bar): Members x_widget_low, x_widget_high X-Git-Tag: emacs-pretest-21.0.91~12 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ae4a31d9c4c705074f6a179146053b76bb1ed95c;p=emacs.git (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 --git a/src/xterm.h b/src/xterm.h index aaf14700ac3..f2294c558b8 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -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 @@ struct x_output 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 @@ struct scroll_bar { 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 @@ 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. */ -#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