API: gdk: Remove visual querying APIs

They are unused, only work on the default display anyway and visuals are
on their way out.
This commit is contained in:
Benjamin Otte 2016-10-28 04:42:24 +02:00
parent f420dc7456
commit 45c0379f87
17 changed files with 0 additions and 937 deletions

View File

@ -261,21 +261,11 @@ gdk_rgba_get_type
GdkVisual GdkVisual
GdkVisualType GdkVisualType
GdkByteOrder GdkByteOrder
gdk_query_depths
gdk_query_visual_types
gdk_list_visuals
gdk_visual_get_blue_pixel_details gdk_visual_get_blue_pixel_details
gdk_visual_get_depth gdk_visual_get_depth
gdk_visual_get_green_pixel_details gdk_visual_get_green_pixel_details
gdk_visual_get_red_pixel_details gdk_visual_get_red_pixel_details
gdk_visual_get_visual_type gdk_visual_get_visual_type
gdk_visual_get_best_depth
gdk_visual_get_best_type
gdk_visual_get_system
gdk_visual_get_best
gdk_visual_get_best_with_depth
gdk_visual_get_best_with_type
gdk_visual_get_best_with_both
gdk_visual_get_screen gdk_visual_get_screen
<SUBSECTION Standard> <SUBSECTION Standard>

View File

@ -91,22 +91,6 @@ gboolean _gdk_keymap_key_is_modifier (GdkKeymap *keymap,
void _gdk_broadway_screen_events_init (GdkScreen *screen); void _gdk_broadway_screen_events_init (GdkScreen *screen);
GdkVisual *_gdk_broadway_screen_get_system_visual (GdkScreen * screen); GdkVisual *_gdk_broadway_screen_get_system_visual (GdkScreen * screen);
gint _gdk_broadway_screen_visual_get_best_depth (GdkScreen * screen);
GdkVisualType _gdk_broadway_screen_visual_get_best_type (GdkScreen * screen);
GdkVisual*_gdk_broadway_screen_visual_get_best (GdkScreen * screen);
GdkVisual*_gdk_broadway_screen_visual_get_best_with_depth (GdkScreen * screen,
gint depth);
GdkVisual*_gdk_broadway_screen_visual_get_best_with_type (GdkScreen * screen,
GdkVisualType visual_type);
GdkVisual*_gdk_broadway_screen_visual_get_best_with_both (GdkScreen * screen,
gint depth,
GdkVisualType visual_type);
void _gdk_broadway_screen_query_depths (GdkScreen * screen,
gint **depths,
gint *count);
void _gdk_broadway_screen_query_visual_types (GdkScreen * screen,
GdkVisualType **visual_types,
gint *count);
GList *_gdk_broadway_screen_list_visuals (GdkScreen *screen); GList *_gdk_broadway_screen_list_visuals (GdkScreen *screen);
void _gdk_broadway_screen_size_changed (GdkScreen *screen, void _gdk_broadway_screen_size_changed (GdkScreen *screen,
BroadwayInputScreenResizeNotify *msg); BroadwayInputScreenResizeNotify *msg);

View File

@ -182,14 +182,6 @@ gdk_broadway_screen_class_init (GdkBroadwayScreenClass *klass)
screen_class->get_setting = gdk_broadway_screen_get_setting; screen_class->get_setting = gdk_broadway_screen_get_setting;
screen_class->get_rgba_visual = gdk_broadway_screen_get_rgba_visual; screen_class->get_rgba_visual = gdk_broadway_screen_get_rgba_visual;
screen_class->get_system_visual = _gdk_broadway_screen_get_system_visual; screen_class->get_system_visual = _gdk_broadway_screen_get_system_visual;
screen_class->visual_get_best_depth = _gdk_broadway_screen_visual_get_best_depth;
screen_class->visual_get_best_type = _gdk_broadway_screen_visual_get_best_type;
screen_class->visual_get_best = _gdk_broadway_screen_visual_get_best;
screen_class->visual_get_best_with_depth = _gdk_broadway_screen_visual_get_best_with_depth;
screen_class->visual_get_best_with_type = _gdk_broadway_screen_visual_get_best_with_type;
screen_class->visual_get_best_with_both = _gdk_broadway_screen_visual_get_best_with_both;
screen_class->query_depths = _gdk_broadway_screen_query_depths;
screen_class->query_visual_types = _gdk_broadway_screen_query_visual_types;
screen_class->list_visuals = _gdk_broadway_screen_list_visuals; screen_class->list_visuals = _gdk_broadway_screen_list_visuals;
} }

View File

