Fix doc-string of pop-to-buffer-same-window. (Bug#15492)
[bpt/emacs.git] / src / xselect.c
index 6a80edd..5eb263d 100644 (file)
@@ -318,7 +318,7 @@ x_own_selection (Lisp_Object selection_name, Lisp_Object selection_value,
 {
   struct frame *f = XFRAME (frame);
   Window selecting_window = FRAME_X_WINDOW (f);
-  struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+  struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
   Display *display = dpyinfo->display;
   Time timestamp = last_event_timestamp;
   Atom selection_atom = symbol_to_x_atom (dpyinfo, selection_name);
@@ -654,7 +654,7 @@ x_reply_selection_request (struct input_event *event,
     if (cs->wait_object)
       {
        int format_bytes = cs->format / 8;
-       int had_errors = x_had_errors_p (display);
+       bool had_errors_p = x_had_errors_p (display);
        unblock_input ();
 
        bytes_remaining = cs->size;
@@ -662,7 +662,7 @@ x_reply_selection_request (struct input_event *event,
 
        /* Wait for the requestor to ack by deleting the property.
           This can run Lisp code (process handlers) or signal.  */
-       if (! had_errors)
+       if (! had_errors_p)
          {
            TRACE1 ("Waiting for ACK (deletion of %s)",
                    XGetAtomName (display, cs->property));
@@ -694,10 +694,10 @@ x_reply_selection_request (struct input_event *event,
            cs->data += i * ((cs->format == 32) ? sizeof (long)
                             : format_bytes);
            XFlush (display);
-           had_errors = x_had_errors_p (display);
+           had_errors_p = x_had_errors_p (display);
            unblock_input ();
 
-           if (had_errors) break;
+           if (had_errors_p) break;
 
            /* Wait for the requestor to ack this chunk by deleting
               the property.  This can run Lisp code or signal.  */
@@ -993,11 +993,11 @@ x_handle_selection_event (struct input_event *event)
    We do this when about to delete a frame.  */
 
 void
-x_clear_frame_selections (FRAME_PTR f)
+x_clear_frame_selections (struct frame *f)
 {
   Lisp_Object frame;
   Lisp_Object rest;
-  struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+  struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
   struct terminal *t = dpyinfo->terminal;
 
   XSETFRAME (frame, f);
@@ -1141,7 +1141,7 @@ wait_for_property_change (struct prop_location *location)
 /* Called from XTread_socket in response to a PropertyNotify event.  */
 
 void
-x_handle_property_notify (XPropertyEvent *event)
+x_handle_property_notify (const XPropertyEvent *event)
 {
   struct prop_location *rest;
 
@@ -1185,7 +1185,7 @@ x_get_foreign_selection (Lisp_Object selection_symbol, Lisp_Object target_type,
                         Lisp_Object time_stamp, Lisp_Object frame)
 {
   struct frame *f = XFRAME (frame);
-  struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+  struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
   Display *display = dpyinfo->display;
   Window requestor_window = FRAME_X_WINDOW (f);
   Time requestor_time = last_event_timestamp;
@@ -1888,7 +1888,7 @@ clean_local_selection_data (Lisp_Object obj)
    We store t there if the reply is successful, lambda if not.  */
 
 void
-x_handle_selection_notify (XSelectionEvent *event)
+x_handle_selection_notify (const XSelectionEvent *event)
 {
   if (event->requestor != reading_selection_window)
     return;
@@ -2009,7 +2009,7 @@ On Nextstep, TIME-STAMP and TERMINAL are unused.  */)
     error ("X selection unavailable for this frame");
 
   val = x_get_local_selection (selection_symbol, target_type, 1,
-                              FRAME_X_DISPLAY_INFO (f));
+                              FRAME_DISPLAY_INFO (f));
 
   if (NILP (val) && FRAME_LIVE_P (f))
     {
@@ -2056,7 +2056,7 @@ On MS-DOS, all this does is return non-nil if we own the selection.  */)
   if (!f)
     return Qnil;
 
-  dpyinfo = FRAME_X_DISPLAY_INFO (f);
+  dpyinfo = FRAME_DISPLAY_INFO (f);
   CHECK_SYMBOL (selection);
 
   /* Don't disown the selection when we're not the owner.  */
@@ -2108,7 +2108,7 @@ On Nextstep, TERMINAL is unused.  */)
   if (EQ (selection, Qnil)) selection = QPRIMARY;
   if (EQ (selection, Qt)) selection = QSECONDARY;
 
-  if (f && !NILP (LOCAL_SELECTION (selection, FRAME_X_DISPLAY_INFO (f))))
+  if (f && !NILP (LOCAL_SELECTION (selection, FRAME_DISPLAY_INFO (f))))
     return Qt;
   else
     return Qnil;
@@ -2141,7 +2141,7 @@ On Nextstep, TERMINAL is unused.  */)
   if (!f)
     return Qnil;
 
-  dpyinfo = FRAME_X_DISPLAY_INFO (f);
+  dpyinfo = FRAME_DISPLAY_INFO (f);
 
   if (!NILP (LOCAL_SELECTION (selection, dpyinfo)))
     return Qt;
@@ -2162,7 +2162,7 @@ static Lisp_Object
 x_clipboard_manager_save (Lisp_Object frame)
 {
   struct frame *f = XFRAME (frame);
-  struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+  struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
   Atom data = dpyinfo->Xatom_UTF8_STRING;
 
   XChangeProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
@@ -2212,7 +2212,7 @@ x_clipboard_manager_save_frame (Lisp_Object frame)
       && (f = XFRAME (frame), FRAME_X_P (f))
       && FRAME_LIVE_P (f))
     {
-      struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+      struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
       Lisp_Object local_selection
        = LOCAL_SELECTION (QCLIPBOARD, dpyinfo);
 
@@ -2377,7 +2377,7 @@ x_property_data_to_lisp (struct frame *f, const unsigned char *data,
 /* Get the mouse position in frame relative coordinates.  */
 
 static void
-mouse_position_for_drop (FRAME_PTR f, int *x, int *y)
+mouse_position_for_drop (struct frame *f, int *x, int *y)
 {
   Window root, dummy_window;
   int dummy;
@@ -2427,17 +2427,17 @@ If the value is 0 or the atom is not known, return the empty string.  */)
   Lisp_Object ret = Qnil;
   Display *dpy = FRAME_X_DISPLAY (f);
   Atom atom;
-  int had_errors;
+  bool had_errors_p;
 
   CONS_TO_INTEGER (value, Atom, atom);
 
   block_input ();
   x_catch_errors (dpy);
   name = atom ? XGetAtomName (dpy, atom) : empty;
-  had_errors = x_had_errors_p (dpy);
+  had_errors_p = x_had_errors_p (dpy);
   x_uncatch_errors ();
 
-  if (!had_errors)
+  if (!had_errors_p)
     ret = build_string (name);
 
   if (atom && name) XFree (name);
@@ -2458,7 +2458,7 @@ FRAME is on.  If FRAME is nil, the selected frame is used.  */)
   Atom x_atom;
   struct frame *f = decode_window_system_frame (frame);
   ptrdiff_t i;
-  struct x_display_info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+  struct x_display_info *dpyinfo = FRAME_DISPLAY_INFO (f);
 
 
   if (SYMBOLP (atom))
@@ -2488,7 +2488,7 @@ FRAME is on.  If FRAME is nil, the selected frame is used.  */)
 /* Convert an XClientMessageEvent to a Lisp event of type DRAG_N_DROP_EVENT.  */
 
 int
-x_handle_dnd_message (struct frame *f, XClientMessageEvent *event,
+x_handle_dnd_message (struct frame *f, const XClientMessageEvent *event,
                       struct x_display_info *dpyinfo, struct input_event *bufp)
 {
   Lisp_Object vec;
@@ -2628,6 +2628,8 @@ x_send_client_event (Lisp_Object display, Lisp_Object dest, Lisp_Object from,
 
   block_input ();
 
+  event.xclient.send_event = True;
+  event.xclient.serial = 0;
   event.xclient.message_type = message_type;
   event.xclient.display = dpyinfo->display;
 
@@ -2635,19 +2637,19 @@ x_send_client_event (Lisp_Object display, Lisp_Object dest, Lisp_Object from,
      when sending to the root window.  */
   event.xclient.window = to_root ? FRAME_OUTER_WINDOW (f) : wdest;
 
-
-  memset (event.xclient.data.b, 0, sizeof (event.xclient.data.b));
+  memset (event.xclient.data.l, 0, sizeof (event.xclient.data.l));
   x_fill_property_data (dpyinfo->display, values, event.xclient.data.b,
                         event.xclient.format);
 
   /* If event mask is 0 the event is sent to the client that created
      the destination window.  But if we are sending to the root window,
-     there is no such client.  Then we set the event mask to 0xffff.  The
+     there is no such client.  Then we set the event mask to 0xffffff.  The
      event then goes to clients selecting for events on the root window.  */
   x_catch_errors (dpyinfo->display);
   {
     int propagate = to_root ? False : True;
-    unsigned mask = to_root ? 0xffff : 0;
+    long mask = to_root ? 0xffffff : 0;
+
     XSendEvent (dpyinfo->display, wdest, propagate, mask, &event);
     XFlush (dpyinfo->display);
   }