Sync whitespace with gnome-panel version of NaTray*

Propagate line-wrapping and other white-space changes from gnome-panel
to our copy of NaTrayChild and NaTrayManager.
This commit is contained in:
Owen W. Taylor 2009-04-18 16:34:52 -04:00
parent c8fd1f99d5
commit bb92791bd3
3 changed files with 74 additions and 65 deletions

View File

@ -46,17 +46,18 @@ na_tray_child_realize (GtkWidget *widget)
GTK_WIDGET_CLASS (na_tray_child_parent_class)->realize (widget); GTK_WIDGET_CLASS (na_tray_child_parent_class)->realize (widget);
/* We have alpha if the visual has something other than red, green, and blue */ /* We have alpha if the visual has something other than red, green,
* and blue */
visual_has_alpha = visual->red_prec + visual->blue_prec + visual->green_prec < visual->depth; visual_has_alpha = visual->red_prec + visual->blue_prec + visual->green_prec < visual->depth;
if (visual_has_alpha && gdk_display_supports_composite (gtk_widget_get_display (widget))) if (visual_has_alpha && gdk_display_supports_composite (gtk_widget_get_display (widget)))
{ {
/* We have real transparency with an ARGB visual and the Composite extension. /* We have real transparency with an ARGB visual and the Composite
*/ * extension. */
/* Set a transparent background */ /* Set a transparent background */
GdkColor transparent = { 0, 0, 0, 0 }; /* only pixel=0 matters */ GdkColor transparent = { 0, 0, 0, 0 }; /* only pixel=0 matters */
gdk_window_set_background(widget->window, &transparent); gdk_window_set_background (widget->window, &transparent);
gdk_window_set_composited (widget->window, TRUE); gdk_window_set_composited (widget->window, TRUE);
child->is_composited = TRUE; child->is_composited = TRUE;
@ -64,9 +65,8 @@ na_tray_child_realize (GtkWidget *widget)
} }
else if (visual == gdk_drawable_get_visual (GDK_DRAWABLE (gdk_window_get_parent (widget->window)))) else if (visual == gdk_drawable_get_visual (GDK_DRAWABLE (gdk_window_get_parent (widget->window))))
{ {
/* Otherwise, if the visual matches the visual of the parent window, we can /* Otherwise, if the visual matches the visual of the parent window, we
* use a parent-relative background and fake transparency. * can use a parent-relative background and fake transparency. */
*/
gdk_window_set_back_pixmap (widget->window, NULL, TRUE); gdk_window_set_back_pixmap (widget->window, NULL, TRUE);
child->is_composited = FALSE; child->is_composited = FALSE;
@ -75,7 +75,6 @@ na_tray_child_realize (GtkWidget *widget)
else else
{ {
/* Nothing to do; the icon will sit on top of an ugly gray box */ /* Nothing to do; the icon will sit on top of an ugly gray box */
child->is_composited = FALSE; child->is_composited = FALSE;
child->parent_relative_bg = FALSE; child->parent_relative_bg = FALSE;
} }
@ -87,23 +86,25 @@ na_tray_child_realize (GtkWidget *widget)
* transparency, since the double-buffer code doesn't know how to fill in the * transparency, since the double-buffer code doesn't know how to fill in the
* background of the double-buffer correctly. * background of the double-buffer correctly.
*/ */
gtk_widget_set_double_buffered (GTK_WIDGET (child), child->parent_relative_bg); gtk_widget_set_double_buffered (GTK_WIDGET (child),
child->parent_relative_bg);
} }
static void static void
na_tray_child_style_set (GtkWidget *widget, na_tray_child_style_set (GtkWidget *widget,
GtkStyle *previous_style) GtkStyle *previous_style)
{ {
/* The default handler resets the background according to the new /* The default handler resets the background according to the new style.
* style. We either use a transparent background or a parent-relative background * We either use a transparent background or a parent-relative background
* and ignore the style background. So, just don't chain up. * and ignore the style background. So, just don't chain up.
*/ */
} }
#if 0 #if 0
/* This is adapted from code that was commented out in na-tray-manager.c; the code /* This is adapted from code that was commented out in na-tray-manager.c; the
* in na-tray-manager.c wouldn't have worked reliably, this will. So maybe it can * code in na-tray-manager.c wouldn't have worked reliably, this will. So maybe
* be reenabled. On other hand, things seem to be working fine without it. * it can be reenabled. On other hand, things seem to be working fine without
* it.
* *
* If reenabling, you need to hook it up in na_tray_child_class_init(). * If reenabling, you need to hook it up in na_tray_child_class_init().
*/ */
@ -134,18 +135,20 @@ na_tray_child_size_allocate (GtkWidget *widget,
{ {
NaTrayChild *child = NA_TRAY_CHILD (widget); NaTrayChild *child = NA_TRAY_CHILD (widget);
gboolean moved = allocation->x != widget->allocation.x || allocation->y != widget->allocation.y; gboolean moved = allocation->x != widget->allocation.x ||
gboolean resized = allocation->width != widget->allocation.width || allocation->height != widget->allocation.height; allocation->y != widget->allocation.y;
gboolean resized = allocation->width != widget->allocation.width ||
allocation->height != widget->allocation.height;
/* When we are allocating the widget while mapped we need special handling for /* When we are allocating the widget while mapped we need special handling
* both real and fake transparency. * for both real and fake transparency.
* *
* Real transparency: we need to invalidate and trigger a redraw of the old * Real transparency: we need to invalidate and trigger a redraw of the old
* and new areas. (GDK really should handle this for us, but doesn't as of * and new areas. (GDK really should handle this for us, but doesn't as of
* GTK+-2.14) * GTK+-2.14)
* *
* Fake transparency: if the widget moved, we need to force the contents to be * Fake transparency: if the widget moved, we need to force the contents to
* redrawn with the new offset for the parent-relative background. * be redrawn with the new offset for the parent-relative background.
*/ */
if ((moved || resized) && GTK_WIDGET_MAPPED (widget)) if ((moved || resized) && GTK_WIDGET_MAPPED (widget))
{ {
@ -154,7 +157,8 @@ na_tray_child_size_allocate (GtkWidget *widget,
&widget->allocation, FALSE); &widget->allocation, FALSE);
} }
GTK_WIDGET_CLASS (na_tray_child_parent_class)->size_allocate (widget, allocation); GTK_WIDGET_CLASS (na_tray_child_parent_class)->size_allocate (widget,
allocation);
if ((moved || resized) && GTK_WIDGET_MAPPED (widget)) if ((moved || resized) && GTK_WIDGET_MAPPED (widget))
{ {
@ -341,7 +345,7 @@ na_tray_child_is_composited (NaTrayChild *child)
/* If we are faking transparency with a window-relative background, force a /* If we are faking transparency with a window-relative background, force a
* redraw of the icon. This should be called if the background changes or if * redraw of the icon. This should be called if the background changes or if
* the child is shifed with respect to the background. * the child is shifted with respect to the background.
*/ */
void void
na_tray_child_force_redraw (NaTrayChild *child) na_tray_child_force_redraw (NaTrayChild *child)

View File

@ -254,7 +254,8 @@ na_tray_manager_plug_removed (GtkSocket *socket,
{ {
NaTrayChild *child = NA_TRAY_CHILD (socket); NaTrayChild *child = NA_TRAY_CHILD (socket);
g_hash_table_remove (manager->socket_table, GINT_TO_POINTER (child->icon_window)); g_hash_table_remove (manager->socket_table,
GINT_TO_POINTER (child->icon_window));
g_signal_emit (manager, manager_signals[TRAY_ICON_REMOVED], 0, child); g_signal_emit (manager, manager_signals[TRAY_ICON_REMOVED], 0, child);
/* This destroys the socket. */ /* This destroys the socket. */
@ -268,7 +269,8 @@ na_tray_manager_handle_dock_request (NaTrayManager *manager,
Window icon_window = xevent->data.l[2]; Window icon_window = xevent->data.l[2];
GtkWidget *child; GtkWidget *child;
if (g_hash_table_lookup (manager->socket_table, GINT_TO_POINTER (icon_window))) if (g_hash_table_lookup (manager->socket_table,
GINT_TO_POINTER (icon_window)))
{ {
/* We already got this notification earlier, ignore this one */ /* We already got this notification earlier, ignore this one */
return; return;
@ -302,7 +304,8 @@ na_tray_manager_handle_dock_request (NaTrayManager *manager,
return; return;
} }
g_hash_table_insert (manager->socket_table, GINT_TO_POINTER (icon_window), child); g_hash_table_insert (manager->socket_table,
GINT_TO_POINTER (icon_window), child);
gtk_widget_show (child); gtk_widget_show (child);
} }
@ -631,9 +634,11 @@ na_tray_manager_set_visual_property (NaTrayManager *manager)
{ {
/* We actually want the visual of the tray where the icons will /* We actually want the visual of the tray where the icons will
* be embedded. In almost all cases, this will be the same as the visual * be embedded. In almost all cases, this will be the same as the visual
* of the screen * of the screen.
*/ */
GdkColormap *colormap = gdk_screen_get_default_colormap (manager->screen); GdkColormap *colormap;
colormap = gdk_screen_get_default_colormap (manager->screen);
xvisual = GDK_VISUAL_XVISUAL (gdk_colormap_get_visual (colormap)); xvisual = GDK_VISUAL_XVISUAL (gdk_colormap_get_visual (colormap));
} }