@ -110,18 +110,6 @@ _gdk_broadway_screen_init_visuals (GdkScreen *screen)
broadway_screen->nvisuals = nvisuals; broadway_screen->nvisuals = nvisuals;
} }
gint
_gdk_broadway_screen_visual_get_best_depth (GdkScreen * screen)
{
return GDK_BROADWAY_SCREEN (screen)->available_depths[0];
}
GdkVisualType
_gdk_broadway_screen_visual_get_best_type (GdkScreen * screen)
{
return GDK_BROADWAY_SCREEN (screen)->available_types[0];
}
GdkVisual * GdkVisual *
_gdk_broadway_screen_get_system_visual (GdkScreen * screen) _gdk_broadway_screen_get_system_visual (GdkScreen * screen)
{ {
@ -130,95 +118,6 @@ _gdk_broadway_screen_get_system_visual (GdkScreen * screen)
return ((GdkVisual *) GDK_BROADWAY_SCREEN (screen)->system_visual); return ((GdkVisual *) GDK_BROADWAY_SCREEN (screen)->system_visual);
} }
GdkVisual*
_gdk_broadway_screen_visual_get_best (GdkScreen * screen)
{
GdkBroadwayScreen *broadway_screen = GDK_BROADWAY_SCREEN (screen);
return (GdkVisual *)broadway_screen->visuals[0];
}
GdkVisual*
_gdk_broadway_screen_visual_get_best_with_depth (GdkScreen * screen,
gint depth)
{
GdkBroadwayScreen *broadway_screen = GDK_BROADWAY_SCREEN (screen);
GdkVisual *return_val;
int i;
return_val = NULL;
for (i = 0; i < broadway_screen->nvisuals; i++)
if (depth == broadway_screen->visuals[i]->depth)
{
return_val = (GdkVisual *) broadway_screen->visuals[i];
break;
}
return return_val;
}
GdkVisual*
_gdk_broadway_screen_visual_get_best_with_type (GdkScreen * screen,
GdkVisualType visual_type)
{
GdkBroadwayScreen *broadway_screen = GDK_BROADWAY_SCREEN (screen);
GdkVisual *return_val;
int i;
return_val = NULL;
for (i = 0; i < broadway_screen->nvisuals; i++)
if (visual_type == broadway_screen->visuals[i]->type)
{
return_val = (GdkVisual *) broadway_screen->visuals[i];
break;
}
return return_val;
}
GdkVisual*
_gdk_broadway_screen_visual_get_best_with_both (GdkScreen * screen,
gint depth,
GdkVisualType visual_type)
{
GdkBroadwayScreen *broadway_screen = GDK_BROADWAY_SCREEN (screen);
GdkVisual *return_val;
int i;
return_val = NULL;
for (i = 0; i < broadway_screen->nvisuals; i++)
if ((depth == broadway_screen->visuals[i]->depth) &&
(visual_type == broadway_screen->visuals[i]->type))
{
return_val = (GdkVisual *) broadway_screen->visuals[i];
break;
}
return return_val;
}
void
_gdk_broadway_screen_query_depths (GdkScreen * screen,
gint **depths,
gint *count)
{
GdkBroadwayScreen *broadway_screen = GDK_BROADWAY_SCREEN (screen);
*count = broadway_screen->navailable_depths;
*depths = broadway_screen->available_depths;
}
void
_gdk_broadway_screen_query_visual_types (GdkScreen * screen,
GdkVisualType **visual_types,
gint *count)
{
GdkBroadwayScreen *broadway_screen = GDK_BROADWAY_SCREEN (screen);
*count = broadway_screen->navailable_types;
*visual_types = broadway_screen->available_types;
}
GList * GList *
_gdk_broadway_screen_list_visuals (GdkScreen *screen) _gdk_broadway_screen_list_visuals (GdkScreen *screen)
{ {

View File

@ -65,22 +65,6 @@ struct _GdkScreenClass
gboolean (* get_setting) (GdkScreen *screen, gboolean (* get_setting) (GdkScreen *screen,
const gchar *name, const gchar *name,
GValue *value); GValue *value);
gint (* visual_get_best_depth) (GdkScreen *screen);
GdkVisualType (* visual_get_best_type) (GdkScreen *screen);
GdkVisual * (* visual_get_best) (GdkScreen *screen);
GdkVisual * (* visual_get_best_with_depth) (GdkScreen *screen,
gint depth);
GdkVisual * (* visual_get_best_with_type) (GdkScreen *screen,
GdkVisualType visual_type);
GdkVisual * (* visual_get_best_with_both) (GdkScreen *screen,
gint depth,
GdkVisualType visual_type);
void (* query_depths) (GdkScreen *screen,
gint **depths,
gint *count);
void (* query_visual_types) (GdkScreen *screen,
GdkVisualType **visual_types,
gint *count);
gint (* get_monitor_scale_factor) (GdkScreen *screen, gint (* get_monitor_scale_factor) (GdkScreen *screen,
gint monitor_num); gint monitor_num);

View File

@ -75,192 +75,6 @@ gdk_visual_class_init (GdkVisualClass *visual_class)
object_class->finalize = gdk_visual_finalize; object_class->finalize = gdk_visual_finalize;
} }
/**
* gdk_list_visuals:
*
* Lists the available visuals for the default screen.
* (See gdk_screen_list_visuals())
* 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 youre finished with it.
*
* Returns: (transfer container) (element-type GdkVisual):
* a list of visuals; the list must be freed, but not its contents
*/
GList*
gdk_list_visuals (void)
{
return gdk_screen_list_visuals (gdk_screen_get_default ());
}
/**
* gdk_visual_get_system:
*
* Get the systems default visual for the default GDK screen.
* This is the visual for the root window of the display.
* The return value should not be freed.
*
* Returns: (transfer none): system visual
*/
GdkVisual*
gdk_visual_get_system (void)
{
return gdk_screen_get_system_visual (gdk_screen_get_default());
}
/**
* gdk_visual_get_best_depth:
*
* Get the best available depth for the default GDK screen. Best
* means largest, i.e. 32 preferred over 24 preferred over 8 bits
* per pixel.
*
* Returns: best available depth
*/
gint
gdk_visual_get_best_depth (void)
{
GdkScreen *screen = gdk_screen_get_default();
return GDK_SCREEN_GET_CLASS(screen)->visual_get_best_depth (screen);
}
/**
* gdk_visual_get_best_type:
*
* Return the best available visual type for the default GDK screen.
*
* Returns: best visual type
*/
GdkVisualType
gdk_visual_get_best_type (void)
{
GdkScreen *screen = gdk_screen_get_default();
return GDK_SCREEN_GET_CLASS(screen)->visual_get_best_type (screen);
}
/**
* gdk_visual_get_best:
*
* Get the visual with the most available colors for the default
* GDK screen. The return value should not be freed.
*
* Returns: (transfer none): best visual
*/
GdkVisual*
gdk_visual_get_best (void)
{
GdkScreen *screen = gdk_screen_get_default();
return GDK_SCREEN_GET_CLASS(screen)->visual_get_best (screen);
}
/**
* gdk_visual_get_best_with_depth:
* @depth: a bit depth
*
* Get the best visual with depth @depth for the default GDK screen.
* Color visuals and visuals with mutable colormaps are preferred
* over grayscale or fixed-colormap visuals. The return value should
* not be freed. %NULL may be returned if no visual supports @depth.
*
* Returns: (transfer none): best visual for the given depth
*/
GdkVisual*
gdk_visual_get_best_with_depth (gint depth)
{
GdkScreen *screen = gdk_screen_get_default();
return GDK_SCREEN_GET_CLASS(screen)->visual_get_best_with_depth (screen, depth);
}
/**
* gdk_visual_get_best_with_type:
* @visual_type: a visual type
*
* Get the best visual of the given @visual_type for the default GDK screen.
* Visuals with higher color depths are considered better. The return value
* should not be freed. %NULL may be returned if no visual has type
* @visual_type.
*
* Returns: (transfer none): best visual of the given type
*/
GdkVisual*
gdk_visual_get_best_with_type (GdkVisualType visual_type)
{
GdkScreen *screen = gdk_screen_get_default();
return GDK_SCREEN_GET_CLASS(screen)->visual_get_best_with_type (screen,
visual_type);
}
/**
* gdk_visual_get_best_with_both:
* @depth: a bit depth
* @visual_type: a visual type
*
* Combines gdk_visual_get_best_with_depth() and
* gdk_visual_get_best_with_type().
*
* Returns: (nullable) (transfer none): best visual with both @depth
* and @visual_type, or %NULL if none
*/
GdkVisual*
gdk_visual_get_best_with_both (gint depth,
GdkVisualType visual_type)
{
GdkScreen *screen = gdk_screen_get_default();
return GDK_SCREEN_GET_CLASS(screen)->visual_get_best_with_both (screen, depth, visual_type);
}
/**
* gdk_query_depths:
* @depths: (out) (array length=count) (transfer none): return
* location for available depths
* @count: return location for number of available depths
*
* This function returns the available bit depths for the default
* screen. Its equivalent to listing the visuals
* (gdk_list_visuals()) and then looking at the depth field in each
* visual, removing duplicates.
*
* The array returned by this function should not be freed.
*/
void
gdk_query_depths (gint **depths,
gint *count)
{
GdkScreen *screen = gdk_screen_get_default();
GDK_SCREEN_GET_CLASS(screen)->query_depths (screen, depths, count);
}
/**
* gdk_query_visual_types:
* @visual_types: (out) (array length=count) (transfer none): return
* location for the available visual types
* @count: return location for the number of available visual types
*
* This function returns the available visual types for the default
* screen. Its equivalent to listing the visuals
* (gdk_list_visuals()) and then looking at the type field in each
* visual, removing duplicates.
*
* The array returned by this function should not be freed.
*/
void
gdk_query_visual_types (GdkVisualType **visual_types,
gint *count)
{
GdkScreen *screen = gdk_screen_get_default();
GDK_SCREEN_GET_CLASS(screen)->query_visual_types (screen, visual_types, count);
}
/** /**
* gdk_visual_get_visual_type: * gdk_visual_get_visual_type:
* @visual: A #GdkVisual. * @visual: A #GdkVisual.

View File

@ -82,32 +82,6 @@ typedef enum
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
GType gdk_visual_get_type (void) G_GNUC_CONST; GType gdk_visual_get_type (void) G_GNUC_CONST;
GDK_AVAILABLE_IN_ALL
gint gdk_visual_get_best_depth (void);
GDK_AVAILABLE_IN_ALL
GdkVisualType gdk_visual_get_best_type (void);
GDK_AVAILABLE_IN_ALL
GdkVisual* gdk_visual_get_system (void);
GDK_AVAILABLE_IN_ALL
GdkVisual* gdk_visual_get_best (void);
GDK_AVAILABLE_IN_ALL
GdkVisual* gdk_visual_get_best_with_depth (gint depth);
GDK_AVAILABLE_IN_ALL
GdkVisual* gdk_visual_get_best_with_type (GdkVisualType visual_type);
GDK_AVAILABLE_IN_ALL
GdkVisual* gdk_visual_get_best_with_both (gint depth,
GdkVisualType visual_type);
GDK_AVAILABLE_IN_ALL
void gdk_query_depths (gint **depths,
gint *count);
GDK_AVAILABLE_IN_ALL
void gdk_query_visual_types (GdkVisualType **visual_types,
gint *count);
GDK_AVAILABLE_IN_ALL
GList* gdk_list_visuals (void);
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
GdkScreen *gdk_visual_get_screen (GdkVisual *visual); GdkScreen *gdk_visual_get_screen (GdkVisual *visual);

View File

@ -677,74 +677,6 @@ gdk_mir_screen_get_setting (GdkScreen *screen,
return FALSE; return FALSE;
} }
static gint
gdk_mir_screen_visual_get_best_depth (GdkScreen *screen)
{
//g_printerr ("gdk_mir_screen_visual_get_best_depth\n");
return VISUAL_DEPTH;
}
static GdkVisualType
gdk_mir_screen_visual_get_best_type (GdkScreen *screen)
{
//g_printerr ("gdk_mir_screen_visual_get_best_type\n");
return VISUAL_TYPE;
}
static GdkVisual*
gdk_mir_screen_visual_get_best (GdkScreen *screen)
{
//g_printerr ("gdk_mir_screen_visual_get_best\n");
return GDK_MIR_SCREEN (screen)->visual;
}
static GdkVisual*
gdk_mir_screen_visual_get_best_with_depth (GdkScreen *screen,
gint depth)
{
//g_printerr ("gdk_mir_screen_visual_get_best_with_depth (%d)\n", depth);
return GDK_MIR_SCREEN (screen)->visual;
}
static GdkVisual*
gdk_mir_screen_visual_get_best_with_type (GdkScreen *screen,
GdkVisualType visual_type)
{
//g_printerr ("gdk_mir_screen_visual_get_best_with_type (%d)\n", visual_type);
return GDK_MIR_SCREEN (screen)->visual;
}
static GdkVisual*
gdk_mir_screen_visual_get_best_with_both (GdkScreen *screen,
gint depth,
GdkVisualType visual_type)
{
//g_printerr ("gdk_mir_screen_visual_get_best_with_both\n");
return GDK_MIR_SCREEN (screen)->visual;
}
static void
gdk_mir_screen_query_depths (GdkScreen *screen,
gint **depths,
gint *count)
{
//g_printerr ("gdk_mir_screen_query_depths\n");
static gint supported_depths[] = { VISUAL_DEPTH };
*depths = supported_depths;
*count = 1;
}
static void
gdk_mir_screen_query_visual_types (GdkScreen *screen,
GdkVisualType **visual_types,
gint *count)
{
//g_printerr ("gdk_mir_screen_query_visual_types\n");
static GdkVisualType supported_visual_types[] = { VISUAL_TYPE };
*visual_types = supported_visual_types;
*count = 1;
}
static gint static gint
gdk_mir_screen_get_monitor_scale_factor (GdkScreen *screen, gdk_mir_screen_get_monitor_scale_factor (GdkScreen *screen,
gint monitor_num) gint monitor_num)
@ -790,13 +722,5 @@ gdk_mir_screen_class_init (GdkMirScreenClass *klass)
screen_class->get_rgba_visual = gdk_mir_screen_get_rgba_visual; screen_class->get_rgba_visual = gdk_mir_screen_get_rgba_visual;
screen_class->is_composited = gdk_mir_screen_is_composited; screen_class->is_composited = gdk_mir_screen_is_composited;
screen_class->get_setting = gdk_mir_screen_get_setting; screen_class->get_setting = gdk_mir_screen_get_setting;
screen_class->visual_get_best_depth = gdk_mir_screen_visual_get_best_depth;
screen_class->visual_get_best_type = gdk_mir_screen_visual_get_best_type;
screen_class->visual_get_best = gdk_mir_screen_visual_get_best;
screen_class->visual_get_best_with_depth = gdk_mir_screen_visual_get_best_with_depth;
screen_class->visual_get_best_with_type = gdk_mir_screen_visual_get_best_with_type;
screen_class->visual_get_best_with_both = gdk_mir_screen_visual_get_best_with_both;
screen_class->query_depths = gdk_mir_screen_query_depths;
screen_class->query_visual_types = gdk_mir_screen_query_visual_types;
screen_class->get_monitor_scale_factor = gdk_mir_screen_get_monitor_scale_factor; screen_class->get_monitor_scale_factor = gdk_mir_screen_get_monitor_scale_factor;
} }

View File

@ -164,23 +164,6 @@ void _gdk_quartz_screen_update_window_sizes (GdkScreen *screen);
/* Screen methods - visual */ /* Screen methods - visual */
GdkVisual * _gdk_quartz_screen_get_rgba_visual (GdkScreen *screen); GdkVisual * _gdk_quartz_screen_get_rgba_visual (GdkScreen *screen);
GdkVisual * _gdk_quartz_screen_get_system_visual (GdkScreen *screen); GdkVisual * _gdk_quartz_screen_get_system_visual (GdkScreen *screen);
gint _gdk_quartz_screen_visual_get_best_depth (GdkScreen *screen);
GdkVisualType _gdk_quartz_screen_visual_get_best_type (GdkScreen *screen);
GdkVisual * _gdk_quartz_screen_get_system_visual (GdkScreen *screen);
GdkVisual* _gdk_quartz_screen_visual_get_best (GdkScreen *screen);
GdkVisual* _gdk_quartz_screen_visual_get_best_with_depth (GdkScreen *screen,
gint depth);
GdkVisual* _gdk_quartz_screen_visual_get_best_with_type (GdkScreen *screen,
GdkVisualType visual_type);
GdkVisual* _gdk_quartz_screen_visual_get_best_with_both (GdkScreen *screen,
gint depth,
GdkVisualType visual_type);
void _gdk_quartz_screen_query_depths (GdkScreen *screen,
gint **depths,
gint *count);
void _gdk_quartz_screen_query_visual_types (GdkScreen *screen,
GdkVisualType **visual_types,
gint *count);
void _gdk_quartz_screen_init_visuals (GdkScreen *screen); void _gdk_quartz_screen_init_visuals (GdkScreen *screen);
GList * _gdk_quartz_screen_list_visuals (GdkScreen *screen); GList * _gdk_quartz_screen_list_visuals (GdkScreen *screen);

