diff options
| author | Stefan Monnier | 2007-11-16 21:04:30 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2007-11-16 21:04:30 +0000 |
| commit | 056ce1959724bce0b79983a2b88d193def718adb (patch) | |
| tree | a2cd01f817757e89e2bfff1b964b3094855d70de /src | |
| parent | 30f95089ed1c8b84dd111fc5edf07b8de07401b2 (diff) | |
| download | emacs-056ce1959724bce0b79983a2b88d193def718adb.tar.gz emacs-056ce1959724bce0b79983a2b88d193def718adb.zip | |
* 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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 20 | ||||
| -rw-r--r-- | src/gtkutil.c | 11 | ||||
| -rw-r--r-- | src/xfns.c | 2 | ||||
| -rw-r--r-- | src/xterm.c | 120 | ||||
| -rw-r--r-- | src/xterm.h | 38 |
5 files changed, 95 insertions, 96 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index bdc58ad4639..85f9736da7b 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,25 @@ | |||
| 1 | 2007-11-16 Stefan Monnier <monnier@iro.umontreal.ca> | 1 | 2007-11-16 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 2 | ||
| 3 | * xterm.h (struct scroll_bar): Only use Lisp_Object for lisp data. | ||
| 4 | Turn integer fields into `int'. Merge x_window_low and x_window_high. | ||
| 5 | (SCROLL_BAR_PACK, SCROLL_BAR_UNPACK, SCROLL_BAR_X_WINDOW) | ||
| 6 | (SET_SCROLL_BAR_X_WINDOW): Remove. | ||
| 7 | (SCROLL_BAR_X_WIDGET, SET_SCROLL_BAR_X_WIDGET): | ||
| 8 | Access the new x_window field directly. | ||
| 9 | * xterm.c (x_scroll_bar_create): Use a pseudovector. | ||
| 10 | Don't wrap/unwrap integers into Lisp_Objects. | ||
| 11 | (XTset_vertical_scroll_bar, x_scroll_bar_handle_click) | ||
| 12 | (x_scroll_bar_report_motion): | ||
| 13 | Don't wrap/unwrap integers into Lisp_Objects. | ||
| 14 | (x_term_init): Use SDATA. | ||
| 15 | (x_window_to_scroll_bar, x_create_toolkit_scroll_bar) | ||
| 16 | (x_scroll_bar_set_handle, x_scroll_bar_remove) | ||
| 17 | (XTset_vertical_scroll_bar, x_scroll_bar_expose) | ||
| 18 | (x_scroll_bar_report_motion, x_scroll_bar_clear): | ||
| 19 | * xfns.c (x_set_background_color): | ||
| 20 | * gtkutil.c (xg_create_scroll_bar, xg_set_toolkit_scroll_bar_thumb): | ||
| 21 | Access the new x_window field directly. | ||
| 22 | |||
| 3 | * alloc.c (ALLOCATE_PSEUDOVECTOR): Move to lisp.h. | 23 | * alloc.c (ALLOCATE_PSEUDOVECTOR): Move to lisp.h. |
| 4 | (allocate_pseudovector): Make non-static. | 24 | (allocate_pseudovector): Make non-static. |
| 5 | * lisp.h (enum pvec_type): New tag PVEC_OTHER. | 25 | * lisp.h (enum pvec_type): New tag PVEC_OTHER. |
diff --git a/src/gtkutil.c b/src/gtkutil.c index e36e192c65e..77d5fd65649 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -2970,10 +2970,9 @@ free_frame_menubar (f) | |||
| 2970 | 2970 | ||
| 2971 | int xg_ignore_gtk_scrollbar; | 2971 | int xg_ignore_gtk_scrollbar; |
| 2972 | 2972 | ||
| 2973 | /* SET_SCROLL_BAR_X_WINDOW assumes the second argument fits in | 2973 | /* Xlib's `Window' fits in 32 bits. But we want to store pointers, and they |
| 2974 | 32 bits. But we want to store pointers, and they may be larger | 2974 | may be larger than 32 bits. Keep a mapping from integer index to widget |
| 2975 | than 32 bits. Keep a mapping from integer index to widget pointers | 2975 | pointers to get around the 32 bit limitation. */ |
| 2976 | to get around the 32 bit limitation. */ | ||
| 2977 | 2976 | ||
| 2978 | static struct | 2977 | static struct |
| 2979 | { | 2978 | { |
| @@ -3183,7 +3182,7 @@ xg_create_scroll_bar (f, bar, scroll_callback, scroll_bar_name) | |||
| 3183 | /* Set the cursor to an arrow. */ | 3182 | /* Set the cursor to an arrow. */ |
| 3184 | xg_set_cursor (webox, FRAME_X_DISPLAY_INFO (f)->xg_cursor); | 3183 | xg_set_cursor (webox, FRAME_X_DISPLAY_INFO (f)->xg_cursor); |
| 3185 | 3184 | ||
| 3186 | SET_SCROLL_BAR_X_WINDOW (bar, scroll_id); | 3185 | bar->x_window = scroll_id; |
| 3187 | } | 3186 | } |
| 3188 | 3187 | ||
| 3189 | /* Make the scroll bar represented by SCROLLBAR_ID visible. */ | 3188 | /* Make the scroll bar represented by SCROLLBAR_ID visible. */ |
| @@ -3258,7 +3257,7 @@ xg_set_toolkit_scroll_bar_thumb (bar, portion, position, whole) | |||
| 3258 | struct scroll_bar *bar; | 3257 | struct scroll_bar *bar; |
| 3259 | int portion, position, whole; | 3258 | int portion, position, whole; |
| 3260 | { | 3259 | { |
| 3261 | GtkWidget *wscroll = xg_get_widget_from_map (SCROLL_BAR_X_WINDOW (bar)); | 3260 | GtkWidget *wscroll = xg_get_widget_from_map (bar->x_window); |
| 3262 | 3261 | ||
| 3263 | FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); | 3262 | FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); |
| 3264 | 3263 | ||
diff --git a/src/xfns.c b/src/xfns.c index a35f9dd5068..96631d98f55 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -931,7 +931,7 @@ x_set_background_color (f, arg, oldval) | |||
| 931 | !NILP (bar); | 931 | !NILP (bar); |
| 932 | bar = XSCROLL_BAR (bar)->next) | 932 | bar = XSCROLL_BAR (bar)->next) |
| 933 | { | 933 | { |
| 934 | Window window = SCROLL_BAR_X_WINDOW (XSCROLL_BAR (bar)); | 934 | Window window = XSCROLL_BAR (bar)->x_window; |
| 935 | XSetWindowBackground (dpy, window, bg); | 935 | XSetWindowBackground (dpy, window, bg); |
| 936 | } | 936 | } |
| 937 | } | 937 | } |
diff --git a/src/xterm.c b/src/xterm.c index f3b84a73cb0..b0897c16838 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -3962,7 +3962,7 @@ x_window_to_scroll_bar (display, window_id) | |||
| 3962 | condemned = Qnil, | 3962 | condemned = Qnil, |
| 3963 | ! GC_NILP (bar)); | 3963 | ! GC_NILP (bar)); |
| 3964 | bar = XSCROLL_BAR (bar)->next) | 3964 | bar = XSCROLL_BAR (bar)->next) |
| 3965 | if (SCROLL_BAR_X_WINDOW (XSCROLL_BAR (bar)) == window_id && | 3965 | if (XSCROLL_BAR (bar)->x_window == window_id && |
| 3966 | FRAME_X_DISPLAY (XFRAME (frame)) == display) | 3966 | FRAME_X_DISPLAY (XFRAME (frame)) == display) |
| 3967 | return XSCROLL_BAR (bar); | 3967 | return XSCROLL_BAR (bar); |
| 3968 | } | 3968 | } |
| @@ -4280,9 +4280,8 @@ xm_scroll_callback (widget, client_data, call_data) | |||
| 4280 | } | 4280 | } |
| 4281 | } | 4281 | } |
| 4282 | 4282 | ||
| 4283 | #elif defined USE_GTK | ||
| 4283 | 4284 | ||
| 4284 | #else /* !USE_MOTIF, i.e. Xaw or GTK */ | ||
| 4285 | #ifdef USE_GTK | ||
| 4286 | /* Scroll bar callback for GTK scroll bars. WIDGET is the scroll | 4285 | /* Scroll bar callback for GTK scroll bars. WIDGET is the scroll |
| 4287 | bar widget. DATA is a pointer to the scroll_bar structure. */ | 4286 | bar widget. DATA is a pointer to the scroll_bar structure. */ |
| 4288 | 4287 | ||
| @@ -4353,7 +4352,7 @@ xg_scroll_callback (widget, data) | |||
| 4353 | } | 4352 | } |
| 4354 | } | 4353 | } |
| 4355 | 4354 | ||
| 4356 | #else /* not USE_GTK */ | 4355 | #else /* not USE_GTK and not USE_MOTIF */ |
| 4357 | 4356 | ||
| 4358 | /* Xaw scroll bar callback. Invoked when the thumb is dragged. | 4357 | /* Xaw scroll bar callback. Invoked when the thumb is dragged. |
| 4359 | WIDGET is the scroll bar widget. CLIENT_DATA is a pointer to the | 4358 | WIDGET is the scroll bar widget. CLIENT_DATA is a pointer to the |
| @@ -4436,8 +4435,7 @@ xaw_scroll_callback (widget, client_data, call_data) | |||
| 4436 | x_send_scroll_bar_event (bar->window, part, position, height); | 4435 | x_send_scroll_bar_event (bar->window, part, position, height); |
| 4437 | } | 4436 | } |
| 4438 | 4437 | ||
| 4439 | #endif /* not USE_GTK */ | 4438 | #endif /* not USE_GTK and not USE_MOTIF */ |
| 4440 | #endif /* not USE_MOTIF */ | ||
| 4441 | 4439 | ||
| 4442 | #define SCROLL_BAR_NAME "verticalScrollBar" | 4440 | #define SCROLL_BAR_NAME "verticalScrollBar" |
| 4443 | 4441 | ||
| @@ -4643,7 +4641,7 @@ x_create_toolkit_scroll_bar (f, bar) | |||
| 4643 | /* Remember X window and widget in the scroll bar vector. */ | 4641 | /* Remember X window and widget in the scroll bar vector. */ |
| 4644 | SET_SCROLL_BAR_X_WIDGET (bar, widget); | 4642 | SET_SCROLL_BAR_X_WIDGET (bar, widget); |
| 4645 | xwindow = XtWindow (widget); | 4643 | xwindow = XtWindow (widget); |
| 4646 | SET_SCROLL_BAR_X_WINDOW (bar, xwindow); | 4644 | bar->x_window = xwindow; |
| 4647 | 4645 | ||
| 4648 | UNBLOCK_INPUT; | 4646 | UNBLOCK_INPUT; |
| 4649 | } | 4647 | } |
| @@ -4787,7 +4785,7 @@ x_scroll_bar_create (w, top, left, width, height) | |||
| 4787 | { | 4785 | { |
| 4788 | struct frame *f = XFRAME (w->frame); | 4786 | struct frame *f = XFRAME (w->frame); |
| 4789 | struct scroll_bar *bar | 4787 | struct scroll_bar *bar |
| 4790 | = XSCROLL_BAR (Fmake_vector (make_number (SCROLL_BAR_VEC_SIZE), Qnil)); | 4788 | = ALLOCATE_PSEUDOVECTOR (struct scroll_bar, x_window, PVEC_OTHER); |
| 4791 | 4789 | ||
| 4792 | BLOCK_INPUT; | 4790 | BLOCK_INPUT; |
| 4793 | 4791 | ||
| @@ -4831,21 +4829,19 @@ x_scroll_bar_create (w, top, left, width, height) | |||
| 4831 | CopyFromParent, | 4829 | CopyFromParent, |
| 4832 | /* Attributes. */ | 4830 | /* Attributes. */ |
| 4833 | mask, &a); | 4831 | mask, &a); |
| 4834 | SET_SCROLL_BAR_X_WINDOW (bar, window); | 4832 | bar->x_window = window; |
| 4835 | } | 4833 | } |
| 4836 | #endif /* not USE_TOOLKIT_SCROLL_BARS */ | 4834 | #endif /* not USE_TOOLKIT_SCROLL_BARS */ |
| 4837 | 4835 | ||
| 4838 | XSETWINDOW (bar->window, w); | 4836 | XSETWINDOW (bar->window, w); |
| 4839 | XSETINT (bar->top, top); | 4837 | bar->top = top; |
| 4840 | XSETINT (bar->left, left); | 4838 | bar->left = left; |
| 4841 | XSETINT (bar->width, width); | 4839 | bar->width = width; |
| 4842 | XSETINT (bar->height, height); | 4840 | bar->height = height; |
| 4843 | XSETINT (bar->start, 0); | 4841 | bar->start = 0; |
| 4844 | XSETINT (bar->end, 0); | 4842 | bar->end = 0; |
| 4845 | bar->dragging = Qnil; | 4843 | bar->dragging = Qnil; |
| 4846 | #ifdef USE_TOOLKIT_SCROLL_BARS | 4844 | bar->fringe_extended_p = 0; |
| 4847 | bar->fringe_extended_p = Qnil; | ||
| 4848 | #endif | ||
| 4849 | 4845 | ||
| 4850 | /* Add bar to its frame's list of scroll bars. */ | 4846 | /* Add bar to its frame's list of scroll bars. */ |
| 4851 | bar->next = FRAME_SCROLL_BARS (f); | 4847 | bar->next = FRAME_SCROLL_BARS (f); |
| @@ -4859,12 +4855,12 @@ x_scroll_bar_create (w, top, left, width, height) | |||
| 4859 | { | 4855 | { |
| 4860 | #ifdef USE_GTK | 4856 | #ifdef USE_GTK |
| 4861 | xg_update_scrollbar_pos (f, | 4857 | xg_update_scrollbar_pos (f, |
| 4862 | SCROLL_BAR_X_WINDOW (bar), | 4858 | bar->x_window, |
| 4863 | top, | 4859 | top, |
| 4864 | left + VERTICAL_SCROLL_BAR_WIDTH_TRIM, | 4860 | left + VERTICAL_SCROLL_BAR_WIDTH_TRIM, |
| 4865 | width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2, | 4861 | width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2, |
| 4866 | max (height, 1)); | 4862 | max (height, 1)); |
| 4867 | xg_show_scroll_bar (SCROLL_BAR_X_WINDOW (bar)); | 4863 | xg_show_scroll_bar (bar->x_window); |
| 4868 | #else /* not USE_GTK */ | 4864 | #else /* not USE_GTK */ |
| 4869 | Widget scroll_bar = SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar); | 4865 | Widget scroll_bar = SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar); |
| 4870 | XtConfigureWidget (scroll_bar, | 4866 | XtConfigureWidget (scroll_bar, |
| @@ -4876,7 +4872,7 @@ x_scroll_bar_create (w, top, left, width, height) | |||
| 4876 | #endif /* not USE_GTK */ | 4872 | #endif /* not USE_GTK */ |
| 4877 | } | 4873 | } |
| 4878 | #else /* not USE_TOOLKIT_SCROLL_BARS */ | 4874 | #else /* not USE_TOOLKIT_SCROLL_BARS */ |
| 4879 | XMapRaised (FRAME_X_DISPLAY (f), SCROLL_BAR_X_WINDOW (bar)); | 4875 | XMapRaised (FRAME_X_DISPLAY (f), bar->x_window); |
| 4880 | #endif /* not USE_TOOLKIT_SCROLL_BARS */ | 4876 | #endif /* not USE_TOOLKIT_SCROLL_BARS */ |
| 4881 | 4877 | ||
| 4882 | UNBLOCK_INPUT; | 4878 | UNBLOCK_INPUT; |
| @@ -4884,6 +4880,8 @@ x_scroll_bar_create (w, top, left, width, height) | |||
| 4884 | } | 4880 | } |
| 4885 | 4881 | ||
| 4886 | 4882 | ||
| 4883 | #ifndef USE_TOOLKIT_SCROLL_BARS | ||
| 4884 | |||
| 4887 | /* Draw BAR's handle in the proper position. | 4885 | /* Draw BAR's handle in the proper position. |
| 4888 | 4886 | ||
| 4889 | If the handle is already drawn from START to END, don't bother | 4887 | If the handle is already drawn from START to END, don't bother |
| @@ -4897,8 +4895,6 @@ x_scroll_bar_create (w, top, left, width, height) | |||
| 4897 | the bar's top is as far down as it goes; otherwise, there's no way | 4895 | the bar's top is as far down as it goes; otherwise, there's no way |
| 4898 | to move to the very end of the buffer. */ | 4896 | to move to the very end of the buffer. */ |
| 4899 | 4897 | ||
| 4900 | #ifndef USE_TOOLKIT_SCROLL_BARS | ||
| 4901 | |||
| 4902 | static void | 4898 | static void |
| 4903 | x_scroll_bar_set_handle (bar, start, end, rebuild) | 4899 | x_scroll_bar_set_handle (bar, start, end, rebuild) |
| 4904 | struct scroll_bar *bar; | 4900 | struct scroll_bar *bar; |
| @@ -4906,7 +4902,7 @@ x_scroll_bar_set_handle (bar, start, end, rebuild) | |||
| 4906 | int rebuild; | 4902 | int rebuild; |
| 4907 | { | 4903 | { |
| 4908 | int dragging = ! NILP (bar->dragging); | 4904 | int dragging = ! NILP (bar->dragging); |
| 4909 | Window w = SCROLL_BAR_X_WINDOW (bar); | 4905 | Window w = bar->x_window; |
| 4910 | FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); | 4906 | FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); |
| 4911 | GC gc = f->output_data.x->normal_gc; | 4907 | GC gc = f->output_data.x->normal_gc; |
| 4912 | 4908 | ||
| @@ -5009,12 +5005,12 @@ x_scroll_bar_remove (bar) | |||
| 5009 | 5005 | ||
| 5010 | #ifdef USE_TOOLKIT_SCROLL_BARS | 5006 | #ifdef USE_TOOLKIT_SCROLL_BARS |
| 5011 | #ifdef USE_GTK | 5007 | #ifdef USE_GTK |
| 5012 | xg_remove_scroll_bar (f, SCROLL_BAR_X_WINDOW (bar)); | 5008 | xg_remove_scroll_bar (f, bar->x_window); |
| 5013 | #else /* not USE_GTK */ | 5009 | #else /* not USE_GTK */ |
| 5014 | XtDestroyWidget (SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar)); | 5010 | XtDestroyWidget (SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar)); |
| 5015 | #endif /* not USE_GTK */ | 5011 | #endif /* not USE_GTK */ |
| 5016 | #else | 5012 | #else |
| 5017 | XDestroyWindow (FRAME_X_DISPLAY (f), SCROLL_BAR_X_WINDOW (bar)); | 5013 | XDestroyWindow (FRAME_X_DISPLAY (f), bar->x_window); |
| 5018 | #endif | 5014 | #endif |
| 5019 | 5015 | ||
| 5020 | /* Disassociate this scroll bar from its window. */ | 5016 | /* Disassociate this scroll bar from its window. */ |
| @@ -5112,19 +5108,19 @@ XTset_vertical_scroll_bar (w, portion, whole, position) | |||
| 5112 | 5108 | ||
| 5113 | BLOCK_INPUT; | 5109 | BLOCK_INPUT; |
| 5114 | 5110 | ||
| 5115 | if (sb_left != XINT (bar->left)) | 5111 | if (sb_left != bar->left) |
| 5116 | mask |= CWX; | 5112 | mask |= CWX; |
| 5117 | if (top != XINT (bar->top)) | 5113 | if (top != bar->top) |
| 5118 | mask |= CWY; | 5114 | mask |= CWY; |
| 5119 | if (sb_width != XINT (bar->width)) | 5115 | if (sb_width != bar->width) |
| 5120 | mask |= CWWidth; | 5116 | mask |= CWWidth; |
| 5121 | if (height != XINT (bar->height)) | 5117 | if (height != bar->height) |
| 5122 | mask |= CWHeight; | 5118 | mask |= CWHeight; |
| 5123 | 5119 | ||
| 5124 | #ifdef USE_TOOLKIT_SCROLL_BARS | 5120 | #ifdef USE_TOOLKIT_SCROLL_BARS |
| 5125 | 5121 | ||
| 5126 | /* Move/size the scroll bar widget. */ | 5122 | /* Move/size the scroll bar widget. */ |
| 5127 | if (mask || !NILP (bar->fringe_extended_p) != fringe_extended_p) | 5123 | if (mask || bar->fringe_extended_p != fringe_extended_p) |
| 5128 | { | 5124 | { |
| 5129 | /* Since toolkit scroll bars are smaller than the space reserved | 5125 | /* Since toolkit scroll bars are smaller than the space reserved |
| 5130 | for them on the frame, we have to clear "under" them. */ | 5126 | for them on the frame, we have to clear "under" them. */ |
| @@ -5139,7 +5135,7 @@ XTset_vertical_scroll_bar (w, portion, whole, position) | |||
| 5139 | } | 5135 | } |
| 5140 | #ifdef USE_GTK | 5136 | #ifdef USE_GTK |
| 5141 | xg_update_scrollbar_pos (f, | 5137 | xg_update_scrollbar_pos (f, |
| 5142 | SCROLL_BAR_X_WINDOW (bar), | 5138 | bar->x_window, |
| 5143 | top, | 5139 | top, |
| 5144 | sb_left + VERTICAL_SCROLL_BAR_WIDTH_TRIM, | 5140 | sb_left + VERTICAL_SCROLL_BAR_WIDTH_TRIM, |
| 5145 | sb_width - VERTICAL_SCROLL_BAR_WIDTH_TRIM *2, | 5141 | sb_width - VERTICAL_SCROLL_BAR_WIDTH_TRIM *2, |
| @@ -5195,23 +5191,23 @@ XTset_vertical_scroll_bar (w, portion, whole, position) | |||
| 5195 | wc.y = top; | 5191 | wc.y = top; |
| 5196 | wc.width = sb_width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2; | 5192 | wc.width = sb_width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2; |
| 5197 | wc.height = height; | 5193 | wc.height = height; |
| 5198 | XConfigureWindow (FRAME_X_DISPLAY (f), SCROLL_BAR_X_WINDOW (bar), | 5194 | XConfigureWindow (FRAME_X_DISPLAY (f), bar->x_window, |
| 5199 | mask, &wc); | 5195 | mask, &wc); |
| 5200 | } | 5196 | } |
| 5201 | 5197 | ||
| 5202 | #endif /* not USE_TOOLKIT_SCROLL_BARS */ | 5198 | #endif /* not USE_TOOLKIT_SCROLL_BARS */ |
| 5203 | 5199 | ||
| 5204 | /* Remember new settings. */ | 5200 | /* Remember new settings. */ |
| 5205 | XSETINT (bar->left, sb_left); | 5201 | bar->left = sb_left; |
| 5206 | XSETINT (bar->top, top); | 5202 | bar->top = top; |
| 5207 | XSETINT (bar->width, sb_width); | 5203 | bar->width = sb_width; |
| 5208 | XSETINT (bar->height, height); | 5204 | bar->height = height; |
| 5209 | 5205 | ||
| 5210 | UNBLOCK_INPUT; | 5206 | UNBLOCK_INPUT; |
| 5211 | } | 5207 | } |
| 5212 | 5208 | ||
| 5213 | #ifdef USE_TOOLKIT_SCROLL_BARS | 5209 | #ifdef USE_TOOLKIT_SCROLL_BARS |
| 5214 | bar->fringe_extended_p = fringe_extended_p ? Qt : Qnil; | 5210 | bar->fringe_extended_p = fringe_extended_p; |
| 5215 | 5211 | ||
| 5216 | x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole); | 5212 | x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole); |
| 5217 | #else /* not USE_TOOLKIT_SCROLL_BARS */ | 5213 | #else /* not USE_TOOLKIT_SCROLL_BARS */ |
| @@ -5355,7 +5351,7 @@ x_scroll_bar_expose (bar, event) | |||
| 5355 | struct scroll_bar *bar; | 5351 | struct scroll_bar *bar; |
| 5356 | XEvent *event; | 5352 | XEvent *event; |
| 5357 | { | 5353 | { |
| 5358 | Window w = SCROLL_BAR_X_WINDOW (bar); | 5354 | Window w = bar->x_window; |
| 5359 | FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); | 5355 | FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); |
| 5360 | GC gc = f->output_data.x->normal_gc; | 5356 | GC gc = f->output_data.x->normal_gc; |
| 5361 | int width_trim = VERTICAL_SCROLL_BAR_WIDTH_TRIM; | 5357 | int width_trim = VERTICAL_SCROLL_BAR_WIDTH_TRIM; |
| @@ -5419,18 +5415,18 @@ x_scroll_bar_handle_click (bar, event, emacs_event) | |||
| 5419 | #if 0 | 5415 | #if 0 |
| 5420 | FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); | 5416 | FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); |
| 5421 | int internal_height | 5417 | int internal_height |
| 5422 | = VERTICAL_SCROLL_BAR_INSIDE_HEIGHT (f, XINT (bar->height)); | 5418 | = VERTICAL_SCROLL_BAR_INSIDE_HEIGHT (f, bar->height); |
| 5423 | #endif | 5419 | #endif |
| 5424 | int top_range | 5420 | int top_range |
| 5425 | = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height)); | 5421 | = VERTICAL_SCROLL_BAR_TOP_RANGE (f, bar->height); |
| 5426 | int y = event->xbutton.y - VERTICAL_SCROLL_BAR_TOP_BORDER; | 5422 | int y = event->xbutton.y - VERTICAL_SCROLL_BAR_TOP_BORDER; |
| 5427 | 5423 | ||
| 5428 | if (y < 0) y = 0; | 5424 | if (y < 0) y = 0; |
| 5429 | if (y > top_range) y = top_range; | 5425 | if (y > top_range) y = top_range; |
| 5430 | 5426 | ||
| 5431 | if (y < XINT (bar->start)) | 5427 | if (y < bar->start) |
| 5432 | emacs_event->part = scroll_bar_above_handle; | 5428 | emacs_event->part = scroll_bar_above_handle; |
| 5433 | else if (y < XINT (bar->end) + VERTICAL_SCROLL_BAR_MIN_HANDLE) | 5429 | else if (y < bar->end + VERTICAL_SCROLL_BAR_MIN_HANDLE) |
| 5434 | emacs_event->part = scroll_bar_handle; | 5430 | emacs_event->part = scroll_bar_handle; |
| 5435 | else | 5431 | else |
| 5436 | emacs_event->part = scroll_bar_below_handle; | 5432 | emacs_event->part = scroll_bar_below_handle; |
| @@ -5523,7 +5519,7 @@ x_scroll_bar_report_motion (fp, bar_window, part, x, y, time) | |||
| 5523 | unsigned long *time; | 5519 | unsigned long *time; |
| 5524 | { | 5520 | { |
| 5525 | struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar); | 5521 | struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar); |
| 5526 | Window w = SCROLL_BAR_X_WINDOW (bar); | 5522 | Window w = bar->x_window; |
| 5527 | FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); | 5523 | FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); |
| 5528 | int win_x, win_y; | 5524 | int win_x, win_y; |
| 5529 | Window dummy_window; | 5525 | Window dummy_window; |
| @@ -5550,10 +5546,10 @@ x_scroll_bar_report_motion (fp, bar_window, part, x, y, time) | |||
| 5550 | { | 5546 | { |
| 5551 | #if 0 | 5547 | #if 0 |
| 5552 | int inside_height | 5548 | int inside_height |
| 5553 | = VERTICAL_SCROLL_BAR_INSIDE_HEIGHT (f, XINT (bar->height)); | 5549 | = VERTICAL_SCROLL_BAR_INSIDE_HEIGHT (f, bar->height); |
| 5554 | #endif | 5550 | #endif |
| 5555 | int top_range | 5551 | int top_range |
| 5556 | = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height)); | 5552 | = VERTICAL_SCROLL_BAR_TOP_RANGE (f, bar->height); |
| 5557 | 5553 | ||
| 5558 | win_y -= VERTICAL_SCROLL_BAR_TOP_BORDER; | 5554 | win_y -= VERTICAL_SCROLL_BAR_TOP_BORDER; |
| 5559 | 5555 | ||
| @@ -5570,9 +5566,9 @@ x_scroll_bar_report_motion (fp, bar_window, part, x, y, time) | |||
| 5570 | 5566 | ||
| 5571 | if (! NILP (bar->dragging)) | 5567 | if (! NILP (bar->dragging)) |
| 5572 | *part = scroll_bar_handle; | 5568 | *part = scroll_bar_handle; |
| 5573 | else if (win_y < XINT (bar->start)) | 5569 | else if (win_y < bar->start) |
| 5574 | *part = scroll_bar_above_handle; | 5570 | *part = scroll_bar_above_handle; |
| 5575 | else if (win_y < XINT (bar->end) + VERTICAL_SCROLL_BAR_MIN_HANDLE) | 5571 | else if (win_y < bar->end + VERTICAL_SCROLL_BAR_MIN_HANDLE) |
| 5576 | *part = scroll_bar_handle; | 5572 | *part = scroll_bar_handle; |
| 5577 | else | 5573 | else |
| 5578 | *part = scroll_bar_below_handle; | 5574 | *part = scroll_bar_below_handle; |
| @@ -5609,7 +5605,7 @@ x_scroll_bar_clear (f) | |||
| 5609 | for (bar = FRAME_SCROLL_BARS (f); VECTORP (bar); | 5605 | for (bar = FRAME_SCROLL_BARS (f); VECTORP (bar); |
| 5610 | bar = XSCROLL_BAR (bar)->next) | 5606 | bar = XSCROLL_BAR (bar)->next) |
| 5611 | XClearArea (FRAME_X_DISPLAY (f), | 5607 | XClearArea (FRAME_X_DISPLAY (f), |
| 5612 | SCROLL_BAR_X_WINDOW (XSCROLL_BAR (bar)), | 5608 | XSCROLL_BAR (bar)->x_window, |
| 5613 | 0, 0, 0, 0, True); | 5609 | 0, 0, 0, 0, True); |
| 5614 | #endif /* not USE_TOOLKIT_SCROLL_BARS */ | 5610 | #endif /* not USE_TOOLKIT_SCROLL_BARS */ |
| 5615 | } | 5611 | } |
| @@ -6847,12 +6843,10 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit) | |||
| 6847 | 6843 | ||
| 6848 | if (tool_bar_p && event.xbutton.button < 4) | 6844 | if (tool_bar_p && event.xbutton.button < 4) |
| 6849 | { | 6845 | { |
| 6850 | if (event.xbutton.type == ButtonPress) | 6846 | handle_tool_bar_click (f, x, y, |
| 6851 | handle_tool_bar_click (f, x, y, 1, 0); | 6847 | event.xbutton.type == ButtonPress, |
| 6852 | else | 6848 | x_x_to_emacs_modifiers (dpyinfo, |
| 6853 | handle_tool_bar_click (f, x, y, 0, | 6849 | event.xbutton.state)); |
| 6854 | x_x_to_emacs_modifiers (dpyinfo, | ||
| 6855 | event.xbutton.state)); | ||
| 6856 | } | 6850 | } |
| 6857 | } | 6851 | } |
| 6858 | 6852 | ||
| @@ -7854,7 +7848,7 @@ x_connection_closed (dpy, error_message) | |||
| 7854 | 7848 | ||
| 7855 | Closing the display is reported to lead to a bus error on | 7849 | Closing the display is reported to lead to a bus error on |
| 7856 | OpenWindows in certain situations. I suspect that is a bug | 7850 | OpenWindows in certain situations. I suspect that is a bug |
| 7857 | in OpenWindows. I don't know how to cicumvent it here. */ | 7851 | in OpenWindows. I don't know how to circumvent it here. */ |
| 7858 | 7852 | ||
| 7859 | #ifdef USE_X_TOOLKIT | 7853 | #ifdef USE_X_TOOLKIT |
| 7860 | /* If DPYINFO is null, this means we didn't open the display | 7854 | /* If DPYINFO is null, this means we didn't open the display |
| @@ -7905,6 +7899,10 @@ x_connection_closed (dpy, error_message) | |||
| 7905 | 7899 | ||
| 7906 | unbind_to (index, Qnil); | 7900 | unbind_to (index, Qnil); |
| 7907 | clear_waiting_for_input (); | 7901 | clear_waiting_for_input (); |
| 7902 | /* FIXME: This is an asynchronous interrupt w.r.t elisp, so signalling an | ||
| 7903 | error might not be the best thing to do. I'd vote for creating an | ||
| 7904 | elisp event and stuffing it in the queue so people can bind to it via | ||
| 7905 | the global map. --Stef */ | ||
| 7908 | error ("%s", error_msg); | 7906 | error ("%s", error_msg); |
| 7909 | } | 7907 | } |
| 7910 | 7908 | ||
| @@ -10868,8 +10866,8 @@ x_term_init (display_name, xrm_option, resource_name) | |||
| 10868 | /* Mac OS X 10.3's Xserver sometimes reports 0.0mm. */ | 10866 | /* Mac OS X 10.3's Xserver sometimes reports 0.0mm. */ |
| 10869 | dpyinfo->resy = (mm < 1) ? 100 : pixels * 25.4 / mm; | 10867 | dpyinfo->resy = (mm < 1) ? 100 : pixels * 25.4 / mm; |
| 10870 | pixels = DisplayWidth (dpyinfo->display, screen_number); | 10868 | pixels = DisplayWidth (dpyinfo->display, screen_number); |
| 10871 | /* Mac OS X 10.3's Xserver sometimes reports 0.0mm. */ | ||
| 10872 | mm = DisplayWidthMM (dpyinfo->display, screen_number); | 10869 | mm = DisplayWidthMM (dpyinfo->display, screen_number); |
| 10870 | /* Mac OS X 10.3's Xserver sometimes reports 0.0mm. */ | ||
| 10873 | dpyinfo->resx = (mm < 1) ? 100 : pixels * 25.4 / mm; | 10871 | dpyinfo->resx = (mm < 1) ? 100 : pixels * 25.4 / mm; |
| 10874 | } | 10872 | } |
| 10875 | 10873 | ||
| @@ -11038,13 +11036,13 @@ x_term_init (display_name, xrm_option, resource_name) | |||
| 11038 | Qnil, Qnil); | 11036 | Qnil, Qnil); |
| 11039 | #ifdef USE_XIM | 11037 | #ifdef USE_XIM |
| 11040 | if (STRINGP (value) | 11038 | if (STRINGP (value) |
| 11041 | && (!strcmp (XSTRING (value)->data, "false") | 11039 | && (!strcmp (SDATA (value), "false") |
| 11042 | || !strcmp (XSTRING (value)->data, "off"))) | 11040 | || !strcmp (SDATA (value), "off"))) |
| 11043 | use_xim = 0; | 11041 | use_xim = 0; |
| 11044 | #else | 11042 | #else |
| 11045 | if (STRINGP (value) | 11043 | if (STRINGP (value) |
| 11046 | && (!strcmp (XSTRING (value)->data, "true") | 11044 | && (!strcmp (SDATA (value), "true") |
| 11047 | || !strcmp (XSTRING (value)->data, "on"))) | 11045 | || !strcmp (SDATA (value), "on"))) |
| 11048 | use_xim = 1; | 11046 | use_xim = 1; |
| 11049 | #endif | 11047 | #endif |
| 11050 | } | 11048 | } |
diff --git a/src/xterm.h b/src/xterm.h index 741dec13e75..d9b5c327858 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -746,13 +746,14 @@ struct scroll_bar | |||
| 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 |
| @@ -765,7 +766,7 @@ struct scroll_bar | |||
| 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 |
| @@ -773,11 +774,9 @@ struct scroll_bar | |||
| 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. */ |
| @@ -790,36 +789,19 @@ 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 | ||