]> code.delx.au - gnu-emacs/commitdiff
Merge from emacs-23; up to 2010-06-08T03:06:47Z!dann@ics.uci.edu.
authorGlenn Morris <rgm@gnu.org>
Sat, 9 Apr 2011 17:40:29 +0000 (10:40 -0700)
committerGlenn Morris <rgm@gnu.org>
Sat, 9 Apr 2011 17:40:29 +0000 (10:40 -0700)
lisp/ChangeLog
src/ChangeLog
src/ftfont.c
src/xmenu.c
src/xselect.c
src/xterm.c

index b7d80c636a71120b4e7c0bf49144471fe0bdc7a9..8d705cdaed66041b8ef035fffd659daeec8a34be 100644 (file)
        (emerge-protect-metachars): Quote correctly for ms-dos and
        windows-nt systems.
 
-2011-03-19  Ralph Schleicher  <rs@ralph-schleicher.de>
+2011-03-19  Ralph Schleicher  <rs@ralph-schleicher.de>  (tiny change)
 
        * info.el (info-initialize): Replace all uses of `:' with
        path-separator for compatibility with non-Unix systems.
index 64aaf22f7810d862a0a474a1b56233e5667d82aa..e7ea07705af2a7bdedad2a5ff03141fd774abe0c 100644 (file)
@@ -1,3 +1,13 @@
+2011-04-09  Chong Yidong  <cyd@stupidchicken.com>
+
+       * ftfont.c (get_adstyle_property, ftfont_pattern_entity): Use
+       unsigned char, to match FcChar8 type definition.
+
+       * xterm.c (handle_one_xevent):
+       * xmenu.c (create_and_show_popup_menu):
+       * xselect.c (x_decline_selection_request)
+       (x_reply_selection_request): Avoid type-punned deref of X events.
+
 2011-04-09  Eli Zaretskii  <eliz@emacstest.gnu.org>
 
        Fix some uses of `int' instead of EMACS_INT.
@@ -39,7 +49,7 @@
        * ccl.c (Fccl_execute_on_string): Declare some variables
        EMACS_INT.
 