View File

@ -480,14 +480,6 @@ gdk_quartz_screen_class_init (GdkQuartzScreenClass *klass)
screen_class->get_setting = _gdk_quartz_screen_get_setting; screen_class->get_setting = _gdk_quartz_screen_get_setting;
screen_class->get_rgba_visual = _gdk_quartz_screen_get_rgba_visual; screen_class->get_rgba_visual = _gdk_quartz_screen_get_rgba_visual;
screen_class->get_system_visual = _gdk_quartz_screen_get_system_visual; screen_class->get_system_visual = _gdk_quartz_screen_get_system_visual;
screen_class->visual_get_best_depth = _gdk_quartz_screen_visual_get_best_depth;
screen_class->visual_get_best_type = _gdk_quartz_screen_visual_get_best_type;
screen_class->visual_get_best = _gdk_quartz_screen_visual_get_best;
screen_class->visual_get_best_with_depth = _gdk_quartz_screen_visual_get_best_with_depth;
screen_class->visual_get_best_with_type = _gdk_quartz_screen_visual_get_best_with_type;
screen_class->visual_get_best_with_both = _gdk_quartz_screen_visual_get_best_with_both;
screen_class->query_depths = _gdk_quartz_screen_query_depths;
screen_class->query_visual_types = _gdk_quartz_screen_query_visual_types;
screen_class->list_visuals = _gdk_quartz_screen_list_visuals; screen_class->list_visuals = _gdk_quartz_screen_list_visuals;
screen_class->get_monitor_scale_factor = _gdk_quartz_screen_get_monitor_scale_factor; screen_class->get_monitor_scale_factor = _gdk_quartz_screen_get_monitor_scale_factor;
} }

