[mutter/wip/cb2eb3: 31/55] frames: Remove get_frame_bounds



commit 20acb73024cfbf562e81baae59a12a1d73a36881
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Fri Apr 27 22:28:04 2012 -0400

    frames: Remove get_frame_bounds
    
    It's now unused, and we can't use it if we want to let GTK+ paint and
    scan the frame region. With it, we can also stop depending on the
    terrible GTK+ hack and remove the corner radius properties in the
    frame geometry, as they aren't needed any more.

 src/core/frame.c          |   14 -----
 src/core/frame.h          |    2 -
 src/core/window-private.h |    3 -
 src/core/window.c         |   43 ++-------------
 src/meta/window.h         |    2 -
 src/ui/frames.c           |  129 ---------------------------------------------
 src/ui/frames.h           |    5 --
 src/ui/theme-private.h    |    6 --
 src/ui/theme.c            |   29 ----------
 src/ui/ui.c               |   10 ----
 src/ui/ui.h               |    5 --
 11 files changed, 6 insertions(+), 242 deletions(-)
---
diff --git a/src/core/frame.c b/src/core/frame.c
index dcc0548..937169e 100644
--- a/src/core/frame.c
+++ b/src/core/frame.c
@@ -220,11 +220,6 @@ meta_window_destroy_frame (MetaWindow *window)
                                     frame->xwindow);
   
   window->frame = NULL;
-  if (window->frame_bounds)
-    {
-      cairo_region_destroy (window->frame_bounds);
-      window->frame_bounds = NULL;
-    }
 
   /* Move keybindings to window instead of frame */
   meta_window_grab_keys (window);
@@ -387,15 +382,6 @@ meta_frame_sync_to_window (MetaFrame *frame,
   return need_resize;
 }
 
