Commit ba999da1 authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Lookup all the atoms in the target list at once.

Sat Jul  5 09:55:38 2003  Owen Taylor  <otaylor@redhat.com>

        * gdk/x11/gdkdnd-x11.c (precache_target_list): Lookup
        all the atoms in the target list at once.

        * gdk/x11/gdkdnd-x11.c (gdk_drag_get_protocol_for_display):
        Local drag short-circuit.

        * gdk/x11/gdkdnd-x11.c (gdk_drag_motion): For the
        local case, poke the actions in directly instead of
        going through xdnd_set_actions.

        * gdk/x11/gdkdnd-x11.c (xdnd_read_actions): Short-circuit
        the local case.

        * gdk/x11/gdkdnd-x11.c (xdnd_manage_source_filter): Don't
        XSelectInput()/add a filter if the drag is local.

        * gdk/x11/gdkdnd-x11.c (gdk_drag_get_selection):
        Simplify handling of "XdndSelection".

        * gdk/x11/gdkevents-x11.c (gdk_event_send_client_message_to_all_recurse): Somehow,
        a WM_STATE => _NET_WM_STATE change hand been made here.

        * gdk/x11/gdkproperty-x11.c (_gdk_x11_precache_atoms): Free
        xatom_names, not atom_names.

        * tests/testdnd.c (target_drag_motion): Make the trashcan
        open again. (Got lost in deprecation cleanup.)
