Commit 4b2885b5 authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Always send "drag_leave" to dests without GTK_DEST_DEFAULT_MOTION.

Tue Oct 20 14:53:28 1998  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtkdnd.c: Always send "drag_leave" to dests
	without GTK_DEST_DEFAULT_MOTION.

Tue Oct 20 11:55:24 1998  Owen Taylor  <otaylor@redhat.com>

	* gdk/gdk.c (gdk_event_translate): Handle DestroyNotify
	on destroyed windows so we clear the XID table properly.
	Finish up restructure of return value handling that
	was half-done before.

Tue Oct 20 12:57:10 1998  Owen Taylor  <otaylor@redhat.com>

	* gdk/gdk.c (gdk_send_clientmessage_to_all): Hunt
	the window tree more comprehensively, so that we find
	client windows hidden under non-toplevels.

Tue Oct 20 12:43:04 1998  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtkselection.c (gtk_selection_data_set):
	Maintain the null-termintation guarantee, even when
	data = NULL, length = 0. (Warn on data = NULL,
	length > 0)

Mon Oct 19 16:41:44 1998  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtkwidget.h (struct _GtkWidgetClass): Add in coordinates
	into function prototype for drag_data_received.
parent 7a564681
Tue Oct 20 14:53:28 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c: Always send "drag_leave" to dests
without GTK_DEST_DEFAULT_MOTION.
Tue Oct 20 11:55:24 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c (gdk_event_translate): Handle DestroyNotify
on destroyed windows so we clear the XID table properly.
Finish up restructure of return value handling that
was half-done before.
Tue Oct 20 12:57:10 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c (gdk_send_clientmessage_to_all): Hunt
the window tree more comprehensively, so that we find
client windows hidden under non-toplevels.
Tue Oct 20 12:43:04 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_selection_data_set):
Maintain the null-termintation guarantee, even when
data = NULL, length = 0. (Warn on data = NULL,
length > 0)
Mon Oct 19 16:41:44 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.h (struct _GtkWidgetClass): Add in coordinates
into function prototype for drag_data_received.
Tue, 20 Oct 1998 11:33:10 +0200 Paolo Molaro <lupus@debian.org>
* gtk/gtkdnd.h,gtk/gtkdnd.c: delete is a reserved word in c++.
......
Tue Oct 20 14:53:28 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c: Always send "drag_leave" to dests
without GTK_DEST_DEFAULT_MOTION.
Tue Oct 20 11:55:24 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c (gdk_event_translate): Handle DestroyNotify
on destroyed windows so we clear the XID table properly.
Finish up restructure of return value handling that
was half-done before.
Tue Oct 20 12:57:10 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c (gdk_send_clientmessage_to_all): Hunt
the window tree more comprehensively, so that we find
client windows hidden under non-toplevels.
Tue Oct 20 12:43:04 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_selection_data_set):
Maintain the null-termintation guarantee, even when
data = NULL, length = 0. (Warn on data = NULL,
length > 0)
Mon Oct 19 16:41:44 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.h (struct _GtkWidgetClass): Add in coordinates
into function prototype for drag_data_received.
Tue, 20 Oct 1998 11:33:10 +0200 Paolo Molaro <lupus@debian.org>
* gtk/gtkdnd.h,gtk/gtkdnd.c: delete is a reserved word in c++.
......
Tue Oct 20 14:53:28 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c: Always send "drag_leave" to dests
without GTK_DEST_DEFAULT_MOTION.
Tue Oct 20 11:55:24 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c (gdk_event_translate): Handle DestroyNotify
on destroyed windows so we clear the XID table properly.
Finish up restructure of return value handling that
was half-done before.
Tue Oct 20 12:57:10 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c (gdk_send_clientmessage_to_all): Hunt
the window tree more comprehensively, so that we find
client windows hidden under non-toplevels.
Tue Oct 20 12:43:04 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_selection_data_set):
Maintain the null-termintation guarantee, even when
data = NULL, length = 0. (Warn on data = NULL,
length > 0)
Mon Oct 19 16:41:44 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.h (struct _GtkWidgetClass): Add in coordinates
into function prototype for drag_data_received.
Tue, 20 Oct 1998 11:33:10 +0200 Paolo Molaro <lupus@debian.org>
* gtk/gtkdnd.h,gtk/gtkdnd.c: delete is a reserved word in c++.
......
Tue Oct 20 14:53:28 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c: Always send "drag_leave" to dests
without GTK_DEST_DEFAULT_MOTION.
Tue Oct 20 11:55:24 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c (gdk_event_translate): Handle DestroyNotify
on destroyed windows so we clear the XID table properly.
Finish up restructure of return value handling that
was half-done before.
Tue Oct 20 12:57:10 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c (gdk_send_clientmessage_to_all): Hunt
the window tree more comprehensively, so that we find
client windows hidden under non-toplevels.
Tue Oct 20 12:43:04 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_selection_data_set):
Maintain the null-termintation guarantee, even when
data = NULL, length = 0. (Warn on data = NULL,
length > 0)
Mon Oct 19 16:41:44 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.h (struct _GtkWidgetClass): Add in coordinates
into function prototype for drag_data_received.
Tue, 20 Oct 1998 11:33:10 +0200 Paolo Molaro <lupus@debian.org>
* gtk/gtkdnd.h,gtk/gtkdnd.c: delete is a reserved word in c++.
......
Tue Oct 20 14:53:28 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c: Always send "drag_leave" to dests
without GTK_DEST_DEFAULT_MOTION.
Tue Oct 20 11:55:24 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c (gdk_event_translate): Handle DestroyNotify
on destroyed windows so we clear the XID table properly.
Finish up restructure of return value handling that
was half-done before.
Tue Oct 20 12:57:10 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c (gdk_send_clientmessage_to_all): Hunt
the window tree more comprehensively, so that we find
client windows hidden under non-toplevels.
Tue Oct 20 12:43:04 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_selection_data_set):
Maintain the null-termintation guarantee, even when
data = NULL, length = 0. (Warn on data = NULL,
length > 0)
Mon Oct 19 16:41:44 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.h (struct _GtkWidgetClass): Add in coordinates
into function prototype for drag_data_received.
Tue, 20 Oct 1998 11:33:10 +0200 Paolo Molaro <lupus@debian.org>
* gtk/gtkdnd.h,gtk/gtkdnd.c: delete is a reserved word in c++.
......
Tue Oct 20 14:53:28 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c: Always send "drag_leave" to dests
without GTK_DEST_DEFAULT_MOTION.
Tue Oct 20 11:55:24 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c (gdk_event_translate): Handle DestroyNotify
on destroyed windows so we clear the XID table properly.
Finish up restructure of return value handling that
was half-done before.
Tue Oct 20 12:57:10 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c (gdk_send_clientmessage_to_all): Hunt
the window tree more comprehensively, so that we find
client windows hidden under non-toplevels.
Tue Oct 20 12:43:04 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_selection_data_set):
Maintain the null-termintation guarantee, even when
data = NULL, length = 0. (Warn on data = NULL,
length > 0)
Mon Oct 19 16:41:44 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.h (struct _GtkWidgetClass): Add in coordinates
into function prototype for drag_data_received.
Tue, 20 Oct 1998 11:33:10 +0200 Paolo Molaro <lupus@debian.org>
* gtk/gtkdnd.h,gtk/gtkdnd.c: delete is a reserved word in c++.
......
Tue Oct 20 14:53:28 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c: Always send "drag_leave" to dests
without GTK_DEST_DEFAULT_MOTION.
Tue Oct 20 11:55:24 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c (gdk_event_translate): Handle DestroyNotify
on destroyed windows so we clear the XID table properly.
Finish up restructure of return value handling that
was half-done before.
Tue Oct 20 12:57:10 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdk.c (gdk_send_clientmessage_to_all): Hunt
the window tree more comprehensively, so that we find
client windows hidden under non-toplevels.
Tue Oct 20 12:43:04 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkselection.c (gtk_selection_data_set):
Maintain the null-termintation guarantee, even when
data = NULL, length = 0. (Warn on data = NULL,
length > 0)
Mon Oct 19 16:41:44 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.h (struct _GtkWidgetClass): Add in coordinates
into function prototype for drag_data_received.
Tue, 20 Oct 1998 11:33:10 +0200 Paolo Molaro <lupus@debian.org>
* gtk/gtkdnd.h,gtk/gtkdnd.c: delete is a reserved word in c++.
......
......@@ -1894,22 +1894,25 @@ gdk_event_translate (GdkEvent *event,
event->any.send_event = xevent->xany.send_event;
if (window_private && window_private->destroyed)
return FALSE;
/* Check for filters for this window */
{
if (xevent->type != DestroyNotify)
return FALSE;
}
else
{
/* Check for filters for this window */
{
GdkFilterReturn result;
result = gdk_event_apply_filters (xevent, event,
window_private
?window_private->filters
:gdk_default_filters);
if (result != GDK_FILTER_CONTINUE)
{
return (result == GDK_FILTER_TRANSLATE) ? TRUE : FALSE;
}
}
GdkFilterReturn result;
result = gdk_event_apply_filters (xevent, event,
window_private
?window_private->filters
:gdk_default_filters);
if (result != GDK_FILTER_CONTINUE)
{
return (result == GDK_FILTER_TRANSLATE) ? TRUE : FALSE;
}
}
/* We do a "manual" conversion of the XEvent to a
* GdkEvent. The structures are mostly the same so
......@@ -1917,10 +1920,9 @@ gdk_event_translate (GdkEvent *event,
* optionally print debugging info regarding events
* received.
*/
/* Addendum:
* During drag & drop you get events where the pointer is
* in other windows. Need to just do finer-grained checking
*/
return_val = TRUE;
switch (xevent->type)
{
case KeyPress:
......@@ -1998,11 +2000,6 @@ gdk_event_translate (GdkEvent *event,
event->key.string = g_strdup (buf);
event->key.length = charcount;
return_val = window_private && !window_private->destroyed;
if (!return_val)
g_free (event->key.string);
break;
case KeyRelease:
......@@ -2028,7 +2025,6 @@ gdk_event_translate (GdkEvent *event,
event->key.length = 0;
event->key.string = NULL;
return_val = window_private && !window_private->destroyed;
break;
case ButtonPress:
......@@ -2044,7 +2040,10 @@ gdk_event_translate (GdkEvent *event,
if (window_private &&
(window_private->extension_events != 0) &&
gdk_input_ignore_core)
break;
{
return_val = FALSE;
break;
}
event->button.type = GDK_BUTTON_PRESS;
event->button.window = window;
......@@ -2097,7 +2096,6 @@ gdk_event_translate (GdkEvent *event,
button_number[0] = event->button.button;
}
return_val = window_private && !window_private->destroyed;
break;
case ButtonRelease:
......@@ -2113,7 +2111,10 @@ gdk_event_translate (GdkEvent *event,
if (window_private &&
(window_private->extension_events != 0) &&
gdk_input_ignore_core)
break;
{
return_val = FALSE;
break;
}
event->button.type = GDK_BUTTON_RELEASE;
event->button.window = window;
......@@ -2130,8 +2131,6 @@ gdk_event_translate (GdkEvent *event,
event->button.source = GDK_SOURCE_MOUSE;
event->button.deviceid = GDK_CORE_POINTER;
return_val = window_private && !window_private->destroyed;
break;
case MotionNotify:
......@@ -2146,7 +2145,10 @@ gdk_event_translate (GdkEvent *event,
if (window_private &&
(window_private->extension_events != 0) &&
gdk_input_ignore_core)
break;
{
return_val = FALSE;
break;
}
event->motion.type = GDK_MOTION_NOTIFY;
event->motion.window = window;
......@@ -2163,7 +2165,6 @@ gdk_event_translate (GdkEvent *event,
event->motion.source = GDK_SOURCE_MOUSE;
event->motion.deviceid = GDK_CORE_POINTER;
return_val = window_private && !window_private->destroyed;
break;
case EnterNotify:
......@@ -2240,7 +2241,6 @@ gdk_event_translate (GdkEvent *event,
event->crossing.focus = xevent->xcrossing.focus;
event->crossing.state = xevent->xcrossing.state;
return_val = window_private && !window_private->destroyed;
break;
case LeaveNotify:
......@@ -2310,7 +2310,6 @@ gdk_event_translate (GdkEvent *event,
event->crossing.focus = xevent->xcrossing.focus;
event->crossing.state = xevent->xcrossing.state;
return_val = window_private && !window_private->destroyed;
break;
case FocusIn:
......@@ -2333,11 +2332,10 @@ gdk_event_translate (GdkEvent *event,
event->focus_change.type = GDK_FOCUS_CHANGE;
event->focus_change.window = window;
event->focus_change.in = (xevent->xany.type == FocusIn);
return_val = window_private && !window_private->destroyed;
break;
default:
;
return_val = FALSE;
}
break;
......@@ -2346,8 +2344,9 @@ gdk_event_translate (GdkEvent *event,
*/
GDK_NOTE (EVENTS,
g_message ("keymap notify"));
/* Not currently handled */
return_val = FALSE;
break;
case Expose:
......@@ -2367,7 +2366,6 @@ gdk_event_translate (GdkEvent *event,
event->expose.area.height = xevent->xexpose.height;
event->expose.count = xevent->xexpose.count;
return_val = window_private && !window_private->destroyed;
break;
case GraphicsExpose:
......@@ -2385,7 +2383,6 @@ gdk_event_translate (GdkEvent *event,
event->expose.area.height = xevent->xgraphicsexpose.height;
event->expose.count = xevent->xexpose.count;
return_val = window_private && !window_private->destroyed;
break;
case NoExpose:
......@@ -2398,7 +2395,6 @@ gdk_event_translate (GdkEvent *event,
event->no_expose.type = GDK_NO_EXPOSE;
event->no_expose.window = window;
return_val = window_private && !window_private->destroyed;
break;
case VisibilityNotify:
......@@ -2441,7 +2437,6 @@ gdk_event_translate (GdkEvent *event,
break;
}
return_val = window_private && !window_private->destroyed;
break;
case CreateNotify:
......@@ -2477,7 +2472,6 @@ gdk_event_translate (GdkEvent *event,
if (xgrab_window == window_private)
xgrab_window = NULL;
return_val = window_private && !window_private->destroyed;
break;
case MapNotify:
......@@ -2490,7 +2484,6 @@ gdk_event_translate (GdkEvent *event,
event->any.type = GDK_MAP;
event->any.window = window;
return_val = window_private && !window_private->destroyed;
break;
case ReparentNotify:
......@@ -2499,8 +2492,9 @@ gdk_event_translate (GdkEvent *event,
GDK_NOTE (EVENTS,
g_message ("reparent notify:\twindow: %ld",
xevent->xreparent.window - base_id));
/* Not currently handled */
return_val = FALSE;
break;
case ConfigureNotify:
......@@ -2535,7 +2529,7 @@ gdk_event_translate (GdkEvent *event,
GDK_NOTE (EVENTS,
g_message ("configure notify:\twindow: %ld x,y: %d %d w,h: %d %d b-w: %d above: %ld ovr: %d",
<g_message ("configure notify:\twindow: %ld x,y: %d %d w,h: %d %d b-w: %d above: %ld ovr: %d",
xevent->xconfigure.window - base_id,
xevent->xconfigure.x,
xevent->xconfigure.y,
......@@ -2545,52 +2539,49 @@ gdk_event_translate (GdkEvent *event,
xevent->xconfigure.above - base_id,
xevent->xconfigure.override_redirect));
if (window_private)
if ((window_private->extension_events != 0) &&
gdk_input_vtable.configure_event)
gdk_input_vtable.configure_event (&xevent->xconfigure, window);
if (window_private->window_type == GDK_WINDOW_CHILD)
return_val = FALSE;
else
{
if ((window_private->extension_events != 0) &&
gdk_input_vtable.configure_event)
gdk_input_vtable.configure_event (&xevent->xconfigure, window);
event->configure.type = GDK_CONFIGURE;
event->configure.window = window;
event->configure.width = xevent->xconfigure.width;
event->configure.height = xevent->xconfigure.height;
if (window_private->window_type != GDK_WINDOW_CHILD)
if (!xevent->xconfigure.x &&
!xevent->xconfigure.y &&
!window_private->destroyed)
{
event->configure.type = GDK_CONFIGURE;
event->configure.window = window;
event->configure.width = xevent->xconfigure.width;
event->configure.height = xevent->xconfigure.height;
if (!xevent->xconfigure.x &&
!xevent->xconfigure.y &&
!window_private->destroyed)
{
gint tx = 0;
gint ty = 0;
Window child_window = 0;
if (!XTranslateCoordinates (window_private->xdisplay,
window_private->xwindow,
gdk_root_window,
0, 0,
&tx, &ty,
&child_window))
g_warning ("GdkWindow %ld doesn't share root windows display?",
window_private->xwindow - base_id);
event->configure.x = tx;
event->configure.y = ty;
}
else
{
event->configure.x = xevent->xconfigure.x;
event->configure.y = xevent->xconfigure.y;
}
window_private->x = event->configure.x;
window_private->y = event->configure.y;
window_private->width = xevent->xconfigure.width;
window_private->height = xevent->xconfigure.height;
if (window_private->resize_count > 1)
window_private->resize_count -= 1;
gint tx = 0;
gint ty = 0;
Window child_window = 0;
return_val = !window_private->destroyed;
if (!XTranslateCoordinates (window_private->xdisplay,
window_private->xwindow,
gdk_root_window,
0, 0,
&tx, &ty,
&child_window))
g_warning ("GdkWindow %ld doesn't share root windows display?",
window_private->xwindow - base_id);
event->configure.x = tx;
event->configure.y = ty;
}
else
{
event->configure.x = xevent->xconfigure.x;
event->configure.y = xevent->xconfigure.y;
}
window_private->x = event->configure.x;
window_private->y = event->configure.y;
window_private->width = xevent->xconfigure.width;
window_private->height = xevent->xconfigure.height;
if (window_private->resize_count > 1)
window_private->resize_count -= 1;
}
break;
......@@ -2607,7 +2598,6 @@ gdk_event_translate (GdkEvent *event,
event->property.time = xevent->xproperty.time;
event->property.state = xevent->xproperty.state;
return_val = window_private && !window_private->destroyed;
break;
case SelectionClear:
......@@ -2620,7 +2610,6 @@ gdk_event_translate (GdkEvent *event,
event->selection.selection = xevent->xselectionclear.selection;
event->selection.time = xevent->xselectionclear.time;
return_val = window_private && !window_private->destroyed;
break;
case SelectionRequest:
......@@ -2636,7 +2625,6 @@ gdk_event_translate (GdkEvent *event,
event->selection.requestor = xevent->xselectionrequest.requestor;
event->selection.time = xevent->xselectionrequest.time;
return_val = window_private && !window_private->destroyed;
break;
case SelectionNotify:
......@@ -2652,7 +2640,6 @@ gdk_event_translate (GdkEvent *event,
event->selection.property = xevent->xselection.property;
event->selection.time = xevent->xselection.time;
return_val = window_private && !window_private->destroyed;
break;
case ColormapNotify:
......@@ -2663,6 +2650,7 @@ gdk_event_translate (GdkEvent *event,
xevent->xcolormap.window - base_id));
/* Not currently handled */
return_val = FALSE;
break;
case ClientMessage:
......@@ -2705,13 +2693,9 @@ gdk_event_translate (GdkEvent *event,
event->client.data_format = xevent->xclient.format;
memcpy(&event->client.data, &xevent->xclient.data,
sizeof(event->client.data));
return_val = (window != NULL);
}
}
if(window_private)
return_val = return_val && !window_private->destroyed;
break;
case MappingNotify:
......@@ -2723,6 +2707,7 @@ gdk_event_translate (GdkEvent *event,
/* Let XLib know that there is a new keyboard mapping.
*/
XRefreshKeyboardMapping (&xevent->xmapping);
return_val = FALSE;
break;
default:
......@@ -2735,8 +2720,6 @@ gdk_event_translate (GdkEvent *event,
else
return_val = FALSE;
return_val = return_val && !window_private->destroyed;
break;
}
......@@ -3710,90 +3693,95 @@ gdk_drop_get_real_window (GdkWindow *w,
}
#endif
/*
* used only by below routine and itself
*/
static Window
getchildren (Display *dpy,
Window win,
Atom wm_state_atom)
/* Sends a ClientMessage to all toplevel client windows */
gboolean
gdk_event_send_client_message (GdkEvent *event, guint32 xid)
{
Window root, parent, *children, inf = 0;
Atom type = None;
unsigned int nchildren, i;
int format;
unsigned long nitems, after;
unsigned char *data;
if (XQueryTree(dpy, win, &root, &parent, &children, &nchildren) == 0)
return 0;
for (i = 0; !inf && (i < nchildren); i++)
{
XGetWindowProperty (dpy, children[i], wm_state_atom, 0, 0, False,
AnyPropertyType, &type, &format, &nitems,
&after, &data);
if (type != 0)
inf = children[i];
XFree(data);
}
XEvent sev;
for (i = 0; !inf && (i < nchildren); i++)
inf = getchildren (dpy, children[i], wm_state_atom);
g_return_val_if_fail(event != NULL, FALSE);
if (children != None)
XFree ((char *) children);
/* Set up our event to send, with the exception of its target window */
sev.xclient.type = ClientMessage;
sev.xclient.display = gdk_display;
sev.xclient.format = event->client.data_format;
sev.xclient.window = xid;
memcpy(&sev.xclient.data, &event->client.data, sizeof(sev.xclient.data));
sev.xclient.message_type = event->client.message_type;
return inf;
return gdk_send_xevent (xid, False, NoEventMask, &sev);
}
/*
* find a window with WM_STATE, else return win itself, as per ICCCM
*
* modification of the XmuClientWindow() routine from X11R6.3
*/
Window
gdk_get_client_window (Display *dpy,
Window win)
/* Sends a ClientMessage to all toplevel client windows */
gboolean
gdk_event_send_client_message_to_all_recurse (XEvent *xev,
guint32 xid,
gboolean send_anyways)
{
static Atom wm_state_atom = None;
static GdkAtom wm_state_atom = GDK_NONE;
Atom type = None;
int format;
unsigned long nitems, after;
unsigned char *data;
Window inf;
if (win == 0)
return DefaultRootWindow(dpy);
Window *ret_children, ret_root, ret_parent;
unsigned int ret_nchildren;
int i;
if ((wm_state_atom = XInternAtom (dpy, "WM_STATE", True)) == 0)
return win;
gboolean send = TRUE;
gboolean found = FALSE;
XGetWindowProperty (dpy, win, wm_state_atom, 0, 0, False, AnyPropertyType,
if (!wm_state_atom)
wm_state_atom = gdk_atom_intern ("WM_STATE", FALSE);
gdk_error_code = 0;
XGetWindowProperty (gdk_display, xid, wm_state_atom, 0, 0, False, AnyPropertyType,
&type, &format, &nitems, &after, &data);
if (gdk_error_code)
{
gdk_error_code = 0;
return FALSE;
}
if (type)
{
send = TRUE;
XFree (data);
return win;
}
inf = getchildren (dpy, win, wm_state_atom);
if (inf == 0)
return win;
else
return inf;
{
/* OK, we're all set, now let's find some windows to send this to */
if (XQueryTree(gdk_display, xid, &ret_root, &ret_parent,
&ret_children, &ret_nchildren) != True)
return FALSE;
if (gdk_error_code)
return FALSE;
for(i = 0; i < ret_nchildren; i++)
if (gdk_event_send_client_message_to_all_recurse(xev, ret_children[i], FALSE))
found = TRUE;
XFree(ret_children);
}
if (send || (!found && send_anyways))
{