forked from AuroraMiddleware/gtk
Deprecate foreign window apis
And add x11- and win32-specific apis for these at the same time
This commit is contained in:
parent
0f8251da61
commit
2f8c78ddc5
@ -1407,6 +1407,9 @@ gdk_x11_get_xatom_by_name
|
|||||||
gdk_x11_get_xatom_by_name_for_display
|
gdk_x11_get_xatom_by_name_for_display
|
||||||
gdk_x11_get_xatom_name
|
gdk_x11_get_xatom_name
|
||||||
gdk_x11_get_xatom_name_for_display
|
gdk_x11_get_xatom_name_for_display
|
||||||
|
gdk_x11_set_sm_client_id
|
||||||
|
gdk_x11_window_foreign_new_for_display
|
||||||
|
gdk_x11_window_lookup_for_display
|
||||||
|
|
||||||
<SUBSECTION Private>
|
<SUBSECTION Private>
|
||||||
gdk_display
|
gdk_display
|
||||||
|
@ -1353,6 +1353,8 @@ gdkx_visual_get
|
|||||||
#if IN_FILE(__GDK_WINDOW_X11_C__)
|
#if IN_FILE(__GDK_WINDOW_X11_C__)
|
||||||
gdk_x11_window_set_user_time
|
gdk_x11_window_set_user_time
|
||||||
gdk_x11_window_move_to_current_desktop
|
gdk_x11_window_move_to_current_desktop
|
||||||
|
gdk_x11_window_foreign_new_for_display
|
||||||
|
gdk_x11_window_lookup_for_display
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if IN_FILE(__GDK_XID_C__)
|
#if IN_FILE(__GDK_XID_C__)
|
||||||
|
@ -475,6 +475,7 @@ gboolean gdk_window_set_static_gravities (GdkWindow *window,
|
|||||||
gboolean use_static);
|
gboolean use_static);
|
||||||
|
|
||||||
/* Functions to create/lookup windows from their native equivalents */
|
/* Functions to create/lookup windows from their native equivalents */
|
||||||
|
#if !defined(GDK_DISABLE_DEPRECATED) || defined(GDK_COMPILATION)
|
||||||
#ifndef GDK_MULTIHEAD_SAFE
|
#ifndef GDK_MULTIHEAD_SAFE
|
||||||
GdkWindow* gdk_window_foreign_new (GdkNativeWindow anid);
|
GdkWindow* gdk_window_foreign_new (GdkNativeWindow anid);
|
||||||
GdkWindow* gdk_window_lookup (GdkNativeWindow anid);
|
GdkWindow* gdk_window_lookup (GdkNativeWindow anid);
|
||||||
@ -483,6 +484,7 @@ GdkWindow *gdk_window_foreign_new_for_display (GdkDisplay *display,
|
|||||||
GdkNativeWindow anid);
|
GdkNativeWindow anid);
|
||||||
GdkWindow* gdk_window_lookup_for_display (GdkDisplay *display,
|
GdkWindow* gdk_window_lookup_for_display (GdkDisplay *display,
|
||||||
GdkNativeWindow anid);
|
GdkNativeWindow anid);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* GdkWindow */
|
/* GdkWindow */
|
||||||
|
@ -117,6 +117,11 @@ GdkDrawable *gdk_win32_begin_direct_draw_libgtk_only (GdkDrawable *drawable,
|
|||||||
gint *y_offset_out);
|
gint *y_offset_out);
|
||||||
void gdk_win32_end_direct_draw_libgtk_only (gpointer priv_data);
|
void gdk_win32_end_direct_draw_libgtk_only (gpointer priv_data);
|
||||||
|
|
||||||
|
GdkWindow * gdk_win32_window_foreign_new_for_display (GdkDisplay *display,
|
||||||
|
GdkNativeWindow anid);
|
||||||
|
GdkWindow * gdk_win32_window_lookup_for_display (GdkDisplay *display,
|
||||||
|
GdkNativeWindow anid);
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
@ -735,6 +735,13 @@ _gdk_window_impl_new (GdkWindow *window,
|
|||||||
GdkWindow *
|
GdkWindow *
|
||||||
gdk_window_foreign_new_for_display (GdkDisplay *display,
|
gdk_window_foreign_new_for_display (GdkDisplay *display,
|
||||||
GdkNativeWindow anid)
|
GdkNativeWindow anid)
|
||||||
|
{
|
||||||
|
return gdk_win32_window_foreign_new_for_display (display, anid);
|
||||||
|
}
|
||||||
|
|
||||||
|
GdkWindow *
|
||||||
|
gdk_win32_window_foreign_new_for_display (GdkDisplay *display,
|
||||||
|
GdkNativeWindow anid)
|
||||||
{
|
{
|
||||||
GdkWindow *window;
|
GdkWindow *window;
|
||||||
GdkWindowObject *private;
|
GdkWindowObject *private;
|
||||||
@ -3639,6 +3646,13 @@ gdk_win32_window_shape_combine_region (GdkWindow *window,
|
|||||||
GdkWindow *
|
GdkWindow *
|
||||||
gdk_window_lookup_for_display (GdkDisplay *display,
|
gdk_window_lookup_for_display (GdkDisplay *display,
|
||||||
GdkNativeWindow anid)
|
GdkNativeWindow anid)
|
||||||
|
{
|
||||||
|
return gdk_win32_window_lookup_for_display (display, anid);
|
||||||
|
}
|
||||||
|
|
||||||
|
GdkWindow *
|
||||||
|
gdk_win32_window_lookup_for_display (GdkDisplay *display,
|
||||||
|
GdkNativeWindow anid)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (display == _gdk_display, NULL);
|
g_return_val_if_fail (display == _gdk_display, NULL);
|
||||||
|
|
||||||
|
@ -872,12 +872,38 @@ x_event_mask_to_gdk_event_mask (long mask)
|
|||||||
* newly created, if one doesn't exist already.
|
* newly created, if one doesn't exist already.
|
||||||
*
|
*
|
||||||
* Since: 2.2
|
* Since: 2.2
|
||||||
|
*
|
||||||
|
* Deprecated:2.24: Use gdk_x11_window_foreign_new_for_display() or
|
||||||
|
* equivalent backend-specific API instead
|
||||||
**/
|
**/
|
||||||
GdkWindow *
|
GdkWindow *
|
||||||
gdk_window_foreign_new_for_display (GdkDisplay *display,
|
gdk_window_foreign_new_for_display (GdkDisplay *display,
|
||||||
GdkNativeWindow anid)
|
GdkNativeWindow anid)
|
||||||
{
|
{
|
||||||
GdkWindow *window;
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gdk_x11_window_foreign_new_for_display:
|
||||||
|
* @display: the #GdkDisplay where the window handle comes from.
|
||||||
|
* @window: an XLib <type>Window</type>
|
||||||
|
*
|
||||||
|
* Wraps a native window in a #GdkWindow.
|
||||||
|
*
|
||||||
|
* This may fail if the window has been destroyed. If the window
|
||||||
|
* was already known to GDK, a new reference to the existing
|
||||||
|
* #GdkWindow is returned.
|
||||||
|
*
|
||||||
|
* Return value: a #GdkWindow wrapper for the native window or
|
||||||
|
* %NULL if the window has been destroyed. The wrapper will be
|
||||||
|
* newly created, if one doesn't exist already.
|
||||||
|
*
|
||||||
|
* Since: 2.24
|
||||||
|
*/
|
||||||
|
GdkWindow *
|
||||||
|
gdk_x11_window_foreign_new_for_display (GdkDisplay *display,
|
||||||
|
Window window)
|
||||||
|
{
|
||||||
|
GdkWindow *win;
|
||||||
GdkWindowObject *private;
|
GdkWindowObject *private;
|
||||||
GdkWindowImplX11 *impl;
|
GdkWindowImplX11 *impl;
|
||||||
GdkDrawableImplX11 *draw_impl;
|
GdkDrawableImplX11 *draw_impl;
|
||||||
@ -892,33 +918,33 @@ gdk_window_foreign_new_for_display (GdkDisplay *display,
|
|||||||
|
|
||||||
display_x11 = GDK_DISPLAY_X11 (display);
|
display_x11 = GDK_DISPLAY_X11 (display);
|
||||||
|
|
||||||
if ((window = gdk_xid_table_lookup_for_display (display, anid)) != NULL)
|
if ((win = gdk_xid_table_lookup_for_display (display, window)) != NULL)
|
||||||
return g_object_ref (window);
|
return g_object_ref (win);
|
||||||
|
|
||||||
gdk_error_trap_push ();
|
gdk_error_trap_push ();
|
||||||
result = XGetWindowAttributes (display_x11->xdisplay, anid, &attrs);
|
result = XGetWindowAttributes (display_x11->xdisplay, window, &attrs);
|
||||||
if (gdk_error_trap_pop () || !result)
|
if (gdk_error_trap_pop () || !result)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* FIXME: This is pretty expensive. Maybe the caller should supply
|
/* FIXME: This is pretty expensive. Maybe the caller should supply
|
||||||
* the parent */
|
* the parent */
|
||||||
gdk_error_trap_push ();
|
gdk_error_trap_push ();
|
||||||
result = XQueryTree (display_x11->xdisplay, anid, &root, &parent, &children, &nchildren);
|
result = XQueryTree (display_x11->xdisplay, window, &root, &parent, &children, &nchildren);
|
||||||
if (gdk_error_trap_pop () || !result)
|
if (gdk_error_trap_pop () || !result)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (children)
|
if (children)
|
||||||
XFree (children);
|
XFree (children);
|
||||||
|
|
||||||
window = g_object_new (GDK_TYPE_WINDOW, NULL);
|
win = g_object_new (GDK_TYPE_WINDOW, NULL);
|
||||||
|
|
||||||
private = (GdkWindowObject *) window;
|
private = (GdkWindowObject *) win;
|
||||||
private->impl = g_object_new (_gdk_window_impl_get_type (), NULL);
|
private->impl = g_object_new (_gdk_window_impl_get_type (), NULL);
|
||||||
private->impl_window = private;
|
private->impl_window = private;
|
||||||
|
|
||||||
impl = GDK_WINDOW_IMPL_X11 (private->impl);
|
impl = GDK_WINDOW_IMPL_X11 (private->impl);
|
||||||
draw_impl = GDK_DRAWABLE_IMPL_X11 (private->impl);
|
draw_impl = GDK_DRAWABLE_IMPL_X11 (private->impl);
|
||||||
draw_impl->wrapper = GDK_DRAWABLE (window);
|
draw_impl->wrapper = GDK_DRAWABLE (win);
|
||||||
draw_impl->screen = _gdk_x11_display_screen_for_xrootwin (display, root);
|
draw_impl->screen = _gdk_x11_display_screen_for_xrootwin (display, root);
|
||||||
|
|
||||||
private->parent = gdk_xid_table_lookup_for_display (display, parent);
|
private->parent = gdk_xid_table_lookup_for_display (display, parent);
|
||||||
@ -926,9 +952,9 @@ gdk_window_foreign_new_for_display (GdkDisplay *display,
|
|||||||
if (!private->parent || GDK_WINDOW_TYPE (private->parent) == GDK_WINDOW_FOREIGN)
|
if (!private->parent || GDK_WINDOW_TYPE (private->parent) == GDK_WINDOW_FOREIGN)
|
||||||
private->parent = (GdkWindowObject *) gdk_screen_get_root_window (draw_impl->screen);
|
private->parent = (GdkWindowObject *) gdk_screen_get_root_window (draw_impl->screen);
|
||||||
|
|
||||||
private->parent->children = g_list_prepend (private->parent->children, window);
|
private->parent->children = g_list_prepend (private->parent->children, win);
|
||||||
|
|
||||||
draw_impl->xid = anid;
|
draw_impl->xid = window;
|
||||||
|
|
||||||
private->x = attrs.x;
|
private->x = attrs.x;
|
||||||
private->y = attrs.y;
|
private->y = attrs.y;
|
||||||
@ -947,13 +973,13 @@ gdk_window_foreign_new_for_display (GdkDisplay *display,
|
|||||||
|
|
||||||
private->depth = attrs.depth;
|
private->depth = attrs.depth;
|
||||||
|
|
||||||
g_object_ref (window);
|
g_object_ref (win);
|
||||||
_gdk_xid_table_insert (display, &GDK_WINDOW_XID (window), window);
|
_gdk_xid_table_insert (display, &GDK_WINDOW_XID (win), win);
|
||||||
|
|
||||||
/* Update the clip region, etc */
|
/* Update the clip region, etc */
|
||||||
_gdk_window_update_size (window);
|
_gdk_window_update_size (win);
|
||||||
|
|
||||||
return window;
|
return win;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -970,11 +996,33 @@ gdk_window_foreign_new_for_display (GdkDisplay *display,
|
|||||||
* or %NULL if there is none.
|
* or %NULL if there is none.
|
||||||
*
|
*
|
||||||
* Since: 2.2
|
* Since: 2.2
|
||||||
|
*
|
||||||
|
* Deprecated:2.24: Use gdk_x11_window_lookup_for_display() instead
|
||||||
**/
|
**/
|
||||||
GdkWindow *
|
GdkWindow *
|
||||||
gdk_window_lookup_for_display (GdkDisplay *display, GdkNativeWindow anid)
|
gdk_window_lookup_for_display (GdkDisplay *display,
|
||||||
|
GdkNativeWindow anid)
|
||||||
{
|
{
|
||||||
return (GdkWindow*) gdk_xid_table_lookup_for_display (display, anid);
|
return gdk_x11_window_lookup_for_display (display, anid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gdk_x11_window_lookup_for_display:
|
||||||
|
* @display: the #GdkDisplay corresponding to the window handle
|
||||||
|
* @window: an XLib <type>Window</type>
|
||||||
|
*
|
||||||
|
* Looks up the #GdkWindow that wraps the given native window handle.
|
||||||
|
*
|
||||||
|
* Return value: the #GdkWindow wrapper for the native window,
|
||||||
|
* or %NULL if there is none.
|
||||||
|
*
|
||||||
|
* Since: 2.24
|
||||||
|
*/
|
||||||
|
GdkWindow *
|
||||||
|
gdk_x11_window_lookup_for_display (GdkDisplay *display,
|
||||||
|
Window window)
|
||||||
|
{
|
||||||
|
return (GdkWindow*) gdk_xid_table_lookup_for_display (display, window);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -988,6 +1036,9 @@ gdk_window_lookup_for_display (GdkDisplay *display, GdkNativeWindow anid)
|
|||||||
*
|
*
|
||||||
* Return value: the #GdkWindow wrapper for the native window,
|
* Return value: the #GdkWindow wrapper for the native window,
|
||||||
* or %NULL if there is none.
|
* or %NULL if there is none.
|
||||||
|
*
|
||||||
|
* Deprecated: 2.24: Use gdk_x11_window_lookup_for_display() or equivalent
|
||||||
|
* backend-specific functionality instead
|
||||||
**/
|
**/
|
||||||
GdkWindow *
|
GdkWindow *
|
||||||
gdk_window_lookup (GdkNativeWindow anid)
|
gdk_window_lookup (GdkNativeWindow anid)
|
||||||
|
@ -219,6 +219,12 @@ G_CONST_RETURN char *gdk_x11_font_get_name (GdkFont *font);
|
|||||||
|
|
||||||
void gdk_x11_set_sm_client_id (const gchar *sm_client_id);
|
void gdk_x11_set_sm_client_id (const gchar *sm_client_id);
|
||||||
|
|
||||||
|
GdkWindow *gdk_x11_window_foreign_new_for_display (GdkDisplay *display,
|
||||||
|
Window window);
|
||||||
|
GdkWindow *gdk_x11_window_lookup_for_display (GdkDisplay *display,
|
||||||
|
Window window);
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GDK_X_H__ */
|
#endif /* __GDK_X_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user