x11: Add API to query root window and screen from GdkDisplay

This commit is contained in:
Benjamin Otte 2017-11-01 22:56:46 +01:00
parent 8f55647fbb
commit f33c20920b
4 changed files with 46 additions and 3 deletions

View File

@ -898,6 +898,8 @@ gdk_x11_display_broadcast_startup_message
gdk_x11_display_get_startup_notification_id
gdk_x11_display_set_startup_notification_id
gdk_x11_display_get_xdisplay
gdk_x11_display_get_xscreen
gdk_x11_display_get_xrootwindow
gdk_x11_display_grab
gdk_x11_display_ungrab
gdk_x11_display_error_trap_push

View File

@ -2179,9 +2179,46 @@ Display *
gdk_x11_display_get_xdisplay (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
return GDK_X11_DISPLAY (display)->xdisplay;
}
/**
* gdk_x11_display_get_xscreen:
* @display: (type GdkX11Display): a #GdkDisplay
*
* Returns the X Screen used by #GdkDisplay.
*
* Returns: (transfer none): an X Screen
*
* Since: 3.94
*/
Screen *
gdk_x11_display_get_xscreen (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
return GDK_X11_SCREEN (GDK_X11_DISPLAY (display)->screen)->xscreen;
}
/**
* gdk_x11_display_get_xrootwindow:
* @display: (type GdkX11Display): a #GdkDisplay
*
* Returns the root X window used by #GdkDisplay.
*
* Returns: (transfer none): an X Window
*
* Since: 3.94
*/
Window
gdk_x11_display_get_xrootwindow (GdkDisplay *display)
{
g_return_val_if_fail (GDK_IS_DISPLAY (display), None);
return GDK_SCREEN_XROOTWIN (GDK_X11_DISPLAY (display)->screen);
}
static void
gdk_x11_display_make_default (GdkDisplay *display)
{

View File

@ -57,7 +57,11 @@ GDK_AVAILABLE_IN_3_94
GdkDisplay * gdk_x11_display_open (const char *display_name);
GDK_AVAILABLE_IN_ALL
Display *gdk_x11_display_get_xdisplay (GdkDisplay *display);
Display * gdk_x11_display_get_xdisplay (GdkDisplay *display);
GDK_AVAILABLE_IN_3_94
Screen * gdk_x11_display_get_xscreen (GdkDisplay *display);
GDK_AVAILABLE_IN_3_94
Window gdk_x11_display_get_xrootwindow (GdkDisplay *display);
#define GDK_DISPLAY_XDISPLAY(display) (gdk_x11_display_get_xdisplay (display))

View File

@ -532,8 +532,8 @@ _gtk_mount_operation_lookup_context_get (GdkDisplay *display)
mapping = NULL;
mapping_length = 0;
get_window_list (GDK_DISPLAY_XDISPLAY (context->display),
GDK_ROOT_WINDOW(),
get_window_list (gdk_x11_display_get_xdisplay (context->display),
gdk_x11_display_get_xrootwindow (context->display),
gdk_x11_get_xatom_by_name_for_display (context->display,
"_NET_CLIENT_LIST"),
&mapping,