frame: Add "get_corner_radiuses" chain

https://bugzilla.gnome.org/show_bug.cgi?id=628195
This commit is contained in:
Jasper St. Pierre 2011-07-11 12:58:31 -04:00
parent f83568fc4e
commit d33d113746
6 changed files with 81 additions and 1 deletions

View File

@ -319,6 +319,19 @@ meta_frame_calc_borders (MetaFrame *frame,
borders); borders);
} }
void
meta_frame_get_corner_radiuses (MetaFrame *frame,
float *top_left,
float *top_right,
float *bottom_left,
float *bottom_right)
{
meta_ui_get_corner_radiuses (frame->window->screen->ui,
frame->xwindow,
top_left, top_right,
bottom_left, bottom_right);
}
gboolean gboolean
meta_frame_sync_to_window (MetaFrame *frame, meta_frame_sync_to_window (MetaFrame *frame,
int resize_gravity, int resize_gravity,

View File

@ -63,6 +63,12 @@ Window meta_frame_get_xwindow (MetaFrame *frame);
void meta_frame_calc_borders (MetaFrame *frame, void meta_frame_calc_borders (MetaFrame *frame,
MetaFrameBorders *borders); MetaFrameBorders *borders);
void meta_frame_get_corner_radiuses (MetaFrame *frame,
float *top_left,
float *top_right,
float *bottom_left,
float *bottom_right);
gboolean meta_frame_sync_to_window (MetaFrame *frame, gboolean meta_frame_sync_to_window (MetaFrame *frame,
int gravity, int gravity,
gboolean need_move, gboolean need_move,

View File

@ -824,6 +824,40 @@ meta_frames_get_borders (MetaFrames *frames,
borders); borders);
} }
void
meta_frames_get_corner_radiuses (MetaFrames *frames,
Window xwindow,
float *top_left,
float *top_right,
float *bottom_left,
float *bottom_right)
{
MetaUIFrame *frame;
MetaFrameGeometry fgeom;
frame = meta_frames_lookup_window (frames, xwindow);
meta_frames_calc_geometry (frames, frame, &fgeom);
/* For compatibility with the code in get_visible_rect(), there's
* a mysterious sqrt() added to the corner radiuses:
*
* const float radius = sqrt(corner) + corner;
*
* It's unclear why the radius is calculated like this, but we
* need to be consistent with it.
*/
if (top_left)
*top_left = fgeom.top_left_corner_rounded_radius + sqrt(fgeom.top_left_corner_rounded_radius);
if (top_right)
*top_right = fgeom.top_right_corner_rounded_radius + sqrt(fgeom.top_right_corner_rounded_radius);
if (bottom_left)
*bottom_left = fgeom.bottom_left_corner_rounded_radius + sqrt(fgeom.bottom_left_corner_rounded_radius);
if (bottom_right)
*bottom_right = fgeom.bottom_right_corner_rounded_radius + sqrt(fgeom.bottom_right_corner_rounded_radius);
}
void void
meta_frames_reset_bg (MetaFrames *frames, meta_frames_reset_bg (MetaFrames *frames,
Window xwindow) Window xwindow)

View File

@ -148,6 +148,14 @@ cairo_region_t *meta_frames_get_frame_bounds (MetaFrames *frames,
Window xwindow, Window xwindow,
int window_width, int window_width,
int window_height); int window_height);
void meta_frames_get_corner_radiuses (MetaFrames *frames,
Window xwindow,
float *top_left,
float *top_right,
float *bottom_left,
float *bottom_right);
void meta_frames_move_resize_frame (MetaFrames *frames, void meta_frames_move_resize_frame (MetaFrames *frames,
Window xwindow, Window xwindow,
int x, int x,

View File

@ -314,6 +314,19 @@ meta_ui_get_frame_borders (MetaUI *ui,
borders); borders);
} }
void
meta_ui_get_corner_radiuses (MetaUI *ui,
Window xwindow,
float *top_left,
float *top_right,
float *bottom_left,
float *bottom_right)
{
meta_frames_get_corner_radiuses (ui->frames, xwindow,
top_left, top_right,
bottom_left, bottom_right);
}
Window Window
meta_ui_create_frame_window (MetaUI *ui, meta_ui_create_frame_window (MetaUI *ui,
Display *xdisplay, Display *xdisplay,
@ -480,7 +493,6 @@ meta_ui_queue_frame_draw (MetaUI *ui,
meta_frames_queue_draw (ui->frames, xwindow); meta_frames_queue_draw (ui->frames, xwindow);
} }
void void
meta_ui_set_frame_title (MetaUI *ui, meta_ui_set_frame_title (MetaUI *ui,
Window xwindow, Window xwindow,

View File

@ -100,6 +100,13 @@ cairo_region_t *meta_ui_get_frame_bounds (MetaUI *ui,
int window_width, int window_width,
int window_height); int window_height);
void meta_ui_get_corner_radiuses (MetaUI *ui,
Window xwindow,
float *top_left,
float *top_right,
float *bottom_left,
float *bottom_right);
void meta_ui_queue_frame_draw (MetaUI *ui, void meta_ui_queue_frame_draw (MetaUI *ui,
Window xwindow); Window xwindow);