diff options
author | Victor Kareh <[email protected]> | 2019-04-12 07:58:30 -0400 |
---|---|---|
committer | Victor Kareh <[email protected]> | 2019-06-05 10:49:37 -0400 |
commit | c66b32666e48996b97e691ed002f86b6ff18dec5 (patch) | |
tree | 3e5d1b07331ab708cac920fcfe62e504aa2481ad /src/core/window.c | |
parent | 707eb409e7dfeec276f6dfa3e667a0140b3300aa (diff) | |
download | marco-c66b32666e48996b97e691ed002f86b6ff18dec5.tar.bz2 marco-c66b32666e48996b97e691ed002f86b6ff18dec5.tar.xz |
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.
Diffstat (limited to 'src/core/window.c')
-rw-r--r-- | src/core/window.c | 69 |
1 files changed, 34 insertions, 35 deletions
diff --git a/src/core/window.c b/src/core/window.c index 620b3a2d..7c8a19a9 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; @@ -3516,8 +3516,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; @@ -3544,7 +3543,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 */ @@ -3559,7 +3558,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, @@ -3581,12 +3580,12 @@ meta_window_move_resize_internal (MetaWindow *window, { int frame_size_dx, frame_size_dy, 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; @@ -3623,8 +3622,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; @@ -3647,8 +3646,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)) @@ -3719,15 +3718,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); } |