/** * na_tray_child_has_alpha; * @child: a #NaTrayChild * * Checks if the child has an ARGB visual and real alpha transparence. * (as opposed to faked alpha transparency with an parent-relative * background) * * Return value: %TRUE if the child has an alpha transparency */ gboolean na_tray_child_has_alpha (NaTrayChild *child) { g_return_val_if_fail (NA_IS_TRAY_CHILD (child), FALSE); return child->has_alpha; }
/** * na_tray_child_set_composited; * @child: a #NaTrayChild * @composited: %TRUE if the child's window should be redirected * * Sets whether the #GdkWindow of the child should be set redirected * using gdk_window_set_composited(). By default this is based off of * na_tray_child_has_alpha(), but it may be useful to override it in * certain circumstances; for example, if the #NaTrayChild is added * to a parent window and that parent window is composited against the * background. */ void na_tray_child_set_composited (NaTrayChild *child, gboolean composited) { g_return_if_fail (NA_IS_TRAY_CHILD (child)); child->composited = composited; if (GTK_WIDGET_REALIZED (child)) gdk_window_set_composited (GTK_WIDGET (child)->window, composited); }
char * na_tray_child_get_title (NaTrayChild *child) { char *retval = NULL; GdkDisplay *display; Atom utf8_string, atom, type; int result; int format; gulong nitems; gulong bytes_after; gchar *val; g_return_val_if_fail (NA_IS_TRAY_CHILD (child), NULL); display = gtk_widget_get_display (GTK_WIDGET (child)); utf8_string = gdk_x11_get_xatom_by_name_for_display (display, "UTF8_STRING"); atom = gdk_x11_get_xatom_by_name_for_display (display, "_NET_WM_NAME"); gdk_error_trap_push (); result = XGetWindowProperty (GDK_DISPLAY_XDISPLAY (display), child->icon_window, atom, 0, G_MAXLONG, False, utf8_string, &type, &format, &nitems, &bytes_after, (guchar **)&val); if (gdk_error_trap_pop () || result != Success) return NULL; if (type != utf8_string || format != 8 || nitems == 0) { if (val) XFree (val); return NULL; } if (!g_utf8_validate (val, nitems, NULL)) { XFree (val); return NULL; } retval = g_strndup (val, nitems); XFree (val); return retval; }
/** * na_tray_child_set_composited; * @child: a #NaTrayChild * @composited: %TRUE if the child's window should be redirected * * Sets whether the #GdkWindow of the child should be set redirected * using gdk_window_set_composited(). By default this is based off of * na_tray_child_has_alpha(), but it may be useful to override it in * certain circumstances; for example, if the #NaTrayChild is added * to a parent window and that parent window is composited against the * background. */ void na_tray_child_set_composited (NaTrayChild *child, gboolean composited) { g_return_if_fail (NA_IS_TRAY_CHILD (child)); if (child->composited == composited) return; child->composited = composited; if (gtk_widget_get_realized (GTK_WIDGET (child))) gdk_window_set_composited (gtk_widget_get_window (GTK_WIDGET (child)), composited); }
/** * na_tray_child_get_wm_class; * @child: a #NaTrayChild * @res_name: return location for a string containing the application name of * @child, or %NULL * @res_class: return location for a string containing the application class of * @child, or %NULL * * Fetches the resource associated with @child. */ void na_tray_child_get_wm_class (NaTrayChild *child, char **res_name, char **res_class) { GdkDisplay *display; g_return_if_fail (NA_IS_TRAY_CHILD (child)); display = gtk_widget_get_display (GTK_WIDGET (child)); _get_wmclass (GDK_DISPLAY_XDISPLAY (display), child->icon_window, res_class, res_name); }