summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/core/keybindings.c25
-rw-r--r--src/core/place.c2
-rw-r--r--src/core/place.h3
3 files changed, 22 insertions, 8 deletions
diff --git a/src/core/keybindings.c b/src/core/keybindings.c
index fb3131c2..a00e0eaf 100644
--- a/src/core/keybindings.c
+++ b/src/core/keybindings.c
@@ -2703,23 +2703,34 @@ handle_move_to_center (MetaDisplay *display,
const MetaXineramaScreenInfo* current;
MetaRectangle work_area;
MetaRectangle outer;
- int orig_x, orig_y;
- int frame_width, frame_height;
+ MetaFrameBorders borders;
+ int client_x, client_y;
current = meta_screen_get_xinerama_for_window(screen, window);
meta_window_get_work_area_for_xinerama (window,
current->number,
&work_area);
meta_window_get_outer_rect (window, &outer);
- meta_window_get_position (window, &orig_x, &orig_y);
- frame_width = (window->frame ? window->frame->child_x : 0);
- frame_height = (window->frame ? window->frame->child_y : 0);
+ center_rect_in_area (&outer, &work_area);
+
+ /* Convert frame position to client position */
+ if (window->frame)
+ {
+ meta_frame_calc_borders (window->frame, &borders);
+ client_x = outer.x + borders.visible.left;
+ client_y = outer.y + borders.visible.top;
+ }
+ else
+ {
+ client_x = outer.x;
+ client_y = outer.y;
+ }
meta_window_move_resize (window,
TRUE,
- work_area.x + (work_area.width +frame_width -outer.width )/2,
- work_area.y + (work_area.height+frame_height-outer.height)/2,
+ client_x,
+ client_y,
window->rect.width,
window->rect.height);
}
diff --git a/src/core/place.c b/src/core/place.c
index 1aafff79..854469a9 100644
--- a/src/core/place.c
+++ b/src/core/place.c
@@ -528,7 +528,7 @@ center_tile_rect_in_area (MetaRectangle *rect,
rect->y = work_area->y + fluff;
}
-static void
+void
center_rect_in_area (MetaRectangle *rect,
MetaRectangle *work_area)
{
diff --git a/src/core/place.h b/src/core/place.h
index 468e3a39..6a2d0ff4 100644
--- a/src/core/place.h
+++ b/src/core/place.h
@@ -34,4 +34,7 @@ void meta_window_place (MetaWindow *window,
int *new_x,
int *new_y);
+void center_rect_in_area (MetaRectangle *rect,
+ MetaRectangle *work_area);
+
#endif