mirror of
https://github.com/brl/mutter.git
synced 2025-06-14 01:09:30 +00:00
Replace ClutterRect by graphene_rect_t
https://gitlab.gnome.org/GNOME/mutter/merge_requests/458
This commit is contained in:
@ -85,7 +85,7 @@ meta_cursor_renderer_emit_painted (MetaCursorRenderer *renderer,
|
||||
|
||||
static void
|
||||
align_cursor_position (MetaCursorRenderer *renderer,
|
||||
ClutterRect *rect)
|
||||
graphene_rect_t *rect)
|
||||
{
|
||||
MetaCursorRendererPrivate *priv =
|
||||
meta_cursor_renderer_get_instance_private (renderer);
|
||||
@ -104,10 +104,10 @@ align_cursor_position (MetaCursorRenderer *renderer,
|
||||
clutter_stage_view_get_layout (view, &view_layout);
|
||||
view_scale = clutter_stage_view_get_scale (view);
|
||||
|
||||
clutter_rect_offset (rect, -view_layout.x, -view_layout.y);
|
||||
graphene_rect_offset (rect, -view_layout.x, -view_layout.y);
|
||||
rect->origin.x = floorf (rect->origin.x * view_scale) / view_scale;
|
||||
rect->origin.y = floorf (rect->origin.y * view_scale) / view_scale;
|
||||
clutter_rect_offset (rect, view_layout.x, view_layout.y);
|
||||
graphene_rect_offset (rect, view_layout.x, view_layout.y);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -118,7 +118,7 @@ queue_redraw (MetaCursorRenderer *renderer,
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
ClutterActor *stage = meta_backend_get_stage (backend);
|
||||
CoglTexture *texture;
|
||||
ClutterRect rect = CLUTTER_RECT_INIT_ZERO;
|
||||
graphene_rect_t rect = GRAPHENE_RECT_INIT_ZERO;
|
||||
|
||||
/* During early initialization, we can have no stage */
|
||||
if (!stage)
|
||||
@ -211,7 +211,7 @@ meta_cursor_renderer_init (MetaCursorRenderer *renderer)
|
||||
NULL);
|
||||
}
|
||||
|
||||
ClutterRect
|
||||
graphene_rect_t
|
||||
meta_cursor_renderer_calculate_rect (MetaCursorRenderer *renderer,
|
||||
MetaCursorSprite *cursor_sprite)
|
||||
{
|
||||
@ -224,14 +224,14 @@ meta_cursor_renderer_calculate_rect (MetaCursorRenderer *renderer,
|
||||
|
||||
texture = meta_cursor_sprite_get_cogl_texture (cursor_sprite);
|
||||
if (!texture)
|
||||
return (ClutterRect) CLUTTER_RECT_INIT_ZERO;
|
||||
return (graphene_rect_t) GRAPHENE_RECT_INIT_ZERO;
|
||||
|
||||
meta_cursor_sprite_get_hotspot (cursor_sprite, &hot_x, &hot_y);
|
||||
texture_scale = meta_cursor_sprite_get_texture_scale (cursor_sprite);
|
||||
width = cogl_texture_get_width (texture);
|
||||
height = cogl_texture_get_height (texture);
|
||||
|
||||
return (ClutterRect) {
|
||||
return (graphene_rect_t) {
|
||||
.origin = {
|
||||
.x = priv->current_x - (hot_x * texture_scale),
|
||||
.y = priv->current_y - (hot_y * texture_scale)
|
||||
|
@ -76,8 +76,8 @@ void meta_cursor_renderer_remove_hw_cursor_inhibitor (MetaCursorRenderer *ren
|
||||
gboolean meta_cursor_renderer_is_hw_cursors_inhibited (MetaCursorRenderer *renderer,
|
||||
MetaCursorSprite *cursor_sprite);
|
||||
|
||||
ClutterRect meta_cursor_renderer_calculate_rect (MetaCursorRenderer *renderer,
|
||||
MetaCursorSprite *cursor_sprite);
|
||||
graphene_rect_t meta_cursor_renderer_calculate_rect (MetaCursorRenderer *renderer,
|
||||
MetaCursorSprite *cursor_sprite);
|
||||
|
||||
void meta_cursor_renderer_emit_painted (MetaCursorRenderer *renderer,
|
||||
MetaCursorSprite *cursor_sprite);
|
||||
|
@ -145,33 +145,33 @@ is_cursor_in_stream (MetaScreenCastMonitorStreamSrc *monitor_src)
|
||||
MetaMonitor *monitor;
|
||||
MetaLogicalMonitor *logical_monitor;
|
||||
MetaRectangle logical_monitor_layout;
|
||||
ClutterRect logical_monitor_rect;
|
||||
graphene_rect_t logical_monitor_rect;
|
||||
MetaCursorSprite *cursor_sprite;
|
||||
|
||||
monitor = get_monitor (monitor_src);
|
||||
logical_monitor = meta_monitor_get_logical_monitor (monitor);
|
||||
logical_monitor_layout = meta_logical_monitor_get_layout (logical_monitor);
|
||||
logical_monitor_rect =
|
||||
meta_rectangle_to_clutter_rect (&logical_monitor_layout);
|
||||
meta_rectangle_to_graphene_rect (&logical_monitor_layout);
|
||||
|
||||
cursor_sprite = meta_cursor_renderer_get_cursor (cursor_renderer);
|
||||
if (cursor_sprite)
|
||||
{
|
||||
ClutterRect cursor_rect;
|
||||
graphene_rect_t cursor_rect;
|
||||
|
||||
cursor_rect = meta_cursor_renderer_calculate_rect (cursor_renderer,
|
||||
cursor_sprite);
|
||||
return clutter_rect_intersection (&cursor_rect,
|
||||
&logical_monitor_rect,
|
||||
NULL);
|
||||
return graphene_rect_intersection (&cursor_rect,
|
||||
&logical_monitor_rect,
|
||||
NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
graphene_point_t cursor_position;
|
||||
|
||||
cursor_position = meta_cursor_renderer_get_position (cursor_renderer);
|
||||
return clutter_rect_contains_point (&logical_monitor_rect,
|
||||
&cursor_position);
|
||||
return graphene_rect_contains_point (&logical_monitor_rect,
|
||||
&cursor_position);
|
||||
}
|
||||
}
|
||||
|
||||
@ -381,7 +381,7 @@ meta_screen_cast_monitor_stream_src_set_cursor_metadata (MetaScreenCastStreamSrc
|
||||
MetaMonitor *monitor;
|
||||
MetaLogicalMonitor *logical_monitor;
|
||||
MetaRectangle logical_monitor_layout;
|
||||
ClutterRect logical_monitor_rect;
|
||||
graphene_rect_t logical_monitor_rect;
|
||||
MetaRendererView *view;
|
||||
float view_scale;
|
||||
graphene_point_t cursor_position;
|
||||
@ -400,7 +400,7 @@ meta_screen_cast_monitor_stream_src_set_cursor_metadata (MetaScreenCastStreamSrc
|
||||
logical_monitor = meta_monitor_get_logical_monitor (monitor);
|
||||
logical_monitor_layout = meta_logical_monitor_get_layout (logical_monitor);
|
||||
logical_monitor_rect =
|
||||
meta_rectangle_to_clutter_rect (&logical_monitor_layout);
|
||||
meta_rectangle_to_graphene_rect (&logical_monitor_layout);
|
||||
|
||||
view = meta_renderer_get_view_from_logical_monitor (renderer,
|
||||
logical_monitor);
|
||||
|
@ -48,10 +48,10 @@ MetaOverlay *meta_stage_create_cursor_overlay (MetaStage *stage);
|
||||
void meta_stage_remove_cursor_overlay (MetaStage *stage,
|
||||
MetaOverlay *overlay);
|
||||
|
||||
void meta_stage_update_cursor_overlay (MetaStage *stage,
|
||||
MetaOverlay *overlay,
|
||||
CoglTexture *texture,
|
||||
ClutterRect *rect);
|
||||
void meta_stage_update_cursor_overlay (MetaStage *stage,
|
||||
MetaOverlay *overlay,
|
||||
CoglTexture *texture,
|
||||
graphene_rect_t *rect);
|
||||
|
||||
void meta_stage_set_active (MetaStage *stage,
|
||||
gboolean is_active);
|
||||
|
@ -55,8 +55,8 @@ struct _MetaOverlay
|
||||
CoglPipeline *pipeline;
|
||||
CoglTexture *texture;
|
||||
|
||||
ClutterRect current_rect;
|
||||
ClutterRect previous_rect;
|
||||
graphene_rect_t current_rect;
|
||||
graphene_rect_t previous_rect;
|
||||
gboolean previous_is_valid;
|
||||
};
|
||||
|
||||
@ -95,9 +95,9 @@ meta_overlay_free (MetaOverlay *overlay)
|
||||
}
|
||||
|
||||
static void
|
||||
meta_overlay_set (MetaOverlay *overlay,
|
||||
CoglTexture *texture,
|
||||
ClutterRect *rect)
|
||||
meta_overlay_set (MetaOverlay *overlay,
|
||||
CoglTexture *texture,
|
||||
graphene_rect_t *rect)
|
||||
{
|
||||
if (overlay->texture != texture)
|
||||
{
|
||||
@ -135,7 +135,7 @@ meta_overlay_paint (MetaOverlay *overlay)
|
||||
(overlay->current_rect.origin.y +
|
||||
overlay->current_rect.size.height));
|
||||
|
||||
if (!clutter_rect_equals (&overlay->previous_rect, &overlay->current_rect))
|
||||
if (!graphene_rect_equal (&overlay->previous_rect, &overlay->current_rect))
|
||||
{
|
||||
overlay->previous_rect = overlay->current_rect;
|
||||
overlay->previous_is_valid = TRUE;
|
||||
@ -297,9 +297,9 @@ meta_stage_new (MetaBackend *backend)
|
||||
}
|
||||
|
||||
static void
|
||||
queue_redraw_clutter_rect (MetaStage *stage,
|
||||
MetaOverlay *overlay,
|
||||
ClutterRect *rect)
|
||||
queue_redraw_clutter_rect (MetaStage *stage,
|
||||
MetaOverlay *overlay,
|
||||
graphene_rect_t *rect)
|
||||
{
|
||||
cairo_rectangle_int_t clip = {
|
||||
.x = floorf (rect->origin.x),
|
||||
@ -358,10 +358,10 @@ meta_stage_remove_cursor_overlay (MetaStage *stage,
|
||||
}
|
||||
|
||||
void
|
||||
meta_stage_update_cursor_overlay (MetaStage *stage,
|
||||
MetaOverlay *overlay,
|
||||
CoglTexture *texture,
|
||||
ClutterRect *rect)
|
||||
meta_stage_update_cursor_overlay (MetaStage *stage,
|
||||
MetaOverlay *overlay,
|
||||
CoglTexture *texture,
|
||||
graphene_rect_t *rect)
|
||||
{
|
||||
g_assert (meta_is_wayland_compositor () || texture == NULL);
|
||||
|
||||
|
@ -286,7 +286,7 @@ typedef struct
|
||||
{
|
||||
MetaCursorRendererNative *in_cursor_renderer_native;
|
||||
MetaLogicalMonitor *in_logical_monitor;
|
||||
ClutterRect in_local_cursor_rect;
|
||||
graphene_rect_t in_local_cursor_rect;
|
||||
MetaCursorSprite *in_cursor_sprite;
|
||||
|
||||
gboolean out_painted;
|
||||
@ -306,7 +306,7 @@ update_monitor_crtc_cursor (MetaMonitor *monitor,
|
||||
meta_cursor_renderer_native_get_instance_private (cursor_renderer_native);
|
||||
MetaCrtc *crtc;
|
||||
MetaMonitorTransform transform;
|
||||
ClutterRect scaled_crtc_rect;
|
||||
graphene_rect_t scaled_crtc_rect;
|
||||
float scale;
|
||||
int crtc_x, crtc_y;
|
||||
int crtc_width, crtc_height;
|
||||
@ -333,7 +333,7 @@ update_monitor_crtc_cursor (MetaMonitor *monitor,
|
||||
crtc_height = monitor_crtc_mode->crtc_mode->height;
|
||||
}
|
||||
|
||||
scaled_crtc_rect = (ClutterRect) {
|
||||
scaled_crtc_rect = (graphene_rect_t) {
|
||||
.origin = {
|
||||
.x = crtc_x / scale,
|
||||
.y = crtc_y / scale
|
||||
@ -347,9 +347,9 @@ update_monitor_crtc_cursor (MetaMonitor *monitor,
|
||||
crtc = meta_output_get_assigned_crtc (monitor_crtc_mode->output);
|
||||
|
||||
if (priv->has_hw_cursor &&
|
||||
clutter_rect_intersection (&scaled_crtc_rect,
|
||||
&data->in_local_cursor_rect,
|
||||
NULL))
|
||||
graphene_rect_intersection (&scaled_crtc_rect,
|
||||
&data->in_local_cursor_rect,
|
||||
NULL))
|
||||
{
|
||||
MetaGpuKms *gpu_kms;
|
||||
int kms_fd;
|
||||
@ -392,13 +392,13 @@ update_hw_cursor (MetaCursorRendererNative *native,
|
||||
meta_backend_get_monitor_manager (backend);
|
||||
GList *logical_monitors;
|
||||
GList *l;
|
||||
ClutterRect rect;
|
||||
graphene_rect_t rect;
|
||||
gboolean painted = FALSE;
|
||||
|
||||
if (cursor_sprite)
|
||||
rect = meta_cursor_renderer_calculate_rect (renderer, cursor_sprite);
|
||||
else
|
||||
rect = (ClutterRect) CLUTTER_RECT_INIT_ZERO;
|
||||
rect = GRAPHENE_RECT_INIT_ZERO;
|
||||
|
||||
logical_monitors =
|
||||
meta_monitor_manager_get_logical_monitors (monitor_manager);
|
||||
@ -412,7 +412,7 @@ update_hw_cursor (MetaCursorRendererNative *native,
|
||||
data = (UpdateCrtcCursorData) {
|
||||
.in_cursor_renderer_native = native,
|
||||
.in_logical_monitor = logical_monitor,
|
||||
.in_local_cursor_rect = (ClutterRect) {
|
||||
.in_local_cursor_rect = (graphene_rect_t) {
|
||||
.origin = {
|
||||
.x = rect.origin.x - logical_monitor->rect.x,
|
||||
.y = rect.origin.y - logical_monitor->rect.y
|
||||
@ -487,7 +487,7 @@ cursor_over_transformed_logical_monitor (MetaCursorRenderer *renderer,
|
||||
meta_backend_get_monitor_manager (backend);
|
||||
GList *logical_monitors;
|
||||
GList *l;
|
||||
ClutterRect cursor_rect;
|
||||
graphene_rect_t cursor_rect;
|
||||
|
||||
cursor_rect = meta_cursor_renderer_calculate_rect (renderer, cursor_sprite);
|
||||
|
||||
@ -497,17 +497,17 @@ cursor_over_transformed_logical_monitor (MetaCursorRenderer *renderer,
|
||||
{
|
||||
MetaLogicalMonitor *logical_monitor = l->data;
|
||||
MetaRectangle logical_monitor_layout;
|
||||
ClutterRect logical_monitor_rect;
|
||||
graphene_rect_t logical_monitor_rect;
|
||||
MetaMonitorTransform transform;
|
||||
GList *monitors, *l_mon;
|
||||
|
||||
logical_monitor_layout =
|
||||
meta_logical_monitor_get_layout (logical_monitor);
|
||||
logical_monitor_rect =
|
||||
meta_rectangle_to_clutter_rect (&logical_monitor_layout);
|
||||
meta_rectangle_to_graphene_rect (&logical_monitor_layout);
|
||||
|
||||
if (!clutter_rect_intersection (&cursor_rect, &logical_monitor_rect,
|
||||
NULL))
|
||||
if (!graphene_rect_intersection (&cursor_rect, &logical_monitor_rect,
|
||||
NULL))
|
||||
continue;
|
||||
|
||||
monitors = meta_logical_monitor_get_monitors (logical_monitor);
|
||||
@ -545,7 +545,7 @@ can_draw_cursor_unscaled (MetaCursorRenderer *renderer,
|
||||
MetaBackend *backend = priv->backend;
|
||||
MetaMonitorManager *monitor_manager =
|
||||
meta_backend_get_monitor_manager (backend);
|
||||
ClutterRect cursor_rect;
|
||||
graphene_rect_t cursor_rect;
|
||||
GList *logical_monitors;
|
||||
GList *l;
|
||||
gboolean has_visible_crtc_sprite = FALSE;
|
||||
@ -564,12 +564,12 @@ can_draw_cursor_unscaled (MetaCursorRenderer *renderer,
|
||||
for (l = logical_monitors; l; l = l->next)
|
||||
{
|
||||
MetaLogicalMonitor *logical_monitor = l->data;
|
||||
ClutterRect logical_monitor_rect =
|
||||
meta_rectangle_to_clutter_rect (&logical_monitor->rect);
|
||||
graphene_rect_t logical_monitor_rect =
|
||||
meta_rectangle_to_graphene_rect (&logical_monitor->rect);
|
||||
|
||||
if (!clutter_rect_intersection (&cursor_rect,
|
||||
&logical_monitor_rect,
|
||||
NULL))
|
||||
if (!graphene_rect_intersection (&cursor_rect,
|
||||
&logical_monitor_rect,
|
||||
NULL))
|
||||
continue;
|
||||
|
||||
if (calculate_cursor_crtc_sprite_scale (cursor_sprite,
|
||||
@ -692,7 +692,7 @@ calculate_cursor_sprite_gpus (MetaCursorRenderer *renderer,
|
||||
GList *gpus = NULL;
|
||||
GList *logical_monitors;
|
||||
GList *l;
|
||||
ClutterRect cursor_rect;
|
||||
graphene_rect_t cursor_rect;
|
||||
|
||||
cursor_rect = meta_cursor_renderer_calculate_rect (renderer, cursor_sprite);
|
||||
|
||||
@ -702,16 +702,16 @@ calculate_cursor_sprite_gpus (MetaCursorRenderer *renderer,
|
||||
{
|
||||
MetaLogicalMonitor *logical_monitor = l->data;
|
||||
MetaRectangle logical_monitor_layout;
|
||||
ClutterRect logical_monitor_rect;
|
||||
graphene_rect_t logical_monitor_rect;
|
||||
GList *monitors, *l_mon;
|
||||
|
||||
logical_monitor_layout =
|
||||
meta_logical_monitor_get_layout (logical_monitor);
|
||||
logical_monitor_rect =
|
||||
meta_rectangle_to_clutter_rect (&logical_monitor_layout);
|
||||
meta_rectangle_to_graphene_rect (&logical_monitor_layout);
|
||||
|
||||
if (!clutter_rect_intersection (&cursor_rect, &logical_monitor_rect,
|
||||
NULL))
|
||||
if (!graphene_rect_intersection (&cursor_rect, &logical_monitor_rect,
|
||||
NULL))
|
||||
continue;
|
||||
|
||||
monitors = meta_logical_monitor_get_monitors (logical_monitor);
|
||||
|
Reference in New Issue
Block a user