API: x11: gdk_drawable_get_xid => gdk_window_get_xid
Also moves the function implementations to gtkwindow-x11.c.
This commit is contained in:
@ -1007,7 +1007,7 @@ gdk_x11_display_error_trap_pop_ignored
|
|||||||
gdk_x11_display_set_cursor_theme
|
gdk_x11_display_set_cursor_theme
|
||||||
gdk_x11_register_standard_event_type
|
gdk_x11_register_standard_event_type
|
||||||
gdk_x11_drawable_get_xdisplay
|
gdk_x11_drawable_get_xdisplay
|
||||||
gdk_x11_drawable_get_xid
|
gdk_x11_window_get_xid
|
||||||
gdk_x11_get_default_root_xwindow
|
gdk_x11_get_default_root_xwindow
|
||||||
gdk_x11_get_default_screen
|
gdk_x11_get_default_screen
|
||||||
gdk_x11_get_default_xdisplay
|
gdk_x11_get_default_xdisplay
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
longer correct to assume that each window has an associated XID.
|
longer correct to assume that each window has an associated XID.
|
||||||
Code that makes this assumption can sometimes be fixed by calling
|
Code that makes this assumption can sometimes be fixed by calling
|
||||||
gdk_window_ensure_native() on the windows in question.
|
gdk_window_ensure_native() on the windows in question.
|
||||||
Calling gdk_x11_drawable_get_xid() (or GDK_WINDOW_XID()) from the
|
Calling gdk_x11_window_get_xid() (or GDK_WINDOW_XID()) from the
|
||||||
X11-specific API on a non-native window will explicitly call
|
X11-specific API on a non-native window will explicitly call
|
||||||
gdk_window_ensure_native(), so old code using this will continue to
|
gdk_window_ensure_native(), so old code using this will continue to
|
||||||
work. A small gotcha is that the GDK_WINDOW_XID() call is no longer a
|
work. A small gotcha is that the GDK_WINDOW_XID() call is no longer a
|
||||||
|
|||||||
@ -224,7 +224,7 @@ int main (int argc, char **argv)
|
|||||||
gtk_main_iteration ();
|
gtk_main_iteration ();
|
||||||
}
|
}
|
||||||
|
|
||||||
id = gdk_x11_drawable_get_xid (GDK_DRAWABLE (window));
|
id = gdk_x11_window_get_xid (window);
|
||||||
screenshot = take_window_shot (id, info->include_decorations);
|
screenshot = take_window_shot (id, info->include_decorations);
|
||||||
filename = g_strdup_printf ("./%s.png", info->name);
|
filename = g_strdup_printf ("./%s.png", info->name);
|
||||||
gdk_pixbuf_save (screenshot, filename, "png", NULL, NULL);
|
gdk_pixbuf_save (screenshot, filename, "png", NULL, NULL);
|
||||||
|
|||||||
@ -548,7 +548,6 @@ gdk_x11_display_set_cursor_theme
|
|||||||
gdk_x11_display_set_startup_notification_id
|
gdk_x11_display_set_startup_notification_id
|
||||||
gdk_x11_display_ungrab
|
gdk_x11_display_ungrab
|
||||||
gdk_x11_drawable_get_xdisplay
|
gdk_x11_drawable_get_xdisplay
|
||||||
gdk_x11_drawable_get_xid
|
|
||||||
gdk_x11_get_default_root_xwindow
|
gdk_x11_get_default_root_xwindow
|
||||||
gdk_x11_get_default_screen
|
gdk_x11_get_default_screen
|
||||||
gdk_x11_get_default_xdisplay
|
gdk_x11_get_default_xdisplay
|
||||||
@ -569,6 +568,7 @@ gdk_x11_screen_supports_net_wm_hint
|
|||||||
gdk_x11_ungrab_server
|
gdk_x11_ungrab_server
|
||||||
gdk_x11_visual_get_xvisual
|
gdk_x11_visual_get_xvisual
|
||||||
gdk_x11_window_get_drawable_impl
|
gdk_x11_window_get_drawable_impl
|
||||||
|
gdk_x11_window_get_xid
|
||||||
gdk_x11_window_move_to_current_desktop
|
gdk_x11_window_move_to_current_desktop
|
||||||
gdk_x11_window_set_user_time
|
gdk_x11_window_set_user_time
|
||||||
gdk_x11_xatom_to_atom
|
gdk_x11_xatom_to_atom
|
||||||
|
|||||||
@ -9606,7 +9606,7 @@ gdk_window_print (GdkWindowObject *window,
|
|||||||
if (gdk_window_has_impl (window))
|
if (gdk_window_has_impl (window))
|
||||||
{
|
{
|
||||||
#ifdef GDK_WINDOWING_X11
|
#ifdef GDK_WINDOWING_X11
|
||||||
g_print (" impl(0x%lx)", gdk_x11_drawable_get_xid (GDK_DRAWABLE (window)));
|
g_print (" impl(0x%lx)", gdk_x11_window_get_xid (window));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -134,52 +134,6 @@ gdk_x11_drawable_get_xdisplay (GdkDrawable *drawable)
|
|||||||
return GDK_SCREEN_XDISPLAY (GDK_DRAWABLE_IMPL_X11 (get_impl_drawable (drawable))->screen);
|
return GDK_SCREEN_XDISPLAY (GDK_DRAWABLE_IMPL_X11 (get_impl_drawable (drawable))->screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* gdk_x11_drawable_get_xid:
|
|
||||||
* @drawable: a #GdkDrawable.
|
|
||||||
*
|
|
||||||
* Returns the X resource (window) belonging to a #GdkDrawable.
|
|
||||||
*
|
|
||||||
* Return value: the ID of @drawable's X resource.
|
|
||||||
**/
|
|
||||||
XID
|
|
||||||
gdk_x11_drawable_get_xid (GdkDrawable *drawable)
|
|
||||||
{
|
|
||||||
GdkDrawable *impl;
|
|
||||||
|
|
||||||
if (GDK_IS_WINDOW (drawable))
|
|
||||||
{
|
|
||||||
GdkWindow *window = (GdkWindow *)drawable;
|
|
||||||
|
|
||||||
/* Try to ensure the window has a native window */
|
|
||||||
if (!_gdk_window_has_impl (window))
|
|
||||||
{
|
|
||||||
gdk_window_ensure_native (window);
|
|
||||||
|
|
||||||
/* We sync here to ensure the window is created in the Xserver when
|
|
||||||
* this function returns. This is required because the returned XID
|
|
||||||
* for this window must be valid immediately, even with another
|
|
||||||
* connection to the Xserver */
|
|
||||||
gdk_display_sync (gdk_window_get_display (window));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!GDK_WINDOW_IS_X11 (window))
|
|
||||||
{
|
|
||||||
g_warning (G_STRLOC " drawable is not a native X11 window");
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl = ((GdkWindowObject *)drawable)->impl;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
g_warning (G_STRLOC " drawable is not a window");
|
|
||||||
return None;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ((GdkDrawableImplX11 *)impl)->xid;
|
|
||||||
}
|
|
||||||
|
|
||||||
GdkDrawable *
|
GdkDrawable *
|
||||||
gdk_x11_window_get_drawable_impl (GdkWindow *window)
|
gdk_x11_window_get_drawable_impl (GdkWindow *window)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -5584,3 +5584,40 @@ gdk_x11_get_server_time (GdkWindow *window)
|
|||||||
|
|
||||||
return xevent.xproperty.time;
|
return xevent.xproperty.time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gdk_x11_window_get_xid:
|
||||||
|
* @window: a native #GdkWindow.
|
||||||
|
*
|
||||||
|
* Returns the X resource (window) belonging to a #GdkWindow.
|
||||||
|
*
|
||||||
|
* Return value: the ID of @drawable's X resource.
|
||||||
|
**/
|
||||||
|
XID
|
||||||
|
gdk_x11_window_get_xid (GdkWindow *window)
|
||||||
|
{
|
||||||
|
GdkDrawable *impl;
|
||||||
|
|
||||||
|
/* Try to ensure the window has a native window */
|
||||||
|
if (!_gdk_window_has_impl (window))
|
||||||
|
{
|
||||||
|
gdk_window_ensure_native (window);
|
||||||
|
|
||||||
|
/* We sync here to ensure the window is created in the Xserver when
|
||||||
|
* this function returns. This is required because the returned XID
|
||||||
|
* for this window must be valid immediately, even with another
|
||||||
|
* connection to the Xserver */
|
||||||
|
gdk_display_sync (gdk_window_get_display (window));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!GDK_WINDOW_IS_X11 (window))
|
||||||
|
{
|
||||||
|
g_warning (G_STRLOC " drawable is not a native X11 window");
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
|
||||||
|
impl = ((GdkWindowObject *) window)->impl;
|
||||||
|
|
||||||
|
return ((GdkDrawableImplX11 *)impl)->xid;
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@ -56,7 +56,7 @@ G_BEGIN_DECLS
|
|||||||
|
|
||||||
|
|
||||||
Display *gdk_x11_drawable_get_xdisplay (GdkDrawable *drawable);
|
Display *gdk_x11_drawable_get_xdisplay (GdkDrawable *drawable);
|
||||||
XID gdk_x11_drawable_get_xid (GdkDrawable *drawable);
|
Window gdk_x11_window_get_xid (GdkWindow *window);
|
||||||
GdkDrawable *gdk_x11_window_get_drawable_impl (GdkWindow *window);
|
GdkDrawable *gdk_x11_window_get_drawable_impl (GdkWindow *window);
|
||||||
Display *gdk_x11_cursor_get_xdisplay (GdkCursor *cursor);
|
Display *gdk_x11_cursor_get_xdisplay (GdkCursor *cursor);
|
||||||
Cursor gdk_x11_cursor_get_xcursor (GdkCursor *cursor);
|
Cursor gdk_x11_cursor_get_xcursor (GdkCursor *cursor);
|
||||||
@ -186,16 +186,16 @@ gint gdk_x11_get_default_screen (void);
|
|||||||
*
|
*
|
||||||
* Returns: the Xlib <type>Window</type> of @win.
|
* Returns: the Xlib <type>Window</type> of @win.
|
||||||
*/
|
*/
|
||||||
#define GDK_WINDOW_XID(win) (gdk_x11_drawable_get_xid (win))
|
#define GDK_WINDOW_XID(win) (gdk_x11_window_get_xid (win))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GDK_WINDOW_XWINDOW:
|
* GDK_WINDOW_XWINDOW:
|
||||||
*
|
*
|
||||||
* Another name for GDK_DRAWABLE_XID().
|
* Another name for GDK_DRAWABLE_XID().
|
||||||
*/
|
*/
|
||||||
#define GDK_WINDOW_XWINDOW(win) (gdk_x11_drawable_get_xid (win))
|
#define GDK_WINDOW_XWINDOW(win) (gdk_x11_window_get_xid (win))
|
||||||
#define GDK_DRAWABLE_XDISPLAY(win) (gdk_x11_drawable_get_xdisplay (win))
|
#define GDK_DRAWABLE_XDISPLAY(win) (gdk_x11_drawable_get_xdisplay (win))
|
||||||
#define GDK_DRAWABLE_XID(win) (gdk_x11_drawable_get_xid (win))
|
#define GDK_DRAWABLE_XID(win) (gdk_x11_window_get_xid (win))
|
||||||
#define GDK_SCREEN_XDISPLAY(screen) (gdk_x11_display_get_xdisplay (gdk_screen_get_display (screen)))
|
#define GDK_SCREEN_XDISPLAY(screen) (gdk_x11_display_get_xdisplay (gdk_screen_get_display (screen)))
|
||||||
#define GDK_SCREEN_XSCREEN(screen) (gdk_x11_screen_get_xscreen (screen))
|
#define GDK_SCREEN_XSCREEN(screen) (gdk_x11_screen_get_xscreen (screen))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user