API: gdk: Make GdkEventSelection.requestor a GdkWindow
instead of a GdkNativeWindow. Also change gdk_selection_notify() API to take a GdkWindow to match this change.
This commit is contained in:
@ -202,7 +202,7 @@ struct _GdkDisplayClass
|
|||||||
guint32 time,
|
guint32 time,
|
||||||
gboolean send_event);
|
gboolean send_event);
|
||||||
void (*send_selection_notify) (GdkDisplay *dispay,
|
void (*send_selection_notify) (GdkDisplay *dispay,
|
||||||
GdkNativeWindow requestor,
|
GdkWindow *requestor,
|
||||||
GdkAtom selection,
|
GdkAtom selection,
|
||||||
GdkAtom target,
|
GdkAtom target,
|
||||||
GdkAtom property,
|
GdkAtom property,
|
||||||
|
|||||||
@ -573,6 +573,14 @@ gdk_event_copy (const GdkEvent *event)
|
|||||||
g_object_ref (new_event->owner_change.owner);
|
g_object_ref (new_event->owner_change.owner);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GDK_SELECTION_CLEAR:
|
||||||
|
case GDK_SELECTION_NOTIFY:
|
||||||
|
case GDK_SELECTION_REQUEST:
|
||||||
|
new_event->selection.requestor = event->selection.requestor;
|
||||||
|
if (new_event->selection.requestor)
|
||||||
|
g_object_unref (new_event->selection.requestor);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -647,6 +655,13 @@ gdk_event_free (GdkEvent *event)
|
|||||||
g_object_unref (event->owner_change.owner);
|
g_object_unref (event->owner_change.owner);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case GDK_SELECTION_CLEAR:
|
||||||
|
case GDK_SELECTION_NOTIFY:
|
||||||
|
case GDK_SELECTION_REQUEST:
|
||||||
|
if (event->selection.requestor)
|
||||||
|
g_object_unref (event->selection.requestor);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -798,7 +798,7 @@ struct _GdkEventProperty
|
|||||||
* @target: the target to which the selection should be converted.
|
* @target: the target to which the selection should be converted.
|
||||||
* @property: the property in which to place the result of the conversion.
|
* @property: the property in which to place the result of the conversion.
|
||||||
* @time: the time of the event in milliseconds.
|
* @time: the time of the event in milliseconds.
|
||||||
* @requestor: the native window on which to place @property.
|
* @requestor: the window on which to place @property or %NULL if none.
|
||||||
*
|
*
|
||||||
* Generated when a selection is requested or ownership of a selection
|
* Generated when a selection is requested or ownership of a selection
|
||||||
* is taken over by another client application.
|
* is taken over by another client application.
|
||||||
@ -812,7 +812,7 @@ struct _GdkEventSelection
|
|||||||
GdkAtom target;
|
GdkAtom target;
|
||||||
GdkAtom property;
|
GdkAtom property;
|
||||||
guint32 time;
|
guint32 time;
|
||||||
GdkNativeWindow requestor;
|
GdkWindow *requestor;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -126,13 +126,13 @@ gdk_selection_owner_get (GdkAtom selection)
|
|||||||
* Sends a response to SelectionRequest event.
|
* Sends a response to SelectionRequest event.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gdk_selection_send_notify (GdkNativeWindow requestor,
|
gdk_selection_send_notify (GdkWindow *requestor,
|
||||||
GdkAtom selection,
|
GdkAtom selection,
|
||||||
GdkAtom target,
|
GdkAtom target,
|
||||||
GdkAtom property,
|
GdkAtom property,
|
||||||
guint32 time)
|
guint32 time)
|
||||||
{
|
{
|
||||||
gdk_selection_send_notify_for_display (gdk_display_get_default (),
|
gdk_selection_send_notify_for_display (gdk_window_get_display (requestor),
|
||||||
requestor, selection,
|
requestor, selection,
|
||||||
target, property, time);
|
target, property, time);
|
||||||
}
|
}
|
||||||
@ -213,7 +213,7 @@ gdk_selection_owner_get_for_display (GdkDisplay *display,
|
|||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
gdk_selection_send_notify_for_display (GdkDisplay *display,
|
gdk_selection_send_notify_for_display (GdkDisplay *display,
|
||||||
GdkNativeWindow requestor,
|
GdkWindow *requestor,
|
||||||
GdkAtom selection,
|
GdkAtom selection,
|
||||||
GdkAtom target,
|
GdkAtom target,
|
||||||
GdkAtom property,
|
GdkAtom property,
|
||||||
|
|||||||
@ -192,16 +192,14 @@ gint gdk_selection_property_get (GdkWindow *requestor,
|
|||||||
GdkAtom *prop_type,
|
GdkAtom *prop_type,
|
||||||
gint *prop_format);
|
gint *prop_format);
|
||||||
|
|
||||||
#ifndef GDK_MULTIHEAD_SAFE
|
void gdk_selection_send_notify (GdkWindow *requestor,
|
||||||
void gdk_selection_send_notify (GdkNativeWindow requestor,
|
|
||||||
GdkAtom selection,
|
GdkAtom selection,
|
||||||
GdkAtom target,
|
GdkAtom target,
|
||||||
GdkAtom property,
|
GdkAtom property,
|
||||||
guint32 time_);
|
guint32 time_);
|
||||||
#endif /* GDK_MULTIHEAD_SAFE */
|
|
||||||
|
|
||||||
void gdk_selection_send_notify_for_display (GdkDisplay *display,
|
void gdk_selection_send_notify_for_display (GdkDisplay *display,
|
||||||
GdkNativeWindow requestor,
|
GdkWindow *requestor,
|
||||||
GdkAtom selection,
|
GdkAtom selection,
|
||||||
GdkAtom target,
|
GdkAtom target,
|
||||||
GdkAtom property,
|
GdkAtom property,
|
||||||
|
|||||||
@ -814,7 +814,11 @@ gdk_x11_display_translate_event (GdkEventTranslator *translator,
|
|||||||
event->selection.selection = gdk_x11_xatom_to_atom_for_display (display, xevent->xselectionrequest.selection);
|
event->selection.selection = gdk_x11_xatom_to_atom_for_display (display, xevent->xselectionrequest.selection);
|
||||||
event->selection.target = gdk_x11_xatom_to_atom_for_display (display, xevent->xselectionrequest.target);
|
event->selection.target = gdk_x11_xatom_to_atom_for_display (display, xevent->xselectionrequest.target);
|
||||||
event->selection.property = gdk_x11_xatom_to_atom_for_display (display, xevent->xselectionrequest.property);
|
event->selection.property = gdk_x11_xatom_to_atom_for_display (display, xevent->xselectionrequest.property);
|
||||||
event->selection.requestor = xevent->xselectionrequest.requestor;
|
if (xevent->xselectionrequest.requestor != None)
|
||||||
|
event->selection.requestor = gdk_x11_window_foreign_new_for_display (display,
|
||||||
|
xevent->xselectionrequest.requestor);
|
||||||
|
else
|
||||||
|
event->selection.requestor = NULL;
|
||||||
event->selection.time = xevent->xselectionrequest.time;
|
event->selection.time = xevent->xselectionrequest.time;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -190,7 +190,7 @@ gboolean _gdk_x11_display_set_selection_owner (GdkDisplay *display,
|
|||||||
GdkWindow * _gdk_x11_display_get_selection_owner (GdkDisplay *display,
|
GdkWindow * _gdk_x11_display_get_selection_owner (GdkDisplay *display,
|
||||||
GdkAtom selection);
|
GdkAtom selection);
|
||||||
void _gdk_x11_display_send_selection_notify (GdkDisplay *display,
|
void _gdk_x11_display_send_selection_notify (GdkDisplay *display,
|
||||||
GdkNativeWindow requestor,
|
GdkWindow *requestor,
|
||||||
GdkAtom selection,
|
GdkAtom selection,
|
||||||
GdkAtom target,
|
GdkAtom target,
|
||||||
GdkAtom property,
|
GdkAtom property,
|
||||||
|
|||||||
@ -308,7 +308,7 @@ _gdk_x11_display_get_selection_property (GdkDisplay *display,
|
|||||||
|
|
||||||
void
|
void
|
||||||
_gdk_x11_display_send_selection_notify (GdkDisplay *display,
|
_gdk_x11_display_send_selection_notify (GdkDisplay *display,
|
||||||
GdkNativeWindow requestor,
|
GdkWindow *requestor,
|
||||||
GdkAtom selection,
|
GdkAtom selection,
|
||||||
GdkAtom target,
|
GdkAtom target,
|
||||||
GdkAtom property,
|
GdkAtom property,
|
||||||
@ -319,7 +319,7 @@ _gdk_x11_display_send_selection_notify (GdkDisplay *display,
|
|||||||
xevent.type = SelectionNotify;
|
xevent.type = SelectionNotify;
|
||||||
xevent.serial = 0;
|
xevent.serial = 0;
|
||||||
xevent.send_event = True;
|
xevent.send_event = True;
|
||||||
xevent.requestor = requestor;
|
xevent.requestor = GDK_WINDOW_XID (requestor);
|
||||||
xevent.selection = gdk_x11_atom_to_xatom_for_display (display, selection);
|
xevent.selection = gdk_x11_atom_to_xatom_for_display (display, selection);
|
||||||
xevent.target = gdk_x11_atom_to_xatom_for_display (display, target);
|
xevent.target = gdk_x11_atom_to_xatom_for_display (display, target);
|
||||||
if (property == GDK_NONE)
|
if (property == GDK_NONE)
|
||||||
@ -328,7 +328,7 @@ _gdk_x11_display_send_selection_notify (GdkDisplay *display,
|
|||||||
xevent.property = gdk_x11_atom_to_xatom_for_display (display, property);
|
xevent.property = gdk_x11_atom_to_xatom_for_display (display, property);
|
||||||
xevent.time = time;
|
xevent.time = time;
|
||||||
|
|
||||||
_gdk_x11_display_send_xevent (display, requestor, False, NoEventMask, (XEvent*) & xevent);
|
_gdk_x11_display_send_xevent (display, xevent.requestor, False, NoEventMask, (XEvent*) & xevent);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -876,7 +876,9 @@ x_event_mask_to_gdk_event_mask (long mask)
|
|||||||
* @display: the #GdkDisplay where the window handle comes from.
|
* @display: the #GdkDisplay where the window handle comes from.
|
||||||
* @window: an XLib <type>Window</type>
|
* @window: an XLib <type>Window</type>
|
||||||
*
|
*
|
||||||
* Wraps a native window in a #GdkWindow.
|
* Wraps a native window in a #GdkWindow. The function will try to
|
||||||
|
* look up the window using gdk_x11_window_lookup_for_display() first.
|
||||||
|
* If it does not find it there, it will create a new window.
|
||||||
*
|
*
|
||||||
* This may fail if the window has been destroyed. If the window
|
* This may fail if the window has been destroyed. If the window
|
||||||
* was already known to GDK, a new reference to the existing
|
* was already known to GDK, a new reference to the existing
|
||||||
|
|||||||
@ -2324,15 +2324,7 @@ _gtk_selection_request (GtkWidget *widget,
|
|||||||
|
|
||||||
info->selection = event->selection;
|
info->selection = event->selection;
|
||||||
info->num_incrs = 0;
|
info->num_incrs = 0;
|
||||||
|
info->requestor = g_object_ref (event->requestor);
|
||||||
/* Create GdkWindow structure for the requestor */
|
|
||||||
|
|
||||||
#ifdef GDK_WINDOWING_X11
|
|
||||||
if (GDK_IS_X11_DISPLAY (display))
|
|
||||||
info->requestor = gdk_x11_window_foreign_new_for_display (display, event->requestor);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
info->requestor = NULL;
|
|
||||||
|
|
||||||
/* Determine conversions we need to perform */
|
/* Determine conversions we need to perform */
|
||||||
if (event->target == gtk_selection_atoms[MULTIPLE])
|
if (event->target == gtk_selection_atoms[MULTIPLE])
|
||||||
|
|||||||
Reference in New Issue
Block a user