Mercurial > emacs
comparison src/xterm.c @ 25716:e2d5cd96727b
(x_scroll_bar_handle_click): Compile only if
not USE_TOOLKIT_SCROLL_BARS.
(x_scroll_bar_set_handle, x_scroll_bar_note_movement): Ditto.
(x_produce_glyphs): Remove unused variable(s).
(x_alloc_nearest_color_for_widget, note_tool_bar_highlight,
x_set_toolkit_scroll_bar_thumb): Ditto.
(x_scroll_bar_create): Move local variable to the
conditionally compiled section of code where it is used.
(x_scroll_bar_create): Remove unused variable(s).
(x_scroll_bar_remove, XTread_socket): Ditto.
(XTread_socket) <ConfigureNotify>: Move variables used for
non-toolkit case into conditionally compiled section of code.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Tue, 14 Sep 1999 13:09:49 +0000 |
parents | 121bd925411f |
children | 84921c27b2b5 |
comparison
equal
deleted
inserted
replaced
25715:feaedc03dbc8 | 25716:e2d5cd96727b |
---|---|
1098 static void x_encode_char P_ ((int, XChar2b *, struct font_info *)); | 1098 static void x_encode_char P_ ((int, XChar2b *, struct font_info *)); |
1099 static void x_append_glyph P_ ((struct it *)); | 1099 static void x_append_glyph P_ ((struct it *)); |
1100 static void x_append_stretch_glyph P_ ((struct it *it, Lisp_Object, | 1100 static void x_append_stretch_glyph P_ ((struct it *it, Lisp_Object, |
1101 int, int, double)); | 1101 int, int, double)); |
1102 static void x_produce_glyphs P_ ((struct it *)); | 1102 static void x_produce_glyphs P_ ((struct it *)); |
1103 static void x_produce_special_glyphs P_ ((struct it *, enum display_element_type)); | |
1104 static void x_produce_image_glyph P_ ((struct it *it)); | 1103 static void x_produce_image_glyph P_ ((struct it *it)); |
1105 | 1104 |
1106 | 1105 |
1107 /* Return a pointer to per-char metric information in FONT of a | 1106 /* Return a pointer to per-char metric information in FONT of a |
1108 character pointed by B which is a pointer to an XChar2b. */ | 1107 character pointed by B which is a pointer to an XChar2b. */ |
1724 { | 1723 { |
1725 XChar2b char2b; | 1724 XChar2b char2b; |
1726 XFontStruct *font; | 1725 XFontStruct *font; |
1727 struct face *face; | 1726 struct face *face; |
1728 XCharStruct *pcm; | 1727 XCharStruct *pcm; |
1729 struct it ci; | |
1730 int font_not_found_p; | 1728 int font_not_found_p; |
1731 int c; | |
1732 | 1729 |
1733 /* Maybe translate single-byte characters to multibyte. */ | 1730 /* Maybe translate single-byte characters to multibyte. */ |
1734 it->char_to_display = it->c; | 1731 it->char_to_display = it->c; |
1735 if (unibyte_display_via_language_environment | 1732 if (unibyte_display_via_language_environment |
1736 && SINGLE_BYTE_CHAR_P (it->c) | 1733 && SINGLE_BYTE_CHAR_P (it->c) |
2094 | 2091 |
2095 struct glyph_string *next, *prev; | 2092 struct glyph_string *next, *prev; |
2096 }; | 2093 }; |
2097 | 2094 |
2098 | 2095 |
2099 #if GLYPH_DEBUG | 2096 #if 0 |
2100 | 2097 |
2101 static void | 2098 static void |
2102 x_dump_glyph_string (s) | 2099 x_dump_glyph_string (s) |
2103 struct glyph_string *s; | 2100 struct glyph_string *s; |
2104 { | 2101 { |
2148 static void x_set_glyph_string_clipping P_ ((struct glyph_string *)); | 2145 static void x_set_glyph_string_clipping P_ ((struct glyph_string *)); |
2149 static void x_set_glyph_string_gc P_ ((struct glyph_string *)); | 2146 static void x_set_glyph_string_gc P_ ((struct glyph_string *)); |
2150 static void x_draw_glyph_string_background P_ ((struct glyph_string *, | 2147 static void x_draw_glyph_string_background P_ ((struct glyph_string *, |
2151 int)); | 2148 int)); |
2152 static void x_draw_glyph_string_foreground P_ ((struct glyph_string *)); | 2149 static void x_draw_glyph_string_foreground P_ ((struct glyph_string *)); |
2153 static void x_draw_glyph_string_underline P_ ((struct glyph_string *)); | |
2154 static void x_draw_glyph_string_box P_ ((struct glyph_string *)); | 2150 static void x_draw_glyph_string_box P_ ((struct glyph_string *)); |
2155 static void x_draw_glyph_string P_ ((struct glyph_string *)); | 2151 static void x_draw_glyph_string P_ ((struct glyph_string *)); |
2156 static void x_compute_glyph_string_overhangs P_ ((struct glyph_string *)); | 2152 static void x_compute_glyph_string_overhangs P_ ((struct glyph_string *)); |
2157 static void x_set_cursor_gc P_ ((struct glyph_string *)); | 2153 static void x_set_cursor_gc P_ ((struct glyph_string *)); |
2158 static void x_set_mode_line_face_gc P_ ((struct glyph_string *)); | 2154 static void x_set_mode_line_face_gc P_ ((struct glyph_string *)); |
2955 Colormap cmap; | 2951 Colormap cmap; |
2956 XColor *color; | 2952 XColor *color; |
2957 { | 2953 { |
2958 struct frame *f; | 2954 struct frame *f; |
2959 struct x_display_info *dpyinfo; | 2955 struct x_display_info *dpyinfo; |
2960 Lisp_Object tail, frame; | 2956 Lisp_Object tail; |
2961 Widget parent; | |
2962 | 2957 |
2963 dpyinfo = x_display_info_for_display (XtDisplay (widget)); | 2958 dpyinfo = x_display_info_for_display (XtDisplay (widget)); |
2964 | 2959 |
2965 /* Find the top-level shell of the widget. Note that this function | 2960 /* Find the top-level shell of the widget. Note that this function |
2966 can be called when the widget is not yet realized, so XtWindow | 2961 can be called when the widget is not yet realized, so XtWindow |
6503 struct window *w = XWINDOW (window); | 6498 struct window *w = XWINDOW (window); |
6504 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); | 6499 struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f); |
6505 int hpos, vpos; | 6500 int hpos, vpos; |
6506 struct glyph *glyph; | 6501 struct glyph *glyph; |
6507 struct glyph_row *row; | 6502 struct glyph_row *row; |
6508 int i, j, area; | 6503 int i; |
6509 Lisp_Object enabled_p; | 6504 Lisp_Object enabled_p; |
6510 int prop_idx; | 6505 int prop_idx; |
6511 enum draw_glyphs_face draw = DRAW_IMAGE_RAISED; | 6506 enum draw_glyphs_face draw = DRAW_IMAGE_RAISED; |
6512 int on_highlight_p, mouse_down_p, rc; | 6507 int mouse_down_p, rc; |
6513 | 6508 |
6514 /* Function note_mouse_highlight is called with negative x(y | 6509 /* Function note_mouse_highlight is called with negative x(y |
6515 values when mouse moves outside of the frame. */ | 6510 values when mouse moves outside of the frame. */ |
6516 if (x <= 0 || y <= 0) | 6511 if (x <= 0 || y <= 0) |
6517 { | 6512 { |
7555 x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole) | 7550 x_set_toolkit_scroll_bar_thumb (bar, portion, position, whole) |
7556 struct scroll_bar *bar; | 7551 struct scroll_bar *bar; |
7557 int portion, position, whole; | 7552 int portion, position, whole; |
7558 { | 7553 { |
7559 float top, shown; | 7554 float top, shown; |
7560 Arg av[2]; | |
7561 Widget widget = SCROLL_BAR_X_WIDGET (bar); | 7555 Widget widget = SCROLL_BAR_X_WIDGET (bar); |
7562 | 7556 |
7563 if (whole == 0) | 7557 if (whole == 0) |
7564 top = 0, shown = 1; | 7558 top = 0, shown = 1; |
7565 else | 7559 else |
7683 x_scroll_bar_create (w, top, left, width, height) | 7677 x_scroll_bar_create (w, top, left, width, height) |
7684 struct window *w; | 7678 struct window *w; |
7685 int top, left, width, height; | 7679 int top, left, width, height; |
7686 { | 7680 { |
7687 struct frame *f = XFRAME (w->frame); | 7681 struct frame *f = XFRAME (w->frame); |
7688 #ifdef USE_X_TOOLKIT | |
7689 Arg av[10]; | |
7690 #endif | |
7691 int ac = 0; | |
7692 Window window; | |
7693 struct scroll_bar *bar | 7682 struct scroll_bar *bar |
7694 = XSCROLL_BAR (Fmake_vector (make_number (SCROLL_BAR_VEC_SIZE), Qnil)); | 7683 = XSCROLL_BAR (Fmake_vector (make_number (SCROLL_BAR_VEC_SIZE), Qnil)); |
7695 | 7684 |
7696 BLOCK_INPUT; | 7685 BLOCK_INPUT; |
7697 | 7686 |
7699 x_create_toolkit_scroll_bar (f, bar); | 7688 x_create_toolkit_scroll_bar (f, bar); |
7700 #else /* not USE_TOOLKIT_SCROLL_BARS */ | 7689 #else /* not USE_TOOLKIT_SCROLL_BARS */ |
7701 { | 7690 { |
7702 XSetWindowAttributes a; | 7691 XSetWindowAttributes a; |
7703 unsigned long mask; | 7692 unsigned long mask; |
7693 Window window; | |
7704 | 7694 |
7705 a.background_pixel = f->output_data.x->scroll_bar_background_pixel; | 7695 a.background_pixel = f->output_data.x->scroll_bar_background_pixel; |
7706 if (a.background_pixel == -1) | 7696 if (a.background_pixel == -1) |
7707 a.background_pixel = f->output_data.x->background_pixel; | 7697 a.background_pixel = f->output_data.x->background_pixel; |
7708 | 7698 |
7781 fit inside its rectangle, but if the user is dragging the scroll | 7771 fit inside its rectangle, but if the user is dragging the scroll |
7782 bar handle, we want to let them drag it down all the way, so that | 7772 bar handle, we want to let them drag it down all the way, so that |
7783 the bar's top is as far down as it goes; otherwise, there's no way | 7773 the bar's top is as far down as it goes; otherwise, there's no way |
7784 to move to the very end of the buffer. */ | 7774 to move to the very end of the buffer. */ |
7785 | 7775 |
7776 #ifndef USE_TOOLKIT_SCROLL_BARS | |
7777 | |
7786 static void | 7778 static void |
7787 x_scroll_bar_set_handle (bar, start, end, rebuild) | 7779 x_scroll_bar_set_handle (bar, start, end, rebuild) |
7788 struct scroll_bar *bar; | 7780 struct scroll_bar *bar; |
7789 int start, end; | 7781 int start, end; |
7790 int rebuild; | 7782 int rebuild; |
7791 { | 7783 { |
7792 #ifndef USE_TOOLKIT_SCROLL_BARS | |
7793 int dragging = ! NILP (bar->dragging); | 7784 int dragging = ! NILP (bar->dragging); |
7794 Window w = SCROLL_BAR_X_WINDOW (bar); | 7785 Window w = SCROLL_BAR_X_WINDOW (bar); |
7795 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); | 7786 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); |
7796 GC gc = f->output_data.x->normal_gc; | 7787 GC gc = f->output_data.x->normal_gc; |
7797 | 7788 |
7879 False); | 7870 False); |
7880 | 7871 |
7881 } | 7872 } |
7882 | 7873 |
7883 UNBLOCK_INPUT; | 7874 UNBLOCK_INPUT; |
7884 #endif /* not USE_TOOLKIT_SCROLL_BARS */ | 7875 } |
7885 } | 7876 |
7886 | 7877 #endif /* !USE_TOOLKIT_SCROLL_BARS */ |
7887 | 7878 |
7888 /* Destroy scroll bar BAR, and set its Emacs window's scroll bar to | 7879 /* Destroy scroll bar BAR, and set its Emacs window's scroll bar to |
7889 nil. */ | 7880 nil. */ |
7890 | 7881 |
7891 static void | 7882 static void |
7892 x_scroll_bar_remove (bar) | 7883 x_scroll_bar_remove (bar) |
7893 struct scroll_bar *bar; | 7884 struct scroll_bar *bar; |
7894 { | 7885 { |
7895 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); | |
7896 | |
7897 BLOCK_INPUT; | 7886 BLOCK_INPUT; |
7898 | 7887 |
7899 #if USE_TOOLKIT_SCROLL_BARS | 7888 #if USE_TOOLKIT_SCROLL_BARS |
7900 XtDestroyWidget (SCROLL_BAR_X_WIDGET (bar)); | 7889 XtDestroyWidget (SCROLL_BAR_X_WIDGET (bar)); |
7901 #else /* not USE_TOOLKIT_SCROLL_BARS */ | 7890 #else /* not USE_TOOLKIT_SCROLL_BARS */ |
7902 XDestroyWindow (FRAME_X_DISPLAY (f), SCROLL_BAR_X_WINDOW (bar)); | 7891 { |
7892 FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); | |
7893 XDestroyWindow (FRAME_X_DISPLAY (f), SCROLL_BAR_X_WINDOW (bar)); | |
7894 } | |
7903 #endif /* not USE_TOOLKIT_SCROLL_BARS */ | 7895 #endif /* not USE_TOOLKIT_SCROLL_BARS */ |
7904 | 7896 |
7905 /* Disassociate this scroll bar from its window. */ | 7897 /* Disassociate this scroll bar from its window. */ |
7906 XWINDOW (bar->window)->vertical_scroll_bar = Qnil; | 7898 XWINDOW (bar->window)->vertical_scroll_bar = Qnil; |
7907 | 7899 |
8211 is set to something other than no_event, it is enqueued. | 8203 is set to something other than no_event, it is enqueued. |
8212 | 8204 |
8213 This may be called from a signal handler, so we have to ignore GC | 8205 This may be called from a signal handler, so we have to ignore GC |
8214 mark bits. */ | 8206 mark bits. */ |
8215 | 8207 |
8208 #ifndef USE_TOOLKIT_SCROLL_BARS | |
8209 | |
8216 static void | 8210 static void |
8217 x_scroll_bar_handle_click (bar, event, emacs_event) | 8211 x_scroll_bar_handle_click (bar, event, emacs_event) |
8218 struct scroll_bar *bar; | 8212 struct scroll_bar *bar; |
8219 XEvent *event; | 8213 XEvent *event; |
8220 struct input_event *emacs_event; | 8214 struct input_event *emacs_event; |
8320 | 8314 |
8321 x_scroll_bar_set_handle (bar, new_start, new_end, 0); | 8315 x_scroll_bar_set_handle (bar, new_start, new_end, 0); |
8322 } | 8316 } |
8323 } | 8317 } |
8324 } | 8318 } |
8319 | |
8320 #endif /* !USE_TOOLKIT_SCROLL_BARS */ | |
8325 | 8321 |
8326 /* Return information to the user about the current position of the mouse | 8322 /* Return information to the user about the current position of the mouse |
8327 on the scroll bar. */ | 8323 on the scroll bar. */ |
8328 | 8324 |
8329 static void | 8325 static void |
8831 { | 8827 { |
8832 /* Ghostview job completed. Kill it. We could | 8828 /* Ghostview job completed. Kill it. We could |
8833 reply with "Next" if we received "Page", but we | 8829 reply with "Next" if we received "Page", but we |
8834 currently never do because we are interested in | 8830 currently never do because we are interested in |
8835 images, only, which should have 1 page. */ | 8831 images, only, which should have 1 page. */ |
8836 Window gs_window = (Window) event.xclient.data.l[0]; | |
8837 Pixmap pixmap = (Pixmap) event.xclient.data.l[1]; | 8832 Pixmap pixmap = (Pixmap) event.xclient.data.l[1]; |
8838 struct frame *f | 8833 struct frame *f |
8839 = x_window_to_frame (dpyinfo, event.xclient.window); | 8834 = x_window_to_frame (dpyinfo, event.xclient.window); |
8840 x_kill_gs_process (pixmap, f); | 8835 x_kill_gs_process (pixmap, f); |
8841 expose_frame (f, 0, 0, 0, 0); | 8836 expose_frame (f, 0, 0, 0, 0); |
9465 | 9460 |
9466 case ConfigureNotify: | 9461 case ConfigureNotify: |
9467 f = x_top_window_to_frame (dpyinfo, event.xconfigure.window); | 9462 f = x_top_window_to_frame (dpyinfo, event.xconfigure.window); |
9468 if (f) | 9463 if (f) |
9469 { | 9464 { |
9465 #ifndef USE_X_TOOLKIT | |
9470 int rows = PIXEL_TO_CHAR_HEIGHT (f, event.xconfigure.height); | 9466 int rows = PIXEL_TO_CHAR_HEIGHT (f, event.xconfigure.height); |
9471 int columns = PIXEL_TO_CHAR_WIDTH (f, event.xconfigure.width); | 9467 int columns = PIXEL_TO_CHAR_WIDTH (f, event.xconfigure.width); |
9472 | 9468 |
9473 #ifndef USE_X_TOOLKIT | |
9474 /* In the toolkit version, change_frame_size | 9469 /* In the toolkit version, change_frame_size |
9475 is called by the code that handles resizing | 9470 is called by the code that handles resizing |
9476 of the EmacsFrame widget. */ | 9471 of the EmacsFrame widget. */ |
9477 | 9472 |
9478 /* Even if the number of character rows and columns has | 9473 /* Even if the number of character rows and columns has |