summaryrefslogtreecommitdiff
path: root/gdk/x11/gdkvisual-x11.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2010-12-06 23:19:58 +0100
committerMatthias Clasen <mclasen@redhat.com>2010-12-21 12:06:55 -0500
commitae146a281750926eee6c5fafb88414999ffa6821 (patch)
tree9c7b9c169b1c10c1a505223271d505c025eee45f /gdk/x11/gdkvisual-x11.c
parentf52223f380e45ae019d65b457871383a0c52c6ca (diff)
downloadgtk+-ae146a281750926eee6c5fafb88414999ffa6821.tar.gz
Convert a bunch of visual related calls to use the screen vtable
Diffstat (limited to 'gdk/x11/gdkvisual-x11.c')
-rw-r--r--gdk/x11/gdkvisual-x11.c158
1 files changed, 25 insertions, 133 deletions
diff --git a/gdk/x11/gdkvisual-x11.c b/gdk/x11/gdkvisual-x11.c
index 59acba26b0..f2ba3ca7f6 100644
--- a/gdk/x11/gdkvisual-x11.c
+++ b/gdk/x11/gdkvisual-x11.c
@@ -338,89 +338,39 @@ _gdk_visual_init (GdkScreen *screen)
screen_x11->nvisuals = nvisuals;
}
-/**
- * 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.
- *
- * Return value: best available depth
- **/
gint
-gdk_visual_get_best_depth (void)
+_gdk_screen_x11_visual_get_best_depth (GdkScreen *screen)
{
- GdkScreen *screen = gdk_screen_get_default();
-
return GDK_SCREEN_X11 (screen)->available_depths[0];
}
-/**
- * gdk_visual_get_best_type:
- *
- * Return the best available visual type for the default GDK screen.
- *
- * Return value: best visual type
- **/
GdkVisualType
-gdk_visual_get_best_type (void)
+_gdk_screen_x11_visual_get_best_type (GdkScreen *screen)
{
- GdkScreen *screen = gdk_screen_get_default();
-
return GDK_SCREEN_X11 (screen)->available_types[0];
}
-/**
- * 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.
- *
- * Return value: (transfer none): the system visual
- *
- * Since: 2.2
- **/
GdkVisual *
-gdk_screen_get_system_visual (GdkScreen * screen)
+_gdk_screen_x11_get_system_visual (GdkScreen * screen)
{
g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL);
return ((GdkVisual *) GDK_SCREEN_X11 (screen)->system_visual);
}
-/**
- * gdk_visual_get_best:
- *
- * Get the visual with the most available colors for the default
- * GDK screen. The return value should not be freed.
- *
- * Return value: (transfer none): best visual
- **/
GdkVisual*
-gdk_visual_get_best (void)
+_gdk_screen_x11_visual_get_best (GdkScreen *screen)
{
- GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (gdk_screen_get_default());
+ GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (screen);
return (GdkVisual *)screen_x11->visuals[0];
}
-/**
- * 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.
- *
- * Return value: (transfer none): best visual for the given depth
- **/
GdkVisual*
-gdk_visual_get_best_with_depth (gint depth)
+_gdk_screen_x11_visual_get_best_with_depth (GdkScreen *screen,
+ gint depth)
{
- GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (gdk_screen_get_default ());
+ GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (screen);
GdkVisual *return_val;
int i;
@@ -435,21 +385,11 @@ gdk_visual_get_best_with_depth (gint depth)
return return_val;
}
-/**
- * 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.
- *
- * Return value: (transfer none): best visual of the given type
- **/
GdkVisual*
-gdk_visual_get_best_with_type (GdkVisualType visual_type)
+_gdk_screen_x11_visual_get_best_with_type (GdkScreen *screen,
+ GdkVisualType visual_type)
{
- GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (gdk_screen_get_default ());
+ GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (screen);
GdkVisual *return_val;
int i;
@@ -464,21 +404,12 @@ gdk_visual_get_best_with_type (GdkVisualType visual_type)
return return_val;
}
-/**
- * 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().
- *
- * Return value: (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)
+_gdk_screen_x11_visual_get_best_with_both (GdkScreen *screen,
+ gint depth,
+ GdkVisualType visual_type)
{
- GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (gdk_screen_get_default ());
+ GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (screen);
GdkVisual *return_val;
int i;
@@ -494,69 +425,30 @@ gdk_visual_get_best_with_both (gint depth,
return return_val;
}
-/**
- * gdk_query_depths:
- * @depths: (out) (array): return location for available depths
- * @count: (out): return location for number of available depths
- *
- * This function returns the available bit depths for the default
- * screen. It's 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)
+_gdk_screen_x11_query_depths (GdkScreen *screen,
+ gint **depths,
+ gint *count)
{
- GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (gdk_screen_get_default ());
-
+ GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (screen);
+
*count = screen_x11->navailable_depths;
*depths = screen_x11->available_depths;
}
-/**
- * gdk_query_visual_types:
- * @visual_types: 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. It's 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)
+_gdk_screen_x11_query_visual_types (GdkScreen *screen,
+ GdkVisualType **visual_types,
+ gint *count)
{
- GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (gdk_screen_get_default ());
+ GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (screen);
*count = screen_x11->navailable_types;
*visual_types = screen_x11->available_types;
}
-/**
- * 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.
- *
- * Return value: (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)
+_gdk_screen_x11_list_visuals (GdkScreen *screen)
{
GList *list;
GdkScreenX11 *screen_x11;