forked from AuroraMiddleware/gtk
x11: Register DND atoms with all other atoms
It's 2020, there's no need to be restrained with registering atoms.
This commit is contained in:
parent
b0f6996892
commit
992173c382
@ -138,6 +138,7 @@ static const char *const precache_atoms[] = {
|
||||
"WM_PROTOCOLS",
|
||||
"WM_TAKE_FOCUS",
|
||||
"WM_WINDOW_ROLE",
|
||||
"WM_STATE",
|
||||
"_NET_ACTIVE_WINDOW",
|
||||
"_NET_CURRENT_DESKTOP",
|
||||
"_NET_FRAME_EXTENTS",
|
||||
@ -177,7 +178,23 @@ static const char *const precache_atoms[] = {
|
||||
"_NET_VIRTUAL_ROOTS",
|
||||
"GDK_SELECTION",
|
||||
"_NET_WM_STATE_FOCUSED",
|
||||
"GDK_VISUALS"
|
||||
"GDK_VISUALS",
|
||||
"XdndAware",
|
||||
"XdndProxy",
|
||||
"XdndActionAsk",
|
||||
"XdndActionCopy",
|
||||
"XdndActionLink",
|
||||
"XdndActionList",
|
||||
"XdndActionMove",
|
||||
"XdndActionPrivate",
|
||||
"XdndDrop",
|
||||
"XdndEnter",
|
||||
"XdndFinished",
|
||||
"XdndLeave",
|
||||
"XdndPosition",
|
||||
"XdndSelection",
|
||||
"XdndStatus",
|
||||
"XdndTypeList"
|
||||
};
|
||||
|
||||
static char *gdk_sm_client_id;
|
||||
|
@ -124,9 +124,6 @@ struct _GdkX11Display
|
||||
gulong user_time;
|
||||
|
||||
/* Sets of atoms for DND */
|
||||
guint base_dnd_atoms_precached : 1;
|
||||
guint xdnd_atoms_precached : 1;
|
||||
guint motif_atoms_precached : 1;
|
||||
guint use_sync : 1;
|
||||
|
||||
guint have_shapes : 1;
|
||||
|
@ -1242,59 +1242,6 @@ xdnd_check_dest (GdkDisplay *display,
|
||||
return retval ? (proxy ? proxy : win) : None;
|
||||
}
|
||||
|
||||
/* Target side */
|
||||
|
||||
static void
|
||||
base_precache_atoms (GdkDisplay *display)
|
||||
{
|
||||
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
|
||||
|
||||
if (!display_x11->base_dnd_atoms_precached)
|
||||
{
|
||||
static const char *const precache_atoms[] = {
|
||||
"WM_STATE",
|
||||
"XdndAware",
|
||||
"XdndProxy"
|
||||
};
|
||||
|
||||
_gdk_x11_precache_atoms (display,
|
||||
precache_atoms, G_N_ELEMENTS (precache_atoms));
|
||||
|
||||
display_x11->base_dnd_atoms_precached = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
xdnd_precache_atoms (GdkDisplay *display)
|
||||
{
|
||||
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
|
||||
|
||||
if (!display_x11->xdnd_atoms_precached)
|
||||
{
|
||||
static const gchar *const precache_atoms[] = {
|
||||
"XdndActionAsk",
|
||||
"XdndActionCopy",
|
||||
"XdndActionLink",
|
||||
"XdndActionList",
|
||||
"XdndActionMove",
|
||||
"XdndActionPrivate",
|
||||
"XdndDrop",
|
||||
"XdndEnter",
|
||||
"XdndFinished",
|
||||
"XdndLeave",
|
||||
"XdndPosition",
|
||||
"XdndSelection",
|
||||
"XdndStatus",
|
||||
"XdndTypeList"
|
||||
};
|
||||
|
||||
_gdk_x11_precache_atoms (display,
|
||||
precache_atoms, G_N_ELEMENTS (precache_atoms));
|
||||
|
||||
display_x11->xdnd_atoms_precached = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/* Source side */
|
||||
|
||||
static void
|
||||
@ -1339,8 +1286,6 @@ _gdk_x11_display_get_drag_protocol (GdkDisplay *display,
|
||||
GdkSurface *surface;
|
||||
Window retval;
|
||||
|
||||
base_precache_atoms (display);
|
||||
|
||||
/* Check for a local drag */
|
||||
surface = gdk_x11_surface_lookup_for_display (display, xid);
|
||||
if (surface)
|
||||
@ -1349,7 +1294,6 @@ _gdk_x11_display_get_drag_protocol (GdkDisplay *display,
|
||||
{
|
||||
*protocol = GDK_DRAG_PROTO_XDND;
|
||||
*version = 5;
|
||||
xdnd_precache_atoms (display);
|
||||
GDK_DISPLAY_NOTE (display, DND, g_message ("Entering local Xdnd window %#x\n", (guint) xid));
|
||||
return xid;
|
||||
}
|
||||
@ -1363,7 +1307,6 @@ _gdk_x11_display_get_drag_protocol (GdkDisplay *display,
|
||||
else if ((retval = xdnd_check_dest (display, xid, version)))
|
||||
{
|
||||
*protocol = GDK_DRAG_PROTO_XDND;
|
||||
xdnd_precache_atoms (display);
|
||||
GDK_DISPLAY_NOTE (display, DND, g_message ("Entering Xdnd window %#x\n", (guint) xid));
|
||||
return retval;
|
||||
}
|
||||
@ -1639,8 +1582,6 @@ _gdk_x11_surface_register_dnd (GdkSurface *surface)
|
||||
|
||||
g_return_if_fail (surface != NULL);
|
||||
|
||||
base_precache_atoms (display);
|
||||
|
||||
if (g_object_get_data (G_OBJECT (surface), "gdk-dnd-registered") != NULL)
|
||||
return;
|
||||
else
|
||||
|
@ -430,37 +430,6 @@ xdnd_source_surface_filter (GdkDisplay *display,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
xdnd_precache_atoms (GdkDisplay *display)
|
||||
{
|
||||
GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
|
||||
|
||||
if (!display_x11->xdnd_atoms_precached)
|
||||
{
|
||||
static const gchar *const precache_atoms[] = {
|
||||
"XdndActionAsk",
|
||||
"XdndActionCopy",
|
||||
"XdndActionLink",
|
||||
"XdndActionList",
|
||||
"XdndActionMove",
|
||||
"XdndActionPrivate",
|
||||
"XdndDrop",
|
||||
"XdndEnter",
|
||||
"XdndFinished",
|
||||
"XdndLeave",
|
||||
"XdndPosition",
|
||||
"XdndSelection",
|
||||
"XdndStatus",
|
||||
"XdndTypeList"
|
||||
};
|
||||
|
||||
_gdk_x11_precache_atoms (display,
|
||||
precache_atoms, G_N_ELEMENTS (precache_atoms));
|
||||
|
||||
display_x11->xdnd_atoms_precached = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
xdnd_enter_filter (GdkSurface *surface,
|
||||
const XEvent *xevent)
|
||||
@ -490,8 +459,6 @@ xdnd_enter_filter (GdkSurface *surface,
|
||||
display = gdk_surface_get_display (surface);
|
||||
display_x11 = GDK_X11_DISPLAY (display);
|
||||
|
||||
xdnd_precache_atoms (display);
|
||||
|
||||
GDK_DISPLAY_NOTE (display, DND,
|
||||
g_message ("XdndEnter: source_window: %#lx, version: %#x",
|
||||
source_window, version));
|
||||
@ -608,8 +575,6 @@ xdnd_leave_filter (GdkSurface *surface,
|
||||
g_message ("XdndLeave: source_window: %#lx",
|
||||
source_window));
|
||||
|
||||
xdnd_precache_atoms (display);
|
||||
|
||||
if ((display_x11->current_drop != NULL) &&
|
||||
(GDK_X11_DROP (display_x11->current_drop)->source_window == source_window))
|
||||
{
|
||||
@ -644,8 +609,6 @@ xdnd_position_filter (GdkSurface *surface,
|
||||
g_message ("XdndPosition: source_window: %#lx position: (%d, %d) time: %d action: %ld",
|
||||
source_window, x_root, y_root, time, action));
|
||||
|
||||
xdnd_precache_atoms (display);
|
||||
|
||||
drop = display_x11->current_drop;
|
||||
drop_x11 = GDK_X11_DROP (drop);
|
||||
|
||||
@ -693,8 +656,6 @@ xdnd_drop_filter (GdkSurface *surface,
|
||||
g_message ("XdndDrop: source_window: %#lx time: %d",
|
||||
source_window, time));
|
||||
|
||||
xdnd_precache_atoms (display);
|
||||
|
||||
drop = display_x11->current_drop;
|
||||
drop_x11 = GDK_X11_DROP (drop);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user