From cfd49bdf68ef48fcd53a084c74626372fc169688 Mon Sep 17 00:00:00 2001 From: Victor Kareh Date: Fri, 12 Apr 2019 07:58:30 -0400 Subject: Replace public MetaFrameGeometry with MetaFrameBorders There were actually *two* MetaFrameGeometry structs: one in theme-private.h, one in frame.h. The latter public struct was populated by a mix of (void*) casting and int pointers, usually pulling directly from the data in the private struct. Remove the public struct, replace it with MetaFrameBorders and scrap all the pointer hacks to populate it, instead relying on both structs being used in common code. This commit should be relatively straightforward, and it should not do any tricky logic at all, just a sophisticated find and replace. https://bugzilla.gnome.org/show_bug.cgi?id=644930 upstream commit: https://gitlab.gnome.org/GNOME/metacity/commit/72224a165 NOTE: Patch copied from metacity and adapted for marco. --- src/core/window.c | 69 +++++++++++++++++++++++++++---------------------------- 1 file changed, 34 insertions(+), 35 deletions(-) (limited to 'src/core/window.c') diff --git a/src/core/window.c b/src/core/window.c index e5046bbb..bba84b4c 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -2771,12 +2771,12 @@ meta_window_can_tile (MetaWindow *window) if (window->frame) { - MetaFrameGeometry fgeom; + MetaFrameBorders borders; - meta_frame_calc_geometry (window->frame, &fgeom); + meta_frame_calc_borders (window->frame, &borders); - tile_area.width -= (fgeom.left_width + fgeom.right_width); - tile_area.height -= (fgeom.top_height + fgeom.bottom_height); + tile_area.width -= (borders.visible.left + borders.visible.right); + tile_area.height -= (borders.visible.top + borders.visible.bottom); } return tile_area.width >= window->size_hints.min_width && @@ -3241,11 +3241,11 @@ meta_window_activate_with_workspace (MetaWindow *window, * internal or client window). */ static void -adjust_for_gravity (MetaWindow *window, - MetaFrameGeometry *fgeom, - gboolean coords_assume_border, - int gravity, - MetaRectangle *rect) +adjust_for_gravity (MetaWindow *window, + MetaFrameBorders *borders, + gboolean coords_assume_border, + int gravity, + MetaRectangle *rect) { int ref_x, ref_y; int bw; @@ -3257,12 +3257,12 @@ adjust_for_gravity (MetaWindow *window, else bw = 0; - if (fgeom) + if (borders) { - child_x = fgeom->left_width; - child_y = fgeom->top_height; - frame_width = child_x + rect->width + fgeom->right_width; - frame_height = child_y + rect->height + fgeom->bottom_height; + child_x = borders->visible.left; + child_y = borders->visible.top; + frame_width = child_x + rect->width + borders->visible.right; + frame_height = child_y + rect->height + borders->visible.bottom; } else { @@ -3470,7 +3470,7 @@ meta_window_move_resize_internal (MetaWindow *window, XWindowChanges values; unsigned int mask; gboolean need_configure_notify; - MetaFrameGeometry fgeom; + MetaFrameBorders borders; gboolean need_move_client = FALSE; gboolean need_move_frame = FALSE; gboolean need_resize_client = FALSE; @@ -3518,8 +3518,7 @@ meta_window_move_resize_internal (MetaWindow *window, old_rect.x, old_rect.y, old_rect.width, old_rect.height); if (have_window_frame) - meta_frame_calc_geometry (window->frame, - &fgeom); + meta_frame_calc_borders (window->frame, &borders); new_rect.x = root_x_nw; new_rect.y = root_y_nw; @@ -3546,7 +3545,7 @@ meta_window_move_resize_internal (MetaWindow *window, else if (is_configure_request || do_gravity_adjust) { adjust_for_gravity (window, - have_window_frame ? &fgeom : NULL, + have_window_frame ? &borders : NULL, /* configure request coords assume * the border width existed */ @@ -3561,7 +3560,7 @@ meta_window_move_resize_internal (MetaWindow *window, } meta_window_constrain (window, - have_window_frame ? &fgeom : NULL, + have_window_frame ? &borders : NULL, flags, gravity, &old_rect, @@ -3583,12 +3582,12 @@ meta_window_move_resize_internal (MetaWindow *window, { int new_w, new_h; - new_w = window->rect.width + fgeom.left_width + fgeom.right_width; + new_w = window->rect.width + borders.visible.left + borders.visible.right; if (window->shaded) - new_h = fgeom.top_height; + new_h = borders.visible.top; else - new_h = window->rect.height + fgeom.top_height + fgeom.bottom_height; + new_h = window->rect.height + borders.visible.top + borders.visible.bottom; frame_size_dx = new_w - window->frame->rect.width; frame_size_dy = new_h - window->frame->rect.height; @@ -3630,8 +3629,8 @@ meta_window_move_resize_internal (MetaWindow *window, int frame_pos_dx, frame_pos_dy; /* Compute new frame coords */ - new_x = root_x_nw - fgeom.left_width; - new_y = root_y_nw - fgeom.top_height; + new_x = root_x_nw - borders.visible.left; + new_y = root_y_nw - borders.visible.top; frame_pos_dx = new_x - window->frame->rect.x; frame_pos_dy = new_y - window->frame->rect.y; @@ -3654,8 +3653,8 @@ meta_window_move_resize_internal (MetaWindow *window, * remember they are the server coords */ - new_x = fgeom.left_width; - new_y = fgeom.top_height; + new_x = borders.visible.left; + new_y = borders.visible.top; if (need_resize_frame && need_move_frame && static_gravity_works (window->display)) @@ -3726,15 +3725,15 @@ meta_window_move_resize_internal (MetaWindow *window, /* If frame extents have changed, fill in other frame fields and change frame's extents property. */ if (have_window_frame && - (window->frame->child_x != fgeom.left_width || - window->frame->child_y != fgeom.top_height || - window->frame->right_width != fgeom.right_width || - window->frame->bottom_height != fgeom.bottom_height)) - { - window->frame->child_x = fgeom.left_width; - window->frame->child_y = fgeom.top_height; - window->frame->right_width = fgeom.right_width; - window->frame->bottom_height = fgeom.bottom_height; + (window->frame->child_x != borders.visible.left || + window->frame->child_y != borders.visible.top || + window->frame->right_width != borders.visible.right || + window->frame->bottom_height != borders.visible.bottom)) + { + window->frame->child_x = borders.visible.left; + window->frame->child_y = borders.visible.top; + window->frame->right_width = borders.visible.right; + window->frame->bottom_height = borders.visible.bottom; update_net_frame_extents (window); } -- cgit v1.2.1