[maemo-commits] [maemo-commits] r14662 - in projects/haf/trunk/hildon-desktop: . libhildondesktop
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Mon Oct 29 12:37:41 EET 2007
- Previous message: [maemo-commits] r14661 - in projects/haf/trunk/hildon-desktop: . libhildondesktop
- Next message: [maemo-commits] r14663 - in projects/haf/trunk/hildon-desktop: . src
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: jobi Date: 2007-10-29 12:37:38 +0200 (Mon, 29 Oct 2007) New Revision: 14662 Modified: projects/haf/trunk/hildon-desktop/ChangeLog projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-panel-window-composite.c Log: 2007-10-29 Johan Bilien <johan.bilien at nokia.com> * libhildondesktop/hildon-desktop-panel-window-composite.c - (hildon_desktop_panel_window_composite_update_background): store a GdkPixmap instead of a Render Picture for the background, and apply it as window background. - (hildon_desktop_panel_window_composite_expose): removed. - (hildon_desktop_panel_window_composite_finalize): added, unref the background pixmap. Fixes: NB#72438 Modified: projects/haf/trunk/hildon-desktop/ChangeLog =================================================================== --- projects/haf/trunk/hildon-desktop/ChangeLog 2007-10-29 10:32:46 UTC (rev 14661) +++ projects/haf/trunk/hildon-desktop/ChangeLog 2007-10-29 10:37:38 UTC (rev 14662) @@ -1,5 +1,16 @@ 2007-10-29 Johan Bilien <johan.bilien at nokia.com> + * libhildondesktop/hildon-desktop-panel-window-composite.c + - (hildon_desktop_panel_window_composite_update_background): + store a GdkPixmap instead of a Render Picture for the background, + and apply it as window background. + - (hildon_desktop_panel_window_composite_expose): removed. + - (hildon_desktop_panel_window_composite_finalize): added, unref + the background pixmap. + Fixes: NB#72438 + +2007-10-29 Johan Bilien <johan.bilien at nokia.com> + * libhildondesktop/hildon-desktop-home-item.c: enable GTK extension events on both the event window and the close / resize handles. Fixes: NB#73005 Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-panel-window-composite.c =================================================================== --- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-panel-window-composite.c 2007-10-29 10:32:46 UTC (rev 14661) +++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-panel-window-composite.c 2007-10-29 10:37:38 UTC (rev 14662) @@ -42,10 +42,6 @@ hildon_desktop_panel_window_composite_style_set (GtkWidget *widget, GtkStyle *old_style); -static gboolean -hildon_desktop_panel_window_composite_expose (GtkWidget *widget, - GdkEventExpose *event); - static void hildon_desktop_panel_window_composite_realize (GtkWidget *widget); @@ -60,8 +56,8 @@ struct _HildonDesktopPanelWindowCompositePrivate { - Picture background_picture; guint background_width, background_height; + GdkPixmap *pixmap; Picture pattern_picture; Picture pattern_mask; @@ -90,6 +86,9 @@ #endif static void +hildon_desktop_panel_window_composite_finalize (GObject *object); + +static void hildon_desktop_panel_window_composite_class_init (HildonDesktopPanelWindowCompositeClass *klass); static void @@ -206,8 +205,25 @@ } static void +hildon_desktop_panel_window_composite_finalize (GObject *object) +{ +#ifdef HAVE_X_COMPOSITE + HildonDesktopPanelWindowCompositePrivate *priv = + HILDON_DESKTOP_PANEL_WINDOW_COMPOSITE (object)->priv; + + if (priv->pixmap) + { + g_object_unref (priv->pixmap); + priv->pixmap = NULL; + } +#endif +} + +static void hildon_desktop_panel_window_composite_class_init (HildonDesktopPanelWindowCompositeClass *klass) { + GObjectClass *object_class; + #ifdef HAVE_X_COMPOSITE { if (klass->desktop_window_data->composite) @@ -220,8 +236,6 @@ hildon_desktop_panel_window_composite_style_set; widget_class->realize = hildon_desktop_panel_window_composite_realize; widget_class->unrealize = hildon_desktop_panel_window_composite_unrealize; - widget_class->expose_event = - hildon_desktop_panel_window_composite_expose; widget_class->configure_event = hildon_desktop_panel_window_composite_configure; @@ -235,11 +249,35 @@ parent_class = g_type_class_peek_parent (klass); + object_class = G_OBJECT_CLASS (klass); + object_class->finalize = hildon_desktop_panel_window_composite_finalize; + } #ifdef HAVE_X_COMPOSITE +/* For foreign children, namely XPlugged windows, we need to + * hide / show so the background is properly updated to be + * what the parent contained (StatusBarSocket sets the background + * of these windows to None */ static void +hide_foreign_window_and_recurse (GdkWindow *window) +{ + GList *children, *i; + + if (gdk_window_get_window_type (window) == GDK_WINDOW_FOREIGN) + { + gdk_window_hide (window); + gdk_window_show (window); + } + + children = gdk_window_get_children (window); + for (i = children; i; i = i->next) + hide_foreign_window_and_recurse (i->data); + g_list_free (children); +} + +static void hildon_desktop_panel_window_composite_update_background (HildonDesktopPanelWindowComposite *window, GdkRectangle *area) { @@ -248,24 +286,30 @@ HILDON_DESKTOP_PANEL_WINDOW_COMPOSITE_GET_CLASS (window); DesktopWindowData *data = klass->desktop_window_data; + GdkDrawable *drawable = + GTK_WIDGET (window)->window; + Picture background_picture; - if (!priv->width || !priv->height) return; + if (priv->width == 0 || priv->height == 0) + return; - if (priv->background_picture == None || + if (priv->pixmap == NULL || priv->width != priv->background_width || priv->height != priv->background_height) { - const GdkColor white = { 0xFFFFFFFF, 0xFFFF, 0xFFFF, 0xFFFF }; - if (priv->background_picture != None) - XRenderFreePicture (GDK_DISPLAY (), priv->background_picture); + if (priv->pixmap != NULL) + g_object_unref (priv->pixmap); - priv->background_picture = hildon_desktop_picture_from_color (&white, - priv->width, - priv->height); + priv->pixmap = gdk_pixmap_new (drawable, + priv->width, + priv->height, + gdk_drawable_get_depth (drawable)); - g_return_if_fail (priv->background_picture != None); + gdk_drawable_set_colormap (priv->pixmap, + gdk_drawable_get_colormap (drawable)); + priv->background_width = priv->width; priv->background_height = priv->height; @@ -275,6 +319,9 @@ area->height = priv->height; } + background_picture = hildon_desktop_picture_from_drawable (priv->pixmap); + g_return_if_fail (background_picture != None); + if (data->home_picture != None) { @@ -282,7 +329,7 @@ PictOpSrc, data->home_picture, None, - priv->background_picture, + background_picture, priv->x + area->x, priv->y + area->y, priv->x + area->x, priv->y + area->y, area->x, @@ -309,7 +356,7 @@ PictOpOver, priv->pattern_picture, priv->pattern_mask, - priv->background_picture, + background_picture, area->x, area->y, area->x, area->y, area->x, area->y, @@ -317,10 +364,22 @@ } + if (priv->pixmap != NULL) + { + gdk_window_set_back_pixmap (drawable, + priv->pixmap, + FALSE); + + hide_foreign_window_and_recurse (drawable); + + } + gdk_window_invalidate_rect (GTK_WIDGET (window)->window, area, TRUE); + XRenderFreePicture (GDK_DISPLAY (), background_picture); + } static GdkFilterReturn @@ -488,72 +547,6 @@ } -static gboolean -hildon_desktop_panel_window_composite_expose (GtkWidget *widget, - GdkEventExpose *event) -{ - -#if 0 - g_debug ("Got expose event on %s, area %i,%i %ix%i", - gtk_widget_get_name (widget), - event->area.x, - event->area.y, - event->area.width, - event->area.height); -#endif - if (GTK_WIDGET_DRAWABLE (widget)) - { - HildonDesktopPanelWindowCompositePrivate *priv = - HILDON_DESKTOP_PANEL_WINDOW_COMPOSITE (widget)->priv; - GdkDrawable *drawable; - gint x_offset, y_offset; - Picture picture; - gboolean result; - - gdk_window_get_internal_paint_info (widget->window, - &drawable, - &x_offset, - &y_offset); - - picture = hildon_desktop_picture_from_drawable (drawable); - g_return_val_if_fail (picture, FALSE); - - g_object_set_data (G_OBJECT (drawable), - "picture", GINT_TO_POINTER (picture)); - - if (priv->background_picture != None) - { - XRenderComposite (GDK_DISPLAY (), - PictOpSrc, - priv->background_picture, - None, - picture, - event->area.x, - event->area.y, - event->area.x, - event->area.y, - event->area.x - x_offset, - event->area.y - y_offset, - event->area.width, - event->area.height); - - } - - result = GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event); - - XRenderFreePicture (GDK_DISPLAY (), - picture); - - g_object_set_data (G_OBJECT (drawable), - "picture", GINT_TO_POINTER (None)); - - return result; - - } - - return FALSE; -} - static void hildon_desktop_panel_window_composite_realize (GtkWidget *widget) {
- Previous message: [maemo-commits] r14661 - in projects/haf/trunk/hildon-desktop: . libhildondesktop
- Next message: [maemo-commits] r14663 - in projects/haf/trunk/hildon-desktop: . src
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]