?? gdkvisual-x11.c
字號:
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: 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 ((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: best visual **/GdkVisual*gdk_visual_get_best (void){ GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (gdk_screen_get_default()); 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: best visual for the given depth **/GdkVisual*gdk_visual_get_best_with_depth (gint depth){ GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (gdk_screen_get_default ()); GdkVisual *return_val; int i; return_val = NULL; for (i = 0; i < screen_x11->nvisuals; i++) if (depth == screen_x11->visuals[i]->visual.depth) { return_val = (GdkVisual *) screen_x11->visuals[i]; break; } 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: best visual of the given type **/GdkVisual*gdk_visual_get_best_with_type (GdkVisualType visual_type){ GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (gdk_screen_get_default ()); GdkVisual *return_val; int i; return_val = NULL; for (i = 0; i < screen_x11->nvisuals; i++) if (visual_type == screen_x11->visuals[i]->visual.type) { return_val = (GdkVisual *) screen_x11->visuals[i]; break; } 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: best visual with both @depth and @visual_type, or %NULL if none **/GdkVisual*gdk_visual_get_best_with_both (gint depth, GdkVisualType visual_type){ GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (gdk_screen_get_default ()); GdkVisual *return_val; int i; return_val = NULL; for (i = 0; i < screen_x11->nvisuals; i++) if ((depth == screen_x11->visuals[i]->visual.depth) && (visual_type == screen_x11->visuals[i]->visual.type)) { return_val = (GdkVisual *) screen_x11->visuals[i]; break; } return return_val;}/** * gdk_query_depths: * @depths: return location for available depths * @count: 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. * **/voidgdk_query_depths (gint **depths, gint *count){ GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (gdk_screen_get_default ()); *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. **/voidgdk_query_visual_types (GdkVisualType **visual_types, gint *count){ GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (gdk_screen_get_default ()); *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: a list of visuals; the list must be freed, but not its * contents * * Since: 2.2 **/GList *gdk_screen_list_visuals (GdkScreen *screen){ GList *list; GdkScreenX11 *screen_x11; guint i; g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); screen_x11 = GDK_SCREEN_X11 (screen); list = NULL; for (i = 0; i < screen_x11->nvisuals; ++i) list = g_list_append (list, screen_x11->visuals[i]); return list;}/** * gdk_x11_screen_lookup_visual: * @screen: a #GdkScreen. * @xvisualid: an X Visual ID. * * Looks up the #GdkVisual for a particular screen and X Visual ID. * * Returns: the #GdkVisual (owned by the screen object), or %NULL * if the visual ID wasn't found. * * Since: 2.2 */GdkVisual *gdk_x11_screen_lookup_visual (GdkScreen *screen, VisualID xvisualid){ int i; GdkScreenX11 *screen_x11; g_return_val_if_fail (GDK_IS_SCREEN (screen), NULL); screen_x11 = GDK_SCREEN_X11 (screen); for (i = 0; i < screen_x11->nvisuals; i++) if (xvisualid == screen_x11->visuals[i]->xvisual->visualid) return (GdkVisual *) screen_x11->visuals[i]; return NULL;}/** * gdkx_visual_get: * @xvisualid: a X visual id. * * Returns a #GdkVisual corresponding to a X visual. * * Return value: the #GdkVisual. **/GdkVisual*gdkx_visual_get (VisualID xvisualid){ return gdk_x11_screen_lookup_visual (gdk_screen_get_default (), xvisualid);}static voidgdk_visual_add (GdkVisual *visual){ GdkVisualPrivate *private = (GdkVisualPrivate *) visual; GdkScreenX11 *screen_x11 = GDK_SCREEN_X11 (private->screen); if (!screen_x11->visual_hash) screen_x11->visual_hash = g_hash_table_new ((GHashFunc) gdk_visual_hash, (GEqualFunc) gdk_visual_equal); g_hash_table_insert (screen_x11->visual_hash, private->xvisual, visual);}static voidgdk_visual_decompose_mask (gulong mask, gint *shift, gint *prec){ *shift = 0; *prec = 0; if (mask == 0) { g_warning ("Mask is 0 in visual. Server bug ?"); return; } while (!(mask & 0x1)) { (*shift)++; mask >>= 1; } while (mask & 0x1) { (*prec)++; mask >>= 1; }}static guintgdk_visual_hash (Visual *key){ return key->visualid;}static gbooleangdk_visual_equal (Visual *a, Visual *b){ return (a->visualid == b->visualid);}/** * gdk_x11_visual_get_xvisual: * @visual: a #GdkVisual. * * Returns the X visual belonging to a #GdkVisual. * * Return value: an Xlib <type>Visual*</type>. **/Visual *gdk_x11_visual_get_xvisual (GdkVisual *visual){ g_return_val_if_fail (visual != NULL, NULL); return ((GdkVisualPrivate*) visual)->xvisual;}/** * gdk_visual_get_screen: * @visual: a #GdkVisual * * Gets the screen to which this visual belongs * * Return value: the screen to which this visual belongs. * * Since: 2.2 **/GdkScreen *gdk_visual_get_screen (GdkVisual *visual){ g_return_val_if_fail (GDK_IS_VISUAL (visual), NULL); return ((GdkVisualPrivate*) visual)->screen;}#define __GDK_VISUAL_X11_C__#include "gdkaliasdef.c"
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -