window: Replace get_titlebar usages
Uses the hardcoded value that was used for wayland clients for x11 ones as well. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3254>
This commit is contained in:
parent
70f8cc433e
commit
503c70e284
@ -1275,11 +1275,7 @@ update_move (MetaWindowDrag *window_drag,
|
||||
* pretend like we started dragging from the middle of the titlebar
|
||||
* instead, as the "correct" anchoring looks wrong. */
|
||||
if (window_drag->anchor_root_y < window_drag->initial_window_pos.y)
|
||||
{
|
||||
MtkRectangle titlebar_rect;
|
||||
meta_window_get_titlebar_rect (window, &titlebar_rect);
|
||||
window_drag->anchor_root_y = window_drag->initial_window_pos.y + titlebar_rect.height / 2;
|
||||
}
|
||||
window_drag->anchor_root_y = window_drag->initial_window_pos.y + META_WINDOW_TITLEBAR_HEIGHT / 2;
|
||||
|
||||
window->saved_rect.x = window_drag->initial_window_pos.x;
|
||||
window->saved_rect.y = window_drag->initial_window_pos.y;
|
||||
|
@ -712,23 +712,20 @@ update_onscreen_requirements (MetaWindow *window,
|
||||
#ifdef HAVE_X11_CLIENT
|
||||
if (window->client_type == META_WINDOW_CLIENT_TYPE_X11 && window->decorated)
|
||||
{
|
||||
MtkRectangle titlebar_rect, frame_rect;
|
||||
MtkRectangle frame_rect;
|
||||
MetaFrame *frame = meta_window_x11_get_frame (window);
|
||||
|
||||
if (!frame)
|
||||
return;
|
||||
|
||||
meta_window_get_titlebar_rect (window, &titlebar_rect);
|
||||
meta_window_get_frame_rect (window, &frame_rect);
|
||||
|
||||
/* translate into screen coordinates */
|
||||
titlebar_rect.x = frame_rect.x;
|
||||
titlebar_rect.y = frame_rect.y;
|
||||
frame_rect.height = META_WINDOW_TITLEBAR_HEIGHT;
|
||||
|
||||
old = window->require_titlebar_visible;
|
||||
window->require_titlebar_visible =
|
||||
meta_rectangle_overlaps_with_region (info->usable_screen_region,
|
||||
&titlebar_rect);
|
||||
&frame_rect);
|
||||
if (old != window->require_titlebar_visible)
|
||||
meta_topic (META_DEBUG_GEOMETRY,
|
||||
"require_titlebar_visible for %s toggled to %s",
|
||||
|
@ -127,7 +127,6 @@ find_next_cascade (MetaWindow *window,
|
||||
GList *tmp;
|
||||
GList *sorted;
|
||||
int cascade_origin_x, cascade_x, cascade_y;
|
||||
MtkRectangle titlebar_rect;
|
||||
int x_threshold, y_threshold;
|
||||
MtkRectangle frame_rect;
|
||||
int window_width, window_height;
|
||||
@ -146,9 +145,8 @@ find_next_cascade (MetaWindow *window,
|
||||
* manually cascade.
|
||||
*/
|
||||
#define CASCADE_FUZZ 15
|
||||
meta_window_get_titlebar_rect (window, &titlebar_rect);
|
||||
x_threshold = MAX (titlebar_rect.x, CASCADE_FUZZ);
|
||||
y_threshold = MAX (titlebar_rect.y, CASCADE_FUZZ);
|
||||
x_threshold = CASCADE_FUZZ;
|
||||
y_threshold = CASCADE_FUZZ;
|
||||
|
||||
/* Find furthest-SE origin of all workspaces.
|
||||
* cascade_x, cascade_y are the target position
|
||||
@ -202,13 +200,11 @@ find_next_cascade (MetaWindow *window,
|
||||
|
||||
if (nearby)
|
||||
{
|
||||
meta_window_get_titlebar_rect (w, &titlebar_rect);
|
||||
|
||||
/* Cascade the window evenly by the titlebar height; this isn't a typo. */
|
||||
cascade_x = ltr
|
||||
? wx + titlebar_rect.height
|
||||
: wx + ww - titlebar_rect.height - window_width;
|
||||
cascade_y = wy + titlebar_rect.height;
|
||||
? wx + META_WINDOW_TITLEBAR_HEIGHT
|
||||
: wx + ww - META_WINDOW_TITLEBAR_HEIGHT - window_width;
|
||||
cascade_y = wy + META_WINDOW_TITLEBAR_HEIGHT;
|
||||
|
||||
/* If we go off the screen, start over with a new cascade */
|
||||
if (((cascade_x + window_width) >
|
||||
|
@ -42,6 +42,8 @@
|
||||
|
||||
typedef struct _MetaWindowQueue MetaWindowQueue;
|
||||
|
||||
#define META_WINDOW_TITLEBAR_HEIGHT 50
|
||||
|
||||
typedef enum
|
||||
{
|
||||
META_CLIENT_TYPE_UNKNOWN = 0,
|
||||
@ -786,8 +788,6 @@ gboolean meta_window_handle_ungrabbed_event (MetaWindow *window,
|
||||
|
||||
void meta_window_get_client_area_rect (const MetaWindow *window,
|
||||
MtkRectangle *rect);
|
||||
void meta_window_get_titlebar_rect (MetaWindow *window,
|
||||
MtkRectangle *titlebar_rect);
|
||||
|
||||
void meta_window_activate_full (MetaWindow *window,
|
||||
guint32 timestamp,
|
||||
|
@ -4415,28 +4415,6 @@ meta_window_get_client_area_rect (const MetaWindow *window,
|
||||
rect->height = window->buffer_rect.height - borders.total.top - borders.total.bottom;
|
||||
}
|
||||
|
||||
void
|
||||
meta_window_get_titlebar_rect (MetaWindow *window,
|
||||
MtkRectangle *rect)
|
||||
{
|
||||
meta_window_get_frame_rect (window, rect);
|
||||
|
||||
/* The returned rectangle is relative to the frame rect. */
|
||||
rect->x = 0;
|
||||
rect->y = 0;
|
||||
|
||||
if (window->frame)
|
||||
{
|
||||
rect->height = window->frame->child_y;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Pick an arbitrary height for a titlebar. We might want to
|
||||
* eventually have CSD windows expose their borders to us. */
|
||||
rect->height = 50;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_window_get_startup_id:
|
||||
* @window: a #MetaWindow
|
||||
|
Loading…
x
Reference in New Issue
Block a user