diff options
| author | Paul Eggert | 2011-03-09 01:12:38 -0800 |
|---|---|---|
| committer | Paul Eggert | 2011-03-09 01:12:38 -0800 |
| commit | a6067996d8aa14819a0cdfdb8596b3252f9f2caa (patch) | |
| tree | 04b61b832ca6ca2d4b1aaeda443424bab492f99f | |
| parent | 38d0b34afe4dedd8c80a25af2cd84d488733b6aa (diff) | |
| download | emacs-a6067996d8aa14819a0cdfdb8596b3252f9f2caa.tar.gz emacs-a6067996d8aa14819a0cdfdb8596b3252f9f2caa.zip | |
* xterm.c: (x_draw_image_foreground, redo_mouse_highlight, XTmouse_position):
(x_scroll_bar_report_motion, handle_one_xevent, x_draw_bar_cursor):
(x_error_catcher, x_connection_closed, x_error_handler):
(x_error_quitter, xembed_send_message, x_iconify_frame):
(my_log_handler): Rename locals to avoid shadowing.
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/xterm.c | 99 |
2 files changed, 58 insertions, 46 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index cdabea5fcd2..2dc9d34f290 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -12,6 +12,11 @@ | |||
| 12 | unless they are used. | 12 | unless they are used. |
| 13 | (XEMBED_VERSION, xembed_set_info): Don't define unless needed. | 13 | (XEMBED_VERSION, xembed_set_info): Don't define unless needed. |
| 14 | (x_fatal_error_signal): Remove; not used. | 14 | (x_fatal_error_signal): Remove; not used. |
| 15 | (x_draw_image_foreground, redo_mouse_highlight, XTmouse_position): | ||
| 16 | (x_scroll_bar_report_motion, handle_one_xevent, x_draw_bar_cursor): | ||
| 17 | (x_error_catcher, x_connection_closed, x_error_handler): | ||
| 18 | (x_error_quitter, xembed_send_message, x_iconify_frame): | ||
| 19 | (my_log_handler): Rename locals to avoid shadowing. | ||
| 15 | 20 | ||
| 16 | * xfaces.c (clear_face_cache, Fx_list_fonts, Fface_font): Rename | 21 | * xfaces.c (clear_face_cache, Fx_list_fonts, Fface_font): Rename |
| 17 | or move locals to avoid shadowing. | 22 | or move locals to avoid shadowing. |
diff --git a/src/xterm.c b/src/xterm.c index e64ab270929..c542f0d9f29 100644 --- a/src/xterm.c +++ b/src/xterm.c | |||
| @@ -2235,12 +2235,12 @@ x_draw_image_foreground (struct glyph_string *s) | |||
| 2235 | nothing here for mouse-face. */ | 2235 | nothing here for mouse-face. */ |
| 2236 | if (s->hl == DRAW_CURSOR) | 2236 | if (s->hl == DRAW_CURSOR) |
| 2237 | { | 2237 | { |
| 2238 | int r = s->img->relief; | 2238 | int relief = s->img->relief; |
| 2239 | if (r < 0) r = -r; | 2239 | if (relief < 0) relief = -relief; |
| 2240 | XDrawRectangle (s->display, s->window, s->gc, | 2240 | XDrawRectangle (s->display, s->window, s->gc, |
| 2241 | x - r, y - r, | 2241 | x - relief, y - relief, |
| 2242 | s->slice.width + r*2 - 1, | 2242 | s->slice.width + relief*2 - 1, |
| 2243 | s->slice.height + r*2 - 1); | 2243 | s->slice.height + relief*2 - 1); |
| 2244 | } | 2244 | } |
| 2245 | } | 2245 | } |
| 2246 | } | 2246 | } |
| @@ -3775,7 +3775,7 @@ redo_mouse_highlight (void) | |||
| 3775 | mouse is on, *BAR_WINDOW to nil, and *X and *Y to the character cell | 3775 | mouse is on, *BAR_WINDOW to nil, and *X and *Y to the character cell |
| 3776 | the mouse is over. | 3776 | the mouse is over. |
| 3777 | 3777 | ||
| 3778 | Set *TIME to the server time-stamp for the time at which the mouse | 3778 | Set *TIMESTAMP to the server time-stamp for the time at which the mouse |
| 3779 | was at this position. | 3779 | was at this position. |
| 3780 | 3780 | ||
| 3781 | Don't store anything if we don't have a valid set of values to report. | 3781 | Don't store anything if we don't have a valid set of values to report. |
| @@ -3784,14 +3784,16 @@ redo_mouse_highlight (void) | |||
| 3784 | movement. */ | 3784 | movement. */ |
| 3785 | 3785 | ||
| 3786 | static void | 3786 | static void |
| 3787 | XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, long unsigned int *time) | 3787 | XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, |
| 3788 | enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, | ||
| 3789 | long unsigned int *timestamp) | ||
| 3788 | { | 3790 | { |
| 3789 | FRAME_PTR f1; | 3791 | FRAME_PTR f1; |
| 3790 | 3792 | ||
| 3791 | BLOCK_INPUT; | 3793 | BLOCK_INPUT; |
| 3792 | 3794 | ||
| 3793 | if (! NILP (last_mouse_scroll_bar) && insist == 0) | 3795 | if (! NILP (last_mouse_scroll_bar) && insist == 0) |
| 3794 | x_scroll_bar_report_motion (fp, bar_window, part, x, y, time); | 3796 | x_scroll_bar_report_motion (fp, bar_window, part, x, y, timestamp); |
| 3795 | else | 3797 | else |
| 3796 | { | 3798 | { |
| 3797 | Window root; | 3799 | Window root; |
| @@ -3964,7 +3966,7 @@ XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, enum scrol | |||
| 3964 | *fp = f1; | 3966 | *fp = f1; |
| 3965 | XSETINT (*x, win_x); | 3967 | XSETINT (*x, win_x); |
| 3966 | XSETINT (*y, win_y); | 3968 | XSETINT (*y, win_y); |
| 3967 | *time = last_mouse_movement_time; | 3969 | *timestamp = last_mouse_movement_time; |
| 3968 | } | 3970 | } |
| 3969 | } | 3971 | } |
| 3970 | } | 3972 | } |
| @@ -5516,7 +5518,9 @@ x_scroll_bar_note_movement (struct scroll_bar *bar, XEvent *event) | |||
| 5516 | on the scroll bar. */ | 5518 | on the scroll bar. */ |
| 5517 | 5519 | ||
| 5518 | static void | 5520 | static void |
| 5519 | x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, enum scroll_bar_part *part, Lisp_Object *x, Lisp_Object *y, long unsigned int *time) | 5521 | x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, |
| 5522 | enum scroll_bar_part *part, Lisp_Object *x, | ||
| 5523 | Lisp_Object *y, long unsigned int *timestamp) | ||
| 5520 | { | 5524 | { |
| 5521 | struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar); | 5525 | struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar); |
| 5522 | Window w = bar->x_window; | 5526 | Window w = bar->x_window; |
| @@ -5576,7 +5580,7 @@ x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, enum scroll_ | |||
| 5576 | last_mouse_scroll_bar = Qnil; | 5580 | last_mouse_scroll_bar = Qnil; |
| 5577 | } | 5581 | } |
| 5578 | 5582 | ||
| 5579 | *time = last_mouse_movement_time; | 5583 | *timestamp = last_mouse_movement_time; |
| 5580 | 5584 | ||
| 5581 | UNBLOCK_INPUT; | 5585 | UNBLOCK_INPUT; |
| 5582 | } | 5586 | } |
| @@ -5750,7 +5754,8 @@ static void xembed_send_message (struct frame *f, Time time, | |||
| 5750 | We return the number of characters stored into the buffer. */ | 5754 | We return the number of characters stored into the buffer. */ |
| 5751 | 5755 | ||
| 5752 | static int | 5756 | static int |
| 5753 | handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, struct input_event *hold_quit) | 5757 | handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, |
| 5758 | int *finish, struct input_event *hold_quit) | ||
| 5754 | { | 5759 | { |
| 5755 | union { | 5760 | union { |
| 5756 | struct input_event ie; | 5761 | struct input_event ie; |
| @@ -5761,7 +5766,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, | |||
| 5761 | int nbytes = 0; | 5766 | int nbytes = 0; |
| 5762 | struct frame *f = NULL; | 5767 | struct frame *f = NULL; |
| 5763 | struct coding_system coding; | 5768 | struct coding_system coding; |
| 5764 | XEvent event = *eventp; | 5769 | XEvent event = *eventptr; |
| 5765 | Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; | 5770 | Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; |
| 5766 | 5771 | ||
| 5767 | *finish = X_EVENT_NORMAL; | 5772 | *finish = X_EVENT_NORMAL; |
| @@ -6461,7 +6466,6 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, | |||
| 6461 | 6466 | ||
| 6462 | { /* Raw bytes, not keysym. */ | 6467 | { /* Raw bytes, not keysym. */ |
| 6463 | register int i; | 6468 | register int i; |
| 6464 | register int c; | ||
| 6465 | int nchars, len; | 6469 | int nchars, len; |
| 6466 | 6470 | ||
| 6467 | for (i = 0, nchars = 0; i < nbytes; i++) | 6471 | for (i = 0, nchars = 0; i < nbytes; i++) |
| @@ -6501,14 +6505,15 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, | |||
| 6501 | character events. */ | 6505 | character events. */ |
| 6502 | for (i = 0; i < nbytes; i += len) | 6506 | for (i = 0; i < nbytes; i += len) |
| 6503 | { | 6507 | { |
| 6508 | int ch; | ||
| 6504 | if (nchars == nbytes) | 6509 | if (nchars == nbytes) |
| 6505 | c = copy_bufptr[i], len = 1; | 6510 | ch = copy_bufptr[i], len = 1; |
| 6506 | else | 6511 | else |
| 6507 | c = STRING_CHAR_AND_LENGTH (copy_bufptr + i, len); | 6512 | ch = STRING_CHAR_AND_LENGTH (copy_bufptr + i, len); |
| 6508 | inev.ie.kind = (SINGLE_BYTE_CHAR_P (c) | 6513 | inev.ie.kind = (SINGLE_BYTE_CHAR_P (ch) |
| 6509 | ? ASCII_KEYSTROKE_EVENT | 6514 | ? ASCII_KEYSTROKE_EVENT |
| 6510 | : MULTIBYTE_CHAR_KEYSTROKE_EVENT); | 6515 | : MULTIBYTE_CHAR_KEYSTROKE_EVENT); |
| 6511 | inev.ie.code = c; | 6516 | inev.ie.code = ch; |
| 6512 | kbd_buffer_store_event_hold (&inev.ie, hold_quit); | 6517 | kbd_buffer_store_event_hold (&inev.ie, hold_quit); |
| 6513 | } | 6518 | } |
| 6514 | 6519 | ||
| @@ -6947,7 +6952,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, | |||
| 6947 | count++; | 6952 | count++; |
| 6948 | } | 6953 | } |
| 6949 | 6954 | ||
| 6950 | *eventp = event; | 6955 | *eventptr = event; |
| 6951 | return count; | 6956 | return count; |
| 6952 | } | 6957 | } |
| 6953 | 6958 | ||
| @@ -7201,9 +7206,9 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text | |||
| 7201 | the bar might not be in the window. */ | 7206 | the bar might not be in the window. */ |
| 7202 | if (cursor_glyph->type == IMAGE_GLYPH) | 7207 | if (cursor_glyph->type == IMAGE_GLYPH) |
| 7203 | { | 7208 | { |
| 7204 | struct glyph_row *row; | 7209 | struct glyph_row *r; |
| 7205 | row = MATRIX_ROW (w->current_matrix, w->phys_cursor.vpos); | 7210 | r = MATRIX_ROW (w->current_matrix, w->phys_cursor.vpos); |
| 7206 | draw_phys_cursor_glyph (w, row, DRAW_CURSOR); | 7211 | draw_phys_cursor_glyph (w, r, DRAW_CURSOR); |
| 7207 | } | 7212 | } |
| 7208 | else | 7213 | else |
| 7209 | { | 7214 | { |
| @@ -7492,9 +7497,9 @@ static struct x_error_message_stack *x_error_message; | |||
| 7492 | x_catch_errors is in effect. */ | 7497 | x_catch_errors is in effect. */ |
| 7493 | 7498 | ||
| 7494 | static void | 7499 | static void |
| 7495 | x_error_catcher (Display *display, XErrorEvent *error) | 7500 | x_error_catcher (Display *display, XErrorEvent *event) |
| 7496 | { | 7501 | { |
| 7497 | XGetErrorText (display, error->error_code, | 7502 | XGetErrorText (display, event->error_code, |
| 7498 | x_error_message->string, | 7503 | x_error_message->string, |
| 7499 | X_ERROR_MESSAGE_SIZE); | 7504 | X_ERROR_MESSAGE_SIZE); |
| 7500 | } | 7505 | } |
| @@ -7651,7 +7656,7 @@ x_connection_closed (Display *dpy, const char *error_message) | |||
| 7651 | { | 7656 | { |
| 7652 | struct x_display_info *dpyinfo = x_display_info_for_display (dpy); | 7657 | struct x_display_info *dpyinfo = x_display_info_for_display (dpy); |
| 7653 | Lisp_Object frame, tail; | 7658 | Lisp_Object frame, tail; |
| 7654 | int index = SPECPDL_INDEX (); | 7659 | int idx = SPECPDL_INDEX (); |
| 7655 | 7660 | ||
| 7656 | error_msg = (char *) alloca (strlen (error_message) + 1); | 7661 | error_msg = (char *) alloca (strlen (error_message) + 1); |
| 7657 | strcpy (error_msg, error_message); | 7662 | strcpy (error_msg, error_message); |
| @@ -7746,7 +7751,7 @@ For details, see etc/PROBLEMS.\n", | |||
| 7746 | sigunblock (sigmask (SIGALRM)); | 7751 | sigunblock (sigmask (SIGALRM)); |
| 7747 | TOTALLY_UNBLOCK_INPUT; | 7752 | TOTALLY_UNBLOCK_INPUT; |
| 7748 | 7753 | ||
| 7749 | unbind_to (index, Qnil); | 7754 | unbind_to (idx, Qnil); |
| 7750 | clear_waiting_for_input (); | 7755 | clear_waiting_for_input (); |
| 7751 | /* Here, we absolutely have to use a non-local exit (e.g. signal, throw, | 7756 | /* Here, we absolutely have to use a non-local exit (e.g. signal, throw, |
| 7752 | longjmp), because returning from this function would get us back into | 7757 | longjmp), because returning from this function would get us back into |
| @@ -7762,12 +7767,12 @@ static void x_error_quitter (Display *, XErrorEvent *); | |||
| 7762 | It calls x_error_quitter or x_error_catcher. */ | 7767 | It calls x_error_quitter or x_error_catcher. */ |
| 7763 | 7768 | ||
| 7764 | static int | 7769 | static int |
| 7765 | x_error_handler (Display *display, XErrorEvent *error) | 7770 | x_error_handler (Display *display, XErrorEvent *event) |
| 7766 | { | 7771 | { |
| 7767 | if (x_error_message) | 7772 | if (x_error_message) |
| 7768 | x_error_catcher (display, error); | 7773 | x_error_catcher (display, event); |
| 7769 | else | 7774 | else |
| 7770 | x_error_quitter (display, error); | 7775 | x_error_quitter (display, event); |
| 7771 | return 0; | 7776 | return 0; |
| 7772 | } | 7777 | } |
| 7773 | 7778 | ||
| @@ -7781,22 +7786,22 @@ x_error_handler (Display *display, XErrorEvent *error) | |||
| 7781 | after x_error_handler prevents inlining into the former. */ | 7786 | after x_error_handler prevents inlining into the former. */ |
| 7782 | 7787 | ||
| 7783 | static void NO_INLINE | 7788 | static void NO_INLINE |
| 7784 | x_error_quitter (Display *display, XErrorEvent *error) | 7789 | x_error_quitter (Display *display, XErrorEvent *event) |
| 7785 | { | 7790 | { |
| 7786 | char buf[256], buf1[356]; | 7791 | char buf[256], buf1[356]; |
| 7787 | 7792 | ||
| 7788 | /* Ignore BadName errors. They can happen because of fonts | 7793 | /* Ignore BadName errors. They can happen because of fonts |
| 7789 | or colors that are not defined. */ | 7794 | or colors that are not defined. */ |
| 7790 | 7795 | ||
| 7791 | if (error->error_code == BadName) | 7796 | if (event->error_code == BadName) |
| 7792 | return; | 7797 | return; |
| 7793 | 7798 | ||
| 7794 | /* Note that there is no real way portable across R3/R4 to get the | 7799 | /* Note that there is no real way portable across R3/R4 to get the |
| 7795 | original error handler. */ | 7800 | original error handler. */ |
| 7796 | 7801 | ||
| 7797 | XGetErrorText (display, error->error_code, buf, sizeof (buf)); | 7802 | XGetErrorText (display, event->error_code, buf, sizeof (buf)); |
| 7798 | sprintf (buf1, "X protocol error: %s on protocol request %d", | 7803 | sprintf (buf1, "X protocol error: %s on protocol request %d", |
| 7799 | buf, error->request_code); | 7804 | buf, event->request_code); |
| 7800 | x_connection_closed (display, buf1); | 7805 | x_connection_closed (display, buf1); |
| 7801 | } | 7806 | } |
| 7802 | 7807 | ||
| @@ -8908,7 +8913,8 @@ xembed_set_info (struct frame *f, enum xembed_info flags) | |||
| 8908 | #endif /* defined USE_X_TOOLKIT || ! defined USE_GTK */ | 8913 | #endif /* defined USE_X_TOOLKIT || ! defined USE_GTK */ |
| 8909 | 8914 | ||
| 8910 | static void | 8915 | static void |
| 8911 | xembed_send_message (struct frame *f, Time time, enum xembed_message message, long int detail, long int data1, long int data2) | 8916 | xembed_send_message (struct frame *f, Time t, enum xembed_message msg, |
| 8917 | long int detail, long int data1, long int data2) | ||
| 8912 | { | 8918 | { |
| 8913 | XEvent event; | 8919 | XEvent event; |
| 8914 | 8920 | ||
| @@ -8916,8 +8922,8 @@ xembed_send_message (struct frame *f, Time time, enum xembed_message message, lo | |||
| 8916 | event.xclient.window = FRAME_X_OUTPUT (f)->parent_desc; | 8922 | event.xclient.window = FRAME_X_OUTPUT (f)->parent_desc; |
| 8917 | event.xclient.message_type = FRAME_X_DISPLAY_INFO (f)->Xatom_XEMBED; | 8923 | event.xclient.message_type = FRAME_X_DISPLAY_INFO (f)->Xatom_XEMBED; |
| 8918 | event.xclient.format = 32; | 8924 | event.xclient.format = 32; |
| 8919 | event.xclient.data.l[0] = time; | 8925 | event.xclient.data.l[0] = t; |
| 8920 | event.xclient.data.l[1] = message; | 8926 | event.xclient.data.l[1] = msg; |
| 8921 | event.xclient.data.l[2] = detail; | 8927 | event.xclient.data.l[2] = detail; |
| 8922 | event.xclient.data.l[3] = data1; | 8928 | event.xclient.data.l[3] = data1; |
| 8923 | event.xclient.data.l[4] = data2; | 8929 | event.xclient.data.l[4] = data2; |
| @@ -9243,19 +9249,19 @@ x_iconify_frame (struct frame *f) | |||
| 9243 | /* X11R4: send a ClientMessage to the window manager using the | 9249 | /* X11R4: send a ClientMessage to the window manager using the |
| 9244 | WM_CHANGE_STATE type. */ | 9250 | WM_CHANGE_STATE type. */ |
| 9245 | { | 9251 | { |
| 9246 | XEvent message; | 9252 | XEvent msg; |
| 9247 | 9253 | ||
| 9248 | message.xclient.window = FRAME_X_WINDOW (f); | 9254 | msg.xclient.window = FRAME_X_WINDOW (f); |
| 9249 | message.xclient.type = ClientMessage; | 9255 | msg.xclient.type = ClientMessage; |
| 9250 | message.xclient.message_type = FRAME_X_DISPLAY_INFO (f)->Xatom_wm_change_state; | 9256 | msg.xclient.message_type = FRAME_X_DISPLAY_INFO (f)->Xatom_wm_change_state; |
| 9251 | message.xclient.format = 32; | 9257 | msg.xclient.format = 32; |
| 9252 | message.xclient.data.l[0] = IconicState; | 9258 | msg.xclient.data.l[0] = IconicState; |
| 9253 | 9259 | ||
| 9254 | if (! XSendEvent (FRAME_X_DISPLAY (f), | 9260 | if (! XSendEvent (FRAME_X_DISPLAY (f), |
| 9255 | DefaultRootWindow (FRAME_X_DISPLAY (f)), | 9261 | DefaultRootWindow (FRAME_X_DISPLAY (f)), |
| 9256 | False, | 9262 | False, |
| 9257 | SubstructureRedirectMask | SubstructureNotifyMask, | 9263 | SubstructureRedirectMask | SubstructureNotifyMask, |
| 9258 | &message)) | 9264 | &msg)) |
| 9259 | { | 9265 | { |
| 9260 | UNBLOCK_INPUT_RESIGNAL; | 9266 | UNBLOCK_INPUT_RESIGNAL; |
| 9261 | error ("Can't notify window manager of iconification"); | 9267 | error ("Can't notify window manager of iconification"); |
| @@ -9747,10 +9753,11 @@ x_display_ok (const char *display) | |||
| 9747 | 9753 | ||
| 9748 | #ifdef USE_GTK | 9754 | #ifdef USE_GTK |
| 9749 | static void | 9755 | static void |
| 9750 | my_log_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data) | 9756 | my_log_handler (const gchar *log_domain, GLogLevelFlags log_level, |
| 9757 | const gchar *msg, gpointer user_data) | ||
| 9751 | { | 9758 | { |
| 9752 | if (!strstr (message, "g_set_prgname")) | 9759 | if (!strstr (msg, "g_set_prgname")) |
| 9753 | fprintf (stderr, "%s-WARNING **: %s\n", log_domain, message); | 9760 | fprintf (stderr, "%s-WARNING **: %s\n", log_domain, msg); |
| 9754 | } | 9761 | } |
| 9755 | #endif | 9762 | #endif |
| 9756 | 9763 | ||