mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 08:00:42 -05:00
meta/boxes: typedef cairo_rectangle_int_t MetaRectangle
They are already effectively interchangeable so this should reduce pointless casts. Just like in GDK though, we need to keep the old definition for instrospection to be able to include the struct's fields.
This commit is contained in:
parent
0745734ba5
commit
daf5a112fb
@ -1037,14 +1037,12 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
|
||||
CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
|
||||
CoglOnscreen *onscreen;
|
||||
CoglFramebuffer *framebuffer;
|
||||
cairo_rectangle_int_t view_layout;
|
||||
MetaRendererView *view;
|
||||
GError *error = NULL;
|
||||
|
||||
view_layout = meta_rectangle_to_cairo_rectangle (&monitor_info->rect);
|
||||
onscreen = cogl_onscreen_new (cogl_context,
|
||||
view_layout.width,
|
||||
view_layout.height);
|
||||
monitor_info->rect.width,
|
||||
monitor_info->rect.height);
|
||||
cogl_onscreen_set_swap_throttled (onscreen,
|
||||
_clutter_get_sync_to_vblank ());
|
||||
|
||||
@ -1054,7 +1052,7 @@ meta_renderer_native_create_view (MetaRenderer *renderer,
|
||||
error->message);
|
||||
|
||||
view = g_object_new (META_TYPE_RENDERER_VIEW,
|
||||
"layout", &view_layout,
|
||||
"layout", &monitor_info->rect,
|
||||
"framebuffer", framebuffer,
|
||||
"monitor-info", monitor_info,
|
||||
NULL);
|
||||
|
@ -76,7 +76,6 @@ meta_renderer_x11_create_view (MetaRenderer *renderer,
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_backend);
|
||||
int width, height;
|
||||
cairo_rectangle_int_t view_layout;
|
||||
CoglTexture2D *texture_2d;
|
||||
CoglOffscreen *offscreen;
|
||||
|
||||
@ -86,10 +85,9 @@ meta_renderer_x11_create_view (MetaRenderer *renderer,
|
||||
height = monitor_info->rect.height;
|
||||
texture_2d = cogl_texture_2d_new_with_size (cogl_context, width, height);
|
||||
offscreen = cogl_offscreen_new_with_texture (COGL_TEXTURE (texture_2d));
|
||||
view_layout = meta_rectangle_to_cairo_rectangle (&monitor_info->rect);
|
||||
|
||||
return g_object_new (META_TYPE_RENDERER_VIEW,
|
||||
"layout", &view_layout,
|
||||
"layout", &monitor_info->rect,
|
||||
"framebuffer", COGL_FRAMEBUFFER (offscreen),
|
||||
NULL);
|
||||
}
|
||||
|
@ -215,6 +215,4 @@ GList* meta_rectangle_find_nonintersected_monitor_edges (
|
||||
const GList *monitor_rects,
|
||||
const GSList *all_struts);
|
||||
|
||||
cairo_rectangle_int_t meta_rectangle_to_cairo_rectangle (MetaRectangle *rect);
|
||||
|
||||
#endif /* META_BOXES_PRIVATE_H */
|
||||
|
@ -2013,14 +2013,3 @@ meta_rectangle_find_nonintersected_monitor_edges (
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
cairo_rectangle_int_t
|
||||
meta_rectangle_to_cairo_rectangle (MetaRectangle *rect)
|
||||
{
|
||||
return (cairo_rectangle_int_t) {
|
||||
.x = rect->x,
|
||||
.y = rect->y,
|
||||
.width = rect->width,
|
||||
.height = rect->height
|
||||
};
|
||||
}
|
||||
|
@ -34,7 +34,14 @@
|
||||
* @width: Width of the rectangle
|
||||
* @height: Height of the rectangle
|
||||
*/
|
||||
typedef struct _MetaRectangle MetaRectangle;
|
||||
#ifdef __GI_SCANNER__
|
||||
/* The introspection scanner is currently unable to lookup how
|
||||
* cairo_rectangle_int_t is actually defined. This prevents
|
||||
* introspection data for the GdkRectangle type to include fields
|
||||
* descriptions. To workaround this issue, we define it with the same
|
||||
* content as cairo_rectangle_int_t, but only under the introspection
|
||||
* define.
|
||||
*/
|
||||
struct _MetaRectangle
|
||||
{
|
||||
int x;
|
||||
@ -42,6 +49,10 @@ struct _MetaRectangle
|
||||
int width;
|
||||
int height;
|
||||
};
|
||||
typedef struct _MetaRectangle MetaRectangle;
|
||||
#else
|
||||
typedef cairo_rectangle_int_t MetaRectangle;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* MetaStrut:
|
||||
|
Loading…
Reference in New Issue
Block a user