parent e5561940
Sat Jul 5 09:55:38 2003 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdnd-x11.c (precache_target_list): Lookup
all the atoms in the target list at once.
* gdk/x11/gdkdnd-x11.c (gdk_drag_get_protocol_for_display):
Local drag short-circuit.
* gdk/x11/gdkdnd-x11.c (gdk_drag_motion): For the
local case, poke the actions in directly instead of
going through xdnd_set_actions.
* gdk/x11/gdkdnd-x11.c (xdnd_read_actions): Short-circuit
the local case.
* gdk/x11/gdkdnd-x11.c (xdnd_manage_source_filter): Don't
XSelectInput()/add a filter if the drag is local.
* gdk/x11/gdkdnd-x11.c (gdk_drag_get_selection):
Simplify handling of "XdndSelection".
* gdk/x11/gdkevents-x11.c (gdk_event_send_client_message_to_all_recurse): Somehow,
a WM_STATE => _NET_WM_STATE change hand been made here.
* gdk/x11/gdkproperty-x11.c (_gdk_x11_precache_atoms): Free
xatom_names, not atom_names.
* tests/testdnd.c (target_drag_motion): Make the trashcan
open again. (Got lost in deprecation cleanup.)
Sat Jul 5 00:49:32 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c (gtk_drag_begin): Move the grabs up
earlier, so we don't get a big pile of uncompressed
motion events before the grab takes effect.
* gtk/gtkdnd.c (gtk_drag_update_icon): Call
gdk_window_process_all_updates() so that the area
we are dragging over gets a change to redraw.
* gtk/gtkdnd.c (_gtk_drag_dest_handle_event): Use
gdk_window_get_position(), not gdk_window_get_origin().
* gdk/x11/gdkwindow-x11.[ch] (gdk_window_have_shape_ext)
gdkdisplay-x11.h: use XShapeQueryExtension to
avoid duplicate XQueryExtension when we actually
use it. Remove unnecessary caching in GdkDisplayX11.
Fri Jul 4 23:49:22 2003 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkasync.[ch] (_gdk_x11_get_window_child_info):
......
Sat Jul 5 09:55:38 2003 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdnd-x11.c (precache_target_list): Lookup
all the atoms in the target list at once.
* gdk/x11/gdkdnd-x11.c (gdk_drag_get_protocol_for_display):
Local drag short-circuit.
* gdk/x11/gdkdnd-x11.c (gdk_drag_motion): For the
local case, poke the actions in directly instead of
going through xdnd_set_actions.
* gdk/x11/gdkdnd-x11.c (xdnd_read_actions): Short-circuit
the local case.
* gdk/x11/gdkdnd-x11.c (xdnd_manage_source_filter): Don't
XSelectInput()/add a filter if the drag is local.
* gdk/x11/gdkdnd-x11.c (gdk_drag_get_selection):
Simplify handling of "XdndSelection".
* gdk/x11/gdkevents-x11.c (gdk_event_send_client_message_to_all_recurse): Somehow,
a WM_STATE => _NET_WM_STATE change hand been made here.
* gdk/x11/gdkproperty-x11.c (_gdk_x11_precache_atoms): Free
xatom_names, not atom_names.
* tests/testdnd.c (target_drag_motion): Make the trashcan
open again. (Got lost in deprecation cleanup.)
Sat Jul 5 00:49:32 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c (gtk_drag_begin): Move the grabs up
earlier, so we don't get a big pile of uncompressed
motion events before the grab takes effect.
* gtk/gtkdnd.c (gtk_drag_update_icon): Call
gdk_window_process_all_updates() so that the area
we are dragging over gets a change to redraw.
* gtk/gtkdnd.c (_gtk_drag_dest_handle_event): Use
gdk_window_get_position(), not gdk_window_get_origin().
* gdk/x11/gdkwindow-x11.[ch] (gdk_window_have_shape_ext)
gdkdisplay-x11.h: use XShapeQueryExtension to
avoid duplicate XQueryExtension when we actually
use it. Remove unnecessary caching in GdkDisplayX11.
Fri Jul 4 23:49:22 2003 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkasync.[ch] (_gdk_x11_get_window_child_info):
......
Sat Jul 5 09:55:38 2003 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdnd-x11.c (precache_target_list): Lookup
all the atoms in the target list at once.
* gdk/x11/gdkdnd-x11.c (gdk_drag_get_protocol_for_display):
Local drag short-circuit.
* gdk/x11/gdkdnd-x11.c (gdk_drag_motion): For the
local case, poke the actions in directly instead of
going through xdnd_set_actions.
* gdk/x11/gdkdnd-x11.c (xdnd_read_actions): Short-circuit
the local case.
* gdk/x11/gdkdnd-x11.c (xdnd_manage_source_filter): Don't
XSelectInput()/add a filter if the drag is local.
* gdk/x11/gdkdnd-x11.c (gdk_drag_get_selection):
Simplify handling of "XdndSelection".
* gdk/x11/gdkevents-x11.c (gdk_event_send_client_message_to_all_recurse): Somehow,
a WM_STATE => _NET_WM_STATE change hand been made here.
* gdk/x11/gdkproperty-x11.c (_gdk_x11_precache_atoms): Free
xatom_names, not atom_names.
* tests/testdnd.c (target_drag_motion): Make the trashcan
open again. (Got lost in deprecation cleanup.)
Sat Jul 5 00:49:32 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c (gtk_drag_begin): Move the grabs up
earlier, so we don't get a big pile of uncompressed
motion events before the grab takes effect.
* gtk/gtkdnd.c (gtk_drag_update_icon): Call
gdk_window_process_all_updates() so that the area
we are dragging over gets a change to redraw.
* gtk/gtkdnd.c (_gtk_drag_dest_handle_event): Use
gdk_window_get_position(), not gdk_window_get_origin().
* gdk/x11/gdkwindow-x11.[ch] (gdk_window_have_shape_ext)
gdkdisplay-x11.h: use XShapeQueryExtension to
avoid duplicate XQueryExtension when we actually
use it. Remove unnecessary caching in GdkDisplayX11.
Fri Jul 4 23:49:22 2003 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkasync.[ch] (_gdk_x11_get_window_child_info):
......
Sat Jul 5 09:55:38 2003 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdnd-x11.c (precache_target_list): Lookup
all the atoms in the target list at once.
* gdk/x11/gdkdnd-x11.c (gdk_drag_get_protocol_for_display):
Local drag short-circuit.
* gdk/x11/gdkdnd-x11.c (gdk_drag_motion): For the
local case, poke the actions in directly instead of
going through xdnd_set_actions.
* gdk/x11/gdkdnd-x11.c (xdnd_read_actions): Short-circuit
the local case.
* gdk/x11/gdkdnd-x11.c (xdnd_manage_source_filter): Don't
XSelectInput()/add a filter if the drag is local.
* gdk/x11/gdkdnd-x11.c (gdk_drag_get_selection):
Simplify handling of "XdndSelection".
* gdk/x11/gdkevents-x11.c (gdk_event_send_client_message_to_all_recurse): Somehow,
a WM_STATE => _NET_WM_STATE change hand been made here.
* gdk/x11/gdkproperty-x11.c (_gdk_x11_precache_atoms): Free
xatom_names, not atom_names.
* tests/testdnd.c (target_drag_motion): Make the trashcan
open again. (Got lost in deprecation cleanup.)
Sat Jul 5 00:49:32 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c (gtk_drag_begin): Move the grabs up
earlier, so we don't get a big pile of uncompressed
motion events before the grab takes effect.
* gtk/gtkdnd.c (gtk_drag_update_icon): Call
gdk_window_process_all_updates() so that the area
we are dragging over gets a change to redraw.
* gtk/gtkdnd.c (_gtk_drag_dest_handle_event): Use
gdk_window_get_position(), not gdk_window_get_origin().
* gdk/x11/gdkwindow-x11.[ch] (gdk_window_have_shape_ext)
gdkdisplay-x11.h: use XShapeQueryExtension to
avoid duplicate XQueryExtension when we actually
use it. Remove unnecessary caching in GdkDisplayX11.
Fri Jul 4 23:49:22 2003 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkasync.[ch] (_gdk_x11_get_window_child_info):
......
Sat Jul 5 09:55:38 2003 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkdnd-x11.c (precache_target_list): Lookup
all the atoms in the target list at once.
* gdk/x11/gdkdnd-x11.c (gdk_drag_get_protocol_for_display):
Local drag short-circuit.
* gdk/x11/gdkdnd-x11.c (gdk_drag_motion): For the
local case, poke the actions in directly instead of
going through xdnd_set_actions.
* gdk/x11/gdkdnd-x11.c (xdnd_read_actions): Short-circuit
the local case.
* gdk/x11/gdkdnd-x11.c (xdnd_manage_source_filter): Don't
XSelectInput()/add a filter if the drag is local.
* gdk/x11/gdkdnd-x11.c (gdk_drag_get_selection):
Simplify handling of "XdndSelection".
* gdk/x11/gdkevents-x11.c (gdk_event_send_client_message_to_all_recurse): Somehow,
a WM_STATE => _NET_WM_STATE change hand been made here.
* gdk/x11/gdkproperty-x11.c (_gdk_x11_precache_atoms): Free
xatom_names, not atom_names.
* tests/testdnd.c (target_drag_motion): Make the trashcan
open again. (Got lost in deprecation cleanup.)
Sat Jul 5 00:49:32 2003 Owen Taylor <otaylor@redhat.com>
* gtk/gtkdnd.c (gtk_drag_begin): Move the grabs up
earlier, so we don't get a big pile of uncompressed
motion events before the grab takes effect.
* gtk/gtkdnd.c (gtk_drag_update_icon): Call
gdk_window_process_all_updates() so that the area
we are dragging over gets a change to redraw.
* gtk/gtkdnd.c (_gtk_drag_dest_handle_event): Use
gdk_window_get_position(), not gdk_window_get_origin().
* gdk/x11/gdkwindow-x11.[ch] (gdk_window_have_shape_ext)
gdkdisplay-x11.h: use XShapeQueryExtension to
avoid duplicate XQueryExtension when we actually
use it. Remove unnecessary caching in GdkDisplayX11.
Fri Jul 4 23:49:22 2003 Owen Taylor <otaylor@redhat.com>
* gdk/x11/gdkasync.[ch] (_gdk_x11_get_window_child_info):
......
......@@ -49,6 +49,7 @@ in this Software without prior written authorization from The Open Group.
typedef struct _ChildInfoChildState ChildInfoChildState;
typedef struct _ChildInfoState ChildInfoState;
typedef struct _ListChildrenState ListChildrenState;
typedef struct _SendEventState SendEventState;
typedef struct _SetInputFocusState SetInputFocusState;
......@@ -78,6 +79,14 @@ struct _ChildInfoState
gboolean child_has_error;
};
struct _ListChildrenState
{
Display *dpy;
gulong get_property_req;
gboolean have_error;
gboolean has_wm_state;
};
struct _SendEventState
{
Display *dpy;
......@@ -316,6 +325,116 @@ _gdk_x11_set_input_focus_safe (GdkDisplay *display,
SyncHandle();
}
static Bool
list_children_handler (Display *dpy,
xReply *rep,
char *buf,
int len,
XPointer data)
{
ListChildrenState *state = (ListChildrenState *)data;
if (dpy->last_request_read != state->get_property_req)
return False;
if (rep->generic.type == X_Error)
{
state->have_error = TRUE;
return False;
}
else
{
xGetPropertyReply replbuf;
xGetPropertyReply *repl;
repl = (xGetPropertyReply *)
_XGetAsyncReply(dpy, (char *)&replbuf, rep, buf, len,
(sizeof(xGetPropertyReply) - sizeof(xReply)) >> 2,
True);
state->has_wm_state = repl->propertyType != None;
/* Since we called GetProperty with longLength of 0, we don't
* have to worry about consuming the property data that would
* normally follow after the reply
*/
return True;
}
}
static gboolean
list_children_and_wm_state (Display *dpy,
Window w,
Atom wm_state_atom,
gboolean *has_wm_state,
Window **children,
unsigned int *nchildren)
{
ListChildrenState state;
_XAsyncHandler async;
long nbytes;
xQueryTreeReply rep;
register xResourceReq *req;
xGetPropertyReq *prop_req;
LockDisplay(dpy);
*children = NULL;
*nchildren = 0;
*has_wm_state = FALSE;
state.have_error = FALSE;
state.has_wm_state = FALSE;
if (wm_state_atom)
{
async.next = dpy->async_handlers;
async.handler = list_children_handler;
async.data = (XPointer) &state;
dpy->async_handlers = &async;
GetReq (GetProperty, prop_req);
prop_req->window = w;
prop_req->property = wm_state_atom;
prop_req->type = AnyPropertyType;
prop_req->delete = False;
prop_req->longOffset = 0;
prop_req->longLength = 0;
state.get_property_req = dpy->request;
}
GetResReq(QueryTree, w, req);
if (!_XReply(dpy, (xReply *)&rep, 0, xFalse))
{
state.have_error = TRUE;
goto out;
}
if (rep.nChildren != 0)
{
nbytes = rep.nChildren << 2;
if (state.have_error)
{
_XEatData(dpy, (unsigned long) nbytes);
goto out;
}
*children = g_new (Window, rep.nChildren);
_XRead32 (dpy, (long *) *children, nbytes);
}
*nchildren = rep.nChildren;
*has_wm_state = state.has_wm_state;
out:
if (wm_state_atom)
DeqAsyncHandler(dpy, &async);
UnlockDisplay(dpy);
SyncHandle();
return !state.have_error;
}
static void
handle_get_wa_reply (Display *dpy,
ChildInfoState *state,
......@@ -454,14 +573,15 @@ gboolean
_gdk_x11_get_window_child_info (GdkDisplay *display,
Window window,
gboolean get_wm_state,
gboolean *win_has_wm_state,
GdkChildInfoX11 **children,
guint *nchildren)
{
Display *dpy;
_XAsyncHandler async;
ChildInfoState state;
Window root, parent;
Atom wm_state_atom;
gboolean has_wm_state;
Bool result;
guint i;
......@@ -469,15 +589,32 @@ _gdk_x11_get_window_child_info (GdkDisplay *display,
*nchildren = 0;
dpy = GDK_DISPLAY_XDISPLAY (display);
wm_state_atom = gdk_x11_get_xatom_by_name_for_display (display, "WM_STATE");
if (get_wm_state)
wm_state_atom = gdk_x11_get_xatom_by_name_for_display (display, "WM_STATE");
else
wm_state_atom = None;
gdk_error_trap_push ();
result = XQueryTree (dpy, window, &root, &parent,
&state.children, &state.nchildren);
result = list_children_and_wm_state (dpy, window,
win_has_wm_state ? wm_state_atom : None,
&has_wm_state,
&state.children, &state.nchildren);
gdk_error_trap_pop ();
if (!result)
return FALSE;
if (has_wm_state)
{
if (win_has_wm_state)
*win_has_wm_state = TRUE;
return TRUE;
}
else
{
if (win_has_wm_state)
*win_has_wm_state = FALSE;
}
state.get_wm_state = get_wm_state;
state.child_info = g_new (GdkChildInfoX11, state.nchildren);
state.child_states = g_new (ChildInfoChildState, state.nchildren);
......@@ -547,7 +684,7 @@ _gdk_x11_get_window_child_info (GdkDisplay *display,
g_free (state.child_info);
}
XFree (state.children);
g_free (state.children);
g_free (state.child_states);
DeqAsyncHandler(dpy, &async);
......
......@@ -59,6 +59,7 @@ void _gdk_x11_set_input_focus_safe (GdkDisplay *display,
gboolean _gdk_x11_get_window_child_info (GdkDisplay *display,
Window window,
gboolean get_wm_state,
gboolean *win_has_wm_state,
GdkChildInfoX11 **children,
guint *nchildren);
......
......@@ -136,6 +136,11 @@ struct _GdkDisplayX11
/* Startup notification */
gchar *startup_notification_id;
/* Sets of atoms for DND */
guint base_dnd_atoms_precached : 1;
guint xdnd_atoms_precached : 1;
guint motif_atoms_precached : 1;
};
struct _GdkDisplayX11Class
......
This diff is collapsed.
......@@ -2095,7 +2095,7 @@ gdk_event_send_client_message_to_all_recurse (GdkDisplay *display,
gdk_error_trap_push ();
if (XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), xid,
gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_STATE"),
gdk_x11_get_xatom_by_name_for_display (display, "WM_STATE"),
0, 0, False, AnyPropertyType,
&type, &format, &nitems, &after, &data) != Success)
goto out;
......
......@@ -234,8 +234,8 @@ _gdk_x11_precache_atoms (GdkDisplay *display,
insert_atom_pair (display, atoms[i], xatoms[i]);
g_free (xatoms);
g_free (xatom_names);
g_free (atoms);
g_free (atom_names);
}
/**
......
......@@ -311,7 +311,7 @@ target_drag_motion (GtkWidget *widget,
{
have_drag = TRUE;
gtk_image_set_from_pixmap (GTK_IMAGE (widget),
trashcan_closed, trashcan_closed_mask);
trashcan_open, trashcan_open_mask);
}
source_widget = gtk_drag_get_source_widget (context);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment