window: Remove shove titlebar onscreen functions
Mutter side of https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3332 Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3254>
This commit is contained in:
parent
acbb14f34b
commit
fff528cbf1
@ -5773,96 +5773,6 @@ meta_window_show_menu (MetaWindow *window,
|
|||||||
meta_compositor_show_window_menu (window->display->compositor, window, menu, x, y);
|
meta_compositor_show_window_menu (window->display->compositor, window, menu, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
meta_window_shove_titlebar_onscreen (MetaWindow *window)
|
|
||||||
{
|
|
||||||
MetaWorkspaceManager *workspace_manager = window->display->workspace_manager;
|
|
||||||
MtkRectangle frame_rect;
|
|
||||||
GList *onscreen_region;
|
|
||||||
int horiz_amount, vert_amount;
|
|
||||||
|
|
||||||
g_return_if_fail (!window->override_redirect);
|
|
||||||
|
|
||||||
/* If there's no titlebar, don't bother */
|
|
||||||
if (!window->frame)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Get the basic info we need */
|
|
||||||
meta_window_get_frame_rect (window, &frame_rect);
|
|
||||||
onscreen_region = workspace_manager->active_workspace->screen_region;
|
|
||||||
|
|
||||||
/* Extend the region (just in case the window is too big to fit on the
|
|
||||||
* screen), then shove the window on screen, then return the region to
|
|
||||||
* normal.
|
|
||||||
*/
|
|
||||||
horiz_amount = frame_rect.width;
|
|
||||||
vert_amount = frame_rect.height;
|
|
||||||
meta_rectangle_expand_region (onscreen_region,
|
|
||||||
horiz_amount,
|
|
||||||
horiz_amount,
|
|
||||||
0,
|
|
||||||
vert_amount);
|
|
||||||
meta_rectangle_shove_into_region(onscreen_region,
|
|
||||||
FIXED_DIRECTION_X,
|
|
||||||
&frame_rect);
|
|
||||||
meta_rectangle_expand_region (onscreen_region,
|
|
||||||
-horiz_amount,
|
|
||||||
-horiz_amount,
|
|
||||||
0,
|
|
||||||
-vert_amount);
|
|
||||||
|
|
||||||
meta_window_move_frame (window, FALSE, frame_rect.x, frame_rect.y);
|
|
||||||
}
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
meta_window_titlebar_is_onscreen (MetaWindow *window)
|
|
||||||
{
|
|
||||||
MetaWorkspaceManager *workspace_manager = window->display->workspace_manager;
|
|
||||||
MtkRectangle titlebar_rect, frame_rect;
|
|
||||||
GList *onscreen_region;
|
|
||||||
gboolean is_onscreen;
|
|
||||||
|
|
||||||
const int min_height_needed = 8;
|
|
||||||
const float min_width_percent = 0.5;
|
|
||||||
const int min_width_absolute = 50;
|
|
||||||
|
|
||||||
/* Titlebar can't be offscreen if there is no titlebar... */
|
|
||||||
if (!window->frame)
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
/* Get the rectangle corresponding to the titlebar */
|
|
||||||
meta_window_get_titlebar_rect (window, &titlebar_rect);
|
|
||||||
|
|
||||||
/* Translate into screen coordinates */
|
|
||||||
meta_window_get_frame_rect (window, &frame_rect);
|
|
||||||
titlebar_rect.x = frame_rect.x;
|
|
||||||
titlebar_rect.y = frame_rect.y;
|
|
||||||
|
|
||||||
/* Run through the spanning rectangles for the screen and see if one of
|
|
||||||
* them overlaps with the titlebar sufficiently to consider it onscreen.
|
|
||||||
*/
|
|
||||||
is_onscreen = FALSE;
|
|
||||||
onscreen_region = workspace_manager->active_workspace->screen_region;
|
|
||||||
while (onscreen_region)
|
|
||||||
{
|
|
||||||
MtkRectangle *spanning_rect = onscreen_region->data;
|
|
||||||
MtkRectangle overlap;
|
|
||||||
|
|
||||||
mtk_rectangle_intersect (&titlebar_rect, spanning_rect, &overlap);
|
|
||||||
if (overlap.height > MIN (titlebar_rect.height, min_height_needed) &&
|
|
||||||
overlap.width > MIN (titlebar_rect.width * min_width_percent,
|
|
||||||
min_width_absolute))
|
|
||||||
{
|
|
||||||
is_onscreen = TRUE;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
onscreen_region = onscreen_region->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
return is_onscreen;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_window_get_work_area_for_logical_monitor (MetaWindow *window,
|
meta_window_get_work_area_for_logical_monitor (MetaWindow *window,
|
||||||
MetaLogicalMonitor *logical_monitor,
|
MetaLogicalMonitor *logical_monitor,
|
||||||
|
@ -423,12 +423,6 @@ gboolean meta_window_allows_move (MetaWindow *window);
|
|||||||
META_EXPORT
|
META_EXPORT
|
||||||
gboolean meta_window_allows_resize (MetaWindow *window);
|
gboolean meta_window_allows_resize (MetaWindow *window);
|
||||||
|
|
||||||
META_EXPORT
|
|
||||||
gboolean meta_window_titlebar_is_onscreen (MetaWindow *window);
|
|
||||||
|
|
||||||
META_EXPORT
|
|
||||||
void meta_window_shove_titlebar_onscreen (MetaWindow *window);
|
|
||||||
|
|
||||||
META_EXPORT
|
META_EXPORT
|
||||||
uint64_t meta_window_get_id (MetaWindow *window);
|
uint64_t meta_window_get_id (MetaWindow *window);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user