-cairo_region_t *
-meta_frame_get_frame_bounds (MetaFrame *frame)
-{
-  return meta_ui_get_frame_bounds (frame->window->screen->ui,
-                                   frame->xwindow,
-                                   frame->rect.width,
-                                   frame->rect.height);
-}
-
 void
 meta_frame_queue_draw (MetaFrame *frame)
 {
diff --git a/src/core/frame.h b/src/core/frame.h
index 405a2d0..bcf9a80 100644
--- a/src/core/frame.h
+++ b/src/core/frame.h
@@ -71,8 +71,6 @@ gboolean meta_frame_sync_to_window (MetaFrame         *frame,
                                     gboolean           need_move,
                                     gboolean           need_resize);
 
-cairo_region_t *meta_frame_get_frame_bounds (MetaFrame *frame);
-
 void meta_frame_set_screen_cursor (MetaFrame   *frame,
                                   MetaCursor   cursor);
 
diff --git a/src/core/window-private.h b/src/core/window-private.h
index d89924c..939ecac 100644
--- a/src/core/window-private.h
+++ b/src/core/window-private.h
@@ -333,9 +333,6 @@ struct _MetaWindow
   /* if TRUE, window is attached to its parent */
   guint attached : 1;
 
-  /* if non-NULL, the bounds of the window frame */
-  cairo_region_t *frame_bounds;
-
   /* Note: can be NULL */
   GSList *struts;
 
diff --git a/src/core/window.c b/src/core/window.c
index d76c9fb..6f8b3b3 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -217,9 +217,6 @@ meta_window_finalize (GObject *object)
   if (window->mini_icon)
     g_object_unref (G_OBJECT (window->mini_icon));
 
-  if (window->frame_bounds)
-    cairo_region_destroy (window->frame_bounds);
-
   meta_icon_cache_free (&window->icon_cache);
 
   g_free (window->sm_client_id);
@@ -4581,7 +4578,6 @@ meta_window_move_resize_internal (MetaWindow          *window,
   gboolean need_resize_frame = FALSE;
   int size_dx;
   int size_dy;
-  gboolean frame_shape_changed = FALSE;
   gboolean is_configure_request;
   gboolean do_gravity_adjust;
   gboolean is_user_action;
@@ -4880,9 +4876,9 @@ meta_window_move_resize_internal (MetaWindow          *window,
     meta_window_set_gravity (window, StaticGravity);
 
   if (configure_frame_first && window->frame)
-    frame_shape_changed = meta_frame_sync_to_window (window->frame,
-                                                     gravity,
-                                                     need_move_frame, need_resize_frame);
+    meta_frame_sync_to_window (window->frame,
+                               gravity,
+                               need_move_frame, need_resize_frame);
 
   values.border_width = 0;
   values.x = client_move_x;
@@ -4937,9 +4933,9 @@ meta_window_move_resize_internal (MetaWindow          *window,
     }
 
   if (!configure_frame_first && window->frame)
-    frame_shape_changed = meta_frame_sync_to_window (window->frame,
-                                                     gravity,
-                                                     need_move_frame, need_resize_frame);
+    meta_frame_sync_to_window (window->frame,
+                               gravity,
+                               need_move_frame, need_resize_frame);
 
   /* Put gravity back to be nice to lesser window managers */
   if (use_static_gravity)
@@ -4982,12 +4978,6 @@ meta_window_move_resize_internal (MetaWindow          *window,
    *   b) all constraints are obeyed by window->rect and frame->rect
    */
 
-  if (frame_shape_changed && window->frame_bounds)
-    {
-      cairo_region_destroy (window->frame_bounds);
-      window->frame_bounds = NULL;
-    }
-
   meta_window_foreach_transient (window, maybe_move_attached_dialog, NULL);
 
   meta_stack_update_window_tile_matches (window->screen->stack,
@@ -10650,27 +10640,6 @@ meta_window_get_frame_type (MetaWindow *window)
 }
 
 /**
- * meta_window_get_frame_bounds:
- *
- * Gets a region representing the outer bounds of the window's frame.
- *
- * Return value: (transfer none) (allow-none): a #cairo_region_t
- *  holding the outer bounds of the window, or %NULL if the window
- *  doesn't have a frame.
- */
-cairo_region_t *
-meta_window_get_frame_bounds (MetaWindow *window)
-{
-  if (!window->frame_bounds)
-    {
-      if (window->frame)
-        window->frame_bounds = meta_frame_get_frame_bounds (window->frame);
-    }
-
-  return window->frame_bounds;
-}
-
-/**
  * meta_window_is_attached_dialog:
  * @window: a #MetaWindow
  *
diff --git a/src/meta/window.h b/src/meta/window.h
index 5e09b59..dd59517 100644
--- a/src/meta/window.h
+++ b/src/meta/window.h
@@ -167,8 +167,6 @@ const char *meta_window_get_mutter_hints (MetaWindow *window);
 
 MetaFrameType meta_window_get_frame_type (MetaWindow *window);
 
-cairo_region_t *meta_window_get_frame_bounds (MetaWindow *window);
-
 MetaWindow *meta_window_get_tile_match (MetaWindow *window);
 
 #endif
diff --git a/src/ui/frames.c b/src/ui/frames.c
index 0837628..f06326a 100644
--- a/src/ui/frames.c
+++ b/src/ui/frames.c
@@ -751,135 +751,6 @@ get_client_rect (MetaFrameGeometry     *fgeom,
   rect->height = window_height - fgeom->borders.total.bottom - rect->y;
 }
 
-/* The visible frame rectangle surrounds the visible portion of the
- * frame window; it subtracts only the invisible borders from the frame
- * window's size.
- */
-static void
-get_visible_frame_rect (MetaFrameGeometry     *fgeom,
-                        int                    window_width,
-                        int                    window_height,
-                        cairo_rectangle_int_t *rect)
-{
-  rect->x = fgeom->borders.invisible.left;
-  rect->y = fgeom->borders.invisible.top;
-  rect->width = window_width - fgeom->borders.invisible.right - rect->x;
-  rect->height = window_height - fgeom->borders.invisible.bottom - rect->y;
-}
-
-static cairo_region_t *
-get_visible_region (MetaFrames        *frames,
-                    MetaUIFrame       *frame,
-                    MetaFrameGeometry *fgeom,
-                    int                window_width,
-                    int                window_height)
-{
-  cairo_region_t *corners_region;
-  cairo_region_t *visible_region;
-  cairo_rectangle_int_t rect;
-  cairo_rectangle_int_t frame_rect;
-
-  corners_region = cairo_region_create ();
-  get_visible_frame_rect (fgeom, window_width, window_height, &frame_rect);
-  
-  if (fgeom->top_left_corner_rounded_radius != 0)
-    {
-      const int corner = fgeom->top_left_corner_rounded_radius;
-      const float radius = corner;
-      int i;
-
-      for (i=0; i<corner; i++)
-        {
-          const int width = floor(0.5 + radius - sqrt(radius*radius - (radius-(i+0.5))*(radius-(i+0.5))));
-          rect.x = frame_rect.x;
-          rect.y = frame_rect.y + i;
-          rect.width = width;
-          rect.height = 1;
-          
-          cairo_region_union_rectangle (corners_region, &rect);
-        }
-    }
-
-  if (fgeom->top_right_corner_rounded_radius != 0)
-    {
-      const int corner = fgeom->top_right_corner_rounded_radius;
-      const float radius = corner;
-      int i;
-
-      for (i=0; i<corner; i++)
-        {
-          const int width = floor(0.5 + radius - sqrt(radius*radius - (radius-(i+0.5))*(radius-(i+0.5))));
-          rect.x = frame_rect.x + frame_rect.width - width;
-          rect.y = frame_rect.y + i;
-          rect.width = width;
-          rect.height = 1;
-          
-          cairo_region_union_rectangle (corners_region, &rect);
-        }
-    }
-
-  if (fgeom->bottom_left_corner_rounded_radius != 0)
-    {
-      const int corner = fgeom->bottom_left_corner_rounded_radius;
-      const float radius = corner;
-      int i;
-
-      for (i=0; i<corner; i++)
-        {
-          const int width = floor(0.5 + radius - sqrt(radius*radius - (radius-(i+0.5))*(radius-(i+0.5))));
-          rect.x = frame_rect.x;
-          rect.y = frame_rect.y + frame_rect.height - i - 1;
-          rect.width = width;
-          rect.height = 1;
-          
-          cairo_region_union_rectangle (corners_region, &rect);
-        }
-    }
-
-  if (fgeom->bottom_right_corner_rounded_radius != 0)
-    {
-      const int corner = fgeom->bottom_right_corner_rounded_radius;
-      const float radius = corner;
-      int i;
-
-      for (i=0; i<corner; i++)
-        {
-          const int width = floor(0.5 + radius - sqrt(radius*radius - (radius-(i+0.5))*(radius-(i+0.5))));
-          rect.x = frame_rect.x + frame_rect.width - width;
-          rect.y = frame_rect.y + frame_rect.height - i - 1;
-          rect.width = width;
-          rect.height = 1;
-          
-          cairo_region_union_rectangle (corners_region, &rect);
-        }
-    }
-  
-  visible_region = cairo_region_create_rectangle (&frame_rect);
-  cairo_region_subtract (visible_region, corners_region);
-  cairo_region_destroy (corners_region);
-
-  return visible_region;
-}
-
-cairo_region_t *
-meta_frames_get_frame_bounds (MetaFrames *frames,
-                              Window      xwindow,
-                              int         window_width,
-                              int         window_height)
-{
-  MetaUIFrame *frame;
-  MetaFrameGeometry fgeom;
-
-  frame = meta_frames_lookup_window (frames, xwindow);
-  g_return_val_if_fail (frame != NULL, NULL);
-
-  meta_frames_calc_geometry (frames, frame, &fgeom);
-
-  return get_visible_region (frames, frame,
-                             &fgeom,
-                             window_width, window_height);
-}
-
 void
 meta_frames_move_resize_frame (MetaFrames *frames,
                                Window      xwindow,
diff --git a/src/ui/frames.h b/src/ui/frames.h
index 8979065..ea149ae 100644
--- a/src/ui/frames.h
+++ b/src/ui/frames.h
@@ -138,11 +138,6 @@ void meta_frames_unflicker_bg (MetaFrames *frames,
                                int         target_width,
                                int         target_height);
 
-cairo_region_t *meta_frames_get_frame_bounds (MetaFrames *frames,
-                                              Window      xwindow,
-                                              int         window_width,
-                                              int         window_height);
-
 void meta_frames_render_background (MetaFrames *frames,
                                     Window      xwindow,
                                     cairo_t    *cr);
diff --git a/src/ui/theme-private.h b/src/ui/theme-private.h
index 8461b76..26decab 100644
--- a/src/ui/theme-private.h
+++ b/src/ui/theme-private.h
@@ -252,12 +252,6 @@ struct _MetaFrameGeometry
   MetaButtonLayout button_layout;
   int n_left_buttons;
   int n_right_buttons;
-  
-  /* Round corners */
-  guint top_left_corner_rounded_radius;
-  guint top_right_corner_rounded_radius;
-  guint bottom_left_corner_rounded_radius;
-  guint bottom_right_corner_rounded_radius;
 };
 
 typedef enum
diff --git a/src/ui/theme.c b/src/ui/theme.c
index 46fd34f..bb1e769 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -543,8 +543,6 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout  *layout,
   int title_right_edge;
   int width, height;
   int button_width, button_height;
-  int min_size_for_rounding;
-  double tl, tr, bl, br;
   
   /* the left/right rects in order; the max # of rects
    * is the number of button functions
@@ -874,33 +872,6 @@ meta_frame_layout_calc_geometry (const MetaFrameLayout  *layout,
       fgeom->title_rect.width = 0;
       fgeom->title_rect.height = 0;
     }
-
-  if (flags & META_FRAME_SHADED)
-    min_size_for_rounding = 0;
-  else
-    min_size_for_rounding = 5;
-
-  fgeom->top_left_corner_rounded_radius = 0;
-  fgeom->top_right_corner_rounded_radius = 0;
-  fgeom->bottom_left_corner_rounded_radius = 0;
-  fgeom->bottom_right_corner_rounded_radius = 0;
-
-  gtk_style_context_get (ctx,
-                         GTK_STATE_ACTIVE,
-                         "border-top-left-radius", &tl,
-                         "border-top-right-radius", &tr,
-                         "border-bottom-left-radius", &bl,
-                         "border-bottom-right-radius", &br,
-                         NULL);
-
-  if (borders.visible.top + borders.visible.left >= min_size_for_rounding)
-    fgeom->top_left_corner_rounded_radius = tl;
-  if (borders.visible.top + borders.visible.right >= min_size_for_rounding)
-    fgeom->top_right_corner_rounded_radius = tr;
-  if (borders.visible.bottom + borders.visible.left >= min_size_for_rounding)
-    fgeom->bottom_left_corner_rounded_radius = bl;
-  if (borders.visible.bottom + borders.visible.right >= min_size_for_rounding)
-    fgeom->bottom_right_corner_rounded_radius = br;
 }
 
 /**
diff --git a/src/ui/ui.c b/src/ui/ui.c
index 20746ca..9fb7d1f 100644
--- a/src/ui/ui.c
+++ b/src/ui/ui.c
@@ -474,16 +474,6 @@ meta_ui_reset_frame_bg (MetaUI *ui,
   meta_frames_reset_bg (ui->frames, xwindow);
 }
 
-cairo_region_t *
-meta_ui_get_frame_bounds (MetaUI  *ui,
-                          Window   xwindow,
-                          int      window_width,
-                          int      window_height)
-{
-  return meta_frames_get_frame_bounds (ui->frames, xwindow,
-                                       window_width, window_height);
-}
-
 void
 meta_ui_queue_frame_draw (MetaUI *ui,
                           Window xwindow)
diff --git a/src/ui/ui.h b/src/ui/ui.h
index 482fadd..8651329 100644
--- a/src/ui/ui.h
+++ b/src/ui/ui.h
@@ -95,11 +95,6 @@ void meta_ui_unflicker_frame_bg (MetaUI *ui,
 void meta_ui_reset_frame_bg     (MetaUI *ui,
                                  Window  xwindow);
 
-cairo_region_t *meta_ui_get_frame_bounds (MetaUI  *ui,
-                                          Window   xwindow,
-                                          int      window_width,
-                                          int      window_height);
-
 void meta_ui_render_background (MetaUI  *ui,
                                 Window   xwindow,
                                 cairo_t *cr);


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