diff options
| author | Miles Bader | 2007-12-06 09:51:45 +0000 |
|---|---|---|
| committer | Miles Bader | 2007-12-06 09:51:45 +0000 |
| commit | 0bd508417142ff377f34aec8dcec9438d9175c2c (patch) | |
| tree | 4d60fe09e5cebf7d79766b11e9cda8cc1c9dbb9b /src/xterm.c | |
| parent | 98fe991da804a42f53f6a5e84cd5eab18a82e181 (diff) | |
| parent | 9fb1ba8090da3528de56158a79bd3527d31c7f2f (diff) | |
| download | emacs-0bd508417142ff377f34aec8dcec9438d9175c2c.tar.gz emacs-0bd508417142ff377f34aec8dcec9438d9175c2c.zip | |
Merge from emacs--devo--0
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-294
Diffstat (limited to 'src/xterm.c')
| -rw-r--r-- | src/xterm.c | 152 |
1 files changed, 75 insertions, 77 deletions
diff --git a/src/xterm.c b/src/xterm.c index 55185fb57f2..023d0194c59 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -4209,7 +4209,7 @@ x_window_to_scroll_bar (display, window_id) | |||
| 4209 | condemned = Qnil, | 4209 | condemned = Qnil, |
| 4210 | ! NILP (bar)); | 4210 | ! NILP (bar)); |
| 4211 | bar = XSCROLL_BAR (bar)->next) | 4211 | bar = XSCROLL_BAR (bar)->next) |
| 4212 | if (SCROLL_BAR_X_WINDOW (XSCROLL_BAR (bar)) == window_id && | 4212 | if (XSCROLL_BAR (bar)->x_window == window_id && |
| 4213 | FRAME_X_DISPLAY (XFRAME (frame)) == display) | 4213 | FRAME_X_DISPLAY (XFRAME (frame)) == display) |
| 4214 | return XSCROLL_BAR (bar); | 4214 | return XSCROLL_BAR (bar); |
| 4215 | } | 4215 | } |
| @@ -4525,9 +4525,8 @@ xm_scroll_callback (widget, client_data, call_data) | |||
| 4525 | } | 4525 | } |
| 4526 | } | 4526 | } |
| 4527 | 4527 | ||
| 4528 | #elif defined USE_GTK | ||
| 4528 | 4529 | ||
| 4529 | #else /* !USE_MOTIF, i.e. Xaw or GTK */ | ||
| 4530 | #ifdef USE_GTK | ||
| 4531 | /* Scroll bar callback for GTK scroll bars. WIDGET is the scroll | 4530 | /* Scroll bar callback for GTK scroll bars. WIDGET is the scroll |
| 4532 | bar widget. DATA is a pointer to the scroll_bar structure. */ | 4531 | bar widget. DATA is a pointer to the scroll_bar structure. */ |
| 4533 | 4532 | ||
| @@ -4598,7 +4597,7 @@ xg_scroll_callback (widget, data) | |||
| 4598 | } | 4597 | } |
| 4599 | } | 4598 | } |
| 4600 | 4599 | ||
| 4601 | #else /* not USE_GTK */ | 4600 | #else /* not USE_GTK and not USE_MOTIF */ |
| 4602 | 4601 | ||
| 4603 | /* Xaw scroll bar callback. Invoked when the thumb is dragged. | 4602 | /* Xaw scroll bar callback. Invoked when the thumb is dragged. |
| 4604 | WIDGET is the scroll bar widget. CLIENT_DATA is a pointer to the | 4603 | WIDGET is the scroll bar widget. CLIENT_DATA is a pointer to the |
| @@ -4681,8 +4680,7 @@ xaw_scroll_callback (widget, client_data, call_data) | |||
| 4681 | x_send_scroll_bar_event (bar->window, part, position, height); | 4680 | x_send_scroll_bar_event (bar->window, part, position, height); |
| 4682 | } | 4681 | } |
| 4683 | 4682 | ||
| 4684 | #endif /* not USE_GTK */ | 4683 | #endif /* not USE_GTK and not USE_MOTIF */ |
| 4685 | #endif /* not USE_MOTIF */ | ||
| 4686 | 4684 | ||
| 4687 | #define SCROLL_BAR_NAME "verticalScrollBar" | 4685 | #define SCROLL_BAR_NAME "verticalScrollBar" |
| 4688 | 4686 | ||
| @@ -4888,7 +4886,7 @@ x_create_toolkit_scroll_bar (f, bar) | |||
| 4888 | /* Remember X window and widget in the scroll bar vector. */ | 4886 | /* Remember X window and widget in the scroll bar vector. */ |
| 4889 | SET_SCROLL_BAR_X_WIDGET (bar, widget); | 4887 | SET_SCROLL_BAR_X_WIDGET (bar, widget); |
| 4890 | xwindow = XtWindow (widget); | 4888 | xwindow = XtWindow (widget); |
| 4891 | SET_SCROLL_BAR_X_WINDOW (bar, xwindow); | 4889 | bar->x_window = xwindow; |
| 4892 | 4890 | ||
| 4893 | UNBLOCK_INPUT; | 4891 | UNBLOCK_INPUT; |
| 4894 | } | 4892 | } |
| @@ -5032,7 +5030,7 @@ x_scroll_bar_create (w, top, left, width, height) | |||
| 5032 | { | 5030 | { |
| 5033 | struct frame *f = XFRAME (w->frame); | 5031 | struct frame *f = XFRAME (w->frame); |
| 5034 | struct scroll_bar *bar | 5032 | struct scroll_bar *bar |
| 5035 | = XSCROLL_BAR (Fmake_vector (make_number (SCROLL_BAR_VEC_SIZE), Qnil)); | 5033 | = ALLOCATE_PSEUDOVECTOR (struct scroll_bar, x_window, PVEC_OTHER); |
| 5036 | 5034 | ||
| 5037 | BLOCK_INPUT; | 5035 | BLOCK_INPUT; |
| 5038 | 5036 | ||
| @@ -5076,21 +5074,19 @@ x_scroll_bar_create (w, top, left, width, height) | |||
| 5076 | CopyFromParent, | 5074 | CopyFromParent, |
| 5077 | /* Attributes. */ | 5075 | /* Attributes. */ |
| 5078 | mask, &a); | 5076 | mask, &a); |
| 5079 | SET_SCROLL_BAR_X_WINDOW (bar, window); | 5077 | bar->x_window = window; |
| 5080 | } | 5078 | } |
| 5081 | #endif /* not USE_TOOLKIT_SCROLL_BARS */ | 5079 | #endif /* not USE_TOOLKIT_SCROLL_BARS */ |
| 5082 | 5080 | ||
| 5083 | XSETWINDOW (bar->window, w); | 5081 | XSETWINDOW (bar->window, w); |
| 5084 | XSETINT (bar->top, top); | 5082 | bar->top = top; |
| 5085 | XSETINT (bar->left, left); | 5083 | bar->left = left; |
| 5086 | XSETINT (bar->width, width); | 5084 | bar->width = width; |
| 5087 | XSETINT (bar->height, height); | 5085 | bar->height = height; |
| 5088 | XSETINT (bar->start, 0); | 5086 | bar->start = 0; |
| 5089 | XSETINT (bar->end, 0); | 5087 | bar->end = 0; |
| 5090 | bar->dragging = Qnil; | 5088 | bar->dragging = Qnil; |
| 5091 | #ifdef USE_TOOLKIT_SCROLL_BARS | 5089 | bar->fringe_extended_p = 0; |
| 5092 | bar->fringe_extended_p = Qnil; | ||
| 5093 | #endif | ||
| 5094 | 5090 | ||
| 5095 | /* Add bar to its frame's list of scroll bars. */ | 5091 | /* Add bar to its frame's list of scroll bars. */ |
| 5096 | bar->next = FRAME_SCROLL_BARS (f); | 5092 | bar->next = FRAME_SCROLL_BARS (f); |
| @@ -5104,12 +5100,12 @@ x_scroll_bar_create (w, top, left, width, height) | |||
| 5104 | { | 5100 | { |
| 5105 | #ifdef USE_GTK | 5101 | #ifdef USE_GTK |
| 5106 | xg_update_scrollbar_pos (f, | 5102 | xg_update_scrollbar_pos (f, |
| 5107 | SCROLL_BAR_X_WINDOW (bar), | 5103 | bar->x_window, |
| 5108 | top, | 5104 | top, |
| 5109 | left + VERTICAL_SCROLL_BAR_WIDTH_TRIM, | 5105 | left + VERTICAL_SCROLL_BAR_WIDTH_TRIM, |
| 5110 | width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2, | 5106 | width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2, |
| 5111 | max (height, 1)); | 5107 | max (height, 1)); |
| 5112 | xg_show_scroll_bar (SCROLL_BAR_X_WINDOW (bar)); | 5108 | xg_show_scroll_bar (bar->x_window); |
| 5113 | #else /* not USE_GTK */ | 5109 | #else /* not USE_GTK */ |
| 5114 | Widget scroll_bar = SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar); | 5110 | Widget scroll_bar = SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar); |
| 5115 | XtConfigureWidget (scroll_bar, | 5111 | XtConfigureWidget (scroll_bar, |
| @@ -5121,7 +5117,7 @@ x_scroll_bar_create (w, top, left, width, height) | |||
| 5121 | #endif /* not USE_GTK */ | 5117 | #endif /* not USE_GTK */ |
| 5122 | } | 5118 | } |
| 5123 | #else /* not USE_TOOLKIT_SCROLL_BARS */ | 5119 | #else /* not USE_TOOLKIT_SCROLL_BARS */ |
| 5124 | XMapRaised (FRAME_X_DISPLAY (f), SCROLL_BAR_X_WINDOW (bar)); | 5120 | XMapRaised (FRAME_X_DISPLAY (f), bar->x_window); |
| 5125 | #endif /* not USE_TOOLKIT_SCROLL_BARS */ | 5121 | #endif /* not USE_TOOLKIT_SCROLL_BARS */ |
| 5126 | 5122 | ||
| 5127 | UNBLOCK_INPUT; | 5123 | UNBLOCK_INPUT; |
| @@ -5129,6 +5125,8 @@ x_scroll_bar_create (w, top, left, width, height) | |||
| 5129 | } | 5125 | } |
| 5130 | 5126 | ||
| 5131 | 5127 | ||
| 5128 | #ifndef USE_TOOLKIT_SCROLL_BARS | ||
| 5129 | |||
| 5132 | /* Draw BAR's handle in the proper position. | 5130 | /* Draw BAR's handle in the proper position. |
| 5133 | 5131 | ||
| 5134 | If the handle is already drawn from START to END, don't bother | 5132 | If the handle is already drawn from START to END, don't bother |
| @@ -5142,8 +5140,6 @@ x_scroll_bar_create (w, top, left, width, height) | |||
| 5142 | the bar's top is as far down as it goes; otherwise, there's no way | 5140 | the bar's top is as far down as it goes; otherwise, there's no way |
| 5143 | to move to the very end of the buffer. */ | 5141 | to move to the very end of the buffer. */ |
| 5144 | 5142 | ||
| 5145 | #ifndef USE_TOOLKIT_SCROLL_BARS | ||
| 5146 | |||
| 5147 | static void | 5143 | static void |
| 5148 | x_scroll_bar_set_handle (bar, start, end, rebuild) | 5144 | x_scroll_bar_set_handle (bar, start, end, rebuild) |
| 5149 | struct scroll_bar *bar; | 5145 | struct scroll_bar *bar; |
| @@ -5151,22 +5147,22 @@ x_scroll_bar_set_handle (bar, start, end, rebuild) | |||
| 5151 | int rebuild; | 5147 | int rebuild; |
| 5152 | { | 5148 | { |
| 5153 | int dragging = ! NILP (bar->dragging); | 5149 | int dragging = ! NILP (bar->dragging); |
| 5154 | Window w = SCROLL_BAR_X_WINDOW (bar); | 5150 | Window w = bar->x_window; |
| 5155 | FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); | 5151 | FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); |
| 5156 | GC gc = f->output_data.x->normal_gc; | 5152 | GC gc = f->output_data.x->normal_gc; |
| 5157 | 5153 | ||
| 5158 | /* If the display is already accurate, do nothing. */ | 5154 | /* If the display is already accurate, do nothing. */ |
| 5159 | if (! rebuild | 5155 | if (! rebuild |
| 5160 | && start == XINT (bar->start) | 5156 | && start == bar->start |
| 5161 | && end == XINT (bar->end)) | 5157 | && end == bar->end) |
| 5162 | return; | 5158 | return; |
| 5163 | 5159 | ||
| 5164 | BLOCK_INPUT; | 5160 | BLOCK_INPUT; |
| 5165 | 5161 | ||
| 5166 | { | 5162 | { |
| 5167 | int inside_width = VERTICAL_SCROLL_BAR_INSIDE_WIDTH (f, XINT (bar->width)); | 5163 | int inside_width = VERTICAL_SCROLL_BAR_INSIDE_WIDTH (f, bar->width); |
| 5168 | int inside_height = VERTICAL_SCROLL_BAR_INSIDE_HEIGHT (f, XINT (bar->height)); | 5164 | int inside_height = VERTICAL_SCROLL_BAR_INSIDE_HEIGHT (f, bar->height); |
| 5169 | int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height)); | 5165 | int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, bar->height); |
| 5170 | 5166 | ||
| 5171 | /* Make sure the values are reasonable, and try to preserve | 5167 | /* Make sure the values are reasonable, and try to preserve |
| 5172 | the distance between start and end. */ | 5168 | the distance between start and end. */ |
| @@ -5186,8 +5182,8 @@ x_scroll_bar_set_handle (bar, start, end, rebuild) | |||
| 5186 | } | 5182 | } |
| 5187 | 5183 | ||
| 5188 | /* Store the adjusted setting in the scroll bar. */ | 5184 | /* Store the adjusted setting in the scroll bar. */ |
| 5189 | XSETINT (bar->start, start); | 5185 | bar->start = start; |
| 5190 | XSETINT (bar->end, end); | 5186 | bar->end = end; |
| 5191 | 5187 | ||
| 5192 | /* Clip the end position, just for display. */ | 5188 | /* Clip the end position, just for display. */ |
| 5193 | if (end > top_range) | 5189 | if (end > top_range) |
| @@ -5254,12 +5250,12 @@ x_scroll_bar_remove (bar) | |||
| 5254 | 5250 | ||
| 5255 | #ifdef USE_TOOLKIT_SCROLL_BARS | 5251 | #ifdef USE_TOOLKIT_SCROLL_BARS |
| 5256 | #ifdef USE_GTK | 5252 | #ifdef USE_GTK |
| 5257 | xg_remove_scroll_bar (f, SCROLL_BAR_X_WINDOW (bar)); | 5253 | xg_remove_scroll_bar (f, bar->x_window); |
| 5258 | #else /* not USE_GTK */ | 5254 | #else /* not USE_GTK */ |
| 5259 | XtDestroyWidget (SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar)); | 5255 | XtDestroyWidget (SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar)); |
| 5260 | #endif /* not USE_GTK */ | 5256 | #endif /* not USE_GTK */ |
| 5261 | #else | 5257 | #else |
| 5262 | XDestroyWindow (FRAME_X_DISPLAY (f), SCROLL_BAR_X_WINDOW (bar)); | 5258 | XDestroyWindow (FRAME_X_DISPLAY (f), bar->x_window); |
| 5263 | #endif | 5259 | #endif |
| 5264 | 5260 | ||
| 5265 | /* Disassociate this scroll bar from its window. */ | 5261 | /* Disassociate this scroll bar from its window. */ |
| @@ -5357,19 +5353,19 @@ XTset_vertical_scroll_bar (w, portion, whole, position) | |||
| 5357 | 5353 | ||
| 5358 | BLOCK_INPUT; | 5354 | BLOCK_INPUT; |
| 5359 | 5355 | ||
| 5360 | if (sb_left != XINT (bar->left)) | 5356 | if (sb_left != bar->left) |
| 5361 | mask |= CWX; | 5357 | mask |= CWX; |
| 5362 | if (top != XINT (bar->top)) | 5358 | if (top != bar->top) |
| 5363 | mask |= CWY; | 5359 | mask |= CWY; |
| 5364 | if (sb_width != XINT (bar->width)) | 5360 | if (sb_width != bar->width) |
| 5365 | mask |= CWWidth; | 5361 | mask |= CWWidth; |
| 5366 | if (height != XINT (bar->height)) | 5362 | if (height != bar->height) |
| 5367 | mask |= CWHeight; | 5363 | mask |= CWHeight; |
| 5368 | 5364 | ||
| 5369 | #ifdef USE_TOOLKIT_SCROLL_BARS | 5365 | #ifdef USE_TOOLKIT_SCROLL_BARS |
| 5370 | 5366 | ||
| 5371 | /* Move/size the scroll bar widget. */ | 5367 | /* Move/size the scroll bar widget. */ |
| 5372 | if (mask || !NILP (bar->fringe_extended_p) != fringe_extended_p) | 5368 | if (mask || bar->fringe_extended_p != fringe_extended_p) |
| 5373 | { | 5369 | { |
| 5374 | /* Since toolkit scroll bars are smaller than the space reserved | 5370 | /* Since toolkit scroll bars are smaller than the space reserved |
| 5375 | for them on the frame, we have to clear "under" them. */ | 5371 | for them on the frame, we have to clear "under" them. */ |
| @@ -5384,7 +5380,7 @@ XTset_vertical_scroll_bar (w, portion, whole, position) | |||
| 5384 | } | 5380 | } |
| 5385 | #ifdef USE_GTK | 5381 | #ifdef USE_GTK |
| 5386 | xg_update_scrollbar_pos (f, | 5382 | xg_update_scrollbar_pos (f, |
| 5387 | SCROLL_BAR_X_WINDOW (bar), | 5383 | bar->x_window, |
| 5388 | top, | 5384 | top, |
| 5389 | sb_left + VERTICAL_SCROLL_BAR_WIDTH_TRIM, | 5385 | sb_left + VERTICAL_SCROLL_BAR_WIDTH_TRIM, |
| 5390 | sb_width - VERTICAL_SCROLL_BAR_WIDTH_TRIM *2, | 5386 | sb_width - VERTICAL_SCROLL_BAR_WIDTH_TRIM *2, |
| @@ -5440,23 +5436,23 @@ XTset_vertical_scroll_bar (w, portion, whole, position) | |||
| 5440 | wc.y = top; | 5436 | wc.y = top; |
| 5441 | wc.width = sb_width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2; | 5437 | wc.width = sb_width - VERTICAL_SCROLL_BAR_WIDTH_TRIM * 2; |
| 5442 | wc.height = height; | 5438 | wc.height = height; |
| 5443 | XConfigureWindow (FRAME_X_DISPLAY (f), SCROLL_BAR_X_WINDOW (bar), | 5439 | XConfigureWindow (FRAME_X_DISPLAY (f), bar->x_window, |
| 5444 | mask, &wc); | 5440 | mask, &wc); |
| 5445 | } | 5441 | } |
| 5446 | 5442 | ||
| 5447 | #endif /* not USE_TOOLKIT_SCROLL_BARS */ | 5443 | #endif /* not USE_TOOLKIT_SCROLL_BARS */ |
| 5448 | 5444 | ||
| 5449 | /* Remember new settings. */ | 5445 | /* Remember new settings. */ |
| 5450 | XSETINT (bar->left, sb_left); | 5446 | bar->left = sb_left; |
| 5451 | XSETINT (bar->top, top); | 5447 | bar->top = top; |
| 5452 | XSETINT (bar->width, sb_width); | 5448 | bar->width = sb_width; |
| 5453 | XSETINT (bar->height, height); | 5449 | bar->height = height; |
| 5454 | 5450 | ||
| 5455 | UNBLOCK_INPUT; | 5451 | UNBLOCK_INPUT; |
| 5456 | } | 5452 | } |
| 5457 | 5453 | ||
| 5458 | #ifdef USE_TOOLKIT_SCROLL_BARS | 5454 | #ifdef USE_TOOLKIT_SCROLL_BARS |
| 5459 | bar->fringe_extended_p = fringe_extended_p ? Qt : Qnil; | 5455 | bar->fringe_extended_p = fringe_extended_p; |
| 5460 | 5456 | ||
| 5461 | x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole); | 5457 | x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole); |
| 5462 | #else /* not USE_TOOLKIT_SCROLL_BARS */ | 5458 | #else /* not USE_TOOLKIT_SCROLL_BARS */ |
| @@ -5600,14 +5596,14 @@ x_scroll_bar_expose (bar, event) | |||
| 5600 | struct scroll_bar *bar; | 5596 | struct scroll_bar *bar; |
| 5601 | XEvent *event; | 5597 | XEvent *event; |
| 5602 | { | 5598 | { |
| 5603 | Window w = SCROLL_BAR_X_WINDOW (bar); | 5599 | Window w = bar->x_window; |
| 5604 | FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); | 5600 | FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); |
| 5605 | GC gc = f->output_data.x->normal_gc; | 5601 | GC gc = f->output_data.x->normal_gc; |
| 5606 | int width_trim = VERTICAL_SCROLL_BAR_WIDTH_TRIM; | 5602 | int width_trim = VERTICAL_SCROLL_BAR_WIDTH_TRIM; |
| 5607 | 5603 | ||
| 5608 | BLOCK_INPUT; | 5604 | BLOCK_INPUT; |
| 5609 | 5605 | ||
| 5610 | x_scroll_bar_set_handle (bar, XINT (bar->start), XINT (bar->end), 1); | 5606 | x_scroll_bar_set_handle (bar, bar->start, bar->end, 1); |
| 5611 | 5607 | ||
| 5612 | /* Switch to scroll bar foreground color. */ | 5608 | /* Switch to scroll bar foreground color. */ |
| 5613 | if (f->output_data.x->scroll_bar_foreground_pixel != -1) | 5609 | if (f->output_data.x->scroll_bar_foreground_pixel != -1) |
| @@ -5619,8 +5615,8 @@ x_scroll_bar_expose (bar, event) | |||
| 5619 | 5615 | ||
| 5620 | /* x, y, width, height */ | 5616 | /* x, y, width, height */ |
| 5621 | 0, 0, | 5617 | 0, 0, |
| 5622 | XINT (bar->width) - 1 - width_trim - width_trim, | 5618 | bar->width - 1 - width_trim - width_trim, |
| 5623 | XINT (bar->height) - 1); | 5619 | bar->height - 1); |
| 5624 | 5620 | ||
| 5625 | /* Restore the foreground color of the GC if we changed it above. */ | 5621 | /* Restore the foreground color of the GC if we changed it above. */ |
| 5626 | if (f->output_data.x->scroll_bar_foreground_pixel != -1) | 5622 | if (f->output_data.x->scroll_bar_foreground_pixel != -1) |
| @@ -5664,18 +5660,18 @@ x_scroll_bar_handle_click (bar, event, emacs_event) | |||
| 5664 | #if 0 | 5660 | #if 0 |
| 5665 | FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); | 5661 | FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); |
| 5666 | int internal_height | 5662 | int internal_height |
| 5667 | = VERTICAL_SCROLL_BAR_INSIDE_HEIGHT (f, XINT (bar->height)); | 5663 | = VERTICAL_SCROLL_BAR_INSIDE_HEIGHT (f, bar->height); |
| 5668 | #endif | 5664 | #endif |
| 5669 | int top_range | 5665 | int top_range |
| 5670 | = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height)); | 5666 | = VERTICAL_SCROLL_BAR_TOP_RANGE (f, bar->height); |
| 5671 | int y = event->xbutton.y - VERTICAL_SCROLL_BAR_TOP_BORDER; | 5667 | int y = event->xbutton.y - VERTICAL_SCROLL_BAR_TOP_BORDER; |
| 5672 | 5668 | ||
| 5673 | if (y < 0) y = 0; | 5669 | if (y < 0) y = 0; |
| 5674 | if (y > top_range) y = top_range; | 5670 | if (y > top_range) y = top_range; |
| 5675 | 5671 | ||
| 5676 | if (y < XINT (bar->start)) | 5672 | if (y < bar->start) |
| 5677 | emacs_event->part = scroll_bar_above_handle; | 5673 | emacs_event->part = scroll_bar_above_handle; |
| 5678 | else if (y < XINT (bar->end) + VERTICAL_SCROLL_BAR_MIN_HANDLE) | 5674 | else if (y < bar->end + VERTICAL_SCROLL_BAR_MIN_HANDLE) |
| 5679 | emacs_event->part = scroll_bar_handle; | 5675 | emacs_event->part = scroll_bar_handle; |
| 5680 | else | 5676 | else |
| 5681 | emacs_event->part = scroll_bar_below_handle; | 5677 | emacs_event->part = scroll_bar_below_handle; |
| @@ -5688,7 +5684,7 @@ x_scroll_bar_handle_click (bar, event, emacs_event) | |||
| 5688 | holding it. */ | 5684 | holding it. */ |
| 5689 | if (event->type == ButtonPress | 5685 | if (event->type == ButtonPress |
| 5690 | && emacs_event->part == scroll_bar_handle) | 5686 | && emacs_event->part == scroll_bar_handle) |
| 5691 | XSETINT (bar->dragging, y - XINT (bar->start)); | 5687 | XSETINT (bar->dragging, y - bar->start); |
| 5692 | #endif | 5688 | #endif |
| 5693 | 5689 | ||
| 5694 | #ifndef USE_TOOLKIT_SCROLL_BARS | 5690 | #ifndef USE_TOOLKIT_SCROLL_BARS |
| @@ -5697,7 +5693,7 @@ x_scroll_bar_handle_click (bar, event, emacs_event) | |||
| 5697 | && ! NILP (bar->dragging)) | 5693 | && ! NILP (bar->dragging)) |
| 5698 | { | 5694 | { |
| 5699 | int new_start = y - XINT (bar->dragging); | 5695 | int new_start = y - XINT (bar->dragging); |
| 5700 | int new_end = new_start + (XINT (bar->end) - XINT (bar->start)); | 5696 | int new_end = new_start + bar->end - bar->start; |
| 5701 | 5697 | ||
| 5702 | x_scroll_bar_set_handle (bar, new_start, new_end, 0); | 5698 | x_scroll_bar_set_handle (bar, new_start, new_end, 0); |
| 5703 | bar->dragging = Qnil; | 5699 | bar->dragging = Qnil; |
| @@ -5745,9 +5741,9 @@ x_scroll_bar_note_movement (bar, event) | |||
| 5745 | /* Where should the handle be now? */ | 5741 | /* Where should the handle be now? */ |
| 5746 | int new_start = event->xmotion.y - XINT (bar->dragging); | 5742 | int new_start = event->xmotion.y - XINT (bar->dragging); |
| 5747 | 5743 | ||
| 5748 | if (new_start != XINT (bar->start)) | 5744 | if (new_start != bar->start) |
| 5749 | { | 5745 | { |
| 5750 | int new_end = new_start + (XINT (bar->end) - XINT (bar->start)); | 5746 | int new_end = new_start + bar->end - bar->start; |
| 5751 | 5747 | ||
| 5752 | x_scroll_bar_set_handle (bar, new_start, new_end, 0); | 5748 | x_scroll_bar_set_handle (bar, new_start, new_end, 0); |
| 5753 | } | 5749 | } |
| @@ -5768,7 +5764,7 @@ x_scroll_bar_report_motion (fp, bar_window, part, x, y, time) | |||
| 5768 | unsigned long *time; | 5764 | unsigned long *time; |
| 5769 | { | 5765 | { |
| 5770 | struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar); | 5766 | struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar); |
| 5771 | Window w = SCROLL_BAR_X_WINDOW (bar); | 5767 | Window w = bar->x_window; |
| 5772 | FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); | 5768 | FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); |
| 5773 | int win_x, win_y; | 5769 | int win_x, win_y; |
| 5774 | Window dummy_window; | 5770 | Window dummy_window; |
| @@ -5795,10 +5791,10 @@ x_scroll_bar_report_motion (fp, bar_window, part, x, y, time) | |||
| 5795 | { | 5791 | { |
| 5796 | #if 0 | 5792 | #if 0 |
| 5797 | int inside_height | 5793 | int inside_height |
| 5798 | = VERTICAL_SCROLL_BAR_INSIDE_HEIGHT (f, XINT (bar->height)); | 5794 | = VERTICAL_SCROLL_BAR_INSIDE_HEIGHT (f, bar->height); |
| 5799 | #endif | 5795 | #endif |
| 5800 | int top_range | 5796 | int top_range |
| 5801 | = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height)); | 5797 | = VERTICAL_SCROLL_BAR_TOP_RANGE (f, bar->height); |
| 5802 | 5798 | ||
| 5803 | win_y -= VERTICAL_SCROLL_BAR_TOP_BORDER; | 5799 | win_y -= VERTICAL_SCROLL_BAR_TOP_BORDER; |
| 5804 | 5800 | ||
| @@ -5815,9 +5811,9 @@ x_scroll_bar_report_motion (fp, bar_window, part, x, y, time) | |||
| 5815 | 5811 | ||
| 5816 | if (! NILP (bar->dragging)) | 5812 | if (! NILP (bar->dragging)) |
| 5817 | *part = scroll_bar_handle; | 5813 | *part = scroll_bar_handle; |
| 5818 | else if (win_y < XINT (bar->start)) | 5814 | else if (win_y < bar->start) |
| 5819 | *part = scroll_bar_above_handle; | 5815 | *part = scroll_bar_above_handle; |
| 5820 | else if (win_y < XINT (bar->end) + VERTICAL_SCROLL_BAR_MIN_HANDLE) | 5816 | else if (win_y < bar->end + VERTICAL_SCROLL_BAR_MIN_HANDLE) |
| 5821 | *part = scroll_bar_handle; | 5817 | *part = scroll_bar_handle; |
| 5822 | else | 5818 | else |
| 5823 | *part = scroll_bar_below_handle; | 5819 | *part = scroll_bar_below_handle; |
| @@ -5854,7 +5850,7 @@ x_scroll_bar_clear (f) | |||
| 5854 | for (bar = FRAME_SCROLL_BARS (f); VECTORP (bar); | 5850 | for (bar = FRAME_SCROLL_BARS (f); VECTORP (bar); |
| 5855 | bar = XSCROLL_BAR (bar)->next) | 5851 | bar = XSCROLL_BAR (bar)->next) |
| 5856 | XClearArea (FRAME_X_DISPLAY (f), | 5852 | XClearArea (FRAME_X_DISPLAY (f), |
| 5857 | SCROLL_BAR_X_WINDOW (XSCROLL_BAR (bar)), | 5853 | XSCROLL_BAR (bar)->x_window, |
| 5858 | 0, 0, 0, 0, True); | 5854 | 0, 0, 0, 0, True); |
| 5859 | #endif /* not USE_TOOLKIT_SCROLL_BARS */ | 5855 | #endif /* not USE_TOOLKIT_SCROLL_BARS */ |
| 5860 | } | 5856 | } |
| @@ -7065,12 +7061,10 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit) | |||
| 7065 | 7061 | ||
| 7066 | if (tool_bar_p && event.xbutton.button < 4) | 7062 | if (tool_bar_p && event.xbutton.button < 4) |
| 7067 | { | 7063 | { |
| 7068 | if (event.xbutton.type == ButtonPress) | 7064 | handle_tool_bar_click (f, x, y, |
| 7069 | handle_tool_bar_click (f, x, y, 1, 0); | 7065 | event.xbutton.type == ButtonPress, |
| 7070 | else | 7066 | x_x_to_emacs_modifiers (dpyinfo, |
| 7071 | handle_tool_bar_click (f, x, y, 0, | 7067 | event.xbutton.state)); |
| 7072 | x_x_to_emacs_modifiers (dpyinfo, | ||
| 7073 | event.xbutton.state)); | ||
| 7074 | } | 7068 | } |
| 7075 | } | 7069 | } |
| 7076 | 7070 | ||
| @@ -8072,7 +8066,7 @@ x_connection_closed (dpy, error_message) | |||
| 8072 | 8066 | ||
| 8073 | Closing the display is reported to lead to a bus error on | 8067 | Closing the display is reported to lead to a bus error on |
| 8074 | OpenWindows in certain situations. I suspect that is a bug | 8068 | OpenWindows in certain situations. I suspect that is a bug |
| 8075 | in OpenWindows. I don't know how to cicumvent it here. */ | 8069 | in OpenWindows. I don't know how to circumvent it here. */ |
| 8076 | 8070 | ||
| 8077 | #ifdef USE_X_TOOLKIT | 8071 | #ifdef USE_X_TOOLKIT |
| 8078 | /* If DPYINFO is null, this means we didn't open the display | 8072 | /* If DPYINFO is null, this means we didn't open the display |
| @@ -8123,6 +8117,10 @@ x_connection_closed (dpy, error_message) | |||
| 8123 | 8117 | ||
| 8124 | unbind_to (index, Qnil); | 8118 | unbind_to (index, Qnil); |
| 8125 | clear_waiting_for_input (); | 8119 | clear_waiting_for_input (); |
| 8120 | /* FIXME: This is an asynchronous interrupt w.r.t elisp, so signalling an | ||
| 8121 | error might not be the best thing to do. I'd vote for creating an | ||
| 8122 | elisp event and stuffing it in the queue so people can bind to it via | ||
| 8123 | the global map. --Stef */ | ||
| 8126 | error ("%s", error_msg); | 8124 | error ("%s", error_msg); |
| 8127 | } | 8125 | } |
| 8128 | 8126 | ||
| @@ -8726,7 +8724,7 @@ x_set_offset (f, xoff, yoff, change_gravity) | |||
| 8726 | on the root window for frame F contains ATOMNAME. | 8724 | on the root window for frame F contains ATOMNAME. |
| 8727 | This is how a WM check shall be done according to the Window Manager | 8725 | This is how a WM check shall be done according to the Window Manager |
| 8728 | Specification/Extended Window Manager Hints at | 8726 | Specification/Extended Window Manager Hints at |
| 8729 | http://freedesktop.org/wiki/Standards_2fwm_2dspec. */ | 8727 | http://freedesktop.org/wiki/Specifications/wm-spec. */ |
| 8730 | 8728 | ||
| 8731 | static int | 8729 | static int |
| 8732 | wm_supports (f, atomname) | 8730 | wm_supports (f, atomname) |
| @@ -9259,7 +9257,7 @@ x_ewmh_activate_frame (f) | |||
| 9259 | FRAME_PTR f; | 9257 | FRAME_PTR f; |
| 9260 | { | 9258 | { |
| 9261 | /* See Window Manager Specification/Extended Window Manager Hints at | 9259 | /* See Window Manager Specification/Extended Window Manager Hints at |
| 9262 | http://freedesktop.org/wiki/Standards_2fwm_2dspec */ | 9260 | http://freedesktop.org/wiki/Specifications/wm-spec */ |
| 9263 | 9261 | ||
| 9264 | const char *atom = "_NET_ACTIVE_WINDOW"; | 9262 | const char *atom = "_NET_ACTIVE_WINDOW"; |
| 9265 | if (f->async_visible && wm_supports (f, atom)) | 9263 | if (f->async_visible && wm_supports (f, atom)) |
| @@ -11329,8 +11327,8 @@ x_term_init (display_name, xrm_option, resource_name) | |||
| 11329 | /* Mac OS X 10.3's Xserver sometimes reports 0.0mm. */ | 11327 | /* Mac OS X 10.3's Xserver sometimes reports 0.0mm. */ |
| 11330 | dpyinfo->resy = (mm < 1) ? 100 : pixels * 25.4 / mm; | 11328 | dpyinfo->resy = (mm < 1) ? 100 : pixels * 25.4 / mm; |
| 11331 | pixels = DisplayWidth (dpyinfo->display, screen_number); | 11329 | pixels = DisplayWidth (dpyinfo->display, screen_number); |
| 11332 | /* Mac OS X 10.3's Xserver sometimes reports 0.0mm. */ | ||
| 11333 | mm = DisplayWidthMM (dpyinfo->display, screen_number); | 11330 | mm = DisplayWidthMM (dpyinfo->display, screen_number); |
| 11331 | /* Mac OS X 10.3's Xserver sometimes reports 0.0mm. */ | ||
| 11334 | dpyinfo->resx = (mm < 1) ? 100 : pixels * 25.4 / mm; | 11332 | dpyinfo->resx = (mm < 1) ? 100 : pixels * 25.4 / mm; |
| 11335 | } | 11333 | } |
| 11336 | 11334 | ||
| @@ -11499,13 +11497,13 @@ x_term_init (display_name, xrm_option, resource_name) | |||
| 11499 | Qnil, Qnil); | 11497 | Qnil, Qnil); |
| 11500 | #ifdef USE_XIM | 11498 | #ifdef USE_XIM |
| 11501 | if (STRINGP (value) | 11499 | if (STRINGP (value) |
| 11502 | && (!strcmp (XSTRING (value)->data, "false") | 11500 | && (!strcmp (SDATA (value), "false") |
| 11503 | || !strcmp (XSTRING (value)->data, "off"))) | 11501 | || !strcmp (SDATA (value), "off"))) |
| 11504 | use_xim = 0; | 11502 | use_xim = 0; |
| 11505 | #else | 11503 | #else |
| 11506 | if (STRINGP (value) | 11504 | if (STRINGP (value) |
| 11507 | && (!strcmp (XSTRING (value)->data, "true") | 11505 | && (!strcmp (SDATA (value), "true") |
| 11508 | || !strcmp (XSTRING (value)->data, "on"))) | 11506 | || !strcmp (SDATA (value), "on"))) |
| 11509 | use_xim = 1; | 11507 | use_xim = 1; |
| 11510 | #endif | 11508 | #endif |
| 11511 | } | 11509 | } |