Mercurial > emacs
comparison src/xterm.c @ 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 | b9c295c443e2 |
children | 1da472256ca6 |
comparison
equal
deleted
inserted
replaced
86160:1ede747999c6 | 86161:3408ab8b4152 |
---|---|
3960 condemned scroll bar lists with one loop. */ | 3960 condemned scroll bar lists with one loop. */ |
3961 ! GC_NILP (bar) || (bar = condemned, | 3961 ! GC_NILP (bar) || (bar = condemned, |
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 } |
3969 | 3969 |
3970 return 0; | 3970 return 0; |
4278 last_scroll_bar_part = part; | 4278 last_scroll_bar_part = part; |
4279 x_send_scroll_bar_event (bar->window, part, portion, whole); | 4279 x_send_scroll_bar_event (bar->window, part, portion, whole); |
4280 } | 4280 } |
4281 } | 4281 } |
4282 | 4282 |
4283 | 4283 #elif defined USE_GTK |
4284 #else /* !USE_MOTIF, i.e. Xaw or GTK */ | 4284 |
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 |
4289 static void | 4288 static void |
4290 xg_scroll_callback (widget, data) | 4289 xg_scroll_callback (widget, data) |
4351 last_scroll_bar_part = part; | 4350 last_scroll_bar_part = part; |
4352 x_send_scroll_bar_event (bar->window, part, portion, whole); | 4351 x_send_scroll_bar_event (bar->window, part, portion, whole); |
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 |
4360 scroll bar struct. CALL_DATA is a pointer to a float saying where | 4359 scroll bar struct. CALL_DATA is a pointer to a float saying where |
4361 the thumb is. */ | 4360 the thumb is. */ |
4434 bar->dragging = Qnil; | 4433 bar->dragging = Qnil; |
4435 last_scroll_bar_part = part; | 4434 last_scroll_bar_part = part; |
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 |
4444 /* Create the widget for scroll bar BAR on frame F. Record the widget | 4442 /* Create the widget for scroll bar BAR on frame F. Record the widget |
4445 and X window of the scroll bar in BAR. */ | 4443 and X window of the scroll bar in BAR. */ |
4641 action_hook_id = XtAppAddActionHook (Xt_app_con, xt_action_hook, 0); | 4639 action_hook_id = XtAppAddActionHook (Xt_app_con, xt_action_hook, 0); |
4642 | 4640 |
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 } |
4650 #endif /* not USE_GTK */ | 4648 #endif /* not USE_GTK */ |
4651 | 4649 |
4785 struct window *w; | 4783 struct window *w; |
4786 int top, left, width, height; | 4784 int 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 |
4794 #ifdef USE_TOOLKIT_SCROLL_BARS | 4792 #ifdef USE_TOOLKIT_SCROLL_BARS |
4795 x_create_toolkit_scroll_bar (f, bar); | 4793 x_create_toolkit_scroll_bar (f, bar); |
4829 CopyFromParent, | 4827 CopyFromParent, |
4830 CopyFromParent, | 4828 CopyFromParent, |
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); |
4852 bar->prev = Qnil; | 4848 bar->prev = Qnil; |
4853 XSETVECTOR (FRAME_SCROLL_BARS (f), bar); | 4849 XSETVECTOR (FRAME_SCROLL_BARS (f), bar); |
4857 /* Map the window/widget. */ | 4853 /* Map the window/widget. */ |
4858 #ifdef USE_TOOLKIT_SCROLL_BARS | 4854 #ifdef USE_TOOLKIT_SCROLL_BARS |
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, |
4871 left + VERTICAL_SCROLL_BAR_WIDTH_TRIM, | 4867 left + VERTICAL_SCROLL_BAR_WIDTH_TRIM, |
4872 top, | 4868 top, |
4874 max (height, 1), 0); | 4870 max (height, 1), 0); |
4875 XtMapWidget (scroll_bar); | 4871 XtMapWidget (scroll_bar); |
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; |
4883 return bar; | 4879 return bar; |
4884 } | 4880 } |
4885 | 4881 |
4882 | |
4883 #ifndef USE_TOOLKIT_SCROLL_BARS | |
4886 | 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 |
4890 redrawing it, unless REBUILD is non-zero; in that case, always | 4888 redrawing it, unless REBUILD is non-zero; in that case, always |
4895 fit inside its rectangle, but if the user is dragging the scroll | 4893 fit inside its rectangle, but if the user is dragging the scroll |
4896 bar handle, we want to let them drag it down all the way, so that | 4894 bar handle, we want to let them drag it down all the way, so that |
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; |
4905 int start, end; | 4901 int start, end; |
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 |
4913 /* If the display is already accurate, do nothing. */ | 4909 /* If the display is already accurate, do nothing. */ |
4914 if (! rebuild | 4910 if (! rebuild |
5007 struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); | 5003 struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); |
5008 BLOCK_INPUT; | 5004 BLOCK_INPUT; |
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. */ |
5021 XWINDOW (bar->window)->vertical_scroll_bar = Qnil; | 5017 XWINDOW (bar->window)->vertical_scroll_bar = Qnil; |
5022 | 5018 |
5110 | 5106 |
5111 bar = XSCROLL_BAR (w->vertical_scroll_bar); | 5107 bar = XSCROLL_BAR (w->vertical_scroll_bar); |
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. */ |
5131 if (width > 0 && height > 0) | 5127 if (width > 0 && height > 0) |
5132 { | 5128 { |
5137 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | 5133 x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), |
5138 left, top, width, height, False); | 5134 left, top, width, height, False); |
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, |
5146 max (height, 1)); | 5142 max (height, 1)); |
5147 #else /* not USE_GTK */ | 5143 #else /* not USE_GTK */ |
5193 | 5189 |
5194 wc.x = sb_left + VERTICAL_SCROLL_BAR_WIDTH_TRIM; | 5190 wc.x = sb_left + VERTICAL_SCROLL_BAR_WIDTH_TRIM; |
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 */ |
5218 /* Set the scroll bar's current state, unless we're currently being | 5214 /* Set the scroll bar's current state, unless we're currently being |
5219 dragged. */ | 5215 dragged. */ |
5353 static void | 5349 static void |
5354 x_scroll_bar_expose (bar, event) | 5350 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; |
5362 | 5358 |
5363 BLOCK_INPUT; | 5359 BLOCK_INPUT; |
5417 emacs_event->timestamp = event->xbutton.time; | 5413 emacs_event->timestamp = event->xbutton.time; |
5418 { | 5414 { |
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; |
5437 | 5433 |
5438 /* Just because the user has clicked on the handle doesn't mean | 5434 /* Just because the user has clicked on the handle doesn't mean |
5521 enum scroll_bar_part *part; | 5517 enum scroll_bar_part *part; |
5522 Lisp_Object *x, *y; | 5518 Lisp_Object *x, *y; |
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; |
5530 int dummy_coord; | 5526 int dummy_coord; |
5531 unsigned int dummy_mask; | 5527 unsigned int dummy_mask; |
5548 ; | 5544 ; |
5549 else | 5545 else |
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 |
5560 if (! NILP (bar->dragging)) | 5556 if (! NILP (bar->dragging)) |
5561 win_y -= XINT (bar->dragging); | 5557 win_y -= XINT (bar->dragging); |
5568 *fp = f; | 5564 *fp = f; |
5569 *bar_window = bar->window; | 5565 *bar_window = bar->window; |
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; |
5579 | 5575 |
5580 XSETINT (*x, win_y); | 5576 XSETINT (*x, win_y); |
5607 But in that case we should not clear them. */ | 5603 But in that case we should not clear them. */ |
5608 if (FRAME_HAS_VERTICAL_SCROLL_BARS (f)) | 5604 if (FRAME_HAS_VERTICAL_SCROLL_BARS (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 } |
5616 | 5612 |
5617 | 5613 |
6845 window = window_from_coordinates (f, x, y, 0, 0, 0, 1); | 6841 window = window_from_coordinates (f, x, y, 0, 0, 0, 1); |
6846 tool_bar_p = EQ (window, f->tool_bar_window); | 6842 tool_bar_p = EQ (window, f->tool_bar_window); |
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 |
6859 if (!tool_bar_p) | 6853 if (!tool_bar_p) |
6860 #if defined (USE_X_TOOLKIT) || defined (USE_GTK) | 6854 #if defined (USE_X_TOOLKIT) || defined (USE_GTK) |
7852 will indefinitely wait in Xt for events for display `:1', opened | 7846 will indefinitely wait in Xt for events for display `:1', opened |
7853 in the first class to make-frame-on-display. | 7847 in the first class to make-frame-on-display. |
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 |
7861 in the first place, so don't try to close it. */ | 7855 in the first place, so don't try to close it. */ |
7862 if (dpyinfo) | 7856 if (dpyinfo) |
7903 sigunblock (sigmask (SIGALRM)); | 7897 sigunblock (sigmask (SIGALRM)); |
7904 TOTALLY_UNBLOCK_INPUT; | 7898 TOTALLY_UNBLOCK_INPUT; |
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 |
7911 /* We specifically use it before defining it, so that gcc doesn't inline it, | 7909 /* We specifically use it before defining it, so that gcc doesn't inline it, |
7912 otherwise gdb doesn't know how to properly put a breakpoint on it. */ | 7910 otherwise gdb doesn't know how to properly put a breakpoint on it. */ |
10866 double pixels = DisplayHeight (dpyinfo->display, screen_number); | 10864 double pixels = DisplayHeight (dpyinfo->display, screen_number); |
10867 double mm = DisplayHeightMM (dpyinfo->display, screen_number); | 10865 double mm = DisplayHeightMM (dpyinfo->display, screen_number); |
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); |
10869 mm = DisplayWidthMM (dpyinfo->display, screen_number); | |
10871 /* Mac OS X 10.3's Xserver sometimes reports 0.0mm. */ | 10870 /* Mac OS X 10.3's Xserver sometimes reports 0.0mm. */ |
10872 mm = DisplayWidthMM (dpyinfo->display, screen_number); | |
10873 dpyinfo->resx = (mm < 1) ? 100 : pixels * 25.4 / mm; | 10871 dpyinfo->resx = (mm < 1) ? 100 : pixels * 25.4 / mm; |
10874 } | 10872 } |
10875 | 10873 |
10876 dpyinfo->Xatom_wm_protocols | 10874 dpyinfo->Xatom_wm_protocols |
10877 = XInternAtom (dpyinfo->display, "WM_PROTOCOLS", False); | 10875 = XInternAtom (dpyinfo->display, "WM_PROTOCOLS", False); |
11036 build_string ("useXIM"), | 11034 build_string ("useXIM"), |
11037 build_string ("UseXIM"), | 11035 build_string ("UseXIM"), |
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 } |
11051 | 11049 |
11052 #ifdef HAVE_X_SM | 11050 #ifdef HAVE_X_SM |