-2011-04-08  Svante Signell  <svante.signell@telia.com>  (tiny change)
+2011-04-08  Samuel Thibault  <sthibault@debian.org>  (tiny change)
 
        * term.c (init_tty): Fix incorrect ifdef placement (Bug#8450).
 
index ad01149106eeb30148cdf0b166f0475e2e5fb4ae..06ba6d7fe2538a19ba7bae456e8a22dde028bc66 100644 (file)
@@ -160,7 +160,7 @@ static struct
 static Lisp_Object
 get_adstyle_property (FcPattern *p)
 {
-  char *str, *end;
+  unsigned char *str, *end;
   Lisp_Object adstyle;
 
   if (FcPatternGetString (p, FC_STYLE, 0, (FcChar8 **) &str) != FcResultMatch)
@@ -189,7 +189,7 @@ static Lisp_Object
 ftfont_pattern_entity (FcPattern *p, Lisp_Object extra)
 {
   Lisp_Object key, cache, entity;
-  char *file, *str;
+  unsigned char *file, *str;
   int idx;
   int numeric;
   double dbl;
index 6e175e69039f1b71794e6536f7bbf3ef94dfa407..dbf8145f737ec5d3bf66d40fa0d9880fe8784222 100644 (file)
@@ -1529,7 +1529,8 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv,
   int i;
   Arg av[2];
   int ac = 0;
-  XButtonPressedEvent dummy;
+  XEvent dummy;
+  XButtonPressedEvent *event = &(dummy.xbutton);
   LWLIB_ID menu_id;
   Widget menu;
 
@@ -1547,36 +1548,35 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv,
                            popup_deactivate_callback,
                            menu_highlight_callback);
 
-  dummy.type = ButtonPress;
-  dummy.serial = 0;
-  dummy.send_event = 0;
-  dummy.display = FRAME_X_DISPLAY (f);
-  dummy.time = CurrentTime;
-  dummy.root = FRAME_X_DISPLAY_INFO (f)->root_window;
-  dummy.window = dummy.root;
-  dummy.subwindow = dummy.root;
-  dummy.x = x;
-  dummy.y = y;
+  event->type = ButtonPress;
+  event->serial = 0;
+  event->send_event = 0;
+  event->display = FRAME_X_DISPLAY (f);
+  event->time = CurrentTime;
+  event->root = FRAME_X_DISPLAY_INFO (f)->root_window;
+  event->window = event->subwindow = event->root;
+  event->x = x;
+  event->y = y;
 
   /* Adjust coordinates to be root-window-relative.  */
   x += f->left_pos + FRAME_OUTER_TO_INNER_DIFF_X (f);
   y += f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f);
 
-  dummy.x_root = x;
-  dummy.y_root = y;
+  event->x_root = x;
+  event->y_root = y;
 
-  dummy.state = 0;
-  dummy.button = 0;
+  event->state = 0;
+  event->button = 0;
   for (i = 0; i < 5; i++)
     if (FRAME_X_DISPLAY_INFO (f)->grabbed & (1 << i))
-      dummy.button = i;
+      event->button = i;
 
   /* Don't allow any geometry request from the user.  */
   XtSetArg (av[ac], XtNgeometry, 0); ac++;
   XtSetValues (menu, av, ac);
 
   /* Display the menu.  */
-  lw_popup_menu (menu, (XEvent *) &dummy);
+  lw_popup_menu (menu, &dummy);
   popup_activated_flag = 1;
   x_activate_timeout_atimer ();
 
index 430b72326590f24a5bf150ef00c7dd2a1238cd1d..4f1a452023a79c8d028ad4c035d53c30f40ed3e8 100644 (file)
@@ -499,22 +499,23 @@ x_get_local_selection (Lisp_Object selection_symbol, Lisp_Object target_type, in
 static void
 x_decline_selection_request (struct input_event *event)
 {
-  XSelectionEvent reply;
+  XEvent reply_base;
+  XSelectionEvent *reply = &(reply_base.xselection);
 
-  reply.type = SelectionNotify;
-  reply.display = SELECTION_EVENT_DISPLAY (event);
-  reply.requestor = SELECTION_EVENT_REQUESTOR (event);
-  reply.selection = SELECTION_EVENT_SELECTION (event);
-  reply.time = SELECTION_EVENT_TIME (event);
-  reply.target = SELECTION_EVENT_TARGET (event);
-  reply.property = None;
+  reply->type = SelectionNotify;
+  reply->display = SELECTION_EVENT_DISPLAY (event);
+  reply->requestor = SELECTION_EVENT_REQUESTOR (event);
+  reply->selection = SELECTION_EVENT_SELECTION (event);
+  reply->time = SELECTION_EVENT_TIME (event);
+  reply->target = SELECTION_EVENT_TARGET (event);
+  reply->property = None;
 
   /* The reason for the error may be that the receiver has
      died in the meantime.  Handle that case.  */
   BLOCK_INPUT;
-  x_catch_errors (reply.display);
-  XSendEvent (reply.display, reply.requestor, False, 0L, (XEvent *) &reply);
-  XFlush (reply.display);
+  x_catch_errors (reply->display);
+  XSendEvent (reply->display, reply->requestor, False, 0L, &reply_base);
+  XFlush (reply->display);
   x_uncatch_errors ();
   UNBLOCK_INPUT;
 }
@@ -617,7 +618,8 @@ static int x_reply_selection_request_cnt;
 static void
 x_reply_selection_request (struct input_event *event, int format, unsigned char *data, int size, Atom type)
 {
-  XSelectionEvent reply;
+  XEvent reply_base;
+  XSelectionEvent *reply = &(reply_base.xselection);
   Display *display = SELECTION_EVENT_DISPLAY (event);
   Window window = SELECTION_EVENT_REQUESTOR (event);
   int bytes_remaining;
@@ -629,15 +631,15 @@ x_reply_selection_request (struct input_event *event, int format, unsigned char
   if (max_bytes > MAX_SELECTION_QUANTUM)
     max_bytes = MAX_SELECTION_QUANTUM;
 
-  reply.type = SelectionNotify;
-  reply.display = display;
-  reply.requestor = window;
-  reply.selection = SELECTION_EVENT_SELECTION (event);
-  reply.time = SELECTION_EVENT_TIME (event);
-  reply.target = SELECTION_EVENT_TARGET (event);
-  reply.property = SELECTION_EVENT_PROPERTY (event);
-  if (reply.property == None)
-    reply.property = reply.target;
+  reply->type = SelectionNotify;
+  reply->display = display;
+  reply->requestor = window;
+  reply->selection = SELECTION_EVENT_SELECTION (event);
+  reply->time = SELECTION_EVENT_TIME (event);
+  reply->target = SELECTION_EVENT_TARGET (event);
+  reply->property = SELECTION_EVENT_PROPERTY (event);
+  if (reply->property == None)
+    reply->property = reply->target;
 
   BLOCK_INPUT;
   /* The protected block contains wait_for_property_change, which can
@@ -648,8 +650,8 @@ x_reply_selection_request (struct input_event *event, int format, unsigned char
 
 #ifdef TRACE_SELECTION
   {
-    char *sel = XGetAtomName (display, reply.selection);
-    char *tgt = XGetAtomName (display, reply.target);
+    char *sel = XGetAtomName (display, reply->selection);
+    char *tgt = XGetAtomName (display, reply->target);
     TRACE3 ("%s, target %s (%d)", sel, tgt, ++x_reply_selection_request_cnt);
     if (sel) XFree (sel);
     if (tgt) XFree (tgt);
@@ -664,10 +666,10 @@ x_reply_selection_request (struct input_event *event, int format, unsigned char
     {
       /* Send all the data at once, with minimal handshaking.  */
       TRACE1 ("Sending all %d bytes", bytes_remaining);
-      XChangeProperty (display, window, reply.property, type, format,
+      XChangeProperty (display, window, reply->property, type, format,
                       PropModeReplace, data, size);
       /* At this point, the selection was successfully stored; ack it.  */
-      XSendEvent (display, window, False, 0L, (XEvent *) &reply);
+      XSendEvent (display, window, False, 0L, &reply_base);
     }
   else
     {
@@ -693,19 +695,19 @@ x_reply_selection_request (struct input_event *event, int format, unsigned char
        error ("Attempt to transfer an INCR to ourself!");
 
       TRACE2 ("Start sending %d bytes incrementally (%s)",
-             bytes_remaining,  XGetAtomName (display, reply.property));
-      wait_object = expect_property_change (display, window, reply.property,
+             bytes_remaining,  XGetAtomName (display, reply->property));
+      wait_object = expect_property_change (display, window, reply->property,
                                            PropertyDelete);
 
       TRACE1 ("Set %s to number of bytes to send",
-             XGetAtomName (display, reply.property));
+             XGetAtomName (display, reply->property));
       {
         /* XChangeProperty expects an array of long even if long is more than
            32 bits.  */
         long value[1];
 
         value[0] = bytes_remaining;
-        XChangeProperty (display, window, reply.property, dpyinfo->Xatom_INCR,
+        XChangeProperty (display, window, reply->property, dpyinfo->Xatom_INCR,
                          32, PropModeReplace,
                          (unsigned char *) value, 1);
       }
@@ -714,7 +716,7 @@ x_reply_selection_request (struct input_event *event, int format, unsigned char
 
       /* Tell 'em the INCR data is there...  */
       TRACE0 ("Send SelectionNotify event");
-      XSendEvent (display, window, False, 0L, (XEvent *) &reply);
+      XSendEvent (display, window, False, 0L, &reply_base);
       XFlush (display);
 
       had_errors = x_had_errors_p (display);
@@ -725,7 +727,7 @@ x_reply_selection_request (struct input_event *event, int format, unsigned char
       if (! had_errors)
        {
          TRACE1 ("Waiting for ACK (deletion of %s)",
-                 XGetAtomName (display, reply.property));
+                 XGetAtomName (display, reply->property));
          wait_for_property_change (wait_object);
        }
       else
@@ -741,15 +743,15 @@ x_reply_selection_request (struct input_event *event, int format, unsigned char
          BLOCK_INPUT;
 
          wait_object
-           = expect_property_change (display, window, reply.property,
+           = expect_property_change (display, window, reply->property,
                                      PropertyDelete);
 
          TRACE1 ("Sending increment of %d elements", i);
          TRACE1 ("Set %s to increment data",
-                 XGetAtomName (display, reply.property));
+                 XGetAtomName (display, reply->property));
 
          /* Append the next chunk of data to the property.  */
-         XChangeProperty (display, window, reply.property, type, format,
+         XChangeProperty (display, window, reply->property, type, format,
                           PropModeAppend, data, i);
          bytes_remaining -= i * format_bytes;
          if (format == 32)
@@ -766,7 +768,7 @@ x_reply_selection_request (struct input_event *event, int format, unsigned char
          /* Now wait for the requester to ack this chunk by deleting the
             property.  This can run random lisp code or signal.  */
          TRACE1 ("Waiting for increment ACK (deletion of %s)",
-                 XGetAtomName (display, reply.property));
+                 XGetAtomName (display, reply->property));
          wait_for_property_change (wait_object);
        }
 
@@ -777,8 +779,8 @@ x_reply_selection_request (struct input_event *event, int format, unsigned char
        XSelectInput (display, window, 0L);
 
       TRACE1 ("Set %s to a 0-length chunk to indicate EOF",
-             XGetAtomName (display, reply.property));
-      XChangeProperty (display, window, reply.property, type, format,
+             XGetAtomName (display, reply->property));
+      XChangeProperty (display, window, reply->property, type, format,
                       PropModeReplace, data, 0);
       TRACE0 ("Done sending incrementally");
     }
index 92df7ae8746b44df213d45499a853fed3b7a8e5a..d1ff5b85a29c54a02b33e963a8b115408f3c62fc 100644 (file)
@@ -4045,7 +4045,7 @@ x_window_to_scroll_bar (Display *display, Window window_id)
          return XSCROLL_BAR (bar);
     }
 
-  return 0;
+  return NULL;
 }
 
 
@@ -6008,7 +6008,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
         goto OTHER;
 #endif /* USE_X_TOOLKIT */
       {
-        XSelectionClearEvent *eventp = (XSelectionClearEvent *) &event;
+        XSelectionClearEvent *eventp = &(event.xselectionclear);
 
         inev.ie.kind = SELECTION_CLEAR_EVENT;
         SELECTION_EVENT_DISPLAY (&inev.sie) = eventp->display;
@@ -6025,8 +6025,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
         goto OTHER;
 #endif /* USE_X_TOOLKIT */
       {
-          XSelectionRequestEvent *eventp
-            = (XSelectionRequestEvent *) &event;
+         XSelectionRequestEvent *eventp = &(event.xselectionrequest);
 
           inev.ie.kind = SELECTION_REQUEST_EVENT;
           SELECTION_EVENT_DISPLAY (&inev.sie) = eventp->display;