View File

@ -88,19 +88,6 @@ gdk_quartz_visual_class_init (GdkQuartzVisualClass *class)
{ {
} }
/* We prefer the system visual for now ... */
gint
_gdk_quartz_screen_visual_get_best_depth (GdkScreen *screen)
{
return system_visual->depth;
}
GdkVisualType
_gdk_quartz_screen_visual_get_best_type (GdkScreen *screen)
{
return system_visual->type;
}
GdkVisual * GdkVisual *
_gdk_quartz_screen_get_rgba_visual (GdkScreen *screen) _gdk_quartz_screen_get_rgba_visual (GdkScreen *screen)
{ {
@ -113,88 +100,6 @@ _gdk_quartz_screen_get_system_visual (GdkScreen *screen)
return system_visual; return system_visual;
} }
GdkVisual*
_gdk_quartz_screen_visual_get_best (GdkScreen *screen)
{
return system_visual;
}
GdkVisual*
_gdk_quartz_screen_visual_get_best_with_depth (GdkScreen *screen,
gint depth)
{
GdkVisual *visual = NULL;
switch (depth)
{
case 32:
visual = rgba_visual;
break;
case 24:
visual = system_visual;
break;
case 1:
visual = gray_visual;
break;
default:
visual = NULL;
}
return visual;
}
GdkVisual*
_gdk_quartz_screen_visual_get_best_with_type (GdkScreen *screen,
GdkVisualType visual_type)
{
if (system_visual->type == visual_type)
return system_visual;
else if (gray_visual->type == visual_type)
return gray_visual;
return NULL;
}
GdkVisual*
_gdk_quartz_screen_visual_get_best_with_both (GdkScreen *screen,
gint depth,
GdkVisualType visual_type)
{
if (system_visual->depth == depth
&& system_visual->type == visual_type)
return system_visual;
else if (rgba_visual->depth == depth
&& rgba_visual->type == visual_type)
return rgba_visual;
else if (gray_visual->depth == depth
&& gray_visual->type == visual_type)
return gray_visual;
return NULL;
}
/* For these, we also prefer the system visual */
void
_gdk_quartz_screen_query_depths (GdkScreen *screen,
gint **depths,
gint *count)
{
*count = 1;
*depths = &system_visual->depth;
}
void
_gdk_quartz_screen_query_visual_types (GdkScreen *screen,
GdkVisualType **visual_types,
gint *count)
{
*count = 1;
*visual_types = &system_visual->type;
}
void void
_gdk_quartz_screen_init_visuals (GdkScreen *screen) _gdk_quartz_screen_init_visuals (GdkScreen *screen)
{ {

View File

@ -652,77 +652,6 @@ _gdk_wayland_visual_init (GdkWaylandVisual *visual)
{ {
} }
static gint
gdk_wayland_screen_visual_get_best_depth (GdkScreen *screen)
{
return 32;
}
static GdkVisualType
gdk_wayland_screen_visual_get_best_type (GdkScreen *screen)
{
return GDK_VISUAL_TRUE_COLOR;
}
static GdkVisual*
gdk_wayland_screen_visual_get_best (GdkScreen *screen)
{
return GDK_WAYLAND_SCREEN (screen)->visual;
}
static GdkVisual*
gdk_wayland_screen_visual_get_best_with_depth (GdkScreen *screen,
gint depth)
{
if (depth == 32)
return GDK_WAYLAND_SCREEN (screen)->visual;
else
return NULL;
}
static GdkVisual*
gdk_wayland_screen_visual_get_best_with_type (GdkScreen *screen,
GdkVisualType visual_type)
{
if (visual_type == GDK_VISUAL_TRUE_COLOR)
return GDK_WAYLAND_SCREEN (screen)->visual;
else
return NULL;
}
static GdkVisual*
gdk_wayland_screen_visual_get_best_with_both (GdkScreen *screen,
gint depth,
GdkVisualType visual_type)
{
if (depth == 32 && visual_type == GDK_VISUAL_TRUE_COLOR)
return GDK_WAYLAND_SCREEN (screen)->visual;
else
return NULL;
}
static void
gdk_wayland_screen_query_depths (GdkScreen *screen,
gint **depths,
gint *count)
{
static gint static_depths[] = { 32 };
*count = G_N_ELEMENTS(static_depths);
*depths = static_depths;
}
static void
gdk_wayland_screen_query_visual_types (GdkScreen *screen,
GdkVisualType **visual_types,
gint *count)
{
static GdkVisualType static_visual_types[] = { GDK_VISUAL_TRUE_COLOR };
*count = G_N_ELEMENTS(static_visual_types);
*visual_types = static_visual_types;
}
static GList * static GList *
gdk_wayland_screen_list_visuals (GdkScreen *screen) gdk_wayland_screen_list_visuals (GdkScreen *screen)
{ {
@ -795,14 +724,6 @@ _gdk_wayland_screen_class_init (GdkWaylandScreenClass *klass)
screen_class->get_rgba_visual = gdk_wayland_screen_get_rgba_visual; screen_class->get_rgba_visual = gdk_wayland_screen_get_rgba_visual;
screen_class->is_composited = gdk_wayland_screen_is_composited; screen_class->is_composited = gdk_wayland_screen_is_composited;
screen_class->get_setting = gdk_wayland_screen_get_setting; screen_class->get_setting = gdk_wayland_screen_get_setting;
screen_class->visual_get_best_depth = gdk_wayland_screen_visual_get_best_depth;
screen_class->visual_get_best_type = gdk_wayland_screen_visual_get_best_type;
screen_class->visual_get_best = gdk_wayland_screen_visual_get_best;
screen_class->visual_get_best_with_depth = gdk_wayland_screen_visual_get_best_with_depth;
screen_class->visual_get_best_with_type = gdk_wayland_screen_visual_get_best_with_type;
screen_class->visual_get_best_with_both = gdk_wayland_screen_visual_get_best_with_both;
screen_class->query_depths = gdk_wayland_screen_query_depths;
screen_class->query_visual_types = gdk_wayland_screen_query_visual_types;
screen_class->list_visuals = gdk_wayland_screen_list_visuals; screen_class->list_visuals = gdk_wayland_screen_list_visuals;
} }

View File

@ -401,18 +401,6 @@ gdk_win32_screen_is_composited (GdkScreen *screen)
} }
} }
static gint
gdk_win32_screen_visual_get_best_depth (GdkScreen *screen)
{
return GDK_WIN32_SCREEN (screen)->available_visual_depths[0];
}
static GdkVisualType
gdk_win32_screen_visual_get_best_type (GdkScreen *screen)
{
return GDK_WIN32_SCREEN (screen)->available_visual_types[0];
}
static GdkVisual * static GdkVisual *
gdk_win32_screen_get_system_visual (GdkScreen *screen) gdk_win32_screen_get_system_visual (GdkScreen *screen)
{ {
@ -425,73 +413,6 @@ gdk_win32_screen_get_rgba_visual (GdkScreen *screen)
return GDK_WIN32_SCREEN (screen)->rgba_visual; return GDK_WIN32_SCREEN (screen)->rgba_visual;
} }
static GdkVisual*
gdk_win32_screen_visual_get_best (GdkScreen *screen)
{
return GDK_WIN32_SCREEN (screen)->rgba_visual;
}
static GdkVisual *
gdk_win32_screen_visual_get_best_with_depth (GdkScreen *screen,
gint depth)
{
GdkWin32Screen *win32_screen = GDK_WIN32_SCREEN (screen);
if (depth == win32_screen->rgba_visual->depth)
return win32_screen->rgba_visual;
else if (depth == win32_screen->system_visual->depth)
return win32_screen->system_visual;
return NULL;
}
static GdkVisual *
gdk_win32_screen_visual_get_best_with_type (GdkScreen *screen,
GdkVisualType visual_type)
{
GdkWin32Screen *win32_screen = GDK_WIN32_SCREEN (screen);
if (visual_type == win32_screen->rgba_visual->type)
return win32_screen->rgba_visual;
else if (visual_type == win32_screen->system_visual->type)
return win32_screen->system_visual;
return NULL;
}
static GdkVisual *
gdk_win32_screen_visual_get_best_with_both (GdkScreen *screen,
gint depth,
GdkVisualType visual_type)
{
GdkWin32Screen *win32_screen = GDK_WIN32_SCREEN (screen);
if ((depth == win32_screen->rgba_visual->depth) && (visual_type == win32_screen->rgba_visual->type))
return win32_screen->rgba_visual;
else if ((depth == win32_screen->system_visual->depth) && (visual_type == win32_screen->system_visual->type))
return win32_screen->system_visual;
return NULL;
}
static void
gdk_win32_screen_query_depths (GdkScreen *screen,
gint **depths,
gint *count)
{
*count = 1;
*depths = GDK_WIN32_SCREEN (screen)->available_visual_depths;
}
static void
gdk_win32_screen_query_visual_types (GdkScreen *screen,
GdkVisualType **visual_types,
gint *count)
{
*count = 1;
*visual_types = GDK_WIN32_SCREEN (screen)->available_visual_types;
}
static GList * static GList *
gdk_win32_screen_list_visuals (GdkScreen *screen) gdk_win32_screen_list_visuals (GdkScreen *screen)
{ {
@ -524,13 +445,5 @@ gdk_win32_screen_class_init (GdkWin32ScreenClass *klass)
screen_class->get_setting = _gdk_win32_screen_get_setting; screen_class->get_setting = _gdk_win32_screen_get_setting;
screen_class->get_system_visual = gdk_win32_screen_get_system_visual; screen_class->get_system_visual = gdk_win32_screen_get_system_visual;
screen_class->get_rgba_visual = gdk_win32_screen_get_rgba_visual; screen_class->get_rgba_visual = gdk_win32_screen_get_rgba_visual;
screen_class->visual_get_best_depth = gdk_win32_screen_visual_get_best_depth;
screen_class->visual_get_best_type = gdk_win32_screen_visual_get_best_type;
screen_class->visual_get_best = gdk_win32_screen_visual_get_best;
screen_class->visual_get_best_with_depth = gdk_win32_screen_visual_get_best_with_depth;
screen_class->visual_get_best_with_type = gdk_win32_screen_visual_get_best_with_type;
screen_class->visual_get_best_with_both = gdk_win32_screen_visual_get_best_with_both;
screen_class->query_depths = gdk_win32_screen_query_depths;
screen_class->query_visual_types = gdk_win32_screen_query_visual_types;
screen_class->list_visuals = gdk_win32_screen_list_visuals; screen_class->list_visuals = gdk_win32_screen_list_visuals;
} }

