forked from AuroraMiddleware/gtk
gdk: Remove visual APIs from GdkScreen
gdk_screen_list_visuals(), gdk_screen_get_system_visual() and gdk_screen_get_rgba_visual() are gone now.
This commit is contained in:
parent
fe08641205
commit
4585af5719
@ -178,12 +178,9 @@ gdk_display_manager_get_type
|
||||
<TITLE>GdkScreen</TITLE>
|
||||
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
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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"),
|
||||
|
@ -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.
|
||||
|
@ -26,7 +26,6 @@ TEST_PROGS += \
|
||||
rectangle \
|
||||
rgba \
|
||||
seat \
|
||||
visual \
|
||||
$(NULL)
|
||||
|
||||
CLEANFILES = \
|
||||
|
@ -1,101 +0,0 @@
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
/* 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 ();
|
||||
}
|
Loading…
Reference in New Issue
Block a user