x11: Do not fake frame extents if unmanaged window asks for _NET_FRAME_EXTENTS

If the window is not managed, it's weird that it asks for _NET_FRAME_EXTENTS,
it's even weirder that mutter replies with a frame border that would only
apply if the window were managed. Stop doing the latter, and drop the
MetaUI call that calculates borders from the theme settings.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2175>
This commit is contained in:
Carlos Garnacho 2021-10-20 14:07:59 +02:00 committed by Marge Bot
parent b891f8a52c
commit 450be1dc95
3 changed files with 2 additions and 76 deletions

View File

@ -211,47 +211,6 @@ meta_ui_window_should_not_cause_focus (Display *xdisplay,
return FALSE;
}
void
meta_ui_theme_get_frame_borders (MetaUI *ui,
MetaFrameType type,
MetaFrameFlags flags,
MetaFrameBorders *borders)
{
GdkDisplay *display;
GdkScreen *screen;
int text_height;
MetaStyleInfo *style_info = NULL;
PangoContext *context;
const PangoFontDescription *font_desc;
PangoFontDescription *free_font_desc = NULL;
display = gdk_x11_lookup_xdisplay (ui->xdisplay);
screen = gdk_display_get_default_screen (display);
style_info = meta_theme_create_style_info (screen, NULL);
context = gtk_widget_get_pango_context (GTK_WIDGET (ui->frames));
font_desc = meta_prefs_get_titlebar_font ();
if (!font_desc)
{
free_font_desc = meta_style_info_create_font_desc (style_info);
font_desc = (const PangoFontDescription *) free_font_desc;
}
text_height = meta_pango_font_desc_get_text_height (font_desc, context);
meta_theme_get_frame_borders (meta_theme_get_default (),
style_info, type, text_height, flags,
borders);
if (free_font_desc)
pango_font_description_free (free_font_desc);
if (style_info != NULL)
meta_style_info_unref (style_info);
}
gboolean
meta_ui_window_is_widget (MetaUI *ui,
Window xwindow)

View File

@ -39,11 +39,6 @@ typedef gboolean (* MetaEventFunc) (XEvent *xevent, gpointer data);
MetaUI *meta_ui_new (MetaX11Display *x11_display);
void meta_ui_free (MetaUI *ui);
void meta_ui_theme_get_frame_borders (MetaUI *ui,
MetaFrameType type,
MetaFrameFlags flags,
MetaFrameBorders *borders);
MetaUIFrame * meta_ui_create_frame (MetaUI *ui,
Display *xdisplay,
MetaWindow *meta_window,

View File

@ -1055,35 +1055,9 @@ process_request_frame_extents (MetaX11Display *x11_display,
Window xwindow = event->xclient.window;
unsigned long data[4] = { 0, 0, 0, 0 };
MotifWmHints *hints = NULL;
gboolean hints_set = FALSE;
meta_verbose ("Setting frame extents for 0x%lx", xwindow);
/* See if the window is decorated. */
hints_set = meta_prop_get_motif_hints (x11_display,
xwindow,
x11_display->atom__MOTIF_WM_HINTS,
&hints);
if ((hints_set && hints->decorations) || !hints_set)
{
MetaFrameBorders borders;
/* Return estimated frame extents for a normal window. */
meta_ui_theme_get_frame_borders (x11_display->ui,
META_FRAME_TYPE_NORMAL,
0,
&borders);
data[0] = borders.visible.left;
data[1] = borders.visible.right;
data[2] = borders.visible.top;
data[3] = borders.visible.bottom;
}
meta_topic (META_DEBUG_GEOMETRY,
"Setting _NET_FRAME_EXTENTS on unmanaged window 0x%lx "
"to top = %lu, left = %lu, bottom = %lu, right = %lu",
xwindow, data[0], data[1], data[2], data[3]);
"Setting _NET_FRAME_EXTENTS on unmanaged window 0x%lx",
xwindow);
meta_x11_error_trap_push (x11_display);
XChangeProperty (x11_display->xdisplay, xwindow,
@ -1091,8 +1065,6 @@ process_request_frame_extents (MetaX11Display *x11_display,
XA_CARDINAL,
32, PropModeReplace, (guchar*) data, 4);
meta_x11_error_trap_pop (x11_display);
g_free (hints);
}
/* from fvwm2, Copyright Matthias Clasen, Dominik Vogt */