View File

@ -50,23 +50,7 @@ void _gdk_x11_error_handler_pop (void);
Colormap _gdk_visual_get_x11_colormap (GdkVisual *visual); Colormap _gdk_visual_get_x11_colormap (GdkVisual *visual);
gint _gdk_x11_screen_visual_get_best_depth (GdkScreen *screen);
GdkVisualType _gdk_x11_screen_visual_get_best_type (GdkScreen *screen);
GdkVisual * _gdk_x11_screen_get_system_visual (GdkScreen *screen); GdkVisual * _gdk_x11_screen_get_system_visual (GdkScreen *screen);
GdkVisual* _gdk_x11_screen_visual_get_best (GdkScreen *screen);
GdkVisual* _gdk_x11_screen_visual_get_best_with_depth (GdkScreen *screen,
gint depth);
GdkVisual* _gdk_x11_screen_visual_get_best_with_type (GdkScreen *screen,
GdkVisualType visual_type);
GdkVisual* _gdk_x11_screen_visual_get_best_with_both (GdkScreen *screen,
gint depth,
GdkVisualType visual_type);
void _gdk_x11_screen_query_depths (GdkScreen *screen,
gint **depths,
gint *count);
void _gdk_x11_screen_query_visual_types (GdkScreen *screen,
GdkVisualType **visual_types,
gint *count);
GList * _gdk_x11_screen_list_visuals (GdkScreen *screen); GList * _gdk_x11_screen_list_visuals (GdkScreen *screen);

