changeset 15711:099dc465c948

(SET_SAVED_MENU_EVENT): New macro. (SET_SAVED_BUTTON_EVENT, SET_SAVED_KEY_EVENT): New macros. (XTread_socket): Use them.
author Karl Heuer <kwzh@gnu.org>
date Tue, 16 Jul 1996 06:10:35 +0000
parents 85d87cd0f655
children a272ccf6c225
files src/xterm.c
diffstat 1 files changed, 20 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/xterm.c	Tue Jul 16 06:01:13 1996 +0000
+++ b/src/xterm.c	Tue Jul 16 06:10:35 1996 +0000
@@ -3211,6 +3211,22 @@
    This variable is used for cycling thru the displays.  */
 static struct x_display_info *next_noop_dpyinfo;
 
+#define SET_SAVED_MENU_EVENT(size) { \
+  if (f->output_data.x->saved_menu_event == 0) \
+    f->output_data.x->saved_menu_event = (XEvent*)xmalloc (sizeof (XEvent)); \
+  bcopy (&event, f->output_data.x->saved_menu_event, size); \
+  if (numchars >= 1) \
+    { \
+      bufp->kind = menu_bar_activate_event; \
+      XSETFRAME (bufp->frame_or_window, f); \
+      bufp++; \
+      count++; \
+      numchars--; \
+    } \
+  }
+#define SET_SAVED_BUTTON_EVENT SET_SAVED_MENU_EVENT (sizeof (XButtonEvent))
+#define SET_SAVED_KEY_EVENT SET_SAVED_MENU_EVENT (sizeof (XKeyEvent))
+
 /* Read events coming from the X server.
    This routine is called by the SIGIO handler.
    We return as soon as there are no more events to be read.
@@ -3226,8 +3242,8 @@
 int
 XTread_socket (sd, bufp, numchars, waitp, expected)
      register int sd;
-     register struct input_event *bufp;
-     register int numchars;
+     /* register */ struct input_event *bufp;
+     /* register */ int numchars;
      int waitp;
      int expected;
 {
@@ -3621,7 +3637,7 @@
                                                f->output_data.x->menubar_widget
                                                ))
                     {
-                      XtDispatchEvent (&event);
+                      SET_SAVED_KEY_EVENT;
                       break;
                     }
 #endif /* USE_X_TOOLKIT */
@@ -4030,19 +4046,7 @@
 		    && event.xbutton.y < f->output_data.x->menubar_height
 		    && event.xbutton.same_screen)
 		  {
-		    if (f->output_data.x->saved_button_event == 0)
-		      f->output_data.x->saved_button_event
-			= (XButtonEvent *) xmalloc (sizeof (XButtonEvent)); 
-		    bcopy (&event, f->output_data.x->saved_button_event,
-			   sizeof (XButtonEvent));
-		    if (numchars >= 1)
-		      {
-			bufp->kind = menu_bar_activate_event;
-			XSETFRAME (bufp->frame_or_window, f);
-			bufp++;
-			count++;
-			numchars--;
-		      }
+		    SET_SAVED_BUTTON_EVENT;
 		  }
 		else
 		  goto OTHER;