gdk: Add api to set drag window hotspot
With GdkDragContext now being in charge of placing the window, it needs to know about the hotspot to place under the cursor.
This commit is contained in:
parent
08ecf19907
commit
f4ebdb64ee
@ -968,6 +968,7 @@ gdk_drag_context_get_source_window
|
||||
gdk_drag_context_get_dest_window
|
||||
gdk_drag_context_get_protocol
|
||||
gdk_drag_context_get_drag_window
|
||||
gdk_drag_context_set_hotspot
|
||||
|
||||
<SUBSECTION Standard>
|
||||
GDK_DRAG_CONTEXT
|
||||
|
23
gdk/gdkdnd.c
23
gdk/gdkdnd.c
@ -480,3 +480,26 @@ gdk_drag_context_get_drag_window (GdkDragContext *context)
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* gdk_drag_context_set_hotspot:
|
||||
* @context: a #GdkDragContext
|
||||
* @hot_x: x coordinate of the drag window hotspot
|
||||
* @hot_y: y coordinate of the drag window hotspot
|
||||
*
|
||||
* Sets the position of the drag window that will be kept
|
||||
* under the cursor hotspot. Initially, the hotspot is at the
|
||||
* top left corner of the drag window.
|
||||
*
|
||||
* Since: 3.20
|
||||
*/
|
||||
void
|
||||
gdk_drag_context_set_hotspot (GdkDragContext *context,
|
||||
gint hot_x,
|
||||
gint hot_y)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_DRAG_CONTEXT (context));
|
||||
|
||||
if (GDK_DRAG_CONTEXT_GET_CLASS (context)->set_hotspot)
|
||||
GDK_DRAG_CONTEXT_GET_CLASS (context)->set_hotspot (context, hot_x, hot_y);
|
||||
}
|
||||
|
@ -174,6 +174,11 @@ gboolean gdk_drag_drop_succeeded (GdkDragContext *context);
|
||||
GDK_AVAILABLE_IN_3_20
|
||||
GdkWindow *gdk_drag_context_get_drag_window (GdkDragContext *context);
|
||||
|
||||
GDK_AVAILABLE_IN_3_20
|
||||
void gdk_drag_context_set_hotspot (GdkDragContext *context,
|
||||
gint hot_x,
|
||||
gint hot_y);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GDK_DND_H__ */
|
||||
|
@ -63,6 +63,9 @@ struct _GdkDragContextClass {
|
||||
guint32 time_);
|
||||
gboolean (*drop_status) (GdkDragContext *context);
|
||||
GdkWindow* (*get_drag_window) (GdkDragContext *context);
|
||||
void (*set_hotspot) (GdkDragContext *context,
|
||||
gint hot_x,
|
||||
gint hot_y);
|
||||
};
|
||||
|
||||
struct _GdkDragContext {
|
||||
|
Loading…
Reference in New Issue
Block a user