View File

@ -1357,14 +1357,6 @@ gdk_x11_screen_class_init (GdkX11ScreenClass *klass)
screen_class->get_rgba_visual = gdk_x11_screen_get_rgba_visual; screen_class->get_rgba_visual = gdk_x11_screen_get_rgba_visual;
screen_class->is_composited = gdk_x11_screen_is_composited; screen_class->is_composited = gdk_x11_screen_is_composited;
screen_class->get_setting = gdk_x11_screen_get_setting; screen_class->get_setting = gdk_x11_screen_get_setting;
screen_class->visual_get_best_depth = _gdk_x11_screen_visual_get_best_depth;
screen_class->visual_get_best_type = _gdk_x11_screen_visual_get_best_type;
screen_class->visual_get_best = _gdk_x11_screen_visual_get_best;
screen_class->visual_get_best_with_depth = _gdk_x11_screen_visual_get_best_with_depth;
screen_class->visual_get_best_with_type = _gdk_x11_screen_visual_get_best_with_type;
screen_class->visual_get_best_with_both = _gdk_x11_screen_visual_get_best_with_both;
screen_class->query_depths = _gdk_x11_screen_query_depths;
screen_class->query_visual_types = _gdk_x11_screen_query_visual_types;
screen_class->list_visuals = _gdk_x11_screen_list_visuals; screen_class->list_visuals = _gdk_x11_screen_list_visuals;
signals[WINDOW_MANAGER_CHANGED] = signals[WINDOW_MANAGER_CHANGED] =

