[metacity] More fixes for compiling with GSeal. Requires gtk 2.20.



commit 6cb379f48e9c9e1b28d461b8ff1eb73ed841fc58
Author: Andre Klapper <a9016009 gmx de>
Date:   Thu Jun 10 12:49:58 2010 +0200

    More fixes for compiling with GSeal. Requires gtk 2.20.

 src/tools/metacity-mag.c |   17 ++++++++++-------
 src/ui/draw-workspace.c  |   16 +++++++++-------
 src/ui/fixedtip.c        |    2 +-
 src/ui/preview-widget.c  |   42 +++++++++++++++++++++++++-----------------
 src/ui/theme.c           |   34 +++++++++++++++++++---------------
 5 files changed, 64 insertions(+), 47 deletions(-)
---
diff --git a/src/tools/metacity-mag.c b/src/tools/metacity-mag.c
index 7c5cb3e..22c7cc3 100644
--- a/src/tools/metacity-mag.c
+++ b/src/tools/metacity-mag.c
@@ -77,13 +77,16 @@ static gboolean
 regrab_idle (GtkWidget *image)
 {
   GdkPixbuf *magnified;
+  GtkAllocation allocation;
+
+  gtk_widget_get_allocation (image, &allocation);
   
-  if (image->allocation.width != last_grab_allocation.width ||
-      image->allocation.height != last_grab_allocation.height)
+  if (allocation.width != last_grab_allocation.width ||
+      allocation.height != last_grab_allocation.height)
     {
-      last_grab_width = rint (image->allocation.width / width_factor);
-      last_grab_height = rint (image->allocation.height / height_factor);
-      last_grab_allocation = image->allocation;
+      last_grab_width = rint (allocation.width / width_factor);
+      last_grab_height = rint (allocation.height / height_factor);
+      last_grab_allocation = allocation;
       
       magnified = get_pixbuf ();
 
@@ -234,7 +237,7 @@ begin_area_grab (void)
       gtk_widget_show (grab_widget);
     }
 
-  if (gdk_keyboard_grab (grab_widget->window,
+  if (gdk_keyboard_grab (gtk_widget_get_window (grab_widget),
                          FALSE,
                          gtk_get_current_event_time ()) != GDK_GRAB_SUCCESS)
     {
@@ -242,7 +245,7 @@ begin_area_grab (void)
       return;
     }
   
-  if (gdk_pointer_grab (grab_widget->window,
+  if (gdk_pointer_grab (gtk_widget_get_window (grab_widget),
                         FALSE,
                         GDK_BUTTON_RELEASE_MASK | GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK,
                         NULL,
diff --git a/src/ui/draw-workspace.c b/src/ui/draw-workspace.c
index f7c98b6..72daf67 100644
--- a/src/ui/draw-workspace.c
+++ b/src/ui/draw-workspace.c
@@ -77,6 +77,7 @@ draw_window (GtkWidget                   *widget,
   int icon_x, icon_y, icon_w, icon_h;
   gboolean is_active;
   GdkColor *color;
+  GtkStyle *style;
 
   is_active = win->is_active;
   
@@ -84,10 +85,11 @@ draw_window (GtkWidget                   *widget,
   cairo_rectangle (cr, winrect->x, winrect->y, winrect->width, winrect->height);
   cairo_clip (cr);
 
+  style = gtk_widget_get_style (widget);
   if (is_active)
-    color = &widget->style->light[state];
+    color = &style->light[state];
   else
-    color = &widget->style->bg[state];
+    color = &style->bg[state];
   cairo_set_source_rgb (cr,
                         color->red / 65535.,
                         color->green / 65535.,
@@ -143,9 +145,9 @@ draw_window (GtkWidget                   *widget,
     }
           
   if (is_active)
-    color = &widget->style->fg[state];
+    color = &style->fg[state];
   else
-    color = &widget->style->fg[state];
+    color = &style->fg[state];
 
   cairo_set_source_rgb (cr,
                         color->red / 65535.,
@@ -193,7 +195,7 @@ wnck_draw_workspace (GtkWidget                   *widget,
   if (workspace_background)
     {
       gdk_draw_pixbuf (drawable,
-                       GTK_WIDGET (widget)->style->dark_gc[state],
+                       gtk_widget_get_style (GTK_WIDGET (widget))->dark_gc[state],
                        workspace_background,
                        0, 0,
                        x, y,
@@ -205,8 +207,8 @@ wnck_draw_workspace (GtkWidget                   *widget,
     {
       cairo_t *cr;
       
-      cr = gdk_cairo_create (widget->window);
-      gdk_cairo_set_source_color (cr, &widget->style->dark[state]);
+      cr = gdk_cairo_create (gtk_widget_get_window (widget));
+      gdk_cairo_set_source_color (cr, &gtk_widget_get_style (widget)->dark[state]);
       cairo_rectangle (cr, x, y, width, height);
       cairo_fill (cr);
       cairo_destroy (cr);
diff --git a/src/ui/fixedtip.c b/src/ui/fixedtip.c
index bffaf99..be25390 100644
--- a/src/ui/fixedtip.c
+++ b/src/ui/fixedtip.c
@@ -53,7 +53,7 @@ static int screen_bottom_edge = 0;
 static gint
 expose_handler (GtkTooltips *tooltips)
 {
-  gtk_paint_flat_box (tip->style, tip->window,
+  gtk_paint_flat_box (gtk_widget_get_style (tip), gtk_widget_get_window (tip),
                       GTK_STATE_NORMAL, GTK_SHADOW_OUT, 
                       NULL, tip, "tooltip",
                       0, 0, -1, -1);
diff --git a/src/ui/preview-widget.c b/src/ui/preview-widget.c
index a6da36d..26b2756 100644
--- a/src/ui/preview-widget.c
+++ b/src/ui/preview-widget.c
@@ -86,7 +86,7 @@ meta_preview_init (MetaPreview *preview)
 {
   int i;
   
-  GTK_WIDGET_SET_FLAGS (preview, GTK_NO_WINDOW);
+  gtk_widget_set_has_window (GTK_WIDGET (preview), FALSE);
 
   i = 0;
   while (i < MAX_BUTTONS_PER_CORNER)
@@ -216,6 +216,7 @@ meta_preview_expose (GtkWidget      *widget,
                      GdkEventExpose *event)
 {
   MetaPreview *preview;
+  GtkAllocation allocation;
   int border_width;
   int client_width;
   int client_height;
@@ -234,10 +235,11 @@ meta_preview_expose (GtkWidget      *widget,
 
   ensure_info (preview);
 
-  border_width = GTK_CONTAINER (widget)->border_width;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
   
-  client_width = widget->allocation.width - preview->left_width - preview->right_width - border_width * 2;
-  client_height = widget->allocation.height - preview->top_height - preview->bottom_height - border_width * 2;
+  gtk_widget_get_allocation (widget, &allocation);
+  client_width = allocation.width - preview->left_width - preview->right_width - border_width * 2;
+  client_height = allocation.height - preview->top_height - preview->bottom_height - border_width * 2;
 
   if (client_width < 0)
     client_width = 1;
@@ -246,14 +248,14 @@ meta_preview_expose (GtkWidget      *widget,
   
   if (preview->theme)
     {
-      border_width = GTK_CONTAINER (widget)->border_width;
+      border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
       
       meta_theme_draw_frame (preview->theme,
                              widget,
-                             widget->window,
+                             gtk_widget_get_window (widget),
                              &event->area,
-                             widget->allocation.x + border_width,
-                             widget->allocation.y + border_width,
+                             allocation.x + border_width,
+                             allocation.y + border_width,
                              preview->type,
                              preview->flags,
                              client_width, client_height,
@@ -274,6 +276,8 @@ meta_preview_size_request (GtkWidget      *widget,
                            GtkRequisition *req)
 {
   MetaPreview *preview;
+  GtkWidget *child;
+  guint border_width;
 
   preview = META_PREVIEW (widget);
 
@@ -282,12 +286,13 @@ meta_preview_size_request (GtkWidget      *widget,
   req->width = preview->left_width + preview->right_width;
   req->height = preview->top_height + preview->bottom_height;
   
-  if (GTK_BIN (preview)->child &&
-      GTK_WIDGET_VISIBLE (GTK_BIN (preview)->child))
+  child = gtk_bin_get_child (GTK_BIN (preview));
+  if (child &&
+      gtk_widget_get_visible (child))
     {
       GtkRequisition child_requisition;
 
-      gtk_widget_size_request (GTK_BIN (preview)->child, &child_requisition);
+      gtk_widget_size_request (child, &child_requisition);
 
       req->width += child_requisition.width;
       req->height += child_requisition.height;
@@ -300,8 +305,9 @@ meta_preview_size_request (GtkWidget      *widget,
       req->height += NO_CHILD_HEIGHT;
     }
 
-  req->width += GTK_CONTAINER (widget)->border_width * 2;
-  req->height += GTK_CONTAINER (widget)->border_width * 2;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+  req->width += border_width * 2;
+  req->height += border_width * 2;
 }
 
 static void
@@ -311,6 +317,7 @@ meta_preview_size_allocate (GtkWidget         *widget,
   MetaPreview *preview;
   int border_width;
   GtkAllocation child_allocation;
+  GtkWidget *child;
   
   preview = META_PREVIEW (widget);
 
@@ -318,10 +325,11 @@ meta_preview_size_allocate (GtkWidget         *widget,
   
   widget->allocation = *allocation;
 
-  border_width = GTK_CONTAINER (widget)->border_width;
+  border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
   
-  if (GTK_BIN (widget)->child &&
-      GTK_WIDGET_VISIBLE (GTK_BIN (widget)->child))
+  child = gtk_bin_get_child (GTK_BIN (widget));
+  if (child &&
+      gtk_widget_get_visible (child))
     {
       child_allocation.x = widget->allocation.x + border_width + preview->left_width;
       child_allocation.y = widget->allocation.y + border_width + preview->top_height;
@@ -329,7 +337,7 @@ meta_preview_size_allocate (GtkWidget         *widget,
       child_allocation.width = MAX (1, widget->allocation.width - border_width * 2 - preview->left_width - preview->right_width);
       child_allocation.height = MAX (1, widget->allocation.height - border_width * 2 - preview->top_height - preview->bottom_height);
 
-      gtk_widget_size_allocate (GTK_BIN (widget)->child, &child_allocation);
+      gtk_widget_size_allocate (gtk_bin_get_child (GTK_BIN (widget)), &child_allocation);
     }
 }
 
diff --git a/src/ui/theme.c b/src/ui/theme.c
index 7e4859d..921a91b 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -1360,9 +1360,13 @@ meta_color_spec_render (MetaColorSpec *spec,
                         GtkWidget     *widget,
                         GdkColor      *color)
 {
+  GtkStyle *widget_style;
+
   g_return_if_fail (spec != NULL);
   g_return_if_fail (GTK_IS_WIDGET (widget));
-  g_return_if_fail (widget->style != NULL);
+
+  widget_style = gtk_widget_get_style (widget);
+  g_return_if_fail (widget_style != NULL);
 
   switch (spec->type)
     {
@@ -1374,28 +1378,28 @@ meta_color_spec_render (MetaColorSpec *spec,
       switch (spec->data.gtk.component)
         {
         case META_GTK_COLOR_BG:
-          *color = widget->style->bg[spec->data.gtk.state];
+          *color = widget_style->bg[spec->data.gtk.state];
           break;
         case META_GTK_COLOR_FG:
-          *color = widget->style->fg[spec->data.gtk.state];
+          *color = widget_style->fg[spec->data.gtk.state];
           break;
         case META_GTK_COLOR_BASE:
-          *color = widget->style->base[spec->data.gtk.state];
+          *color = widget_style->base[spec->data.gtk.state];
           break;
         case META_GTK_COLOR_TEXT:
-          *color = widget->style->text[spec->data.gtk.state];
+          *color = widget_style->text[spec->data.gtk.state];
           break;
         case META_GTK_COLOR_LIGHT:
-          *color = widget->style->light[spec->data.gtk.state];
+          *color = widget_style->light[spec->data.gtk.state];
           break;
         case META_GTK_COLOR_DARK:
-          *color = widget->style->dark[spec->data.gtk.state];
+          *color = widget_style->dark[spec->data.gtk.state];
           break;
         case META_GTK_COLOR_MID:
-          *color = widget->style->mid[spec->data.gtk.state];
+          *color = widget_style->mid[spec->data.gtk.state];
           break;
         case META_GTK_COLOR_TEXT_AA:
-          *color = widget->style->text_aa[spec->data.gtk.state];
+          *color = widget_style->text_aa[spec->data.gtk.state];
           break;
         case META_GTK_COLOR_LAST:
           g_assert_not_reached ();
@@ -3857,7 +3861,7 @@ meta_draw_op_draw (const MetaDrawOp    *op,
                    const MetaDrawInfo  *info,
                    MetaRectangle        logical_region)
 {
-  meta_draw_op_draw_with_style (op, widget->style, widget,
+  meta_draw_op_draw_with_style (op, gtk_widget_get_style (widget), widget,
                                 drawable, clip, info, logical_region);
 }
 
@@ -3987,7 +3991,7 @@ meta_draw_op_list_draw  (const MetaDrawOpList *op_list,
                          MetaRectangle         rect)
 
 {
-  meta_draw_op_list_draw_with_style (op_list, widget->style, widget,
+  meta_draw_op_list_draw_with_style (op_list, gtk_widget_get_style (widget), widget,
                                      drawable, clip, info, rect);
 }
 
@@ -4559,7 +4563,7 @@ meta_frame_style_draw (MetaFrameStyle          *style,
                        GdkPixbuf               *mini_icon,
                        GdkPixbuf               *icon)
 {
-  meta_frame_style_draw_with_style (style, widget->style, widget,
+  meta_frame_style_draw_with_style (style, gtk_widget_get_style (widget), widget,
                                     drawable, x_offset, y_offset,
                                     clip, fgeom, client_width, client_height,
                                     title_layout, text_height,
@@ -5182,7 +5186,7 @@ meta_theme_draw_frame (MetaTheme              *theme,
                        GdkPixbuf              *mini_icon,
                        GdkPixbuf              *icon)
 {
-  meta_theme_draw_frame_with_style (theme, widget->style, widget,
+  meta_theme_draw_frame_with_style (theme, gtk_widget_get_style (widget), widget,
                                     drawable, clip, x_offset, y_offset, type,flags,
                                     client_width, client_height,
                                     title_layout, text_height,
@@ -5576,9 +5580,9 @@ meta_gtk_widget_get_font_desc (GtkWidget *widget,
 {
   PangoFontDescription *font_desc;
   
-  g_return_val_if_fail (GTK_WIDGET_REALIZED (widget), NULL);
+  g_return_val_if_fail (gtk_widget_get_realized (widget), NULL);
 
-  font_desc = pango_font_description_copy (widget->style->font_desc);
+  font_desc = pango_font_description_copy (gtk_widget_get_style (widget)->font_desc);
 
   if (override)
     pango_font_description_merge (font_desc, override, TRUE);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]