mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 08:00:42 -05:00
core/place: Use work area when centering new window.
use the workarea instead of the logical monitor Closes https://gitlab.gnome.org/GNOME/mutter/-/issues/964
This commit is contained in:
parent
d823a54b5d
commit
6f62c5b575
@ -802,22 +802,19 @@ meta_window_place (MetaWindow *window,
|
|||||||
if (window_place_centered (window))
|
if (window_place_centered (window))
|
||||||
{
|
{
|
||||||
/* Center on current monitor */
|
/* Center on current monitor */
|
||||||
int w, h;
|
MetaRectangle work_area;
|
||||||
MetaRectangle frame_rect;
|
MetaRectangle frame_rect;
|
||||||
|
|
||||||
meta_window_get_frame_rect (window, &frame_rect);
|
|
||||||
|
|
||||||
/* Warning, this function is a round trip! */
|
/* Warning, this function is a round trip! */
|
||||||
logical_monitor = meta_backend_get_current_logical_monitor (backend);
|
logical_monitor = meta_backend_get_current_logical_monitor (backend);
|
||||||
|
|
||||||
w = logical_monitor->rect.width;
|
meta_window_get_work_area_for_logical_monitor (window,
|
||||||
h = logical_monitor->rect.height;
|
logical_monitor,
|
||||||
|
&work_area);
|
||||||
|
meta_window_get_frame_rect (window, &frame_rect);
|
||||||
|
|
||||||
x = (w - frame_rect.width) / 2;
|
x = work_area.x + (work_area.width - frame_rect.width) / 2;
|
||||||
y = (h - frame_rect.height) / 2;
|
y = work_area.y + (work_area.height - frame_rect.height) / 2;
|
||||||
|
|
||||||
x += logical_monitor->rect.x;
|
|
||||||
y += logical_monitor->rect.y;
|
|
||||||
|
|
||||||
meta_topic (META_DEBUG_PLACEMENT, "Centered window %s on monitor %d\n",
|
meta_topic (META_DEBUG_PLACEMENT, "Centered window %s on monitor %d\n",
|
||||||
window->desc, logical_monitor->number);
|
window->desc, logical_monitor->number);
|
||||||
|
Loading…
Reference in New Issue
Block a user