Add vfuncs for get/set_selection_owner
This commit is contained in:
@ -196,6 +196,14 @@ struct _GdkDisplayClass
|
|||||||
gint (*pop_error_trap) (GdkDisplay *display,
|
gint (*pop_error_trap) (GdkDisplay *display,
|
||||||
gboolean ignore);
|
gboolean ignore);
|
||||||
|
|
||||||
|
GdkWindow * (*get_selection_owner) (GdkDisplay *display,
|
||||||
|
GdkAtom selection);
|
||||||
|
gboolean (*set_selection_owner) (GdkDisplay *display,
|
||||||
|
GdkWindow *owner,
|
||||||
|
GdkAtom selection,
|
||||||
|
guint32 time,
|
||||||
|
gboolean send_event);
|
||||||
|
|
||||||
/* Signals */
|
/* Signals */
|
||||||
void (*closed) (GdkDisplay *display,
|
void (*closed) (GdkDisplay *display,
|
||||||
gboolean is_error);
|
gboolean is_error);
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include "gdkselection.h"
|
#include "gdkselection.h"
|
||||||
|
|
||||||
#include "gdkproperty.h"
|
#include "gdkproperty.h"
|
||||||
#include "gdkdisplay.h"
|
#include "gdkdisplayprivate.h"
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -246,3 +246,63 @@ gdk_utf8_to_compound_text (const gchar *str,
|
|||||||
str, encoding, format,
|
str, encoding, format,
|
||||||
ctext, length);
|
ctext, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gdk_selection_owner_set_for_display:
|
||||||
|
* @display: the #GdkDisplay
|
||||||
|
* @owner: a #GdkWindow or %NULL to indicate that the owner for
|
||||||
|
* the given should be unset
|
||||||
|
* @selection: an atom identifying a selection
|
||||||
|
* @time_: timestamp to use when setting the selection
|
||||||
|
* If this is older than the timestamp given last time the owner was
|
||||||
|
* set for the given selection, the request will be ignored
|
||||||
|
* @send_event: if %TRUE, and the new owner is different from the current
|
||||||
|
* owner, the current owner will be sent a SelectionClear event
|
||||||
|
*
|
||||||
|
* Sets the #GdkWindow @owner as the current owner of the selection @selection.
|
||||||
|
*
|
||||||
|
* Returns: %TRUE if the selection owner was successfully changed to owner,
|
||||||
|
* otherwise %FALSE.
|
||||||
|
*
|
||||||
|
* Since: 2.2
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
gdk_selection_owner_set_for_display (GdkDisplay *display,
|
||||||
|
GdkWindow *owner,
|
||||||
|
GdkAtom selection,
|
||||||
|
guint32 time,
|
||||||
|
gboolean send_event)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
|
||||||
|
g_return_val_if_fail (selection != GDK_NONE, FALSE);
|
||||||
|
|
||||||
|
return GDK_DISPLAY_GET_CLASS (display)
|
||||||
|
->set_selection_owner (display, owner, selection, time, send_event);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gdk_selection_owner_get_for_display:
|
||||||
|
* @display: a #GdkDisplay
|
||||||
|
* @selection: an atom indentifying a selection
|
||||||
|
*
|
||||||
|
* Determine the owner of the given selection.
|
||||||
|
*
|
||||||
|
* Note that the return value may be owned by a different
|
||||||
|
* process if a foreign window was previously created for that
|
||||||
|
* window, but a new foreign window will never be created by this call.
|
||||||
|
*
|
||||||
|
* Returns: (transfer none): if there is a selection owner for this window,
|
||||||
|
* and it is a window known to the current process, the #GdkWindow that
|
||||||
|
* owns the selection, otherwise %NULL.
|
||||||
|
*
|
||||||
|
* Since: 2.2
|
||||||
|
*/
|
||||||
|
GdkWindow *
|
||||||
|
gdk_selection_owner_get_for_display (GdkDisplay *display,
|
||||||
|
GdkAtom selection)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
|
||||||
|
g_return_val_if_fail (selection != GDK_NONE, NULL);
|
||||||
|
|
||||||
|
return GDK_DISPLAY_GET_CLASS (display)->get_selection_owner (display, selection);
|
||||||
|
}
|
||||||
|
@ -2760,4 +2760,6 @@ _gdk_display_x11_class_init (GdkDisplayX11Class * class)
|
|||||||
display_class->get_keymap = gdk_x11_display_get_keymap;
|
display_class->get_keymap = gdk_x11_display_get_keymap;
|
||||||
display_class->push_error_trap = gdk_x11_display_error_trap_push;
|
display_class->push_error_trap = gdk_x11_display_error_trap_push;
|
||||||
display_class->pop_error_trap = pop_error_trap;
|
display_class->pop_error_trap = pop_error_trap;
|
||||||
|
display_class->get_selection_owner = _gdk_x11_display_get_selection_owner;
|
||||||
|
display_class->set_selection_owner = _gdk_x11_display_set_selection_owner;
|
||||||
}
|
}
|
||||||
|
@ -187,6 +187,16 @@ void _gdk_x11_display_update_grab_info_ungrab (GdkDisplay *display,
|
|||||||
guint32 time,
|
guint32 time,
|
||||||
gulong serial);
|
gulong serial);
|
||||||
void _gdk_x11_display_queue_events (GdkDisplay *display);
|
void _gdk_x11_display_queue_events (GdkDisplay *display);
|
||||||
|
|
||||||
|
|
||||||
|
gboolean _gdk_x11_display_set_selection_owner (GdkDisplay *display,
|
||||||
|
GdkWindow *owner,
|
||||||
|
GdkAtom selection,
|
||||||
|
guint32 time,
|
||||||
|
gboolean send_event);
|
||||||
|
GdkWindow * _gdk_x11_display_get_selection_owner (GdkDisplay *display,
|
||||||
|
GdkAtom selection);
|
||||||
|
|
||||||
void _gdk_x11_device_check_extension_events (GdkDevice *device);
|
void _gdk_x11_device_check_extension_events (GdkDevice *device);
|
||||||
|
|
||||||
GdkDeviceManager *_gdk_x11_device_manager_new (GdkDisplay *display);
|
GdkDeviceManager *_gdk_x11_device_manager_new (GdkDisplay *display);
|
||||||
|
@ -101,27 +101,9 @@ _gdk_selection_filter_clear_event (XSelectionClearEvent *event)
|
|||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* gdk_selection_owner_set_for_display:
|
|
||||||
* @display: the #GdkDisplay.
|
|
||||||
* @owner: a #GdkWindow or %NULL to indicate that the owner for
|
|
||||||
* the given should be unset.
|
|
||||||
* @selection: an atom identifying a selection.
|
|
||||||
* @time_: timestamp to use when setting the selection.
|
|
||||||
* If this is older than the timestamp given last time the owner was
|
|
||||||
* set for the given selection, the request will be ignored.
|
|
||||||
* @send_event: if %TRUE, and the new owner is different from the current
|
|
||||||
* owner, the current owner will be sent a SelectionClear event.
|
|
||||||
*
|
|
||||||
* Sets the #GdkWindow @owner as the current owner of the selection @selection.
|
|
||||||
*
|
|
||||||
* Returns: %TRUE if the selection owner was successfully changed to owner,
|
|
||||||
* otherwise %FALSE.
|
|
||||||
*
|
|
||||||
* Since: 2.2
|
|
||||||
*/
|
|
||||||
gboolean
|
gboolean
|
||||||
gdk_selection_owner_set_for_display (GdkDisplay *display,
|
_gdk_x11_display_set_selection_owner (GdkDisplay *display,
|
||||||
GdkWindow *owner,
|
GdkWindow *owner,
|
||||||
GdkAtom selection,
|
GdkAtom selection,
|
||||||
guint32 time,
|
guint32 time,
|
||||||
@ -133,9 +115,6 @@ gdk_selection_owner_set_for_display (GdkDisplay *display,
|
|||||||
GSList *tmp_list;
|
GSList *tmp_list;
|
||||||
OwnerInfo *info;
|
OwnerInfo *info;
|
||||||
|
|
||||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), FALSE);
|
|
||||||
g_return_val_if_fail (selection != GDK_NONE, FALSE);
|
|
||||||
|
|
||||||
if (gdk_display_is_closed (display))
|
if (gdk_display_is_closed (display))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
@ -184,32 +163,12 @@ gdk_selection_owner_set_for_display (GdkDisplay *display,
|
|||||||
return (XGetSelectionOwner (xdisplay, xselection) == xwindow);
|
return (XGetSelectionOwner (xdisplay, xselection) == xwindow);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gdk_selection_owner_get_for_display:
|
|
||||||
* @display: a #GdkDisplay.
|
|
||||||
* @selection: an atom indentifying a selection.
|
|
||||||
*
|
|
||||||
* Determine the owner of the given selection.
|
|
||||||
*
|
|
||||||
* Note that the return value may be owned by a different
|
|
||||||
* process if a foreign window was previously created for that
|
|
||||||
* window, but a new foreign window will never be created by this call.
|
|
||||||
*
|
|
||||||
* Returns: (transfer none): if there is a selection owner for this window,
|
|
||||||
* and it is a window known to the current process, the #GdkWindow that
|
|
||||||
* owns the selection, otherwise %NULL.
|
|
||||||
*
|
|
||||||
* Since: 2.2
|
|
||||||
*/
|
|
||||||
GdkWindow *
|
GdkWindow *
|
||||||
gdk_selection_owner_get_for_display (GdkDisplay *display,
|
_gdk_x11_display_get_selection_owner (GdkDisplay *display,
|
||||||
GdkAtom selection)
|
GdkAtom selection)
|
||||||
{
|
{
|
||||||
Window xwindow;
|
Window xwindow;
|
||||||
|
|
||||||
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
|
|
||||||
g_return_val_if_fail (selection != GDK_NONE, NULL);
|
|
||||||
|
|
||||||
if (gdk_display_is_closed (display))
|
if (gdk_display_is_closed (display))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user