From 4585af5719d6854d298038a9defa2c1b3c542612 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Fri, 4 Nov 2016 00:02:37 +0100 Subject: [PATCH] gdk: Remove visual APIs from GdkScreen gdk_screen_list_visuals(), gdk_screen_get_system_visual() and gdk_screen_get_rgba_visual() are gone now. --- docs/reference/gdk/gdk4-sections.txt | 3 - gdk/broadway/gdkprivate-broadway.h | 2 - gdk/broadway/gdkscreen-broadway.c | 11 --- gdk/broadway/gdkvisual-broadway.c | 25 ------- gdk/gdkscreen.c | 81 +-------------------- gdk/gdkscreen.h | 7 -- gdk/gdkscreenprivate.h | 3 - gdk/gdkwindow.c | 4 -- gdk/mir/gdkmirscreen.c | 24 ------- gdk/quartz/gdkprivate-quartz.h | 3 - gdk/quartz/gdkscreen-quartz.c | 3 - gdk/quartz/gdkvisual-quartz.c | 23 ------ gdk/wayland/gdkscreen-wayland.c | 29 -------- gdk/win32/gdkdisplay-win32.c | 2 - gdk/win32/gdkscreen-win32.c | 27 ------- gdk/x11/gdkprivate-x11.h | 4 -- gdk/x11/gdkscreen-x11.c | 11 --- gdk/x11/gdkvisual-x11.c | 26 ------- testsuite/gdk/Makefile.am | 1 - testsuite/gdk/visual.c | 101 --------------------------- 20 files changed, 1 insertion(+), 389 deletions(-) delete mode 100644 testsuite/gdk/visual.c diff --git a/docs/reference/gdk/gdk4-sections.txt b/docs/reference/gdk/gdk4-sections.txt index d4fa3eeff3..7f86bfe14c 100644 --- a/docs/reference/gdk/gdk4-sections.txt +++ b/docs/reference/gdk/gdk4-sections.txt @@ -178,12 +178,9 @@ gdk_display_manager_get_type GdkScreen GdkScreen gdk_screen_get_default -gdk_screen_get_system_visual -gdk_screen_get_rgba_visual gdk_screen_get_root_window gdk_screen_get_display gdk_screen_get_number -gdk_screen_list_visuals gdk_screen_get_toplevel_windows gdk_screen_get_n_monitors gdk_screen_get_primary_monitor diff --git a/gdk/broadway/gdkprivate-broadway.h b/gdk/broadway/gdkprivate-broadway.h index 799c61b146..90ac71443c 100644 --- a/gdk/broadway/gdkprivate-broadway.h +++ b/gdk/broadway/gdkprivate-broadway.h @@ -90,8 +90,6 @@ gboolean _gdk_keymap_key_is_modifier (GdkKeymap *keymap, guint keycode); void _gdk_broadway_screen_events_init (GdkScreen *screen); -GdkVisual *_gdk_broadway_screen_get_system_visual (GdkScreen * screen); -GList *_gdk_broadway_screen_list_visuals (GdkScreen *screen); void _gdk_broadway_screen_size_changed (GdkScreen *screen, BroadwayInputScreenResizeNotify *msg); diff --git a/gdk/broadway/gdkscreen-broadway.c b/gdk/broadway/gdkscreen-broadway.c index b73dac4247..8d97dc4ca0 100644 --- a/gdk/broadway/gdkscreen-broadway.c +++ b/gdk/broadway/gdkscreen-broadway.c @@ -112,14 +112,6 @@ gdk_broadway_screen_finalize (GObject *object) G_OBJECT_CLASS (gdk_broadway_screen_parent_class)->finalize (object); } -static GdkVisual * -gdk_broadway_screen_get_rgba_visual (GdkScreen *screen) -{ - GdkBroadwayScreen *broadway_screen = GDK_BROADWAY_SCREEN (screen); - - return broadway_screen->rgba_visual; -} - GdkScreen * _gdk_broadway_screen_new (GdkDisplay *display, gint screen_number) @@ -162,8 +154,5 @@ gdk_broadway_screen_class_init (GdkBroadwayScreenClass *klass) screen_class->get_display = gdk_broadway_screen_get_display; screen_class->get_root_window = gdk_broadway_screen_get_root_window; screen_class->get_setting = gdk_broadway_screen_get_setting; - screen_class->get_rgba_visual = gdk_broadway_screen_get_rgba_visual; - screen_class->get_system_visual = _gdk_broadway_screen_get_system_visual; - screen_class->list_visuals = _gdk_broadway_screen_list_visuals; } diff --git a/gdk/broadway/gdkvisual-broadway.c b/gdk/broadway/gdkvisual-broadway.c index 81a1b4bed8..924f278812 100644 --- a/gdk/broadway/gdkvisual-broadway.c +++ b/gdk/broadway/gdkvisual-broadway.c @@ -110,28 +110,3 @@ _gdk_broadway_screen_init_visuals (GdkScreen *screen) broadway_screen->nvisuals = nvisuals; } -GdkVisual * -_gdk_broadway_screen_get_system_visual (GdkScreen * screen) -{ - g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); - - return ((GdkVisual *) GDK_BROADWAY_SCREEN (screen)->system_visual); -} - -GList * -_gdk_broadway_screen_list_visuals (GdkScreen *screen) -{ - GList *list; - GdkBroadwayScreen *broadway_screen; - guint i; - - g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); - broadway_screen = GDK_BROADWAY_SCREEN (screen); - - list = NULL; - - for (i = 0; i < broadway_screen->nvisuals; ++i) - list = g_list_append (list, broadway_screen->visuals[i]); - - return list; -} diff --git a/gdk/gdkscreen.c b/gdk/gdkscreen.c index 0b80257564..35bf2add58 100644 --- a/gdk/gdkscreen.c +++ b/gdk/gdkscreen.c @@ -40,10 +40,7 @@ * combines several physical monitors (see gdk_screen_get_n_monitors()). * * GdkScreen is used throughout GDK and GTK+ to specify which screen - * the top level windows are to be displayed on. it is also used to - * query the screen specification and default settings such as - * the default visual (gdk_screen_get_system_visual()), the dimensions - * of the physical monitors (gdk_screen_get_monitor_geometry()), etc. + * the top level windows are to be displayed on. */ @@ -282,82 +279,6 @@ gdk_screen_get_root_window (GdkScreen *screen) return GDK_SCREEN_GET_CLASS (screen)->get_root_window (screen); } -/** - * gdk_screen_list_visuals: - * @screen: the relevant #GdkScreen. - * - * Lists the available visuals for the specified @screen. - * A visual describes a hardware image data format. - * For example, a visual might support 24-bit color, or 8-bit color, - * and might expect pixels to be in a certain format. - * - * Call g_list_free() on the return value when you’re finished with it. - * - * Returns: (transfer container) (element-type GdkVisual): - * a list of visuals; the list must be freed, but not its contents - * - * Since: 2.2 - **/ -GList * -gdk_screen_list_visuals (GdkScreen *screen) -{ - g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); - - return GDK_SCREEN_GET_CLASS (screen)->list_visuals (screen); -} - -/** - * gdk_screen_get_system_visual: - * @screen: a #GdkScreen. - * - * Get the system’s default visual for @screen. - * This is the visual for the root window of the display. - * The return value should not be freed. - * - * Returns: (transfer none): the system visual - * - * Since: 2.2 - **/ -GdkVisual * -gdk_screen_get_system_visual (GdkScreen * screen) -{ - g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); - - return GDK_SCREEN_GET_CLASS (screen)->get_system_visual (screen); -} - -/** - * gdk_screen_get_rgba_visual: - * @screen: a #GdkScreen - * - * Gets a visual to use for creating windows with an alpha channel. - * The windowing system on which GTK+ is running - * may not support this capability, in which case %NULL will - * be returned. Even if a non-%NULL value is returned, its - * possible that the window’s alpha channel won’t be honored - * when displaying the window on the screen: in particular, for - * X an appropriate windowing manager and compositing manager - * must be running to provide appropriate display. - * - * This functionality is not implemented in the Windows backend. - * - * For setting an overall opacity for a top-level window, see - * gdk_window_set_opacity(). - * - * Returns: (nullable) (transfer none): a visual to use for windows - * with an alpha channel or %NULL if the capability is not - * available. - * - * Since: 2.8 - **/ -GdkVisual * -gdk_screen_get_rgba_visual (GdkScreen *screen) -{ - g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); - - return GDK_SCREEN_GET_CLASS (screen)->get_rgba_visual (screen); -} - /** * gdk_screen_get_setting: * @screen: the #GdkScreen where the setting is located diff --git a/gdk/gdkscreen.h b/gdk/gdkscreen.h index ece84cedf9..c62b318337 100644 --- a/gdk/gdkscreen.h +++ b/gdk/gdkscreen.h @@ -41,18 +41,11 @@ G_BEGIN_DECLS GDK_AVAILABLE_IN_ALL GType gdk_screen_get_type (void) G_GNUC_CONST; -GDK_AVAILABLE_IN_ALL -GdkVisual * gdk_screen_get_system_visual (GdkScreen *screen); -GDK_AVAILABLE_IN_ALL -GdkVisual * gdk_screen_get_rgba_visual (GdkScreen *screen); - GDK_AVAILABLE_IN_ALL GdkWindow * gdk_screen_get_root_window (GdkScreen *screen); GDK_AVAILABLE_IN_ALL GdkDisplay * gdk_screen_get_display (GdkScreen *screen); -GDK_AVAILABLE_IN_ALL -GList * gdk_screen_list_visuals (GdkScreen *screen); GDK_AVAILABLE_IN_ALL GList * gdk_screen_get_toplevel_windows (GdkScreen *screen); diff --git a/gdk/gdkscreenprivate.h b/gdk/gdkscreenprivate.h index b65bbbe9b9..bc6ae1d0ff 100644 --- a/gdk/gdkscreenprivate.h +++ b/gdk/gdkscreenprivate.h @@ -58,9 +58,6 @@ struct _GdkScreenClass void (* get_monitor_workarea) (GdkScreen *screen, gint monitor_num, GdkRectangle *dest); - GList * (* list_visuals) (GdkScreen *screen); - GdkVisual * (* get_system_visual) (GdkScreen *screen); - GdkVisual * (* get_rgba_visual) (GdkScreen *screen); gboolean (* get_setting) (GdkScreen *screen, const gchar *name, GValue *value); diff --git a/gdk/gdkwindow.c b/gdk/gdkwindow.c index 2eefac0ea8..e53d3a75b1 100644 --- a/gdk/gdkwindow.c +++ b/gdk/gdkwindow.c @@ -9996,10 +9996,6 @@ gdk_window_begin_move_drag (GdkWindow *window, * with alpha, or use gtk_widget_set_opacity() to set an overall opacity * for your widgets. * - * For child windows this function only works for non-native windows. - * - * For setting up per-pixel alpha topelevels, see gdk_screen_get_rgba_visual(). - * * Support for non-toplevel windows was added in 3.8. * * Since: 2.12 diff --git a/gdk/mir/gdkmirscreen.c b/gdk/mir/gdkmirscreen.c index d325e72842..77e8fa3338 100644 --- a/gdk/mir/gdkmirscreen.c +++ b/gdk/mir/gdkmirscreen.c @@ -390,27 +390,6 @@ gdk_mir_screen_get_monitor_workarea (GdkScreen *screen, gdk_mir_screen_get_monitor_geometry (screen, monitor_num, dest); } -static GList * -gdk_mir_screen_list_visuals (GdkScreen *screen) -{ - //g_printerr ("gdk_mir_screen_list_visuals\n"); - return g_list_append (NULL, GDK_MIR_SCREEN (screen)->visual); -} - -static GdkVisual * -gdk_mir_screen_get_system_visual (GdkScreen *screen) -{ - //g_printerr ("gdk_mir_screen_get_system_visual\n"); - return GDK_MIR_SCREEN (screen)->visual; -} - -static GdkVisual * -gdk_mir_screen_get_rgba_visual (GdkScreen *screen) -{ - //g_printerr ("gdk_mir_screen_get_rgba_visual\n"); - return GDK_MIR_SCREEN (screen)->visual; -} - static gboolean gdk_mir_screen_get_setting (GdkScreen *screen, const gchar *name, @@ -709,9 +688,6 @@ gdk_mir_screen_class_init (GdkMirScreenClass *klass) screen_class->get_monitor_plug_name = gdk_mir_screen_get_monitor_plug_name; screen_class->get_monitor_geometry = gdk_mir_screen_get_monitor_geometry; screen_class->get_monitor_workarea = gdk_mir_screen_get_monitor_workarea; - screen_class->list_visuals = gdk_mir_screen_list_visuals; - screen_class->get_system_visual = gdk_mir_screen_get_system_visual; - screen_class->get_rgba_visual = gdk_mir_screen_get_rgba_visual; screen_class->get_setting = gdk_mir_screen_get_setting; screen_class->get_monitor_scale_factor = gdk_mir_screen_get_monitor_scale_factor; } diff --git a/gdk/quartz/gdkprivate-quartz.h b/gdk/quartz/gdkprivate-quartz.h index 79d2778d68..66cc8fc49e 100644 --- a/gdk/quartz/gdkprivate-quartz.h +++ b/gdk/quartz/gdkprivate-quartz.h @@ -162,10 +162,7 @@ GdkScreen *_gdk_quartz_screen_new (void); void _gdk_quartz_screen_update_window_sizes (GdkScreen *screen); /* Screen methods - visual */ -GdkVisual * _gdk_quartz_screen_get_rgba_visual (GdkScreen *screen); -GdkVisual * _gdk_quartz_screen_get_system_visual (GdkScreen *screen); void _gdk_quartz_screen_init_visuals (GdkScreen *screen); -GList * _gdk_quartz_screen_list_visuals (GdkScreen *screen); /* Screen methods - events */ gboolean _gdk_quartz_screen_get_setting (GdkScreen *screen, diff --git a/gdk/quartz/gdkscreen-quartz.c b/gdk/quartz/gdkscreen-quartz.c index 1c7d251501..f82ad1c9ba 100644 --- a/gdk/quartz/gdkscreen-quartz.c +++ b/gdk/quartz/gdkscreen-quartz.c @@ -471,8 +471,5 @@ gdk_quartz_screen_class_init (GdkQuartzScreenClass *klass) screen_class->get_monitor_geometry = gdk_quartz_screen_get_monitor_geometry; screen_class->get_monitor_workarea = gdk_quartz_screen_get_monitor_workarea; screen_class->get_setting = _gdk_quartz_screen_get_setting; - screen_class->get_rgba_visual = _gdk_quartz_screen_get_rgba_visual; - screen_class->get_system_visual = _gdk_quartz_screen_get_system_visual; - screen_class->list_visuals = _gdk_quartz_screen_list_visuals; screen_class->get_monitor_scale_factor = _gdk_quartz_screen_get_monitor_scale_factor; } diff --git a/gdk/quartz/gdkvisual-quartz.c b/gdk/quartz/gdkvisual-quartz.c index 53d74aba7b..b15ea4c9b8 100644 --- a/gdk/quartz/gdkvisual-quartz.c +++ b/gdk/quartz/gdkvisual-quartz.c @@ -88,18 +88,6 @@ gdk_quartz_visual_class_init (GdkQuartzVisualClass *class) { } -GdkVisual * -_gdk_quartz_screen_get_rgba_visual (GdkScreen *screen) -{ - return rgba_visual; -} - -GdkVisual* -_gdk_quartz_screen_get_system_visual (GdkScreen *screen) -{ - return system_visual; -} - void _gdk_quartz_screen_init_visuals (GdkScreen *screen) { @@ -108,14 +96,3 @@ _gdk_quartz_screen_init_visuals (GdkScreen *screen) gray_visual = create_gray_visual (screen); } -GList* -_gdk_quartz_screen_list_visuals (GdkScreen *screen) -{ - GList *visuals = NULL; - - visuals = g_list_append (visuals, system_visual); - visuals = g_list_append (visuals, rgba_visual); - visuals = g_list_append (visuals, gray_visual); - - return visuals; -} diff --git a/gdk/wayland/gdkscreen-wayland.c b/gdk/wayland/gdkscreen-wayland.c index 0d40c1062c..5004438fc5 100644 --- a/gdk/wayland/gdkscreen-wayland.c +++ b/gdk/wayland/gdkscreen-wayland.c @@ -117,18 +117,6 @@ gdk_wayland_screen_get_root_window (GdkScreen *screen) return GDK_WAYLAND_SCREEN (screen)->root_window; } -static GdkVisual * -gdk_wayland_screen_get_system_visual (GdkScreen * screen) -{ - return (GdkVisual *) GDK_WAYLAND_SCREEN (screen)->visual; -} - -static GdkVisual * -gdk_wayland_screen_get_rgba_visual (GdkScreen *screen) -{ - return (GdkVisual *) GDK_WAYLAND_SCREEN (screen)->visual; -} - static void notify_setting (GdkScreen *screen, const gchar *setting) @@ -646,20 +634,6 @@ _gdk_wayland_visual_init (GdkWaylandVisual *visual) { } -static GList * -gdk_wayland_screen_list_visuals (GdkScreen *screen) -{ - GList *list; - GdkWaylandScreen *screen_wayland; - - g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); - screen_wayland = GDK_WAYLAND_SCREEN (screen); - - list = g_list_append (NULL, screen_wayland->visual); - - return list; -} - #define GDK_TYPE_WAYLAND_VISUAL (_gdk_wayland_visual_get_type ()) #define GDK_WAYLAND_VISUAL(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GDK_TYPE_WAYLAND_VISUAL, GdkWaylandVisual)) @@ -714,10 +688,7 @@ _gdk_wayland_screen_class_init (GdkWaylandScreenClass *klass) screen_class->get_display = gdk_wayland_screen_get_display; screen_class->get_root_window = gdk_wayland_screen_get_root_window; - screen_class->get_system_visual = gdk_wayland_screen_get_system_visual; - screen_class->get_rgba_visual = gdk_wayland_screen_get_rgba_visual; screen_class->get_setting = gdk_wayland_screen_get_setting; - screen_class->list_visuals = gdk_wayland_screen_list_visuals; } static void diff --git a/gdk/win32/gdkdisplay-win32.c b/gdk/win32/gdkdisplay-win32.c index ad40ea3d09..0d626c46f2 100644 --- a/gdk/win32/gdkdisplay-win32.c +++ b/gdk/win32/gdkdisplay-win32.c @@ -401,8 +401,6 @@ _gdk_win32_display_open (const gchar *display_name) win32_display = GDK_WIN32_DISPLAY (_gdk_display); win32_display->screen = g_object_new (GDK_TYPE_WIN32_SCREEN, NULL); - if (gdk_screen_get_rgba_visual (win32_display->screen) == NULL) - gdk_display_set_rgba (_gdk_display, FALSE); _gdk_events_init (_gdk_display); diff --git a/gdk/win32/gdkscreen-win32.c b/gdk/win32/gdkscreen-win32.c index 05840df500..b6fccae715 100644 --- a/gdk/win32/gdkscreen-win32.c +++ b/gdk/win32/gdkscreen-win32.c @@ -379,30 +379,6 @@ gdk_win32_screen_get_root_window (GdkScreen *screen) return GDK_WIN32_SCREEN (screen)->root_window; } -static GdkVisual * -gdk_win32_screen_get_system_visual (GdkScreen *screen) -{ - return GDK_WIN32_SCREEN (screen)->system_visual; -} - -static GdkVisual * -gdk_win32_screen_get_rgba_visual (GdkScreen *screen) -{ - return GDK_WIN32_SCREEN (screen)->rgba_visual; -} - -static GList * -gdk_win32_screen_list_visuals (GdkScreen *screen) -{ - GdkWin32Screen *win32_screen = GDK_WIN32_SCREEN (screen); - GList *result = NULL; - - result = g_list_append (result, win32_screen->rgba_visual); - result = g_list_append (result, win32_screen->system_visual); - - return result; -} - static void gdk_win32_screen_finalize (GObject *object) { @@ -420,7 +396,4 @@ gdk_win32_screen_class_init (GdkWin32ScreenClass *klass) screen_class->get_display = gdk_win32_screen_get_display; screen_class->get_root_window = gdk_win32_screen_get_root_window; screen_class->get_setting = _gdk_win32_screen_get_setting; - screen_class->get_system_visual = gdk_win32_screen_get_system_visual; - screen_class->get_rgba_visual = gdk_win32_screen_get_rgba_visual; - screen_class->list_visuals = gdk_win32_screen_list_visuals; } diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h index 3353f74c7e..c1496e87a0 100644 --- a/gdk/x11/gdkprivate-x11.h +++ b/gdk/x11/gdkprivate-x11.h @@ -48,10 +48,6 @@ void _gdk_x11_error_handler_push (void); void _gdk_x11_error_handler_pop (void); -GdkVisual * _gdk_x11_screen_get_system_visual (GdkScreen *screen); -GList * _gdk_x11_screen_list_visuals (GdkScreen *screen); - - void gdk_display_setup_window_visual (GdkDisplay *display, gint depth, Visual *visual, diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c index 905368d35f..6a06b62c1d 100644 --- a/gdk/x11/gdkscreen-x11.c +++ b/gdk/x11/gdkscreen-x11.c @@ -279,14 +279,6 @@ out: XFree (ret_workarea); } -static GdkVisual * -gdk_x11_screen_get_rgba_visual (GdkScreen *screen) -{ - GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen); - - return x11_screen->rgba_visual; -} - /** * gdk_x11_screen_get_xscreen: * @screen: (type GdkX11Screen): a #GdkScreen @@ -1291,10 +1283,7 @@ gdk_x11_screen_class_init (GdkX11ScreenClass *klass) screen_class->get_display = gdk_x11_screen_get_display; screen_class->get_root_window = gdk_x11_screen_get_root_window; - screen_class->get_system_visual = _gdk_x11_screen_get_system_visual; - screen_class->get_rgba_visual = gdk_x11_screen_get_rgba_visual; screen_class->get_setting = gdk_x11_screen_get_setting; - screen_class->list_visuals = _gdk_x11_screen_list_visuals; signals[WINDOW_MANAGER_CHANGED] = g_signal_new (g_intern_static_string ("window-manager-changed"), diff --git a/gdk/x11/gdkvisual-x11.c b/gdk/x11/gdkvisual-x11.c index 366193336b..0430db1ce5 100644 --- a/gdk/x11/gdkvisual-x11.c +++ b/gdk/x11/gdkvisual-x11.c @@ -291,32 +291,6 @@ _gdk_x11_screen_init_visuals (GdkScreen *screen, } } -GdkVisual * -_gdk_x11_screen_get_system_visual (GdkScreen *screen) -{ - g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); - - return ((GdkVisual *) GDK_X11_SCREEN (screen)->system_visual); -} - -GList * -_gdk_x11_screen_list_visuals (GdkScreen *screen) -{ - GList *list; - GdkX11Screen *x11_screen; - guint i; - - g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); - x11_screen = GDK_X11_SCREEN (screen); - - list = NULL; - - for (i = 0; i < x11_screen->nvisuals; ++i) - list = g_list_append (list, x11_screen->visuals[i]); - - return list; -} - /** * gdk_x11_screen_lookup_visual: * @screen: (type GdkX11Screen): a #GdkScreen. diff --git a/testsuite/gdk/Makefile.am b/testsuite/gdk/Makefile.am index 98a76888fa..9315e3e307 100644 --- a/testsuite/gdk/Makefile.am +++ b/testsuite/gdk/Makefile.am @@ -26,7 +26,6 @@ TEST_PROGS += \ rectangle \ rgba \ seat \ - visual \ $(NULL) CLEANFILES = \ diff --git a/testsuite/gdk/visual.c b/testsuite/gdk/visual.c deleted file mode 100644 index d9dd3c4cbd..0000000000 --- a/testsuite/gdk/visual.c +++ /dev/null @@ -1,101 +0,0 @@ -#include - -/* We don't technically guarantee that the visual returned by - * gdk_screen_get_rgba_visual is ARGB8888. But if it isn't, lots - * of code will break, so test this here anyway. - * The main point of this test is to ensure that the pixel_details - * functions return meaningful values for TrueColor visuals. - */ -static void -test_rgba_visual (void) -{ - GdkScreen *screen; - GdkVisual *visual; - guint32 r_mask, g_mask, b_mask; - gint r_shift, g_shift, b_shift; - gint r_precision, g_precision, b_precision; - gint depth; - GdkVisualType type; - - g_test_bug ("764210"); - - screen = gdk_screen_get_default (); - visual = gdk_screen_get_rgba_visual (screen); - - if (visual == NULL) - { - g_test_skip ("no rgba visual"); - return; - } - - depth = gdk_visual_get_depth (visual); - type = gdk_visual_get_visual_type (visual); - gdk_visual_get_red_pixel_details (visual, &r_mask, &r_shift, &r_precision); - gdk_visual_get_green_pixel_details (visual, &g_mask, &g_shift, &g_precision); - gdk_visual_get_blue_pixel_details (visual, &b_mask, &b_shift, &b_precision); - - g_assert_cmpint (depth, ==, 32); - g_assert_cmpint (type, ==, GDK_VISUAL_TRUE_COLOR); - - g_assert_cmphex (r_mask, ==, 0x00ff0000); - g_assert_cmphex (g_mask, ==, 0x0000ff00); - g_assert_cmphex (b_mask, ==, 0x000000ff); - - g_assert_cmpint (r_shift, ==, 16); - g_assert_cmpint (g_shift, ==, 8); - g_assert_cmpint (b_shift, ==, 0); - - g_assert_cmpint (r_precision, ==, 8); - g_assert_cmpint (g_precision, ==, 8); - g_assert_cmpint (b_precision, ==, 8); -} - -static void -test_list_visuals (void) -{ - GdkScreen *screen; - GdkVisual *visual; - GdkVisual *rgba_visual; - GdkVisual *system_visual; - GList *list, *l; - gboolean found_system, found_rgba; - - screen = gdk_screen_get_default (); - system_visual = gdk_screen_get_system_visual (screen); - rgba_visual = gdk_screen_get_rgba_visual (screen); - - found_system = FALSE; - found_rgba = FALSE; - - list = gdk_screen_list_visuals (screen); - for (l = list; l; l = l->next) - { - visual = l->data; - if (visual == system_visual) - found_system = TRUE; - if (visual == rgba_visual) - found_rgba = TRUE; - g_assert_true (GDK_IS_VISUAL (visual)); - - g_assert_true (gdk_visual_get_screen (visual) == screen); - } - g_list_free (list); - - g_assert (system_visual != NULL && found_system); - g_assert (rgba_visual == NULL || found_rgba); -} - -int -main (int argc, char *argv[]) -{ - g_test_init (&argc, &argv, NULL); - - gdk_init (NULL, NULL); - - g_test_bug_base ("http://bugzilla.gnome.org/"); - - g_test_add_func ("/visual/list", test_list_visuals); - g_test_add_func ("/visual/rgba", test_rgba_visual); - - return g_test_run (); -}