From 918ae0f4d49173dd100fd3989ae0edf8a0b1c9ec Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Wed, 19 Jul 2023 16:59:04 +0200 Subject: [PATCH] mutter: Replace cairo_rectangle_int_t with MtkRectangle Note: the various helpers in boxes.c were not ported yet, see the next commit. This was intentionally done to simplify the porting process Part-of: --- src/backends/meta-cursor-renderer.c | 3 +- src/backends/meta-eis-client.c | 2 +- src/backends/meta-input-capture-session.c | 2 +- src/backends/meta-monitor-manager.c | 6 +-- src/backends/meta-renderer-view.c | 4 +- .../meta-screen-cast-monitor-stream-src.c | 2 +- src/backends/meta-screen-cast-stream-src.c | 2 +- src/backends/meta-stage-impl.c | 38 +++++++++---------- src/backends/meta-stage.c | 6 +-- src/backends/meta-viewport-info.c | 10 ++--- src/backends/meta-viewport-info.h | 6 +-- .../native/meta-pointer-constraint-native.c | 2 +- src/backends/native/meta-seat-impl.c | 6 +-- src/backends/native/meta-stage-native.c | 6 +-- src/backends/x11/cm/meta-renderer-x11-cm.c | 8 ++-- src/backends/x11/meta-stage-x11.c | 4 +- src/compositor/compositor.c | 4 +- src/compositor/meta-background-content.c | 16 ++++---- src/compositor/meta-background-private.h | 8 ++-- src/compositor/meta-background.c | 20 +++++----- src/compositor/meta-shadow-factory.c | 12 +++--- src/compositor/meta-shaped-texture-private.h | 2 +- src/compositor/meta-shaped-texture.c | 30 +++++++-------- src/compositor/meta-surface-actor.c | 18 ++++----- src/compositor/meta-window-actor-wayland.c | 4 +- src/compositor/meta-window-actor-x11.c | 36 +++++++++--------- src/compositor/meta-window-shape.c | 10 ++--- src/compositor/region-utils.c | 24 ++++++------ src/compositor/region-utils.h | 4 +- src/core/frame.c | 4 +- src/core/frame.h | 2 +- src/core/keybindings.c | 2 +- src/core/window-private.h | 2 +- src/core/window.c | 2 +- src/meson.build | 1 + src/meta/meta-shadow-factory.h | 2 +- src/meta/meta-shaped-texture.h | 2 +- src/meta/meta-window-actor.h | 2 +- src/tests/meta-monitor-test-utils.c | 2 +- src/tests/meta-ref-test.c | 2 +- src/tests/stage-view-tests.c | 2 +- src/wayland/meta-pointer-lock-wayland.c | 4 +- src/wayland/meta-wayland-actor-surface.c | 4 +- src/wayland/meta-wayland-buffer.c | 2 +- .../meta-wayland-pointer-constraints.c | 2 +- src/wayland/meta-wayland-region.c | 5 ++- src/wayland/meta-wayland-surface.c | 22 +++++------ src/wayland/meta-wayland-text-input.c | 8 ++-- src/wayland/meta-window-xwayland.c | 4 +- src/x11/window-props.c | 6 +-- src/x11/window-x11.c | 8 ++-- 51 files changed, 194 insertions(+), 191 deletions(-) diff --git a/src/backends/meta-cursor-renderer.c b/src/backends/meta-cursor-renderer.c index 1b7c140f6..904a21a0f 100644 --- a/src/backends/meta-cursor-renderer.c +++ b/src/backends/meta-cursor-renderer.c @@ -35,6 +35,7 @@ #include "core/boxes-private.h" #include "meta/meta-backend.h" #include "meta/util.h" +#include "mtk/mtk.h" G_DEFINE_INTERFACE (MetaHwCursorInhibitor, meta_hw_cursor_inhibitor, G_TYPE_OBJECT) @@ -109,7 +110,7 @@ align_cursor_position (MetaCursorRenderer *renderer, meta_cursor_renderer_get_instance_private (renderer); ClutterActor *stage = meta_backend_get_stage (priv->backend); ClutterStageView *view; - cairo_rectangle_int_t view_layout; + MtkRectangle view_layout; float view_scale; view = clutter_stage_get_view_at (CLUTTER_STAGE (stage), diff --git a/src/backends/meta-eis-client.c b/src/backends/meta-eis-client.c index 592d9f8be..bc927572a 100644 --- a/src/backends/meta-eis-client.c +++ b/src/backends/meta-eis-client.c @@ -221,7 +221,7 @@ configure_abs (MetaEisClient *meta_eis_client, struct eis_device *eis_device) { int idx = 0; - cairo_rectangle_int_t rect; + MtkRectangle rect; float scale; if (!meta_eis_client->viewports) diff --git a/src/backends/meta-input-capture-session.c b/src/backends/meta-input-capture-session.c index 485cbcc46..af6c37a75 100644 --- a/src/backends/meta-input-capture-session.c +++ b/src/backends/meta-input-capture-session.c @@ -187,7 +187,7 @@ ensure_eis_pointer_regions (MetaInputCaptureSession *session, struct eis_device *eis_pointer) { int idx = 0; - cairo_rectangle_int_t rect; + MtkRectangle rect; float scale; if (!session->viewports) diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c index 103770abf..dbd669530 100644 --- a/src/backends/meta-monitor-manager.c +++ b/src/backends/meta-monitor-manager.c @@ -4019,7 +4019,7 @@ meta_monitor_manager_get_viewports (MetaMonitorManager *manager) GArray *views, *scales; GList *logical_monitors, *l; - views = g_array_new (FALSE, FALSE, sizeof (cairo_rectangle_int_t)); + views = g_array_new (FALSE, FALSE, sizeof (MtkRectangle)); scales = g_array_new (FALSE, FALSE, sizeof (float)); logical_monitors = meta_monitor_manager_get_logical_monitors (manager); @@ -4027,7 +4027,7 @@ meta_monitor_manager_get_viewports (MetaMonitorManager *manager) for (l = logical_monitors; l; l = l->next) { MetaLogicalMonitor *logical_monitor = l->data; - cairo_rectangle_int_t rect; + MtkRectangle rect; float scale; rect = logical_monitor->rect; @@ -4037,7 +4037,7 @@ meta_monitor_manager_get_viewports (MetaMonitorManager *manager) g_array_append_val (scales, scale); } - info = meta_viewport_info_new ((cairo_rectangle_int_t *) views->data, + info = meta_viewport_info_new ((MtkRectangle *) views->data, (float *) scales->data, views->len, meta_backend_is_stage_views_scaled (backend)); diff --git a/src/backends/meta-renderer-view.c b/src/backends/meta-renderer-view.c index 7ffe9e736..a456c3102 100644 --- a/src/backends/meta-renderer-view.c +++ b/src/backends/meta-renderer-view.c @@ -103,10 +103,10 @@ meta_renderer_view_setup_offscreen_blit_pipeline (ClutterStageView *view, static void meta_renderer_view_transform_rect_to_onscreen (ClutterStageView *view, - const cairo_rectangle_int_t *src_rect, + const MtkRectangle *src_rect, int dst_width, int dst_height, - cairo_rectangle_int_t *dst_rect) + MtkRectangle *dst_rect) { MetaRendererView *renderer_view = META_RENDERER_VIEW (view); MetaRendererViewPrivate *priv = diff --git a/src/backends/meta-screen-cast-monitor-stream-src.c b/src/backends/meta-screen-cast-monitor-stream-src.c index 772d1db43..cd1fd94ab 100644 --- a/src/backends/meta-screen-cast-monitor-stream-src.c +++ b/src/backends/meta-screen-cast-monitor-stream-src.c @@ -655,7 +655,7 @@ meta_screen_cast_monitor_stream_record_follow_up (MetaScreenCastStreamSrc *src) if (!meta_rectangle_overlap (&logical_monitor_layout, &view_layout)) continue; - damage = (cairo_rectangle_int_t) { + damage = (MtkRectangle) { .x = view_layout.x, .y = view_layout.y, .width = 1, diff --git a/src/backends/meta-screen-cast-stream-src.c b/src/backends/meta-screen-cast-stream-src.c index 598682883..39dd72da7 100644 --- a/src/backends/meta-screen-cast-stream-src.c +++ b/src/backends/meta-screen-cast-stream-src.c @@ -708,7 +708,7 @@ maybe_add_damaged_regions_metadata (MetaScreenCastStreamSrc *src, { spa_meta_for_each (meta_region, spa_meta_video_damage) { - cairo_rectangle_int_t rect; + MtkRectangle rect; cairo_region_get_rectangle (priv->redraw_clip, i, &rect); meta_region->region = SPA_REGION (rect.x, rect.y, diff --git a/src/backends/meta-stage-impl.c b/src/backends/meta-stage-impl.c index af88451d3..48d62c1bb 100644 --- a/src/backends/meta-stage-impl.c +++ b/src/backends/meta-stage-impl.c @@ -163,7 +163,7 @@ paint_damage_region (ClutterStageWindow *stage_window, n_rects = cairo_region_num_rectangles (swap_region); for (i = 0; i < n_rects; i++) { - cairo_rectangle_int_t rect; + MtkRectangle rect; float x_1, x_2, y_1, y_2; cairo_region_get_rectangle (swap_region, i, &rect); @@ -189,7 +189,7 @@ paint_damage_region (ClutterStageWindow *stage_window, n_rects = cairo_region_num_rectangles (queued_redraw_clip); for (i = 0; i < n_rects; i++) { - cairo_rectangle_int_t rect; + MtkRectangle rect; float x_1, x_2, y_1, y_2; cairo_region_get_rectangle (queued_redraw_clip, i, &rect); @@ -237,7 +237,7 @@ queue_damage_region (ClutterStageWindow *stage_window, for (i = 0; i < n_rects; i++) { - cairo_rectangle_int_t rect; + MtkRectangle rect; cairo_region_get_rectangle (damage_region, i, &rect); @@ -283,7 +283,7 @@ swap_framebuffer (ClutterStageWindow *stage_window, damage = g_newa (int, n_rects * 4); for (i = 0; i < n_rects; i++) { - cairo_rectangle_int_t rect; + MtkRectangle rect; cairo_region_get_rectangle (swap_region, i, &rect); damage[i * 4] = rect.x; @@ -346,8 +346,8 @@ offset_scale_and_clamp_region (const cairo_region_t *region, float scale) { int n_rects, i; - cairo_rectangle_int_t *rects; - g_autofree cairo_rectangle_int_t *freeme = NULL; + MtkRectangle *rects; + g_autofree MtkRectangle *freeme = NULL; n_rects = cairo_region_num_rectangles (region); @@ -355,13 +355,13 @@ offset_scale_and_clamp_region (const cairo_region_t *region, return cairo_region_create (); if (n_rects < MAX_STACK_RECTS) - rects = g_newa (cairo_rectangle_int_t, n_rects); + rects = g_newa (MtkRectangle, n_rects); else - rects = freeme = g_new (cairo_rectangle_int_t, n_rects); + rects = freeme = g_new (MtkRectangle, n_rects); for (i = 0; i < n_rects; i++) { - cairo_rectangle_int_t *rect = &rects[i]; + MtkRectangle *rect = &rects[i]; graphene_rect_t tmp; cairo_region_get_rectangle (region, i, rect); @@ -382,8 +382,8 @@ scale_offset_and_clamp_region (const cairo_region_t *region, int offset_y) { int n_rects, i; - cairo_rectangle_int_t *rects; - g_autofree cairo_rectangle_int_t *freeme = NULL; + MtkRectangle *rects; + g_autofree MtkRectangle *freeme = NULL; n_rects = cairo_region_num_rectangles (region); @@ -391,13 +391,13 @@ scale_offset_and_clamp_region (const cairo_region_t *region, return cairo_region_create (); if (n_rects < MAX_STACK_RECTS) - rects = g_newa (cairo_rectangle_int_t, n_rects); + rects = g_newa (MtkRectangle, n_rects); else - rects = freeme = g_new (cairo_rectangle_int_t, n_rects); + rects = freeme = g_new (MtkRectangle, n_rects); for (i = 0; i < n_rects; i++) { - cairo_rectangle_int_t *rect = &rects[i]; + MtkRectangle *rect = &rects[i]; graphene_rect_t tmp; cairo_region_get_rectangle (region, i, rect); @@ -431,7 +431,7 @@ transform_swap_region_to_onscreen (ClutterStageView *stage_view, { CoglFramebuffer *onscreen = clutter_stage_view_get_onscreen (stage_view); int n_rects, i; - cairo_rectangle_int_t *rects; + MtkRectangle *rects; cairo_region_t *transformed_region; int width, height; @@ -439,7 +439,7 @@ transform_swap_region_to_onscreen (ClutterStageView *stage_view, height = cogl_framebuffer_get_height (onscreen); n_rects = cairo_region_num_rectangles (swap_region); - rects = g_newa (cairo_rectangle_int_t, n_rects); + rects = g_newa (MtkRectangle, n_rects); for (i = 0; i < n_rects; i++) { cairo_region_get_rectangle (swap_region, i, &rects[i]); @@ -503,7 +503,7 @@ meta_stage_impl_redraw_view_primary (MetaStageImpl *stage_impl, MetaStageView *view = META_STAGE_VIEW (stage_view); CoglFramebuffer *fb = clutter_stage_view_get_framebuffer (stage_view); CoglFramebuffer *onscreen = clutter_stage_view_get_onscreen (stage_view); - cairo_rectangle_int_t view_rect; + MtkRectangle view_rect; gboolean is_full_redraw; gboolean use_clipped_redraw; gboolean buffer_has_valid_damage_history = FALSE; @@ -574,9 +574,9 @@ meta_stage_impl_redraw_view_primary (MetaStageImpl *stage_impl, } else { - cairo_rectangle_int_t fb_rect; + MtkRectangle fb_rect; - fb_rect = (cairo_rectangle_int_t) { + fb_rect = (MtkRectangle) { .width = fb_width, .height = fb_height, }; diff --git a/src/backends/meta-stage.c b/src/backends/meta-stage.c index 0de2b8997..a816aff45 100644 --- a/src/backends/meta-stage.c +++ b/src/backends/meta-stage.c @@ -371,7 +371,7 @@ queue_redraw_clutter_rect (MetaStage *stage, MetaOverlay *overlay, graphene_rect_t *rect) { - cairo_rectangle_int_t clip = { + MtkRectangle clip = { .x = floorf (rect->origin.x), .y = floorf (rect->origin.y), .width = ceilf (rect->size.width), @@ -389,8 +389,8 @@ queue_redraw_clutter_rect (MetaStage *stage, l = l->next) { ClutterStageView *view = l->data; - cairo_rectangle_int_t view_layout; - cairo_rectangle_int_t view_clip; + MtkRectangle view_layout; + MtkRectangle view_clip; if (clutter_stage_view_get_default_paint_flags (view) & CLUTTER_PAINT_FLAG_NO_CURSORS) diff --git a/src/backends/meta-viewport-info.c b/src/backends/meta-viewport-info.c index ded2ac4e2..c502cedc9 100644 --- a/src/backends/meta-viewport-info.c +++ b/src/backends/meta-viewport-info.c @@ -65,7 +65,7 @@ meta_viewport_info_init (MetaViewportInfo *info) } MetaViewportInfo * -meta_viewport_info_new (cairo_rectangle_int_t *views, +meta_viewport_info_new (MtkRectangle *views, float *scales, int n_views, gboolean is_views_scaled) @@ -110,7 +110,7 @@ meta_viewport_info_get_view_at (MetaViewportInfo *viewport_info, gboolean meta_viewport_info_get_view_info (MetaViewportInfo *viewport_info, int idx, - cairo_rectangle_int_t *rect, + MtkRectangle *rect, float *scale) { ViewInfo *info; @@ -128,8 +128,8 @@ meta_viewport_info_get_view_info (MetaViewportInfo *viewport_info, } static gboolean -view_has_neighbor (cairo_rectangle_int_t *view, - cairo_rectangle_int_t *neighbor, +view_has_neighbor (MtkRectangle *view, + MtkRectangle *neighbor, MetaDisplayDirection neighbor_direction) { switch (neighbor_direction) @@ -164,7 +164,7 @@ meta_viewport_info_get_neighbor (MetaViewportInfo *viewport_info, int idx, MetaDisplayDirection direction) { - cairo_rectangle_int_t rect; + MtkRectangle rect; int i; if (!meta_viewport_info_get_view_info (viewport_info, idx, &rect, NULL)) diff --git a/src/backends/meta-viewport-info.h b/src/backends/meta-viewport-info.h index 8c73b28d8..72bf6a426 100644 --- a/src/backends/meta-viewport-info.h +++ b/src/backends/meta-viewport-info.h @@ -20,16 +20,16 @@ #pragma once -#include #include #include "meta/display.h" +#include "mtk/mtk.h" #define META_TYPE_VIEWPORT_INFO (meta_viewport_info_get_type ()) G_DECLARE_FINAL_TYPE (MetaViewportInfo, meta_viewport_info, META, VIEWPORT_INFO, GObject) -MetaViewportInfo * meta_viewport_info_new (cairo_rectangle_int_t *views, +MetaViewportInfo * meta_viewport_info_new (MtkRectangle *views, float *scales, int n_views, gboolean is_views_scaled); @@ -40,7 +40,7 @@ int meta_viewport_info_get_view_at (MetaViewportInfo *info, gboolean meta_viewport_info_get_view_info (MetaViewportInfo *viewport_info, int idx, - cairo_rectangle_int_t *rect, + MtkRectangle *rect, float *scale); int meta_viewport_info_get_neighbor (MetaViewportInfo *info, diff --git a/src/backends/native/meta-pointer-constraint-native.c b/src/backends/native/meta-pointer-constraint-native.c index 8c4b840d0..8f18b54e4 100644 --- a/src/backends/native/meta-pointer-constraint-native.c +++ b/src/backends/native/meta-pointer-constraint-native.c @@ -253,7 +253,7 @@ region_to_outline (cairo_region_t *region, boxes = g_new (MetaBox, num_boxes); for (i = 0; i < num_boxes; i++) { - cairo_rectangle_int_t rect; + MtkRectangle rect; cairo_region_get_rectangle (region, i, &rect); boxes[i] = (MetaBox) { .x1 = rect.x, diff --git a/src/backends/native/meta-seat-impl.c b/src/backends/native/meta-seat-impl.c index dcd699732..f059efe0e 100644 --- a/src/backends/native/meta-seat-impl.c +++ b/src/backends/native/meta-seat-impl.c @@ -1124,7 +1124,7 @@ constrain_all_screen_monitors (ClutterInputDevice *device, for (i = 0; i < n_views; i++) { int left, right, top, bottom; - cairo_rectangle_int_t rect; + MtkRectangle rect; meta_viewport_info_get_view_info (viewports, i, &rect, NULL); @@ -1214,7 +1214,7 @@ relative_motion_across_outputs (MetaViewportInfo *viewports, MetaLine2 left, right, top, bottom, motion; MetaVector2 intersection; MetaDisplayDirection direction; - cairo_rectangle_int_t rect; + MtkRectangle rect; float scale; meta_viewport_info_get_view_info (viewports, cur_view, &rect, &scale); @@ -3664,7 +3664,7 @@ ensure_pointer_onscreen (MetaSeatImpl *seat_impl) { int i, candidate = -1; int nearest_monitor_x, nearest_monitor_y, min_distance = G_MAXINT; - cairo_rectangle_int_t monitor_rect; + MtkRectangle monitor_rect; graphene_point_t coords; if (!meta_seat_impl_query_state (seat_impl, diff --git a/src/backends/native/meta-stage-native.c b/src/backends/native/meta-stage-native.c index ea88efad2..6e60b6319 100644 --- a/src/backends/native/meta-stage-native.c +++ b/src/backends/native/meta-stage-native.c @@ -74,7 +74,7 @@ meta_stage_native_can_clip_redraws (ClutterStageWindow *stage_window) static void meta_stage_native_get_geometry (ClutterStageWindow *stage_window, - cairo_rectangle_int_t *geometry) + MtkRectangle *geometry) { MetaStageImpl *stage_impl = META_STAGE_IMPL (stage_window); MetaBackend *backend = meta_stage_impl_get_backend (stage_impl); @@ -86,14 +86,14 @@ meta_stage_native_get_geometry (ClutterStageWindow *stage_window, int width, height; meta_monitor_manager_get_screen_size (monitor_manager, &width, &height); - *geometry = (cairo_rectangle_int_t) { + *geometry = (MtkRectangle) { .width = width, .height = height, }; } else { - *geometry = (cairo_rectangle_int_t) { + *geometry = (MtkRectangle) { .width = 1, .height = 1, }; diff --git a/src/backends/x11/cm/meta-renderer-x11-cm.c b/src/backends/x11/cm/meta-renderer-x11-cm.c index 2dcbb0550..c69447f93 100644 --- a/src/backends/x11/cm/meta-renderer-x11-cm.c +++ b/src/backends/x11/cm/meta-renderer-x11-cm.c @@ -43,11 +43,11 @@ meta_renderer_x11_cm_init_screen_view (MetaRendererX11Cm *renderer_x11_cm, MetaRenderer *renderer = META_RENDERER (renderer_x11_cm); MetaBackend *backend = meta_renderer_get_backend (renderer); ClutterActor *stage = meta_backend_get_stage (backend); - cairo_rectangle_int_t view_layout; + MtkRectangle view_layout; g_return_if_fail (!renderer_x11_cm->screen_view); - view_layout = (cairo_rectangle_int_t) { + view_layout = (MtkRectangle) { .width = width, .height = height, }; @@ -66,9 +66,9 @@ meta_renderer_x11_cm_resize (MetaRendererX11Cm *renderer_x11_cm, int width, int height) { - cairo_rectangle_int_t view_layout; + MtkRectangle view_layout; - view_layout = (cairo_rectangle_int_t) { + view_layout = (MtkRectangle) { .width = width, .height = height, }; diff --git a/src/backends/x11/meta-stage-x11.c b/src/backends/x11/meta-stage-x11.c index 60375201f..3956aeeb8 100644 --- a/src/backends/x11/meta-stage-x11.c +++ b/src/backends/x11/meta-stage-x11.c @@ -137,7 +137,7 @@ meta_stage_x11_set_wm_protocols (MetaStageX11 *stage_x11) static void meta_stage_x11_get_geometry (ClutterStageWindow *stage_window, - cairo_rectangle_int_t *geometry) + MtkRectangle *geometry) { MetaStageX11 *stage_x11 = META_STAGE_X11 (stage_window); @@ -765,7 +765,7 @@ meta_stage_x11_handle_event (MetaStageX11 *stage_x11, case Expose: { XExposeEvent *expose = (XExposeEvent *) xevent; - cairo_rectangle_int_t clip; + MtkRectangle clip; g_debug ("expose for stage: win:0x%x - " "redrawing area (x: %d, y: %d, width: %d, height: %d)", diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c index 69cc2b782..d8595858a 100644 --- a/src/compositor/compositor.c +++ b/src/compositor/compositor.c @@ -1023,11 +1023,11 @@ meta_compositor_real_before_paint (MetaCompositor *compositor, meta_compositor_get_instance_private (compositor); ClutterActor *stage = meta_backend_get_stage (priv->backend); ClutterStageView *stage_view; - cairo_rectangle_int_t stage_rect; + MtkRectangle stage_rect; cairo_region_t *unobscured_region; GList *l; - stage_rect = (cairo_rectangle_int_t) { + stage_rect = (MtkRectangle) { 0, 0, clutter_actor_get_width (stage), clutter_actor_get_height (stage), diff --git a/src/compositor/meta-background-content.c b/src/compositor/meta-background-content.c index 297cc1372..6f4137630 100644 --- a/src/compositor/meta-background-content.c +++ b/src/compositor/meta-background-content.c @@ -229,7 +229,7 @@ struct _MetaBackgroundContent ChangedFlags changed; CoglPipeline *pipeline; PipelineFlags pipeline_flags; - cairo_rectangle_int_t texture_area; + MtkRectangle texture_area; int texture_width, texture_height; cairo_region_t *clip_region; @@ -389,7 +389,7 @@ static void setup_pipeline (MetaBackgroundContent *self, ClutterActor *actor, ClutterPaintContext *paint_context, - cairo_rectangle_int_t *actor_pixel_rect) + MtkRectangle *actor_pixel_rect) { MetaContext *context = meta_display_get_context (self->display); MetaBackend *backend = meta_context_get_backend (context); @@ -566,7 +566,7 @@ setup_pipeline (MetaBackgroundContent *self, static void set_glsl_parameters (MetaBackgroundContent *self, - cairo_rectangle_int_t *actor_pixel_rect) + MtkRectangle *actor_pixel_rect) { MetaContext *context = meta_display_get_context (self->display); MetaBackend *backend = meta_context_get_backend (context); @@ -616,7 +616,7 @@ static void paint_clipped_rectangle (MetaBackgroundContent *self, ClutterPaintNode *node, ClutterActorBox *actor_box, - cairo_rectangle_int_t *rect) + MtkRectangle *rect) { g_autoptr (ClutterPaintNode) pipeline_node = NULL; float h_scale, v_scale; @@ -659,8 +659,8 @@ meta_background_content_paint_content (ClutterContent *content, { MetaBackgroundContent *self = META_BACKGROUND_CONTENT (content); ClutterActorBox actor_box; - cairo_rectangle_int_t rect_within_actor; - cairo_rectangle_int_t rect_within_stage; + MtkRectangle rect_within_actor; + MtkRectangle rect_within_stage; cairo_region_t *region; int i, n_rects; float transformed_x, transformed_y, transformed_width, transformed_height; @@ -758,14 +758,14 @@ meta_background_content_paint_content (ClutterContent *content, { for (i = 0; i < n_rects; i++) { - cairo_rectangle_int_t rect; + MtkRectangle rect; cairo_region_get_rectangle (region, i, &rect); paint_clipped_rectangle (self, node, &actor_box, &rect); } } else { - cairo_rectangle_int_t rect; + MtkRectangle rect; cairo_region_get_extents (region, &rect); paint_clipped_rectangle (self, node, &actor_box, &rect); } diff --git a/src/compositor/meta-background-private.h b/src/compositor/meta-background-private.h index 0ba655fa3..dca3a5d94 100644 --- a/src/compositor/meta-background-private.h +++ b/src/compositor/meta-background-private.h @@ -5,7 +5,7 @@ #include "cogl/cogl.h" #include "meta/meta-background.h" -CoglTexture *meta_background_get_texture (MetaBackground *self, - int monitor_index, - cairo_rectangle_int_t *texture_area, - CoglPipelineWrapMode *wrap_mode); +CoglTexture * meta_background_get_texture (MetaBackground *self, + int monitor_index, + MtkRectangle *texture_area, + CoglPipelineWrapMode *wrap_mode); diff --git a/src/compositor/meta-background.c b/src/compositor/meta-background.c index 77e0cb800..5ddd3977e 100644 --- a/src/compositor/meta-background.c +++ b/src/compositor/meta-background.c @@ -369,8 +369,8 @@ meta_background_init (MetaBackground *self) } static void -set_texture_area_from_monitor_area (cairo_rectangle_int_t *monitor_area, - cairo_rectangle_int_t *texture_area) +set_texture_area_from_monitor_area (MtkRectangle *monitor_area, + MtkRectangle *texture_area) { texture_area->x = 0; texture_area->y = 0; @@ -380,12 +380,12 @@ set_texture_area_from_monitor_area (cairo_rectangle_int_t *monitor_area, static void get_texture_area (MetaBackground *self, - cairo_rectangle_int_t *monitor_rect, + MtkRectangle *monitor_rect, float monitor_scale, CoglTexture *texture, - cairo_rectangle_int_t *texture_area) + MtkRectangle *texture_area) { - cairo_rectangle_int_t image_area; + MtkRectangle image_area; int screen_width, screen_height; float texture_width, texture_height; float monitor_x_scale, monitor_y_scale; @@ -493,10 +493,10 @@ draw_texture (MetaBackground *self, CoglFramebuffer *framebuffer, CoglPipeline *pipeline, CoglTexture *texture, - cairo_rectangle_int_t *monitor_area, + MtkRectangle *monitor_area, float monitor_scale) { - cairo_rectangle_int_t texture_area; + MtkRectangle texture_area; gboolean bare_region_visible; get_texture_area (self, monitor_area, monitor_scale, texture, &texture_area); @@ -531,7 +531,7 @@ draw_texture (MetaBackground *self, texture_area.x + texture_area.width, texture_area.y + texture_area.height, 0, 0, 1.0, 1.0); - bare_region_visible = texture_has_alpha (texture) || memcmp (&texture_area, monitor_area, sizeof (cairo_rectangle_int_t)) != 0; + bare_region_visible = texture_has_alpha (texture) || memcmp (&texture_area, monitor_area, sizeof (MtkRectangle)) != 0; break; case G_DESKTOP_BACKGROUND_STYLE_NONE: bare_region_visible = TRUE; @@ -752,12 +752,12 @@ get_best_mipmap_level (CoglTexture *texture, CoglTexture * meta_background_get_texture (MetaBackground *self, int monitor_index, - cairo_rectangle_int_t *texture_area, + MtkRectangle *texture_area, CoglPipelineWrapMode *wrap_mode) { MetaBackgroundMonitor *monitor; MetaRectangle geometry; - cairo_rectangle_int_t monitor_area; + MtkRectangle monitor_area; CoglTexture *texture1, *texture2; float monitor_scale; diff --git a/src/compositor/meta-shadow-factory.c b/src/compositor/meta-shadow-factory.c index ebb548536..5122e2db3 100644 --- a/src/compositor/meta-shadow-factory.c +++ b/src/compositor/meta-shadow-factory.c @@ -270,7 +270,7 @@ meta_shadow_paint (MetaShadow *shadow, for (j = 0; j < n_y; j++) { - cairo_rectangle_int_t dest_rect; + MtkRectangle dest_rect; dest_rect.y = dest_y[j]; dest_rect.height = dest_y[j + 1] - dest_y[j]; @@ -322,7 +322,7 @@ meta_shadow_paint (MetaShadow *shadow, n_rectangles = cairo_region_num_rectangles (intersection); for (k = 0; k < n_rectangles; k++) { - cairo_rectangle_int_t rect; + MtkRectangle rect; float src_x1, src_x2, src_y1, src_y2; cairo_region_get_rectangle (intersection, k, &rect); @@ -370,7 +370,7 @@ meta_shadow_get_bounds (MetaShadow *shadow, int window_y, int window_width, int window_height, - cairo_rectangle_int_t *bounds) + MtkRectangle *bounds) { bounds->x = window_x - shadow->outer_border_left; bounds->y = window_y - shadow->outer_border_top; @@ -582,7 +582,7 @@ blur_rows (cairo_region_t *convolve_region, n_rectangles = cairo_region_num_rectangles (convolve_region); for (i = 0; i < n_rectangles; i++) { - cairo_rectangle_int_t rect; + MtkRectangle rect; cairo_region_get_rectangle (convolve_region, i, &rect); @@ -710,7 +710,7 @@ make_shadow (MetaShadow *shadow, GError *error = NULL; int d = get_box_filter_size (shadow->key.radius); int spread = get_shadow_spread (shadow->key.radius); - cairo_rectangle_int_t extents; + MtkRectangle extents; cairo_region_t *row_convolve_region; cairo_region_t *column_convolve_region; guchar *buffer; @@ -763,7 +763,7 @@ make_shadow (MetaShadow *shadow, n_rectangles = cairo_region_num_rectangles (region); for (k = 0; k < n_rectangles; k++) { - cairo_rectangle_int_t rect; + MtkRectangle rect; cairo_region_get_rectangle (region, k, &rect); for (j = y_offset + rect.y; j < y_offset + rect.y + rect.height; j++) diff --git a/src/compositor/meta-shaped-texture-private.h b/src/compositor/meta-shaped-texture-private.h index 620c72967..48e2bc676 100644 --- a/src/compositor/meta-shaped-texture-private.h +++ b/src/compositor/meta-shaped-texture-private.h @@ -58,7 +58,7 @@ gboolean meta_shaped_texture_update_area (MetaShapedTexture *stex, int y, int width, int height, - cairo_rectangle_int_t *clip); + MtkRectangle *clip); int meta_shaped_texture_get_width (MetaShapedTexture *stex); int meta_shaped_texture_get_height (MetaShapedTexture *stex); diff --git a/src/compositor/meta-shaped-texture.c b/src/compositor/meta-shaped-texture.c index 14367cf30..a6bbd0741 100644 --- a/src/compositor/meta-shaped-texture.c +++ b/src/compositor/meta-shaped-texture.c @@ -528,7 +528,7 @@ static void paint_clipped_rectangle_node (MetaShapedTexture *stex, ClutterPaintNode *root_node, CoglPipeline *pipeline, - cairo_rectangle_int_t *rect, + MtkRectangle *rect, ClutterActorBox *alloc) { g_autoptr (ClutterPaintNode) node = NULL; @@ -625,7 +625,7 @@ do_paint_content (MetaShapedTexture *stex, uint8_t opacity) { int dst_width, dst_height; - cairo_rectangle_int_t content_rect; + MtkRectangle content_rect; gboolean use_opaque_region; cairo_region_t *blended_tex_region; CoglContext *ctx; @@ -645,7 +645,7 @@ do_paint_content (MetaShapedTexture *stex, if (dst_width == 0 || dst_height == 0) /* no contents yet */ return; - content_rect = (cairo_rectangle_int_t) { + content_rect = (MtkRectangle) { .x = 0, .y = 0, .width = dst_width, @@ -777,7 +777,7 @@ do_paint_content (MetaShapedTexture *stex, n_rects = cairo_region_num_rectangles (region); for (i = 0; i < n_rects; i++) { - cairo_rectangle_int_t rect; + MtkRectangle rect; cairo_region_get_rectangle (region, i, &rect); paint_clipped_rectangle_node (stex, root_node, opaque_pipeline, @@ -844,7 +844,7 @@ do_paint_content (MetaShapedTexture *stex, for (i = 0; i < n_rects; i++) { - cairo_rectangle_int_t rect; + MtkRectangle rect; cairo_region_get_rectangle (blended_tex_region, i, &rect); if (!meta_rectangle_intersect (&content_rect, &rect, &rect)) @@ -1011,10 +1011,10 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex, int y, int width, int height, - cairo_rectangle_int_t *clip) + MtkRectangle *clip) { MetaMonitorTransform inverted_transform; - cairo_rectangle_int_t buffer_rect; + MtkRectangle buffer_rect; int scaled_and_transformed_width; int scaled_and_transformed_height; @@ -1022,14 +1022,14 @@ meta_shaped_texture_update_area (MetaShapedTexture *stex, return FALSE; /* Pad the actor clip to ensure that pixels affected by linear scaling are accounted for */ - *clip = (cairo_rectangle_int_t) { + *clip = (MtkRectangle) { .x = x - 1, .y = y - 1, .width = width + 2, .height = height + 2 }; - buffer_rect = (cairo_rectangle_int_t) { + buffer_rect = (MtkRectangle) { .x = 0, .y = 0, .width = stex->tex_width, @@ -1236,7 +1236,7 @@ gboolean meta_shaped_texture_is_opaque (MetaShapedTexture *stex) { MetaMultiTexture *multi_texture; - cairo_rectangle_int_t opaque_rect; + MtkRectangle opaque_rect; multi_texture = stex->texture; if (!multi_texture) @@ -1417,9 +1417,9 @@ meta_shaped_texture_should_get_via_offscreen (MetaShapedTexture *stex) */ cairo_surface_t * meta_shaped_texture_get_image (MetaShapedTexture *stex, - cairo_rectangle_int_t *clip) + MtkRectangle *clip) { - cairo_rectangle_int_t *image_clip = NULL; + MtkRectangle *image_clip = NULL; CoglTexture *texture; CoglContext *cogl_context = clutter_backend_get_cogl_context (clutter_get_default_backend ()); @@ -1440,10 +1440,10 @@ meta_shaped_texture_get_image (MetaShapedTexture *stex, if (clip != NULL) { - cairo_rectangle_int_t dst_rect; + MtkRectangle dst_rect; - image_clip = alloca (sizeof (cairo_rectangle_int_t)); - dst_rect = (cairo_rectangle_int_t) { + image_clip = alloca (sizeof (MtkRectangle)); + dst_rect = (MtkRectangle) { .width = stex->dst_width, .height = stex->dst_height, }; diff --git a/src/compositor/meta-surface-actor.c b/src/compositor/meta-surface-actor.c index a1ffdbe9c..3dc3a5481 100644 --- a/src/compositor/meta-surface-actor.c +++ b/src/compositor/meta-surface-actor.c @@ -128,13 +128,13 @@ set_unobscured_region (MetaSurfaceActor *surface_actor, } else { - cairo_rectangle_int_t bounds = { 0, }; + MtkRectangle bounds = { 0, }; float width, height; clutter_content_get_preferred_size (CLUTTER_CONTENT (priv->texture), &width, &height); - bounds = (cairo_rectangle_int_t) { + bounds = (MtkRectangle) { .width = width, .height = height, }; @@ -201,7 +201,7 @@ meta_surface_actor_pick (ClutterActor *actor, for (i = 0; i < n_rects; i++) { - cairo_rectangle_int_t rect; + MtkRectangle rect; ClutterActorBox box; cairo_region_get_rectangle (priv->input_region, i, &rect); @@ -400,7 +400,7 @@ meta_surface_actor_update_area (MetaSurfaceActor *self, MetaSurfaceActorPrivate *priv = meta_surface_actor_get_instance_private (self); gboolean repaint_scheduled = FALSE; - cairo_rectangle_int_t clip; + MtkRectangle clip; if (meta_shaped_texture_update_area (priv->texture, x, y, width, height, &clip)) { @@ -425,7 +425,7 @@ meta_surface_actor_update_area (MetaSurfaceActor *self, n_rectangles = cairo_region_num_rectangles (intersection); for (i = 0; i < n_rectangles; i++) { - cairo_rectangle_int_t rect; + MtkRectangle rect; cairo_region_get_rectangle (intersection, i, &rect); clutter_actor_queue_redraw_with_clip (CLUTTER_ACTOR (self), &rect); @@ -483,7 +483,7 @@ meta_surface_actor_is_obscured_on_stage_view (MetaSurfaceActor *self, meta_surface_actor_get_instance_private (self); ClutterActor *stage = clutter_actor_get_stage (CLUTTER_ACTOR (self)); cairo_region_t *intersection_region; - cairo_rectangle_int_t stage_rect; + MtkRectangle stage_rect; graphene_matrix_t transform; graphene_rect_t actor_bounds; float bounds_width, bounds_height; @@ -526,7 +526,7 @@ meta_surface_actor_is_obscured_on_stage_view (MetaSurfaceActor *self, n_rects = cairo_region_num_rectangles (intersection_region); for (i = 0; i < n_rects; i++) { - cairo_rectangle_int_t rect; + MtkRectangle rect; cairo_region_get_rectangle (intersection_region, i, &rect); intersection_size += rect.width * rect.height; @@ -600,7 +600,7 @@ meta_surface_actor_process_damage (MetaSurfaceActor *self, * any drawing done to the window is always immediately reflected in the * texture regardless of damage event handling. */ - cairo_rectangle_int_t rect = { .x = x, .y = y, .width = width, .height = height }; + MtkRectangle rect = { .x = x, .y = y, .width = width, .height = height }; if (!priv->pending_damage) priv->pending_damage = cairo_region_create_rectangle (&rect); @@ -627,7 +627,7 @@ meta_surface_actor_set_frozen (MetaSurfaceActor *self, if (!frozen && priv->pending_damage) { int i, n_rects = cairo_region_num_rectangles (priv->pending_damage); - cairo_rectangle_int_t rect; + MtkRectangle rect; /* Since we ignore damage events while a window is frozen for certain effects * we need to apply the tracked damage now. */ diff --git a/src/compositor/meta-window-actor-wayland.c b/src/compositor/meta-window-actor-wayland.c index 61e0b9f9d..755366581 100644 --- a/src/compositor/meta-window-actor-wayland.c +++ b/src/compositor/meta-window-actor-wayland.c @@ -278,10 +278,10 @@ calculate_background_cull_region (MetaWindowActorWayland *self) { MetaWindowActor *window_actor = META_WINDOW_ACTOR (self); int geometry_scale; - cairo_rectangle_int_t rect; + MtkRectangle rect; geometry_scale = meta_window_actor_get_geometry_scale (window_actor); - rect = (cairo_rectangle_int_t) { + rect = (MtkRectangle) { .x = 0, .y = 0, .width = clutter_actor_get_width (self->background) * geometry_scale, diff --git a/src/compositor/meta-window-actor-x11.c b/src/compositor/meta-window-actor-x11.c index e8f91fe1b..19bd41f59 100644 --- a/src/compositor/meta-window-actor-x11.c +++ b/src/compositor/meta-window-actor-x11.c @@ -521,7 +521,7 @@ get_shadow_params (MetaWindowActorX11 *actor_x11, static void get_shape_bounds (MetaWindowActorX11 *actor_x11, - cairo_rectangle_int_t *bounds) + MtkRectangle *bounds) { cairo_region_get_extents (actor_x11->shape_region, bounds); } @@ -529,10 +529,10 @@ get_shape_bounds (MetaWindowActorX11 *actor_x11, static void get_shadow_bounds (MetaWindowActorX11 *actor_x11, gboolean appears_focused, - cairo_rectangle_int_t *bounds) + MtkRectangle *bounds) { MetaShadow *shadow; - cairo_rectangle_int_t shape_bounds; + MtkRectangle shape_bounds; MetaShadowParams params; shadow = appears_focused ? actor_x11->focused_shadow @@ -662,7 +662,7 @@ check_needs_shadow (MetaWindowActorX11 *actor_x11) { MetaShadowFactory *factory = actor_x11->shadow_factory; const char *shadow_class = get_shadow_class (actor_x11); - cairo_rectangle_int_t shape_bounds; + MtkRectangle shape_bounds; if (!actor_x11->shadow_shape) { @@ -712,7 +712,7 @@ scan_visible_region (guchar *mask_data, for (i = 0; i < n_rects; i++) { int x, y; - cairo_rectangle_int_t rect; + MtkRectangle rect; cairo_region_get_rectangle (scan_area, i, &rect); @@ -739,11 +739,11 @@ scan_visible_region (guchar *mask_data, static void get_client_area_rect_from_texture (MetaWindowActorX11 *actor_x11, MetaShapedTexture *shaped_texture, - cairo_rectangle_int_t *client_area) + MtkRectangle *client_area) { MetaWindow *window = meta_window_actor_get_meta_window (META_WINDOW_ACTOR (actor_x11)); - cairo_rectangle_int_t surface_rect = { 0 }; + MtkRectangle surface_rect = { 0 }; surface_rect.width = meta_shaped_texture_get_width (shaped_texture); surface_rect.height = meta_shaped_texture_get_height (shaped_texture); @@ -754,7 +754,7 @@ get_client_area_rect_from_texture (MetaWindowActorX11 *actor_x11, static void get_client_area_rect (MetaWindowActorX11 *actor_x11, - cairo_rectangle_int_t *client_area) + MtkRectangle *client_area) { MetaSurfaceActor *surface = meta_window_actor_get_surface (META_WINDOW_ACTOR (actor_x11)); @@ -816,9 +816,9 @@ build_and_scan_frame_mask (MetaWindowActorX11 *actor_x11, if (window->frame) { cairo_region_t *frame_paint_region, *scanned_region; - cairo_rectangle_int_t rect = { 0, 0, tex_width, tex_height }; - cairo_rectangle_int_t client_area; - cairo_rectangle_int_t frame_rect; + MtkRectangle rect = { 0, 0, tex_width, tex_height }; + MtkRectangle client_area; + MtkRectangle frame_rect; /* If we update the shape regardless of the frozen state of the actor, * as with Xwayland to avoid the black shadow effect, we ought to base @@ -898,7 +898,7 @@ update_shape_region (MetaWindowActorX11 *actor_x11) MetaWindow *window = meta_window_actor_get_meta_window (META_WINDOW_ACTOR (actor_x11)); cairo_region_t *region = NULL; - cairo_rectangle_int_t client_area; + MtkRectangle client_area; get_client_area_rect (actor_x11, &client_area); @@ -941,7 +941,7 @@ update_input_region (MetaWindowActorX11 *actor_x11) if (window->shape_region && window->input_region) { - cairo_rectangle_int_t client_area; + MtkRectangle client_area; cairo_region_t *frames_input; cairo_region_t *client_input; @@ -960,7 +960,7 @@ update_input_region (MetaWindowActorX11 *actor_x11) } else if (window->shape_region) { - cairo_rectangle_int_t client_area; + MtkRectangle client_area; meta_window_get_client_area_rect (window, &client_area); @@ -1015,7 +1015,7 @@ update_opaque_region (MetaWindowActorX11 *actor_x11) (window->opaque_region || (window->frame && window->frame->opaque_region))) { - cairo_rectangle_int_t client_area; + MtkRectangle client_area; if (window->frame && window->frame->opaque_region) opaque_region = cairo_region_copy (window->frame->opaque_region); @@ -1212,7 +1212,7 @@ meta_window_actor_x11_paint (ClutterActor *actor, if (shadow) { MetaShadowParams params; - cairo_rectangle_int_t shape_bounds; + MtkRectangle shape_bounds; cairo_region_t *clip = actor_x11->shadow_clip; CoglFramebuffer *framebuffer; @@ -1224,7 +1224,7 @@ meta_window_actor_x11_paint (ClutterActor *actor, */ if (!clip && clip_shadow_under_window (actor_x11)) { - cairo_rectangle_int_t bounds; + MtkRectangle bounds; get_shadow_bounds (actor_x11, appears_focused, &bounds); clip = cairo_region_create_rectangle (&bounds); @@ -1321,7 +1321,7 @@ meta_window_actor_x11_get_paint_volume (ClutterActor *actor, appears_focused = meta_window_appears_focused (window); if (appears_focused ? actor_x11->focused_shadow : actor_x11->unfocused_shadow) { - cairo_rectangle_int_t shadow_bounds; + MtkRectangle shadow_bounds; ClutterActorBox shadow_box; /* We could compute an full clip region as we do for the window diff --git a/src/compositor/meta-window-shape.c b/src/compositor/meta-window-shape.c index 3bb6409c4..fc6e74d3c 100644 --- a/src/compositor/meta-window-shape.c +++ b/src/compositor/meta-window-shape.c @@ -35,7 +35,7 @@ struct _MetaWindowShape int top, right, bottom, left; int n_rectangles; - cairo_rectangle_int_t *rectangles; + MtkRectangle *rectangles; guint hash; }; @@ -44,7 +44,7 @@ meta_window_shape_new (cairo_region_t *region) { MetaWindowShape *shape; MetaRegionIterator iter; - cairo_rectangle_int_t extents; + MtkRectangle extents; int max_yspan_y1 = 0; int max_yspan_y2 = 0; int max_xspan_x1 = -1; @@ -114,7 +114,7 @@ meta_window_shape_new (cairo_region_t *region) shape->bottom = extents.y + extents.height - max_yspan_y2; shape->left = max_xspan_x1 - extents.x; - shape->rectangles = g_new (cairo_rectangle_int_t, shape->n_rectangles); + shape->rectangles = g_new (MtkRectangle, shape->n_rectangles); hash = 0; for (meta_region_iterator_init (&iter, region); @@ -194,7 +194,7 @@ meta_window_shape_equal (MetaWindowShape *shape_a, return FALSE; return memcmp (shape_a->rectangles, shape_b->rectangles, - sizeof (cairo_rectangle_int_t) * shape_a->n_rectangles) == 0; + sizeof (MtkRectangle) * shape_a->n_rectangles) == 0; } void @@ -237,7 +237,7 @@ meta_window_shape_to_region (MetaWindowShape *shape, for (i = 0; i < shape->n_rectangles; i++) { - cairo_rectangle_int_t rect = shape->rectangles[i]; + MtkRectangle rect = shape->rectangles[i]; if (rect.x <= shape->left && rect.x + rect.width >= shape->left + 1) rect.width += center_width; diff --git a/src/compositor/region-utils.c b/src/compositor/region-utils.c index 49ef2150c..2798276fd 100644 --- a/src/compositor/region-utils.c +++ b/src/compositor/region-utils.c @@ -29,11 +29,11 @@ #define META_REGION_MAX_STACK_RECTS 256 #define META_REGION_CREATE_RECTANGLE_ARRAY_SCOPED(n_rects, rects) \ - g_autofree cairo_rectangle_int_t *G_PASTE(__n, __LINE__) = NULL; \ + g_autofree MtkRectangle *G_PASTE(__n, __LINE__) = NULL; \ if (n_rects < META_REGION_MAX_STACK_RECTS) \ - rects = g_newa (cairo_rectangle_int_t, n_rects); \ + rects = g_newa (MtkRectangle, n_rects); \ else \ - rects = G_PASTE(__n, __LINE__) = g_new (cairo_rectangle_int_t, n_rects); + rects = G_PASTE(__n, __LINE__) = g_new (MtkRectangle, n_rects); /* MetaRegionBuilder */ @@ -71,7 +71,7 @@ meta_region_builder_add_rectangle (MetaRegionBuilder *builder, int width, int height) { - cairo_rectangle_int_t rect; + MtkRectangle rect; int i; if (builder->levels[0] == NULL) @@ -189,7 +189,7 @@ cairo_region_t * meta_region_scale (cairo_region_t *region, int scale) { int n_rects, i; - cairo_rectangle_int_t *rects; + MtkRectangle *rects; cairo_region_t *scaled_region; if (scale == 1) @@ -246,7 +246,7 @@ expand_region (cairo_region_t *region, n = cairo_region_num_rectangles (region); for (i = 0; i < n; i++) { - cairo_rectangle_int_t rect; + MtkRectangle rect; cairo_region_get_rectangle (region, i, &rect); add_expanded_rect (&builder, @@ -267,7 +267,7 @@ expand_region_inverse (cairo_region_t *region, { MetaRegionBuilder builder; MetaRegionIterator iter; - cairo_rectangle_int_t extents; + MtkRectangle extents; int last_x; @@ -356,7 +356,7 @@ meta_region_transform (const cairo_region_t *region, int height) { int n_rects, i; - cairo_rectangle_int_t *rects; + MtkRectangle *rects; cairo_region_t *transformed_region; if (transform == META_MONITOR_TRANSFORM_NORMAL) @@ -387,7 +387,7 @@ meta_region_crop_and_scale (cairo_region_t *region, int dst_height) { int n_rects, i; - cairo_rectangle_int_t *rects; + MtkRectangle *rects; cairo_region_t *viewport_region; if (G_APPROX_VALUE (src_rect->size.width, dst_width, FLT_EPSILON) && @@ -432,7 +432,7 @@ void meta_region_to_cairo_path (cairo_region_t *region, cairo_t *cr) { - cairo_rectangle_int_t rect; + MtkRectangle rect; int n_rects, i; n_rects = cairo_region_num_rectangles (region); @@ -449,7 +449,7 @@ meta_region_apply_matrix_transform_expand (const cairo_region_t *region, graphene_matrix_t *transform) { int n_rects, i; - cairo_rectangle_int_t *rects; + MtkRectangle *rects; cairo_region_t *transformed_region; if (graphene_matrix_is_identity (transform)) @@ -460,7 +460,7 @@ meta_region_apply_matrix_transform_expand (const cairo_region_t *region, for (i = 0; i < n_rects; i++) { graphene_rect_t transformed_rect, rect; - cairo_rectangle_int_t int_rect; + MtkRectangle int_rect; cairo_region_get_rectangle (region, i, &int_rect); rect = meta_rectangle_to_graphene_rect (&int_rect); diff --git a/src/compositor/region-utils.h b/src/compositor/region-utils.h index b46bc6dbb..fa74f9331 100644 --- a/src/compositor/region-utils.h +++ b/src/compositor/region-utils.h @@ -52,14 +52,14 @@ typedef struct _MetaRegionIterator MetaRegionIterator; struct _MetaRegionIterator { cairo_region_t *region; - cairo_rectangle_int_t rectangle; + MtkRectangle rectangle; gboolean line_start; gboolean line_end; int i; /*< private >*/ int n_rectangles; - cairo_rectangle_int_t next_rectangle; + MtkRectangle next_rectangle; }; typedef struct _MetaRegionBuilder MetaRegionBuilder; diff --git a/src/core/frame.c b/src/core/frame.c index 34df93df2..9ccae57a0 100644 --- a/src/core/frame.c +++ b/src/core/frame.c @@ -407,7 +407,7 @@ meta_frame_get_frame_bounds (MetaFrame *frame) /* FIXME: currently just the client area, should shape closer to * frame border, incl. rounded corners. */ - bounds = cairo_region_create_rectangle (&(cairo_rectangle_int_t) { + bounds = cairo_region_create_rectangle (&(MtkRectangle) { borders.total.left, borders.total.top, frame->rect.width - borders.total.left - borders.total.right, @@ -419,7 +419,7 @@ meta_frame_get_frame_bounds (MetaFrame *frame) void meta_frame_get_mask (MetaFrame *frame, - cairo_rectangle_int_t *frame_rect, + MtkRectangle *frame_rect, cairo_t *cr) { MetaFrameBorders borders; diff --git a/src/core/frame.h b/src/core/frame.h index ee5e5a567..6c484b8a5 100644 --- a/src/core/frame.h +++ b/src/core/frame.h @@ -70,7 +70,7 @@ void meta_frame_clear_cached_borders (MetaFrame *frame); cairo_region_t *meta_frame_get_frame_bounds (MetaFrame *frame); void meta_frame_get_mask (MetaFrame *frame, - cairo_rectangle_int_t *frame_rect, + MtkRectangle *frame_rect, cairo_t *cr); gboolean meta_frame_handle_xevent (MetaFrame *frame, diff --git a/src/core/keybindings.c b/src/core/keybindings.c index 086796d16..cd6426d43 100644 --- a/src/core/keybindings.c +++ b/src/core/keybindings.c @@ -2565,7 +2565,7 @@ handle_activate_window_menu (MetaDisplay *display, { int x, y; MetaRectangle frame_rect; - cairo_rectangle_int_t child_rect; + MtkRectangle child_rect; meta_window_get_frame_rect (display->focus_window, &frame_rect); meta_window_get_client_area_rect (display->focus_window, &child_rect); diff --git a/src/core/window-private.h b/src/core/window-private.h index fd0dcaa45..f3300a977 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -816,7 +816,7 @@ void meta_window_handle_ungrabbed_event (MetaWindow *window, const ClutterEvent *event); void meta_window_get_client_area_rect (const MetaWindow *window, - cairo_rectangle_int_t *rect); + MtkRectangle *rect); void meta_window_get_titlebar_rect (MetaWindow *window, MetaRectangle *titlebar_rect); diff --git a/src/core/window.c b/src/core/window.c index 80a28f259..0550e1528 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -4453,7 +4453,7 @@ meta_window_get_frame_rect (const MetaWindow *window, */ void meta_window_get_client_area_rect (const MetaWindow *window, - cairo_rectangle_int_t *rect) + MtkRectangle *rect) { MetaFrameBorders borders; diff --git a/src/meson.build b/src/meson.build index d05204e2f..a5b6efd4d 100644 --- a/src/meson.build +++ b/src/meson.build @@ -1268,6 +1268,7 @@ if have_introspection libmutter_cogl_gir[0], libmutter_cogl_pango_gir[0], libmutter_clutter_gir[0], + libmutter_mtk_gir[0], ], dependencies: [ libmutter_dep, diff --git a/src/meta/meta-shadow-factory.h b/src/meta/meta-shadow-factory.h index f01198ba7..74946ddb0 100644 --- a/src/meta/meta-shadow-factory.h +++ b/src/meta/meta-shadow-factory.h @@ -121,7 +121,7 @@ void meta_shadow_get_bounds (MetaShadow *shadow, int window_y, int window_width, int window_height, - cairo_rectangle_int_t *bounds); + MtkRectangle *bounds); META_EXPORT MetaShadowFactory *meta_shadow_factory_new (void); diff --git a/src/meta/meta-shaped-texture.h b/src/meta/meta-shaped-texture.h index 330220d8e..f804454eb 100644 --- a/src/meta/meta-shaped-texture.h +++ b/src/meta/meta-shaped-texture.h @@ -53,6 +53,6 @@ void meta_shaped_texture_set_mask_texture (MetaShapedTexture *stex, META_EXPORT cairo_surface_t * meta_shaped_texture_get_image (MetaShapedTexture *stex, - cairo_rectangle_int_t *clip); + MtkRectangle *clip); G_END_DECLS diff --git a/src/meta/meta-window-actor.h b/src/meta/meta-window-actor.h index f0c17a096..c03f664dd 100644 --- a/src/meta/meta-window-actor.h +++ b/src/meta/meta-window-actor.h @@ -48,7 +48,7 @@ gboolean meta_window_actor_is_destroyed (MetaWindowActor *self); META_EXPORT cairo_surface_t * meta_window_actor_get_image (MetaWindowActor *self, - cairo_rectangle_int_t *clip); + MtkRectangle *clip); META_EXPORT ClutterContent * meta_window_actor_paint_to_content (MetaWindowActor *self, diff --git a/src/tests/meta-monitor-test-utils.c b/src/tests/meta-monitor-test-utils.c index 98ff445b4..ffcb0b544 100644 --- a/src/tests/meta-monitor-test-utils.c +++ b/src/tests/meta-monitor-test-utils.c @@ -572,7 +572,7 @@ meta_check_monitor_configuration (MetaContext *context, const GList *outputs = meta_crtc_get_outputs (crtc); const GList *l_output; MetaRendererView *view; - cairo_rectangle_int_t view_layout; + MtkRectangle view_layout; for (l_output = outputs; l_output; diff --git a/src/tests/meta-ref-test.c b/src/tests/meta-ref-test.c index f1874b1ae..53e086f78 100644 --- a/src/tests/meta-ref-test.c +++ b/src/tests/meta-ref-test.c @@ -229,7 +229,7 @@ capture_view_into (ClutterStageView *view, ClutterBackend *backend; CoglContext *context; CoglBitmap *bitmap; - cairo_rectangle_int_t view_layout; + MtkRectangle view_layout; float view_scale; float texture_width; float texture_height; diff --git a/src/tests/stage-view-tests.c b/src/tests/stage-view-tests.c index 16f26c441..0bc94fc3a 100644 --- a/src/tests/stage-view-tests.c +++ b/src/tests/stage-view-tests.c @@ -505,7 +505,7 @@ assert_is_stage_view (ClutterStageView *stage_view, int width, int height) { - cairo_rectangle_int_t layout; + MtkRectangle layout; g_assert_nonnull (stage_view); g_assert_true (CLUTTER_IS_STAGE_VIEW (stage_view)); diff --git a/src/wayland/meta-pointer-lock-wayland.c b/src/wayland/meta-pointer-lock-wayland.c index 98dd1bebf..549defbcb 100644 --- a/src/wayland/meta-pointer-lock-wayland.c +++ b/src/wayland/meta-pointer-lock-wayland.c @@ -61,7 +61,7 @@ meta_pointer_lock_wayland_create_constraint (MetaPointerConfinementWayland *conf ClutterInputDevice *pointer = clutter_seat_get_pointer (seat); MetaPointerConstraint *constraint; graphene_point_t point; - cairo_rectangle_int_t rect; + MtkRectangle rect; cairo_region_t *region; float sx, sy, x, y; @@ -74,7 +74,7 @@ meta_pointer_lock_wayland_create_constraint (MetaPointerConfinementWayland *conf &sx, &sy); meta_wayland_surface_get_absolute_coordinates (surface, sx, sy, &x, &y); - rect = (cairo_rectangle_int_t) { .x = x, .y = y, .width = 1, .height = 1 }; + rect = (MtkRectangle) { .x = x, .y = y, .width = 1, .height = 1 }; region = cairo_region_create_rectangle (&rect); constraint = meta_pointer_constraint_new (region, 0.0); diff --git a/src/wayland/meta-wayland-actor-surface.c b/src/wayland/meta-wayland-actor-surface.c index 0dc3f7e47..cef1141cb 100644 --- a/src/wayland/meta-wayland-actor-surface.c +++ b/src/wayland/meta-wayland-actor-surface.c @@ -179,7 +179,7 @@ meta_wayland_actor_surface_real_sync_actor_state (MetaWaylandActorSurface *actor MetaSurfaceActor *surface_actor; MetaShapedTexture *stex; MetaWaylandBuffer *buffer; - cairo_rectangle_int_t surface_rect; + MtkRectangle surface_rect; MetaWaylandSurface *subsurface_surface; surface_actor = priv->actor; @@ -207,7 +207,7 @@ meta_wayland_actor_surface_real_sync_actor_state (MetaWaylandActorSurface *actor meta_shaped_texture_set_texture (stex, NULL); } - surface_rect = (cairo_rectangle_int_t) { + surface_rect = (MtkRectangle) { .width = meta_wayland_surface_get_width (surface), .height = meta_wayland_surface_get_height (surface), }; diff --git a/src/wayland/meta-wayland-buffer.c b/src/wayland/meta-wayland-buffer.c index b24309086..7a9858010 100644 --- a/src/wayland/meta-wayland-buffer.c +++ b/src/wayland/meta-wayland-buffer.c @@ -701,7 +701,7 @@ process_shm_buffer_damage (MetaWaylandBuffer *buffer, { const uint8_t *data = wl_shm_buffer_get_data (shm_buffer); int32_t stride = wl_shm_buffer_get_stride (shm_buffer); - cairo_rectangle_int_t rect; + MtkRectangle rect; int bpp; bpp = cogl_pixel_format_get_bytes_per_pixel (format, 0); diff --git a/src/wayland/meta-wayland-pointer-constraints.c b/src/wayland/meta-wayland-pointer-constraints.c index f4fe89cd0..a1a6441f1 100644 --- a/src/wayland/meta-wayland-pointer-constraints.c +++ b/src/wayland/meta-wayland-pointer-constraints.c @@ -630,7 +630,7 @@ meta_wayland_pointer_constraint_calculate_effective_region (MetaWaylandPointerCo frame->bottom_height); if (actual_width > 0 && actual_height > 0) { - cairo_region_intersect_rectangle (region, &(cairo_rectangle_int_t) { + cairo_region_intersect_rectangle (region, &(MtkRectangle) { .x = frame->child_x, .y = frame->child_y, .width = actual_width, diff --git a/src/wayland/meta-wayland-region.c b/src/wayland/meta-wayland-region.c index d52e011d7..9dfb3b92b 100644 --- a/src/wayland/meta-wayland-region.c +++ b/src/wayland/meta-wayland-region.c @@ -22,6 +22,7 @@ #include "config.h" +#include "mtk/mtk.h" #include "wayland/meta-wayland-region.h" struct _MetaWaylandRegion @@ -46,7 +47,7 @@ wl_region_add (struct wl_client *client, gint32 height) { MetaWaylandRegion *region = wl_resource_get_user_data (resource); - cairo_rectangle_int_t rectangle = { x, y, width, height }; + MtkRectangle rectangle = { x, y, width, height }; cairo_region_union_rectangle (region->region, &rectangle); } @@ -60,7 +61,7 @@ wl_region_subtract (struct wl_client *client, gint32 height) { MetaWaylandRegion *region = wl_resource_get_user_data (resource); - cairo_rectangle_int_t rectangle = { x, y, width, height }; + MtkRectangle rectangle = { x, y, width, height }; cairo_region_subtract_rectangle (region->region, &rectangle); } diff --git a/src/wayland/meta-wayland-surface.c b/src/wayland/meta-wayland-surface.c index 296ab7505..3c9b47a84 100644 --- a/src/wayland/meta-wayland-surface.c +++ b/src/wayland/meta-wayland-surface.c @@ -266,7 +266,7 @@ surface_process_damage (MetaWaylandSurface *surface, cairo_region_t *buffer_region) { MetaWaylandBuffer *buffer = meta_wayland_surface_get_buffer (surface); - cairo_rectangle_int_t buffer_rect; + MtkRectangle buffer_rect; MetaSurfaceActor *actor; /* If the client destroyed the buffer it attached before committing, but @@ -276,14 +276,14 @@ surface_process_damage (MetaWaylandSurface *surface, if (!buffer) return; - buffer_rect = (cairo_rectangle_int_t) { + buffer_rect = (MtkRectangle) { .width = meta_wayland_surface_get_buffer_width (surface), .height = meta_wayland_surface_get_buffer_height (surface), }; if (!cairo_region_is_empty (surface_region)) { - cairo_rectangle_int_t surface_rect; + MtkRectangle surface_rect; cairo_region_t *scaled_region; cairo_region_t *transformed_region; cairo_region_t *viewport_region; @@ -292,7 +292,7 @@ surface_process_damage (MetaWaylandSurface *surface, /* Intersect the damage region with the surface region before scaling in * order to avoid integer overflow when scaling a damage region is too * large (for example INT32_MAX which mesa passes). */ - surface_rect = (cairo_rectangle_int_t) { + surface_rect = (MtkRectangle) { .width = meta_wayland_surface_get_width (surface), .height = meta_wayland_surface_get_height (surface), }; @@ -362,7 +362,7 @@ surface_process_damage (MetaWaylandSurface *surface, n_rectangles = cairo_region_num_rectangles (buffer_region); for (i = 0; i < n_rectangles; i++) { - cairo_rectangle_int_t rect; + MtkRectangle rect; cairo_region_get_rectangle (buffer_region, i, &rect); meta_surface_actor_process_damage (actor, @@ -1063,9 +1063,9 @@ wl_surface_damage (struct wl_client *client, { MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource); MetaWaylandSurfaceState *pending = surface->pending_state; - cairo_rectangle_int_t rectangle; + MtkRectangle rectangle; - rectangle = (cairo_rectangle_int_t) { + rectangle = (MtkRectangle) { .x = x, .y = y, .width = width, @@ -1232,9 +1232,9 @@ wl_surface_damage_buffer (struct wl_client *client, { MetaWaylandSurface *surface = wl_resource_get_user_data (surface_resource); MetaWaylandSurfaceState *pending = surface->pending_state; - cairo_rectangle_int_t rectangle; + MtkRectangle rectangle; - rectangle = (cairo_rectangle_int_t) { + rectangle = (MtkRectangle) { .x = x, .y = y, .width = width, @@ -2070,12 +2070,12 @@ cairo_region_t * meta_wayland_surface_calculate_input_region (MetaWaylandSurface *surface) { cairo_region_t *region; - cairo_rectangle_int_t buffer_rect; + MtkRectangle buffer_rect; if (!surface->buffer) return NULL; - buffer_rect = (cairo_rectangle_int_t) { + buffer_rect = (MtkRectangle) { .width = meta_wayland_surface_get_width (surface), .height = meta_wayland_surface_get_height (surface), }; diff --git a/src/wayland/meta-wayland-text-input.c b/src/wayland/meta-wayland-text-input.c index a7d8af44c..b1ceb1a6b 100644 --- a/src/wayland/meta-wayland-text-input.c +++ b/src/wayland/meta-wayland-text-input.c @@ -65,7 +65,7 @@ struct _MetaWaylandTextInput uint32_t anchor; } surrounding; - cairo_rectangle_int_t cursor_rect; + MtkRectangle cursor_rect; uint32_t content_type_hint; uint32_t content_type_purpose; @@ -584,7 +584,7 @@ text_input_set_cursor_rectangle (struct wl_client *client, if (!client_matches_focus (text_input, client)) return; - text_input->cursor_rect = (cairo_rectangle_int_t) { x, y, width, height }; + text_input->cursor_rect = (MtkRectangle) { x, y, width, height }; text_input->pending_state |= META_WAYLAND_PENDING_STATE_INPUT_RECT; } @@ -595,7 +595,7 @@ meta_wayland_text_input_reset (MetaWaylandTextInput *text_input) text_input->content_type_hint = ZWP_TEXT_INPUT_V3_CONTENT_HINT_NONE; text_input->content_type_purpose = ZWP_TEXT_INPUT_V3_CONTENT_PURPOSE_NORMAL; text_input->text_change_cause = ZWP_TEXT_INPUT_V3_CHANGE_CAUSE_INPUT_METHOD; - text_input->cursor_rect = (cairo_rectangle_int_t) { 0, 0, 0, 0 }; + text_input->cursor_rect = (MtkRectangle) { 0, 0, 0, 0 }; text_input->pending_state = META_WAYLAND_PENDING_STATE_NONE; } @@ -661,7 +661,7 @@ text_input_commit_state (struct wl_client *client, { graphene_rect_t cursor_rect; float x1, y1, x2, y2; - cairo_rectangle_int_t rect; + MtkRectangle rect; rect = text_input->cursor_rect; meta_wayland_surface_get_absolute_coordinates (text_input->surface, diff --git a/src/wayland/meta-window-xwayland.c b/src/wayland/meta-window-xwayland.c index 57b639315..5cb72d756 100644 --- a/src/wayland/meta-window-xwayland.c +++ b/src/wayland/meta-window-xwayland.c @@ -109,7 +109,7 @@ meta_window_xwayland_adjust_fullscreen_monitor_rect (MetaWindow *window, { MetaX11Display *x11_display = window->display->x11_display; MetaRectangle win_monitor_rect; - cairo_rectangle_int_t *rects; + MtkRectangle *rects; uint32_t *list = NULL; int i, n_items = 0; @@ -135,7 +135,7 @@ meta_window_xwayland_adjust_fullscreen_monitor_rect (MetaWindow *window, return; } - rects = (cairo_rectangle_int_t *) list; + rects = (MtkRectangle *) list; n_items = n_items / 4; for (i = 0; i < n_items; i++) { diff --git a/src/x11/window-props.c b/src/x11/window-props.c index 715bc10c9..5baa92f9f 100644 --- a/src/x11/window-props.c +++ b/src/x11/window-props.c @@ -672,7 +672,7 @@ reload_opaque_region (MetaWindow *window, uint32_t *region = value->v.cardinal_list.cardinals; int nitems = value->v.cardinal_list.n_cardinals; - cairo_rectangle_int_t *rects; + MtkRectangle *rects; int i, rect_index, nrects; if (nitems % 4 != 0) @@ -687,13 +687,13 @@ reload_opaque_region (MetaWindow *window, nrects = nitems / 4; - rects = g_new (cairo_rectangle_int_t, nrects); + rects = g_new (MtkRectangle, nrects); rect_index = 0; i = 0; while (i < nitems) { - cairo_rectangle_int_t *rect = &rects[rect_index]; + MtkRectangle *rect = &rects[rect_index]; rect->x = region[i++]; rect->y = region[i++]; diff --git a/src/x11/window-x11.c b/src/x11/window-x11.c index 3f34f03a1..a59f7f19a 100644 --- a/src/x11/window-x11.c +++ b/src/x11/window-x11.c @@ -2374,7 +2374,7 @@ region_create_from_x_rectangles (const XRectangle *rects, int n_rects) { int i; - cairo_rectangle_int_t *cairo_rects = g_newa (cairo_rectangle_int_t, n_rects); + MtkRectangle *cairo_rects = g_newa (MtkRectangle, n_rects); for (i = 0; i < n_rects; i ++) { @@ -2414,7 +2414,7 @@ print_region (cairo_region_t *region) g_print ("["); for (i = 0; i < n_rects; i++) { - cairo_rectangle_int_t rect; + MtkRectangle rect; cairo_region_get_rectangle (region, i, &rect); g_print ("+%d+%dx%dx%d ", rect.x, rect.y, rect.width, rect.height); @@ -2506,7 +2506,7 @@ meta_window_x11_update_input_region (MetaWindow *window) if (region != NULL) { - cairo_rectangle_int_t client_area; + MtkRectangle client_area; client_area.x = 0; client_area.y = 0; @@ -2587,7 +2587,7 @@ meta_window_x11_update_shape_region (MetaWindow *window) if (region != NULL) { - cairo_rectangle_int_t client_area; + MtkRectangle client_area; client_area.x = 0; client_area.y = 0;