Comprehensively zero all unused parts of client messages (Mainly Motif DND

Tue May 20 15:09:29 2003  Owen Taylor  <otaylor@redhat.com>

        * gdk/x11/gdkdnd-x11.c gdk/x11/gdkwindow-x11.c: Comprehensively
        zero all unused parts of client messages (Mainly Motif DND
        and EWMH). Also, fix a couple places where we were putting
        contents into Motif DND messages that didn't belong.
        (#113361, EWMH problem reported by Lubos Lunak)

        * gtk/gtkselection.c (_gtk_selection_request): Handle the
        case where the property type for the multiple atoms is
        ATOM_PAIR by doing the conversions ourselve. This is
        needed for Xt inter-operation.
This commit is contained in:
Owen Taylor 2003-05-20 21:01:08 +00:00 committed by Owen Taylor
parent 27a0a3bf22
commit ef6053684b
9 changed files with 169 additions and 29 deletions

View File

@ -1,7 +1,19 @@
Tue May 20 15:48:45 2003 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdnd-x11.c gdk/x11/gdkwindow-x11.c: Comprehensively
zero all unused parts of client messages (Mainly Motif DND
and EWMH). Also, fix a couple places where we were putting
contents into Motif DND messages that didn't belong.
(#113361, EWMH problem reported by Lubos Lunak)
* gtk/gtkselection.c (_gtk_selection_request): Handle the
case where the property type for the multiple atoms is
ATOM_PAIR by doing the conversions ourselve. This is
needed for Xt inter-operation.
2003-05-19 Arafat Medini <lumina@silverpen.de>
* ar.po: Added Arabic translation.
* configure.in: Added ar to ALL_LINGUAS
2003-05-19 Matthias Clasen <maclas@gmx.de>

View File

@ -1,7 +1,19 @@
Tue May 20 15:48:45 2003 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdnd-x11.c gdk/x11/gdkwindow-x11.c: Comprehensively
zero all unused parts of client messages (Mainly Motif DND
and EWMH). Also, fix a couple places where we were putting
contents into Motif DND messages that didn't belong.
(#113361, EWMH problem reported by Lubos Lunak)
* gtk/gtkselection.c (_gtk_selection_request): Handle the
case where the property type for the multiple atoms is
ATOM_PAIR by doing the conversions ourselve. This is
needed for Xt inter-operation.
2003-05-19 Arafat Medini <lumina@silverpen.de>
* ar.po: Added Arabic translation.
* configure.in: Added ar to ALL_LINGUAS
2003-05-19 Matthias Clasen <maclas@gmx.de>

View File

@ -1,7 +1,19 @@
Tue May 20 15:48:45 2003 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdnd-x11.c gdk/x11/gdkwindow-x11.c: Comprehensively
zero all unused parts of client messages (Mainly Motif DND
and EWMH). Also, fix a couple places where we were putting
contents into Motif DND messages that didn't belong.
(#113361, EWMH problem reported by Lubos Lunak)
* gtk/gtkselection.c (_gtk_selection_request): Handle the
case where the property type for the multiple atoms is
ATOM_PAIR by doing the conversions ourselve. This is
needed for Xt inter-operation.
2003-05-19 Arafat Medini <lumina@silverpen.de>
* ar.po: Added Arabic translation.
* configure.in: Added ar to ALL_LINGUAS
2003-05-19 Matthias Clasen <maclas@gmx.de>

View File

@ -1,7 +1,19 @@
Tue May 20 15:48:45 2003 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdnd-x11.c gdk/x11/gdkwindow-x11.c: Comprehensively
zero all unused parts of client messages (Mainly Motif DND
and EWMH). Also, fix a couple places where we were putting
contents into Motif DND messages that didn't belong.
(#113361, EWMH problem reported by Lubos Lunak)
* gtk/gtkselection.c (_gtk_selection_request): Handle the
case where the property type for the multiple atoms is
ATOM_PAIR by doing the conversions ourselve. This is
needed for Xt inter-operation.
2003-05-19 Arafat Medini <lumina@silverpen.de>
* ar.po: Added Arabic translation.
* configure.in: Added ar to ALL_LINGUAS
2003-05-19 Matthias Clasen <maclas@gmx.de>

View File

@ -1,7 +1,19 @@
Tue May 20 15:48:45 2003 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdnd-x11.c gdk/x11/gdkwindow-x11.c: Comprehensively
zero all unused parts of client messages (Mainly Motif DND
and EWMH). Also, fix a couple places where we were putting
contents into Motif DND messages that didn't belong.
(#113361, EWMH problem reported by Lubos Lunak)
* gtk/gtkselection.c (_gtk_selection_request): Handle the
case where the property type for the multiple atoms is
ATOM_PAIR by doing the conversions ourselve. This is
needed for Xt inter-operation.
2003-05-19 Arafat Medini <lumina@silverpen.de>
* ar.po: Added Arabic translation.
* configure.in: Added ar to ALL_LINGUAS
2003-05-19 Matthias Clasen <maclas@gmx.de>

View File

@ -824,6 +824,12 @@ broadcast_xmessage (GdkDisplay *display,
++src;
}
while (dest != dest_end)
{
*dest = 0;
++dest;
}
XSendEvent (xdisplay,
xroot_window,
False,

View File

@ -1307,6 +1307,7 @@ motif_send_enter (GdkDragContext *context,
motif_set_targets (context);
MOTIF_XCLIENT_LONG (&xev, 3) = private->motif_selection;
MOTIF_XCLIENT_LONG (&xev, 4) = 0;
if (!_gdk_send_xevent (display,
GDK_DRAWABLE_XID (context->dest_window),
@ -1332,8 +1333,9 @@ motif_send_leave (GdkDragContext *context,
MOTIF_XCLIENT_BYTE (&xev, 1) = local_byte_order;
MOTIF_XCLIENT_SHORT (&xev, 1) = 0;
MOTIF_XCLIENT_LONG (&xev, 1) = time;
MOTIF_XCLIENT_LONG (&xev, 2) = GDK_DRAWABLE_XID (context->source_window);
MOTIF_XCLIENT_LONG (&xev, 2) = 0;
MOTIF_XCLIENT_LONG (&xev, 3) = 0;
MOTIF_XCLIENT_LONG (&xev, 4) = 0;
if (!_gdk_send_xevent (display,
GDK_DRAWABLE_XID (context->dest_window),
@ -1363,6 +1365,8 @@ motif_send_motion (GdkDragContext *context,
MOTIF_XCLIENT_BYTE (&xev, 1) = local_byte_order;
MOTIF_XCLIENT_SHORT (&xev, 1) = motif_dnd_get_flags (context);
MOTIF_XCLIENT_LONG (&xev, 1) = time;
MOTIF_XCLIENT_LONG (&xev, 3) = 0;
MOTIF_XCLIENT_LONG (&xev, 4) = 0;
if ((context->suggested_action != private->old_action) ||
(context->actions != private->old_actions))
@ -3223,6 +3227,8 @@ gdk_drag_status (GdkDragContext *context,
if (context->protocol == GDK_DRAG_PROTO_MOTIF)
{
gboolean need_coords = FALSE;
xev.xclient.type = ClientMessage;
xev.xclient.message_type = gdk_x11_get_xatom_by_name_for_display (display,
"_MOTIF_DRAG_AND_DROP_MESSAGE");
@ -3238,12 +3244,18 @@ gdk_drag_status (GdkDragContext *context,
if ((action != 0) != (private->old_action != 0))
{
if (action != 0)
{
MOTIF_XCLIENT_BYTE (&xev, 0) = XmDROP_SITE_ENTER | 0x80;
need_coords = TRUE;
}
else
MOTIF_XCLIENT_BYTE (&xev, 0) = XmDROP_SITE_LEAVE | 0x80;
}
else
{
MOTIF_XCLIENT_BYTE (&xev, 0) = XmDRAG_MOTION | 0x80;
need_coords = TRUE;
}
}
MOTIF_XCLIENT_BYTE (&xev, 1) = local_byte_order;
@ -3270,8 +3282,17 @@ gdk_drag_status (GdkDragContext *context,
MOTIF_XCLIENT_SHORT (&xev, 1) |= (XmNO_DROP_SITE << 4);
MOTIF_XCLIENT_LONG (&xev, 1) = time;
if (need_coords)
{
MOTIF_XCLIENT_SHORT (&xev, 4) = private->last_x;
MOTIF_XCLIENT_SHORT (&xev, 5) = private->last_y;
}
else
MOTIF_XCLIENT_LONG (&xev, 2) = 0;
MOTIF_XCLIENT_LONG (&xev, 3) = 0;
MOTIF_XCLIENT_LONG (&xev, 4) = 0;
if (!_gdk_send_xevent (display,
GDK_DRAWABLE_XID (context->source_window),
@ -3350,6 +3371,9 @@ gdk_drop_reply (GdkDragContext *context,
(XmDROP_CANCEL << 12);
MOTIF_XCLIENT_SHORT (&xev, 2) = private->last_x;
MOTIF_XCLIENT_SHORT (&xev, 3) = private->last_y;
MOTIF_XCLIENT_LONG (&xev, 2) = 0;
MOTIF_XCLIENT_LONG (&xev, 3) = 0;
MOTIF_XCLIENT_LONG (&xev, 4) = 0;
_gdk_send_xevent (display,
GDK_DRAWABLE_XID (context->source_window),

View File

@ -899,6 +899,9 @@ _gdk_windowing_window_destroy (GdkWindow *window,
xevent.data.l[0] = gdk_x11_get_xatom_by_name_for_display (GDK_WINDOW_DISPLAY (window),
"WM_DELETE_WINDOW");
xevent.data.l[1] = CurrentTime;
xevent.data.l[2] = 0;
xevent.data.l[3] = 0;
xevent.data.l[4] = 0;
XSendEvent (GDK_WINDOW_XDISPLAY (window),
GDK_WINDOW_XID (window),
@ -1565,6 +1568,10 @@ gdk_window_focus (GdkWindow *window,
"_NET_ACTIVE_WINDOW");
xev.xclient.format = 32;
xev.xclient.data.l[0] = 0;
xev.xclient.data.l[1] = 0;
xev.xclient.data.l[2] = 0;
xev.xclient.data.l[3] = 0;
xev.xclient.data.l[4] = 0;
XSendEvent (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XROOTWIN (window), False,
SubstructureRedirectMask | SubstructureNotifyMask,
@ -1742,6 +1749,8 @@ gdk_wmspec_change_state (gboolean add,
xev.xclient.data.l[0] = add ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE;
xev.xclient.data.l[1] = gdk_x11_atom_to_xatom_for_display (display, state1);
xev.xclient.data.l[2] = gdk_x11_atom_to_xatom_for_display (display, state2);
xev.xclient.data.l[3] = 0;
xev.xclient.data.l[4] = 0;
XSendEvent (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XROOTWIN (window), False,
SubstructureRedirectMask | SubstructureNotifyMask,
@ -3473,6 +3482,10 @@ gdk_window_stick (GdkWindow *window)
xev.xclient.format = 32;
xev.xclient.data.l[0] = 0xFFFFFFFF;
xev.xclient.data.l[1] = 0;
xev.xclient.data.l[2] = 0;
xev.xclient.data.l[3] = 0;
xev.xclient.data.l[4] = 0;
XSendEvent (GDK_WINDOW_XDISPLAY (window), GDK_WINDOW_XROOTWIN (window), False,
SubstructureRedirectMask | SubstructureNotifyMask,
@ -3537,6 +3550,10 @@ gdk_window_unstick (GdkWindow *window)
xev.xclient.format = 32;
xev.xclient.data.l[0] = *current_desktop;
xev.xclient.data.l[1] = 0;
xev.xclient.data.l[2] = 0;
xev.xclient.data.l[3] = 0;
xev.xclient.data.l[4] = 0;
XSendEvent (GDK_DISPLAY_XDISPLAY (display), GDK_WINDOW_XROOTWIN (window), False,
SubstructureRedirectMask | SubstructureNotifyMask,

View File

@ -58,6 +58,10 @@
#include "gtkmain.h"
#include "gtkselection.h"
#ifdef GDK_WINDOWING_X11
#include "x11/gdkx.h"
#endif
/* #define DEBUG_SELECTION */
/* Maximum size of a sent chunk, in bytes. Also the default size of
@ -1085,9 +1089,9 @@ gboolean
_gtk_selection_request (GtkWidget *widget,
GdkEventSelection *event)
{
GdkDisplay *display = gtk_widget_get_display (widget);
GtkIncrInfo *info;
GList *tmp_list;
guchar *mult_atoms;
int i;
if (initialize)
@ -1119,10 +1123,10 @@ _gtk_selection_request (GtkWidget *widget,
/* Create GdkWindow structure for the requestor */
info->requestor = gdk_window_lookup_for_display (gtk_widget_get_display (widget),
info->requestor = gdk_window_lookup_for_display (display,
event->requestor);
if (!info->requestor)
info->requestor = gdk_window_foreign_new_for_display (gtk_widget_get_display (widget),
info->requestor = gdk_window_foreign_new_for_display (display,
event->requestor);
/* Determine conversions we need to perform */
@ -1130,6 +1134,7 @@ _gtk_selection_request (GtkWidget *widget,
if (event->target == gtk_selection_atoms[MULTIPLE])
{
GdkAtom type;
guchar *mult_atoms;
gint format;
gint length;
@ -1140,7 +1145,7 @@ _gtk_selection_request (GtkWidget *widget,
0, GTK_SELECTION_MAX_SIZE, FALSE,
&type, &format, &length, &mult_atoms))
{
gdk_selection_send_notify_for_display (gtk_widget_get_display (widget),
gdk_selection_send_notify_for_display (display,
event->requestor,
event->selection,
event->target,
@ -1152,6 +1157,28 @@ _gtk_selection_request (GtkWidget *widget,
}
gdk_error_trap_pop ();
/* This is annoying; the ICCCM doesn't specify the property type
* used for the property contents, so the autoconversion for
* ATOM / ATOM_PAIR in GDK doesn't work properly.
*/
#ifdef GDK_WINDOWING_X11
if (type != GDK_SELECTION_TYPE_ATOM &&
type != gdk_atom_intern ("ATOM_PAIR", FALSE))
{
info->num_conversions = length / (2*sizeof (glong));
info->conversions = g_new (GtkIncrConversion, info->num_conversions);
for (i=0; i<info->num_conversions; i++)
{
info->conversions[i].target = gdk_x11_xatom_to_atom_for_display (display,
((glong *)mult_atoms)[2*i]);
info->conversions[i].property = gdk_x11_xatom_to_atom_for_display (display,
((glong *)mult_atoms)[2*i + 1]);
}
}
else
#endif
{
info->num_conversions = length / (2*sizeof (GdkAtom));
info->conversions = g_new (GtkIncrConversion, info->num_conversions);
@ -1161,13 +1188,13 @@ _gtk_selection_request (GtkWidget *widget,
info->conversions[i].property = ((GdkAtom *)mult_atoms)[2*i+1];
}
}
}
else /* only a single conversion */
{
info->conversions = g_new (GtkIncrConversion, 1);
info->num_conversions = 1;
info->conversions[0].target = event->target;
info->conversions[0].property = event->property;
mult_atoms = (guchar *)info->conversions;
}
/* Loop through conversions and determine which of these are big
@ -1194,7 +1221,6 @@ _gtk_selection_request (GtkWidget *widget,
if (data.length < 0)
{
((GdkAtom *)mult_atoms)[2*i+1] = GDK_NONE;
info->conversions[i].property = GDK_NONE;
continue;
}
@ -1256,10 +1282,17 @@ _gtk_selection_request (GtkWidget *widget,
conversions succeeded */
if (event->target == gtk_selection_atoms[MULTIPLE])
{
GdkAtom *mult_atoms = g_new (GdkAtom, 2 * info->num_conversions);
for (i = 0; i < info->num_conversions; i++)
{
mult_atoms[2*i] = info->conversions[i].target;
mult_atoms[2*i+1] = info->conversions[i].property;
}
gdk_property_change (info->requestor, event->property,
gdk_atom_intern ("ATOM_PAIR", FALSE), 32,
GDK_PROP_MODE_REPLACE,
mult_atoms, 2*info->num_conversions);
(guchar *)mult_atoms, 2*info->num_conversions);
g_free (mult_atoms);
}