View File

@ -309,18 +309,6 @@ _gdk_x11_screen_init_visuals (GdkScreen *screen)
_gdk_x11_screen_update_visuals_for_gl (screen); _gdk_x11_screen_update_visuals_for_gl (screen);
} }
gint
_gdk_x11_screen_visual_get_best_depth (GdkScreen *screen)
{
return GDK_X11_SCREEN (screen)->available_depths[0];
}
GdkVisualType
_gdk_x11_screen_visual_get_best_type (GdkScreen *screen)
{
return GDK_X11_SCREEN (screen)->available_types[0];
}
GdkVisual * GdkVisual *
_gdk_x11_screen_get_system_visual (GdkScreen *screen) _gdk_x11_screen_get_system_visual (GdkScreen *screen)
{ {
@ -329,95 +317,6 @@ _gdk_x11_screen_get_system_visual (GdkScreen *screen)
return ((GdkVisual *) GDK_X11_SCREEN (screen)->system_visual); return ((GdkVisual *) GDK_X11_SCREEN (screen)->system_visual);
} }
GdkVisual*
_gdk_x11_screen_visual_get_best (GdkScreen *screen)
{
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
return x11_screen->visuals[0];
}
GdkVisual*
_gdk_x11_screen_visual_get_best_with_depth (GdkScreen *screen,
gint depth)
{
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
GdkVisual *return_val;
int i;
return_val = NULL;
for (i = 0; i < x11_screen->nvisuals; i++)
if (depth == x11_screen->visuals[i]->depth)
{
return_val = x11_screen->visuals[i];
break;
}
return return_val;
}
GdkVisual*
_gdk_x11_screen_visual_get_best_with_type (GdkScreen *screen,
GdkVisualType visual_type)
{
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
GdkVisual *return_val;
int i;
return_val = NULL;
for (i = 0; i < x11_screen->nvisuals; i++)
if (visual_type == x11_screen->visuals[i]->type)
{
return_val = x11_screen->visuals[i];
break;
}
return return_val;
}
GdkVisual*
_gdk_x11_screen_visual_get_best_with_both (GdkScreen *screen,
gint depth,
GdkVisualType visual_type)
{
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
GdkVisual *return_val;
int i;
return_val = NULL;
for (i = 0; i < x11_screen->nvisuals; i++)
if ((depth == x11_screen->visuals[i]->depth) &&
(visual_type == x11_screen->visuals[i]->type))
{
return_val = x11_screen->visuals[i];
break;
}
return return_val;
}
void
_gdk_x11_screen_query_depths (GdkScreen *screen,
gint **depths,
gint *count)
{
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
*count = x11_screen->navailable_depths;
*depths = x11_screen->available_depths;
}
void
_gdk_x11_screen_query_visual_types (GdkScreen *screen,
GdkVisualType **visual_types,
gint *count)
{
GdkX11Screen *x11_screen = GDK_X11_SCREEN (screen);
*count = x11_screen->navailable_types;
*visual_types = x11_screen->available_types;
}
GList * GList *
_gdk_x11_screen_list_visuals (GdkScreen *screen) _gdk_x11_screen_list_visuals (GdkScreen *screen)
{ {

View File

@ -85,91 +85,6 @@ test_list_visuals (void)
g_assert (rgba_visual == NULL || found_rgba); g_assert (rgba_visual == NULL || found_rgba);
} }
static void
test_depth (void)
{
GdkVisual *visual;
gint *depths;
gint n_depths;
gint i, j;
gboolean is_depth;
gdk_query_depths (&depths, &n_depths);
g_assert_cmpint (n_depths, >, 0);
for (i = 0; i < n_depths; i++)
{
g_assert_cmpint (depths[i], >, 0);
g_assert_cmpint (depths[i], <=, 32);
visual = gdk_visual_get_best_with_depth (depths[i]);
g_assert_nonnull (visual);
g_assert_cmpint (gdk_visual_get_depth (visual), ==, depths[i]);
}
for (i = 1; i <= 32; i++)
{
is_depth = FALSE;
for (j = 0; j < n_depths; j++)
{
if (i == depths[j])
is_depth = TRUE;
}
visual = gdk_visual_get_best_with_depth (i);
if (!is_depth)
g_assert_null (visual);
else
{
g_assert_nonnull (visual);
g_assert_cmpint (gdk_visual_get_depth (visual), ==, i);
}
}
}
static void
test_type (void)
{
GdkVisual *visual;
GdkVisualType *types;
gint n_types;
gint i, j;
gboolean is_type;
gdk_query_visual_types (&types, &n_types);
g_assert_cmpint (n_types, >, 0);
for (i = 0; i < n_types; i++)
{
g_assert_cmpint (types[i], >=, GDK_VISUAL_STATIC_GRAY);
g_assert_cmpint (types[i], <=, GDK_VISUAL_DIRECT_COLOR);
visual = gdk_visual_get_best_with_type (types[i]);
g_assert_nonnull (visual);
g_assert_cmpint (gdk_visual_get_visual_type (visual), ==, types[i]);
}
for (i = GDK_VISUAL_STATIC_GRAY; i <= GDK_VISUAL_DIRECT_COLOR; i++)
{
is_type = FALSE;
for (j = 0; j < n_types; j++)
{
if (i == types[j])
is_type = TRUE;
}
visual = gdk_visual_get_best_with_type (i);
if (!is_type)
g_assert_null (visual);
else
{
g_assert_nonnull (visual);
g_assert_cmpint (gdk_visual_get_visual_type (visual), ==, i);
}
}
}
int int
main (int argc, char *argv[]) main (int argc, char *argv[])
{ {
@ -181,8 +96,6 @@ main (int argc, char *argv[])
g_test_add_func ("/visual/list", test_list_visuals); g_test_add_func ("/visual/list", test_list_visuals);
g_test_add_func ("/visual/rgba", test_rgba_visual); g_test_add_func ("/visual/rgba", test_rgba_visual);
g_test_add_func ("/visual/depth", test_depth);
g_test_add_func ("/visual/type", test_type);
return g_test_run (); return g_test_run ();
} }