Commit a6067996 authored by Paul Eggert's avatar Paul Eggert
Browse files

* 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.
parent 38d0b34a
...@@ -12,6 +12,11 @@ ...@@ -12,6 +12,11 @@
unless they are used. unless they are used.
(XEMBED_VERSION, xembed_set_info): Don't define unless needed. (XEMBED_VERSION, xembed_set_info): Don't define unless needed.
(x_fatal_error_signal): Remove; not used. (x_fatal_error_signal): Remove; not used.
(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.
   
* xfaces.c (clear_face_cache, Fx_list_fonts, Fface_font): Rename * xfaces.c (clear_face_cache, Fx_list_fonts, Fface_font): Rename
or move locals to avoid shadowing. or move locals to avoid shadowing.
...@@ -2235,12 +2235,12 @@ x_draw_image_foreground (struct glyph_string *s) ...@@ -2235,12 +2235,12 @@ x_draw_image_foreground (struct glyph_string *s)
nothing here for mouse-face. */ nothing here for mouse-face. */
if (s->hl == DRAW_CURSOR) if (s->hl == DRAW_CURSOR)
{ {
int r = s->img->relief; int relief = s->img->relief;
if (r < 0) r = -r; if (relief < 0) relief = -relief;
XDrawRectangle (s->display, s->window, s->gc, XDrawRectangle (s->display, s->window, s->gc,
x - r, y - r, x - relief, y - relief,
s->slice.width + r*2 - 1, s->slice.width + relief*2 - 1,
s->slice.height + r*2 - 1); s->slice.height + relief*2 - 1);
} }
} }
} }
...@@ -3775,7 +3775,7 @@ redo_mouse_highlight (void) ...@@ -3775,7 +3775,7 @@ redo_mouse_highlight (void)
mouse is on, *BAR_WINDOW to nil, and *X and *Y to the character cell mouse is on, *BAR_WINDOW to nil, and *X and *Y to the character cell
the mouse is over. the mouse is over.
Set *TIME to the server time-stamp for the time at which the mouse Set *TIMESTAMP to the server time-stamp for the time at which the mouse
was at this position. was at this position.
Don't store anything if we don't have a valid set of values to report. 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,14 +3784,16 @@ redo_mouse_highlight (void)
movement. */ movement. */
static void static void
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) 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 *timestamp)
{ {
FRAME_PTR f1; FRAME_PTR f1;
BLOCK_INPUT; BLOCK_INPUT;
if (! NILP (last_mouse_scroll_bar) && insist == 0) if (! NILP (last_mouse_scroll_bar) && insist == 0)
x_scroll_bar_report_motion (fp, bar_window, part, x, y, time); x_scroll_bar_report_motion (fp, bar_window, part, x, y, timestamp);
else else
{ {
Window root; Window root;
...@@ -3964,7 +3966,7 @@ XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, enum scrol ...@@ -3964,7 +3966,7 @@ XTmouse_position (FRAME_PTR *fp, int insist, Lisp_Object *bar_window, enum scrol
*fp = f1; *fp = f1;
XSETINT (*x, win_x); XSETINT (*x, win_x);
XSETINT (*y, win_y); XSETINT (*y, win_y);
*time = last_mouse_movement_time; *timestamp = last_mouse_movement_time;
} }
} }
} }
...@@ -5516,7 +5518,9 @@ x_scroll_bar_note_movement (struct scroll_bar *bar, XEvent *event) ...@@ -5516,7 +5518,9 @@ x_scroll_bar_note_movement (struct scroll_bar *bar, XEvent *event)
on the scroll bar. */ on the scroll bar. */
static void static void
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) 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 *timestamp)
{ {
struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar); struct scroll_bar *bar = XSCROLL_BAR (last_mouse_scroll_bar);
Window w = bar->x_window; Window w = bar->x_window;
...@@ -5576,7 +5580,7 @@ x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, enum scroll_ ...@@ -5576,7 +5580,7 @@ x_scroll_bar_report_motion (FRAME_PTR *fp, Lisp_Object *bar_window, enum scroll_
last_mouse_scroll_bar = Qnil; last_mouse_scroll_bar = Qnil;
} }
*time = last_mouse_movement_time; *timestamp = last_mouse_movement_time;
UNBLOCK_INPUT; UNBLOCK_INPUT;
} }
...@@ -5750,7 +5754,8 @@ static void xembed_send_message (struct frame *f, Time time, ...@@ -5750,7 +5754,8 @@ static void xembed_send_message (struct frame *f, Time time,
We return the number of characters stored into the buffer. */ We return the number of characters stored into the buffer. */
static int static int
handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, struct input_event *hold_quit) handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
int *finish, struct input_event *hold_quit)
{ {
union { union {
struct input_event ie; struct input_event ie;
...@@ -5761,7 +5766,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, ...@@ -5761,7 +5766,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
int nbytes = 0; int nbytes = 0;
struct frame *f = NULL; struct frame *f = NULL;
struct coding_system coding; struct coding_system coding;
XEvent event = *eventp; XEvent event = *eventptr;
Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight;
*finish = X_EVENT_NORMAL; *finish = X_EVENT_NORMAL;
...@@ -6461,7 +6466,6 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, ...@@ -6461,7 +6466,6 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
{ /* Raw bytes, not keysym. */ { /* Raw bytes, not keysym. */
register int i; register int i;
register int c;
int nchars, len; int nchars, len;
for (i = 0, nchars = 0; i < nbytes; i++) 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,14 +6505,15 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
character events. */ character events. */
for (i = 0; i < nbytes; i += len) for (i = 0; i < nbytes; i += len)
{ {
int ch;
if (nchars == nbytes) if (nchars == nbytes)
c = copy_bufptr[i], len = 1; ch = copy_bufptr[i], len = 1;
else else
c = STRING_CHAR_AND_LENGTH (copy_bufptr + i, len); ch = STRING_CHAR_AND_LENGTH (copy_bufptr + i, len);
inev.ie.kind = (SINGLE_BYTE_CHAR_P (c) inev.ie.kind = (SINGLE_BYTE_CHAR_P (ch)
? ASCII_KEYSTROKE_EVENT ? ASCII_KEYSTROKE_EVENT
: MULTIBYTE_CHAR_KEYSTROKE_EVENT); : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
inev.ie.code = c; inev.ie.code = ch;
kbd_buffer_store_event_hold (&inev.ie, hold_quit); kbd_buffer_store_event_hold (&inev.ie, hold_quit);
} }
...@@ -6947,7 +6952,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish, ...@@ -6947,7 +6952,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventp, int *finish,
count++; count++;
} }
*eventp = event; *eventptr = event;
return count; return count;
} }
...@@ -7201,9 +7206,9 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text ...@@ -7201,9 +7206,9 @@ x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text
the bar might not be in the window. */ the bar might not be in the window. */
if (cursor_glyph->type == IMAGE_GLYPH) if (cursor_glyph->type == IMAGE_GLYPH)
{ {
struct glyph_row *row; struct glyph_row *r;
row = MATRIX_ROW (w->current_matrix, w->phys_cursor.vpos); r = MATRIX_ROW (w->current_matrix, w->phys_cursor.vpos);
draw_phys_cursor_glyph (w, row, DRAW_CURSOR); draw_phys_cursor_glyph (w, r, DRAW_CURSOR);
} }
else else
{ {
...@@ -7492,9 +7497,9 @@ static struct x_error_message_stack *x_error_message; ...@@ -7492,9 +7497,9 @@ static struct x_error_message_stack *x_error_message;
x_catch_errors is in effect. */ x_catch_errors is in effect. */
static void static void
x_error_catcher (Display *display, XErrorEvent *error) x_error_catcher (Display *display, XErrorEvent *event)
{ {
XGetErrorText (display, error->error_code, XGetErrorText (display, event->error_code,
x_error_message->string, x_error_message->string,
X_ERROR_MESSAGE_SIZE); X_ERROR_MESSAGE_SIZE);
} }
...@@ -7651,7 +7656,7 @@ x_connection_closed (Display *dpy, const char *error_message) ...@@ -7651,7 +7656,7 @@ x_connection_closed (Display *dpy, const char *error_message)
{ {
struct x_display_info *dpyinfo = x_display_info_for_display (dpy); struct x_display_info *dpyinfo = x_display_info_for_display (dpy);
Lisp_Object frame, tail; Lisp_Object frame, tail;
int index = SPECPDL_INDEX (); int idx = SPECPDL_INDEX ();
error_msg = (char *) alloca (strlen (error_message) + 1); error_msg = (char *) alloca (strlen (error_message) + 1);
strcpy (error_msg, error_message); strcpy (error_msg, error_message);
...@@ -7746,7 +7751,7 @@ For details, see etc/PROBLEMS.\n", ...@@ -7746,7 +7751,7 @@ For details, see etc/PROBLEMS.\n",
sigunblock (sigmask (SIGALRM)); sigunblock (sigmask (SIGALRM));
TOTALLY_UNBLOCK_INPUT; TOTALLY_UNBLOCK_INPUT;
unbind_to (index, Qnil); unbind_to (idx, Qnil);
clear_waiting_for_input (); clear_waiting_for_input ();
/* Here, we absolutely have to use a non-local exit (e.g. signal, throw, /* Here, we absolutely have to use a non-local exit (e.g. signal, throw,
longjmp), because returning from this function would get us back into longjmp), because returning from this function would get us back into
...@@ -7762,12 +7767,12 @@ static void x_error_quitter (Display *, XErrorEvent *); ...@@ -7762,12 +7767,12 @@ static void x_error_quitter (Display *, XErrorEvent *);
It calls x_error_quitter or x_error_catcher. */ It calls x_error_quitter or x_error_catcher. */
static int static int
x_error_handler (Display *display, XErrorEvent *error) x_error_handler (Display *display, XErrorEvent *event)
{ {
if (x_error_message) if (x_error_message)
x_error_catcher (display, error); x_error_catcher (display, event);
else else
x_error_quitter (display, error); x_error_quitter (display, event);
return 0; return 0;
} }
...@@ -7781,22 +7786,22 @@ x_error_handler (Display *display, XErrorEvent *error) ...@@ -7781,22 +7786,22 @@ x_error_handler (Display *display, XErrorEvent *error)
after x_error_handler prevents inlining into the former. */ after x_error_handler prevents inlining into the former. */
static void NO_INLINE static void NO_INLINE
x_error_quitter (Display *display, XErrorEvent *error) x_error_quitter (Display *display, XErrorEvent *event)
{ {
char buf[256], buf1[356]; char buf[256], buf1[356];
/* Ignore BadName errors. They can happen because of fonts /* Ignore BadName errors. They can happen because of fonts
or colors that are not defined. */ or colors that are not defined. */
if (error->error_code == BadName) if (event->error_code == BadName)
return; return;
/* Note that there is no real way portable across R3/R4 to get the /* Note that there is no real way portable across R3/R4 to get the
original error handler. */ original error handler. */
XGetErrorText (display, error->error_code, buf, sizeof (buf)); XGetErrorText (display, event->error_code, buf, sizeof (buf));
sprintf (buf1, "X protocol error: %s on protocol request %d", sprintf (buf1, "X protocol error: %s on protocol request %d",
buf, error->request_code); buf, event->request_code);
x_connection_closed (display, buf1); x_connection_closed (display, buf1);
} }
...@@ -8908,7 +8913,8 @@ xembed_set_info (struct frame *f, enum xembed_info flags) ...@@ -8908,7 +8913,8 @@ xembed_set_info (struct frame *f, enum xembed_info flags)
#endif /* defined USE_X_TOOLKIT || ! defined USE_GTK */ #endif /* defined USE_X_TOOLKIT || ! defined USE_GTK */
static void static void
xembed_send_message (struct frame *f, Time time, enum xembed_message message, long int detail, long int data1, long int data2) xembed_send_message (struct frame *f, Time t, enum xembed_message msg,
long int detail, long int data1, long int data2)
{ {
XEvent event; XEvent event;
...@@ -8916,8 +8922,8 @@ xembed_send_message (struct frame *f, Time time, enum xembed_message message, lo ...@@ -8916,8 +8922,8 @@ xembed_send_message (struct frame *f, Time time, enum xembed_message message, lo
event.xclient.window = FRAME_X_OUTPUT (f)->parent_desc; event.xclient.window = FRAME_X_OUTPUT (f)->parent_desc;
event.xclient.message_type = FRAME_X_DISPLAY_INFO (f)->Xatom_XEMBED; event.xclient.message_type = FRAME_X_DISPLAY_INFO (f)->Xatom_XEMBED;
event.xclient.format = 32; event.xclient.format = 32;
event.xclient.data.l[0] = time; event.xclient.data.l[0] = t;
event.xclient.data.l[1] = message; event.xclient.data.l[1] = msg;
event.xclient.data.l[2] = detail; event.xclient.data.l[2] = detail;
event.xclient.data.l[3] = data1; event.xclient.data.l[3] = data1;
event.xclient.data.l[4] = data2; event.xclient.data.l[4] = data2;
...@@ -9243,19 +9249,19 @@ x_iconify_frame (struct frame *f) ...@@ -9243,19 +9249,19 @@ x_iconify_frame (struct frame *f)
/* X11R4: send a ClientMessage to the window manager using the /* X11R4: send a ClientMessage to the window manager using the
WM_CHANGE_STATE type. */ WM_CHANGE_STATE type. */
{ {
XEvent message; XEvent msg;
message.xclient.window = FRAME_X_WINDOW (f); msg.xclient.window = FRAME_X_WINDOW (f);
message.xclient.type = ClientMessage; msg.xclient.type = ClientMessage;
message.xclient.message_type = FRAME_X_DISPLAY_INFO (f)->Xatom_wm_change_state; msg.xclient.message_type = FRAME_X_DISPLAY_INFO (f)->Xatom_wm_change_state;
message.xclient.format = 32; msg.xclient.format = 32;
message.xclient.data.l[0] = IconicState; msg.xclient.data.l[0] = IconicState;
if (! XSendEvent (FRAME_X_DISPLAY (f), if (! XSendEvent (FRAME_X_DISPLAY (f),
DefaultRootWindow (FRAME_X_DISPLAY (f)), DefaultRootWindow (FRAME_X_DISPLAY (f)),
False, False,
SubstructureRedirectMask | SubstructureNotifyMask, SubstructureRedirectMask | SubstructureNotifyMask,
&message)) &msg))
{ {
UNBLOCK_INPUT_RESIGNAL; UNBLOCK_INPUT_RESIGNAL;
error ("Can't notify window manager of iconification"); error ("Can't notify window manager of iconification");
...@@ -9747,10 +9753,11 @@ x_display_ok (const char *display) ...@@ -9747,10 +9753,11 @@ x_display_ok (const char *display)
#ifdef USE_GTK #ifdef USE_GTK
static void static void
my_log_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data) my_log_handler (const gchar *log_domain, GLogLevelFlags log_level,
const gchar *msg, gpointer user_data)
{ {
if (!strstr (message, "g_set_prgname")) if (!strstr (msg, "g_set_prgname"))
fprintf (stderr, "%s-WARNING **: %s\n", log_domain, message); fprintf (stderr, "%s-WARNING **: %s\n", log_domain, msg);
} }
#endif #endif
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment