Add gdk_display_get_toplevel_windows

This is replacing the corresponding GdkScreen api, which
is going away. To implement this, we need to add a
get_root_window vfunc to GdkDisplay.
This commit is contained in:
Matthias Clasen 2017-10-31 20:26:42 -04:00
parent 0839aae3c8
commit 5cb5bdf1bc
13 changed files with 68 additions and 3 deletions

View File

@ -316,6 +316,14 @@ gdk_broadway_display_get_setting (GdkDisplay *display,
return FALSE;
}
static GdkWindow *
gdk_broadway_display_get_root_window (GdkDisplay *display)
{
GdkBroadwayDisplay *broadway_display = GDK_BROADWAY_DISPLAY (display);
return gdk_broadway_screen_get_root_window (broadway_display->default_screen);
}
static void
gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class)
{
@ -365,5 +373,6 @@ gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class)
display_class->get_monitor = gdk_broadway_display_get_monitor;
display_class->get_primary_monitor = gdk_broadway_display_get_primary_monitor;
display_class->get_setting = gdk_broadway_display_get_setting;
display_class->get_root_window = gdk_broadway_display_get_root_window;
}

View File

@ -2249,3 +2249,25 @@ gdk_display_setting_changed (GdkDisplay *display,
{
g_signal_emit (display, signals[SETTING_CHANGED], 0, name);
}
GList *
gdk_display_get_toplevel_windows (GdkDisplay *display)
{
GdkWindow * root_window;
GList *new_list = NULL;
GList *tmp_list;
root_window = GDK_DISPLAY_GET_CLASS (display)->get_root_window (display);
tmp_list = root_window->children;
while (tmp_list)
{
GdkWindow *w = tmp_list->data;
if (w->window_type != GDK_WINDOW_FOREIGN)
new_list = g_list_prepend (new_list, w);
tmp_list = tmp_list->next;
}
return new_list;
}

View File

@ -224,6 +224,7 @@ struct _GdkDisplayClass
gboolean (*get_setting) (GdkDisplay *display,
const char *name,
GValue *value);
GdkWindow * (*get_root_window) (GdkDisplay *display);
/* Signals */
void (*opened) (GdkDisplay *display);
@ -307,6 +308,8 @@ void gdk_display_emit_opened (GdkDisplay *display
void gdk_display_setting_changed (GdkDisplay *display,
const char *name);
GList * gdk_display_get_toplevel_windows (GdkDisplay *display);
G_END_DECLS
#endif /* __GDK_DISPLAY_PRIVATE_H__ */

View File

@ -248,6 +248,12 @@ gdk_quartz_display_finalize (GObject *object)
G_OBJECT_CLASS (gdk_quartz_display_parent_class)->finalize (object);
}
static GdkWindow *
gdk_quartz_display_get_root_window (GdkDisplay *display)
{
return _gdk_root;
}
`
static void
gdk_quartz_display_class_init (GdkQuartzDisplayClass *class)
{
@ -297,6 +303,7 @@ gdk_quartz_display_class_init (GdkQuartzDisplayClass *class)
display_class->get_monitor = gdk_quartz_display_get_monitor;
display_class->get_primary_monitor = gdk_quartz_display_get_primary_monitor;
display_class->get_setting = gdk_quartz_display_get_setting;
display_class->get_root_window = gdk_quartz_display_get_root_window;
ProcessSerialNumber psn = { 0, kCurrentProcess };

View File

@ -989,6 +989,12 @@ gdk_wayland_display_get_setting (GdkDisplay *display,
return gdk_wayland_screen_get_setting (GDK_WAYLAND_DISPLAY (display)->screen, name, value);
}
static GdkWindow *
gdk_wayland_display_get_root_window (GdkDisplay *display)
{
return gdk_wayland_screen_get_root_window (GDK_WAYLAND_DISPLAY (display)->screen);
}
static void
gdk_wayland_display_class_init (GdkWaylandDisplayClass *class)
{
@ -1048,6 +1054,7 @@ gdk_wayland_display_class_init (GdkWaylandDisplayClass *class)
display_class->get_monitor = gdk_wayland_display_get_monitor;
display_class->get_monitor_at_window = gdk_wayland_display_get_monitor_at_window;
display_class->get_setting = gdk_wayland_display_get_setting;
display_class->get_root_window = gdk_wayland_display_get_root_window;
}
static void

View File

@ -213,6 +213,7 @@ GdkWindow *_gdk_wayland_screen_create_root_window (GdkScreen *screen,
gboolean gdk_wayland_screen_get_setting (GdkScreen *screen,
const gchar *name,
GValue *value);
GdkWindow *gdk_wayland_screen_get_root_window (GdkScreen *screen);
GdkScreen *_gdk_wayland_screen_new (GdkDisplay *display);
void _gdk_wayland_screen_add_output (GdkScreen *screen,

View File

@ -105,7 +105,7 @@ gdk_wayland_screen_get_display (GdkScreen *screen)
return GDK_WAYLAND_SCREEN (screen)->display;
}
static GdkWindow *
GdkWindow *
gdk_wayland_screen_get_root_window (GdkScreen *screen)
{
return GDK_WAYLAND_SCREEN (screen)->root_window;

View File

@ -1238,6 +1238,12 @@ gdk_win32_display_get_setting (GdkDisplay *display,
value);
}
static GdkWindow *
gdk_win32_display_get_root_window (GdkDisplay *display)
{
return gdk_win32_screen_get_root_window (GDK_WIN32_DISPLAY (display)->screen);
}
static void
gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
{
@ -1300,6 +1306,7 @@ gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
#endif
display_class->get_setting = gdk_win32_display_get_setting;
display_class->get_root_window = gdk_win32_display_get_root_window;
_gdk_win32_windowing_init ();
}

View File

@ -504,6 +504,7 @@ void _gdk_win32_window_delete_property (GdkWindow *window, GdkAtom property);
/* Stray GdkWin32Screen members */
gboolean _gdk_win32_screen_get_setting (GdkScreen *screen, const gchar *name, GValue *value);
void _gdk_win32_screen_on_displaychange_event (GdkWin32Screen *screen);
GdkWindow *gdk_win32_screen_get_root_window (GdkScreen *screen);
/* Distributed display manager implementation */
GdkDisplay *_gdk_win32_display_open (const gchar *display_name);

View File

@ -183,7 +183,7 @@ gdk_win32_screen_get_display (GdkScreen *screen)
return _gdk_display;
}
static GdkWindow *
GdkWindow *
gdk_win32_screen_get_root_window (GdkScreen *screen)
{
return GDK_WIN32_SCREEN (screen)->root_window;

View File

@ -3135,6 +3135,12 @@ gdk_x11_display_get_setting (GdkDisplay *display,
return gdk_x11_screen_get_setting (GDK_X11_DISPLAY (display)->screen, name, value);
}
static GdkWindow *
gdk_x11_display_get_root_window (GdkDisplay *display)
{
return gdk_x11_screen_get_root_window (GDK_X11_DISPLAY (display)->screen);
}
static void
gdk_x11_display_class_init (GdkX11DisplayClass * class)
{
@ -3196,6 +3202,7 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class)
display_class->get_monitor = gdk_x11_display_get_monitor;
display_class->get_primary_monitor = gdk_x11_display_get_primary_monitor;
display_class->get_setting = gdk_x11_display_get_setting;
display_class->get_root_window = gdk_x11_display_get_root_window;
_gdk_x11_windowing_init ();
}

View File

@ -79,7 +79,7 @@ gdk_x11_screen_get_display (GdkScreen *screen)
return GDK_X11_SCREEN (screen)->display;
}
static GdkWindow *
GdkWindow *
gdk_x11_screen_get_root_window (GdkScreen *screen)
{
return GDK_X11_SCREEN (screen)->root_window;

View File

@ -117,6 +117,7 @@ void gdk_x11_screen_get_work_area (GdkScreen *screen,
gboolean gdk_x11_screen_get_setting (GdkScreen *screen,
const char *name,
GValue *value);
GdkWindow *gdk_x11_screen_get_root_window (GdkScreen *screen);
G_END_DECLS