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_name
|
||||
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>
|
||||
gdk_display
|
||||
|
@ -1353,6 +1353,8 @@ gdkx_visual_get
|
||||
#if IN_FILE(__GDK_WINDOW_X11_C__)
|
||||
gdk_x11_window_set_user_time
|
||||
gdk_x11_window_move_to_current_desktop
|
||||
gdk_x11_window_foreign_new_for_display
|
||||
gdk_x11_window_lookup_for_display
|
||||
#endif
|
||||
|
||||
#if IN_FILE(__GDK_XID_C__)
|
||||
|
@ -475,6 +475,7 @@ gboolean gdk_window_set_static_gravities (GdkWindow *window,
|
||||
gboolean use_static);
|
||||
|
||||
/* Functions to create/lookup windows from their native equivalents */
|
||||
#if !defined(GDK_DISABLE_DEPRECATED) || defined(GDK_COMPILATION)
|
||||
#ifndef GDK_MULTIHEAD_SAFE
|
||||
GdkWindow* gdk_window_foreign_new (GdkNativeWindow anid);
|
||||
GdkWindow* gdk_window_lookup (GdkNativeWindow anid);
|
||||
@ -483,6 +484,7 @@ GdkWindow *gdk_window_foreign_new_for_display (GdkDisplay *display,
|
||||
GdkNativeWindow anid);
|
||||
GdkWindow* gdk_window_lookup_for_display (GdkDisplay *display,
|
||||
GdkNativeWindow anid);
|
||||
#endif
|
||||
|
||||
|
||||
/* GdkWindow */
|
||||
|
@ -117,6 +117,11 @@ GdkDrawable *gdk_win32_begin_direct_draw_libgtk_only (GdkDrawable *drawable,
|
||||
gint *y_offset_out);
|
||||
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
|
||||
|
||||
|
@ -735,6 +735,13 @@ _gdk_window_impl_new (GdkWindow *window,
|
||||
GdkWindow *
|
||||
gdk_window_foreign_new_for_display (GdkDisplay *display,
|
||||
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;
|
||||
GdkWindowObject *private;
|
||||
@ -3639,6 +3646,13 @@ gdk_win32_window_shape_combine_region (GdkWindow *window,
|
||||
GdkWindow *
|
||||
gdk_window_lookup_for_display (GdkDisplay *display,
|
||||
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);
|
||||
|
||||
|
@ -867,17 +867,43 @@ x_event_mask_to_gdk_event_mask (long mask)
|
||||
* For example in the X backend, a native window handle is an Xlib
|
||||
* <type>XID</type>.
|
||||
*
|
||||
* Return value: a #GdkWindow wrapper for the native window or
|
||||
* 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.2
|
||||
*
|
||||
* Deprecated:2.24: Use gdk_x11_window_foreign_new_for_display() or
|
||||
* equivalent backend-specific API instead
|
||||
**/
|
||||
GdkWindow *
|
||||
gdk_window_foreign_new_for_display (GdkDisplay *display,
|
||||
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;
|
||||
GdkWindowImplX11 *impl;
|
||||
GdkDrawableImplX11 *draw_impl;
|
||||
@ -892,33 +918,33 @@ gdk_window_foreign_new_for_display (GdkDisplay *display,
|
||||
|
||||
display_x11 = GDK_DISPLAY_X11 (display);
|
||||
|
||||
if ((window = gdk_xid_table_lookup_for_display (display, anid)) != NULL)
|
||||
return g_object_ref (window);
|
||||
if ((win = gdk_xid_table_lookup_for_display (display, window)) != NULL)
|
||||
return g_object_ref (win);
|
||||
|
||||
gdk_error_trap_push ();
|
||||
result = XGetWindowAttributes (display_x11->xdisplay, anid, &attrs);
|
||||
result = XGetWindowAttributes (display_x11->xdisplay, window, &attrs);
|
||||
if (gdk_error_trap_pop () || !result)
|
||||
return NULL;
|
||||
|
||||
/* FIXME: This is pretty expensive. Maybe the caller should supply
|
||||
* the parent */
|
||||
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)
|
||||
return NULL;
|
||||
|
||||
if (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_window = private;
|
||||
|
||||
impl = GDK_WINDOW_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);
|
||||
|
||||
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)
|
||||
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->y = attrs.y;
|
||||
@ -947,13 +973,13 @@ gdk_window_foreign_new_for_display (GdkDisplay *display,
|
||||
|
||||
private->depth = attrs.depth;
|
||||
|
||||
g_object_ref (window);
|
||||
_gdk_xid_table_insert (display, &GDK_WINDOW_XID (window), window);
|
||||
g_object_ref (win);
|
||||
_gdk_xid_table_insert (display, &GDK_WINDOW_XID (win), win);
|
||||
|
||||
/* Update the clip region, etc */
|
||||
_gdk_window_update_size (window);
|
||||
_gdk_window_update_size (win);
|
||||
|
||||
return window;
|
||||
return win;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -966,15 +992,37 @@ gdk_window_foreign_new_for_display (GdkDisplay *display,
|
||||
* For example in the X backend, a native window handle is an Xlib
|
||||
* <type>XID</type>.
|
||||
*
|
||||
* Return value: the #GdkWindow wrapper for the native window,
|
||||
* Return value: the #GdkWindow wrapper for the native window,
|
||||
* or %NULL if there is none.
|
||||
*
|
||||
* Since: 2.2
|
||||
*
|
||||
* Deprecated:2.24: Use gdk_x11_window_lookup_for_display() instead
|
||||
**/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -986,8 +1034,11 @@ gdk_window_lookup_for_display (GdkDisplay *display, GdkNativeWindow anid)
|
||||
* For example in the X backend, a native window handle is an Xlib
|
||||
* <type>XID</type>.
|
||||
*
|
||||
* Return value: the #GdkWindow wrapper for the native window,
|
||||
* Return value: the #GdkWindow wrapper for the native window,
|
||||
* or %NULL if there is none.
|
||||
*
|
||||
* Deprecated: 2.24: Use gdk_x11_window_lookup_for_display() or equivalent
|
||||
* backend-specific functionality instead
|
||||
**/
|
||||
GdkWindow *
|
||||
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);
|
||||
|
||||
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
|
||||
|
||||
#endif /* __GDK_X_H__ */
|
||||
|
Loading…
Reference in New Issue
Block a user