Remove support for window shading

It's been broken for an unknown time and was never supported on Wayland.
Thus let's remove the leftovers.

Helpful command: `rg 'shade(?!r)' --pcre2`

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2884>
This commit is contained in:
Robert Mader 2023-03-03 13:24:42 +01:00 committed by Marge Bot
parent 92ac922519
commit b521747d81
12 changed files with 25 additions and 229 deletions

View File

@ -277,8 +277,6 @@ meta_frame_get_flags (MetaFrame *frame)
if (frame->window->has_minimize_func)
flags |= META_FRAME_ALLOWS_MINIMIZE;
if (frame->window->has_shade_func)
flags |= META_FRAME_ALLOWS_SHADE;
}
if (META_WINDOW_ALLOWS_MOVE (frame->window))
@ -293,9 +291,6 @@ meta_frame_get_flags (MetaFrame *frame)
if (meta_window_appears_focused (frame->window))
flags |= META_FRAME_HAS_FOCUS;
if (frame->window->shaded)
flags |= META_FRAME_SHADED;
if (frame->window->on_all_workspaces_requested)
flags |= META_FRAME_STUCK;

View File

@ -2660,19 +2660,6 @@ handle_unmaximize (MetaDisplay *display,
meta_window_unmaximize (window, META_MAXIMIZE_BOTH);
}
static void
handle_toggle_shaded (MetaDisplay *display,
MetaWindow *window,
ClutterKeyEvent *event,
MetaKeyBinding *binding,
gpointer dummy)
{
if (window->shaded)
meta_window_unshade (window, event->time);
else if (window->has_shade_func)
meta_window_shade (window, event->time);
}
static void
handle_close (MetaDisplay *display,
MetaWindow *window,
@ -3484,14 +3471,6 @@ init_builtin_key_bindings (MetaDisplay *display)
META_KEYBINDING_ACTION_UNMAXIMIZE,
handle_unmaximize, 0);
add_builtin_keybinding (display,
"toggle-shaded",
common_keybindings,
META_KEY_BINDING_PER_WINDOW |
META_KEY_BINDING_IGNORE_AUTOREPEAT,
META_KEYBINDING_ACTION_TOGGLE_SHADED,
handle_toggle_shaded, 0);
add_builtin_keybinding (display,
"minimize",
common_keybindings,

View File

@ -828,8 +828,7 @@ meta_window_place (MetaWindow *window,
}
/* Find windows that matter (not minimized, on same workspace
* as placed window, may be shaded - if shaded we pretend it isn't
* for placement purposes)
* as placed window)
*/
{
GSList *all_windows;

View File

@ -378,9 +378,6 @@ struct _MetaWindow
* that to toggle between normal/tiled or maximized/tiled states. */
guint saved_maximize : 1;
/* Whether we're shaded */
guint shaded : 1;
/* Whether we're fullscreen */
guint fullscreen : 1;
@ -478,7 +475,6 @@ struct _MetaWindow
guint has_close_func : 1;
guint has_minimize_func : 1;
guint has_maximize_func : 1;
guint has_shade_func : 1;
guint has_move_func : 1;
guint has_resize_func : 1;
guint has_fullscreen_func : 1;
@ -628,7 +624,7 @@ struct _MetaWindowClass
#define META_WINDOW_TILED_MAXIMIZED(w)(META_WINDOW_MAXIMIZED(w) && \
(w)->tile_mode == META_TILE_MAXIMIZED)
#define META_WINDOW_ALLOWS_MOVE(w) ((w)->has_move_func && !(w)->fullscreen)
#define META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS(w) ((w)->has_resize_func && !META_WINDOW_MAXIMIZED (w) && !(w)->fullscreen && !(w)->shaded)
#define META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS(w) ((w)->has_resize_func && !META_WINDOW_MAXIMIZED (w) && !(w)->fullscreen)
#define META_WINDOW_ALLOWS_RESIZE(w) (META_WINDOW_ALLOWS_RESIZE_EXCEPT_HINTS (w) && \
(((w)->size_hints.min_width < (w)->size_hints.max_width) || \
((w)->size_hints.min_height < (w)->size_hints.max_height)))

View File

@ -854,7 +854,7 @@ client_window_should_be_mapped (MetaWindow *window)
window->decorated && !window->frame)
return FALSE;
return !window->shaded;
return TRUE;
}
static void
@ -1068,7 +1068,6 @@ meta_window_constructed (GObject *object)
window->tile_mode = META_TILE_NONE;
window->tile_monitor_number = -1;
window->tile_hfraction = -1.;
window->shaded = FALSE;
window->initially_iconic = FALSE;
window->minimized = FALSE;
window->tab_unminimized = FALSE;
@ -1110,8 +1109,6 @@ meta_window_constructed (GObject *object)
window->has_move_func = TRUE;
window->has_resize_func = TRUE;
window->has_shade_func = TRUE;
window->has_fullscreen_func = TRUE;
window->always_sticky = FALSE;
@ -1174,7 +1171,6 @@ meta_window_constructed (GObject *object)
window->decorated = FALSE;
window->always_sticky = TRUE;
window->has_close_func = FALSE;
window->has_shade_func = FALSE;
window->has_move_func = FALSE;
window->has_resize_func = FALSE;
}
@ -2153,8 +2149,8 @@ meta_window_show (MetaWindow *window)
MetaDisplay *display = window->display;
meta_topic (META_DEBUG_WINDOW_STATE,
"Showing window %s, shaded: %d iconic: %d placed: %d",
window->desc, window->shaded, window->iconic, window->placed);
"Showing window %s, iconic: %d placed: %d",
window->desc, window->iconic, window->placed);
focus_window = window->display->focus_window; /* May be NULL! */
did_show = FALSE;
@ -2635,16 +2631,6 @@ meta_window_maximize (MetaWindow *window,
if ((maximize_horizontally && !window->maximized_horizontally) ||
(maximize_vertically && !window->maximized_vertically))
{
if (window->shaded && maximize_vertically)
{
/* Shading sucks anyway; I'm not adding a timestamp argument
* to this function just for this niche usage & corner case.
*/
guint32 timestamp =
meta_display_get_current_time_roundtrip (window->display);
meta_window_unshade (window, timestamp);
}
/* if the window hasn't been placed yet, we'll maximize it then
*/
if (!window->placed)
@ -3232,16 +3218,6 @@ meta_window_make_fullscreen_internal (MetaWindow *window)
meta_topic (META_DEBUG_WINDOW_OPS,
"Fullscreening %s", window->desc);
if (window->shaded)
{
/* Shading sucks anyway; I'm not adding a timestamp argument
* to this function just for this niche usage & corner case.
*/
guint32 timestamp =
meta_display_get_current_time_roundtrip (window->display);
meta_window_unshade (window, timestamp);
}
window->saved_rect_fullscreen = window->rect;
window->fullscreen = TRUE;
@ -3391,57 +3367,6 @@ meta_window_adjust_fullscreen_monitor_rect (MetaWindow *window,
window_class->adjust_fullscreen_monitor_rect (window, monitor_rect);
}
void
meta_window_shade (MetaWindow *window,
guint32 timestamp)
{
g_return_if_fail (!window->override_redirect);
meta_topic (META_DEBUG_WINDOW_OPS,
"Shading %s", window->desc);
if (!window->shaded)
{
window->shaded = TRUE;
meta_window_queue(window, META_QUEUE_MOVE_RESIZE | META_QUEUE_CALC_SHOWING);
meta_window_frame_size_changed (window);
/* After queuing the calc showing, since _focus flushes it,
* and we need to focus the frame
*/
meta_topic (META_DEBUG_FOCUS,
"Re-focusing window %s after shading it",
window->desc);
meta_window_focus (window, timestamp);
set_net_wm_state (window);
}
}
void
meta_window_unshade (MetaWindow *window,
guint32 timestamp)
{
g_return_if_fail (!window->override_redirect);
meta_topic (META_DEBUG_WINDOW_OPS,
"Unshading %s", window->desc);
if (window->shaded)
{
window->shaded = FALSE;
meta_window_queue(window, META_QUEUE_MOVE_RESIZE | META_QUEUE_CALC_SHOWING);
meta_window_frame_size_changed (window);
/* focus the window */
meta_topic (META_DEBUG_FOCUS,
"Focusing window %s after unshading it",
window->desc);
meta_window_focus (window, timestamp);
set_net_wm_state (window);
}
}
static gboolean
unminimize_func (MetaWindow *window,
void *data)
@ -3519,9 +3444,6 @@ meta_window_activate_full (MetaWindow *window,
meta_window_change_workspace (window, workspace);
}
if (window->shaded)
meta_window_unshade (window, timestamp);
unminimize_window_and_all_transient_parents (window);
if (meta_prefs_get_raise_on_click () ||
@ -4452,8 +4374,7 @@ meta_window_get_frame_rect (const MetaWindow *window,
* @rect: (out): pointer to a cairo rectangle
*
* Gets the rectangle for the boundaries of the client area, relative
* to the buffer rect. If the window is shaded, the height of the
* rectangle is 0.
* to the buffer rect.
*/
void
meta_window_get_client_area_rect (const MetaWindow *window,
@ -4467,10 +4388,7 @@ meta_window_get_client_area_rect (const MetaWindow *window,
rect->y = borders.total.top;
rect->width = window->buffer_rect.width - borders.total.left - borders.total.right;
if (window->shaded)
rect->height = 0;
else
rect->height = window->buffer_rect.height - borders.total.top - borders.total.bottom;
rect->height = window->buffer_rect.height - borders.total.top - borders.total.bottom;
}
void
@ -4650,7 +4568,7 @@ meta_window_focus (MetaWindow *window,
meta_window_flush_calc_showing (window);
if ((!window->mapped || window->hidden) && !window->shaded)
if (!window->mapped || window->hidden)
{
meta_topic (META_DEBUG_FOCUS,
"Window %s is not showing, not focusing after all",
@ -5516,7 +5434,6 @@ meta_window_recalc_features (MetaWindow *window)
gboolean old_has_minimize_func;
gboolean old_has_move_func;
gboolean old_has_resize_func;
gboolean old_has_shade_func;
gboolean old_always_sticky;
gboolean old_skip_taskbar;
@ -5524,7 +5441,6 @@ meta_window_recalc_features (MetaWindow *window)
old_has_minimize_func = window->has_minimize_func;
old_has_move_func = window->has_move_func;
old_has_resize_func = window->has_resize_func;
old_has_shade_func = window->has_shade_func;
old_always_sticky = window->always_sticky;
old_skip_taskbar = window->skip_taskbar;
@ -5563,7 +5479,6 @@ meta_window_recalc_features (MetaWindow *window)
window->size_hints.max_height);
}
window->has_shade_func = TRUE;
window->has_fullscreen_func = TRUE;
window->always_sticky = FALSE;
@ -5582,7 +5497,6 @@ meta_window_recalc_features (MetaWindow *window)
{
window->decorated = FALSE;
window->has_close_func = FALSE;
window->has_shade_func = FALSE;
/* FIXME this keeps panels and things from using
* NET_WM_MOVERESIZE; the problem is that some
@ -5632,7 +5546,6 @@ meta_window_recalc_features (MetaWindow *window)
*/
if (window->fullscreen)
{
window->has_shade_func = FALSE;
window->has_move_func = FALSE;
window->has_resize_func = FALSE;
window->has_maximize_func = FALSE;
@ -5660,10 +5573,6 @@ meta_window_recalc_features (MetaWindow *window)
window->size_hints.max_width,
window->size_hints.max_height);
/* no shading if not decorated */
if (!window->decorated || window->border_only)
window->has_shade_func = FALSE;
meta_window_recalc_skip_features (window);
/* To prevent users from losing windows, let's prevent users from
@ -5672,7 +5581,7 @@ meta_window_recalc_features (MetaWindow *window)
window->has_minimize_func = FALSE;
meta_topic (META_DEBUG_WINDOW_OPS,
"Window %s decorated = %d border_only = %d has_close = %d has_minimize = %d has_maximize = %d has_move = %d has_shade = %d skip_taskbar = %d skip_pager = %d",
"Window %s decorated = %d border_only = %d has_close = %d has_minimize = %d has_maximize = %d has_move = %d skip_taskbar = %d skip_pager = %d",
window->desc,
window->decorated,
window->border_only,
@ -5680,7 +5589,6 @@ meta_window_recalc_features (MetaWindow *window)
window->has_minimize_func,
window->has_maximize_func,
window->has_move_func,
window->has_shade_func,
window->skip_taskbar,
window->skip_pager);
@ -5697,7 +5605,6 @@ meta_window_recalc_features (MetaWindow *window)
old_has_minimize_func != window->has_minimize_func ||
old_has_move_func != window->has_move_func ||
old_has_resize_func != window->has_resize_func ||
old_has_shade_func != window->has_shade_func ||
old_always_sticky != window->always_sticky)
set_allowed_actions_hint (window);
@ -5705,10 +5612,6 @@ meta_window_recalc_features (MetaWindow *window)
g_object_notify_by_pspec (G_OBJECT (window), obj_props[PROP_RESIZEABLE]);
meta_window_frame_size_changed (window);
/* FIXME perhaps should ensure if we don't have a shade func,
* we aren't shaded, etc.
*/
}
void
@ -6468,12 +6371,6 @@ meta_window_has_focus (MetaWindow *window)
return window->has_focus;
}
gboolean
meta_window_is_shaded (MetaWindow *window)
{
return window->shaded;
}
/**
* meta_window_is_override_redirect:
* @window: A #MetaWindow
@ -7152,7 +7049,7 @@ meta_window_find_tile_match (MetaWindow *window,
MetaStack *stack;
MetaTileMode match_tile_mode = META_TILE_NONE;
if (window->shaded || window->minimized)
if (window->minimized)
return NULL;
if (current_mode == META_TILE_LEFT)
@ -7168,8 +7065,7 @@ meta_window_find_tile_match (MetaWindow *window,
match;
match = meta_stack_get_below (stack, match, FALSE))
{
if (!match->shaded &&
!match->minimized &&
if (!match->minimized &&
match->tile_mode == match_tile_mode &&
match->tile_monitor_number == window->tile_monitor_number &&
meta_window_get_workspace (match) == meta_window_get_workspace (window))
@ -7781,12 +7677,6 @@ meta_window_can_minimize (MetaWindow *window)
return window->has_minimize_func;
}
gboolean
meta_window_can_shade (MetaWindow *window)
{
return window->has_shade_func;
}
gboolean
meta_window_can_close (MetaWindow *window)
{

View File

@ -36,10 +36,8 @@ typedef enum _MetaCompositorType
* @META_FRAME_ALLOWS_VERTICAL_RESIZE: frame allows vertical resize
* @META_FRAME_ALLOWS_HORIZONTAL_RESIZE: frame allows horizontal resize
* @META_FRAME_HAS_FOCUS: frame has focus
* @META_FRAME_SHADED: frame is shaded
* @META_FRAME_STUCK: frame is stuck
* @META_FRAME_MAXIMIZED: frame is maximized
* @META_FRAME_ALLOWS_SHADE: frame allows shade
* @META_FRAME_ALLOWS_MOVE: frame allows move
* @META_FRAME_FULLSCREEN: frame allows fullscreen
* @META_FRAME_ABOVE: frame is above
@ -55,15 +53,13 @@ typedef enum
META_FRAME_ALLOWS_VERTICAL_RESIZE = 1 << 4,
META_FRAME_ALLOWS_HORIZONTAL_RESIZE = 1 << 5,
META_FRAME_HAS_FOCUS = 1 << 6,
META_FRAME_SHADED = 1 << 7,
META_FRAME_STUCK = 1 << 8,
META_FRAME_MAXIMIZED = 1 << 9,
META_FRAME_ALLOWS_SHADE = 1 << 10,
META_FRAME_ALLOWS_MOVE = 1 << 11,
META_FRAME_FULLSCREEN = 1 << 12,
META_FRAME_ABOVE = 1 << 13,
META_FRAME_TILED_LEFT = 1 << 14,
META_FRAME_TILED_RIGHT = 1 << 15
META_FRAME_STUCK = 1 << 7,
META_FRAME_MAXIMIZED = 1 << 8,
META_FRAME_ALLOWS_MOVE = 1 << 9,
META_FRAME_FULLSCREEN = 1 << 10,
META_FRAME_ABOVE = 1 << 11,
META_FRAME_TILED_LEFT = 1 << 12,
META_FRAME_TILED_RIGHT = 1 << 13
} MetaFrameFlags;
/**

View File

@ -115,9 +115,6 @@ gboolean meta_window_has_focus (MetaWindow *window);
META_EXPORT
gboolean meta_window_appears_focused (MetaWindow *window);
META_EXPORT
gboolean meta_window_is_shaded (MetaWindow *window);
META_EXPORT
gboolean meta_window_is_override_redirect (MetaWindow *window);
@ -373,14 +370,6 @@ void meta_window_make_above (MetaWindow *window);
META_EXPORT
void meta_window_unmake_above (MetaWindow *window);
META_EXPORT
void meta_window_shade (MetaWindow *window,
guint32 timestamp);
META_EXPORT
void meta_window_unshade (MetaWindow *window,
guint32 timestamp);
META_EXPORT
void meta_window_stick (MetaWindow *window);
@ -424,9 +413,6 @@ gboolean meta_window_can_maximize (MetaWindow *window);
META_EXPORT
gboolean meta_window_can_minimize (MetaWindow *window);
META_EXPORT
gboolean meta_window_can_shade (MetaWindow *window);
META_EXPORT
gboolean meta_window_can_close (MetaWindow *window);

View File

@ -309,11 +309,8 @@ gtk_surface_titlebar_gesture (struct wl_client *client,
meta_window_show_menu (window, META_WINDOW_MENU_WM, x, y);
break;
case G_DESKTOP_TITLEBAR_ACTION_TOGGLE_SHADE:
g_warning ("No shade! The library is closed.");
G_GNUC_FALLTHROUGH;
default:
return;
break;
}
}

View File

@ -110,7 +110,6 @@ item(_NET_SUPPORTED)
item(_NET_WM_NAME)
item(_NET_CLOSE_WINDOW)
item(_NET_WM_STATE)
item(_NET_WM_STATE_SHADED)
item(_NET_WM_STATE_MAXIMIZED_HORZ)
item(_NET_WM_STATE_MAXIMIZED_VERT)
item(_NET_WM_DESKTOP)

View File

@ -802,7 +802,7 @@ handle_window_focus_event (MetaX11Display *x11_display,
const char *window_type;
/* Note the event can be on either the window or the frame,
* we focus the frame for shaded windows
* we focus the frame for output-only windows
*/
if (window)
{

View File

@ -783,7 +783,6 @@ reload_net_wm_state (MetaWindow *window,
return;
}
window->shaded = FALSE;
window->maximized_horizontally = FALSE;
window->maximized_vertically = FALSE;
window->fullscreen = FALSE;
@ -800,9 +799,7 @@ reload_net_wm_state (MetaWindow *window,
i = 0;
while (i < value->v.atom_list.n_atoms)
{
if (value->v.atom_list.atoms[i] == x11_display->atom__NET_WM_STATE_SHADED)
window->shaded = TRUE;
else if (value->v.atom_list.atoms[i] == x11_display->atom__NET_WM_STATE_MAXIMIZED_HORZ)
if (value->v.atom_list.atoms[i] == x11_display->atom__NET_WM_STATE_MAXIMIZED_HORZ)
window->maximize_horizontally_after_placement = TRUE;
else if (value->v.atom_list.atoms[i] == x11_display->atom__NET_WM_STATE_MAXIMIZED_VERT)
window->maximize_vertically_after_placement = TRUE;

View File

@ -974,9 +974,6 @@ maybe_focus_default_window (MetaDisplay *display,
if (focus_window->input)
break;
if (focus_window->shaded && focus_window->frame)
break;
}
focus_candidates_maybe_take_and_focus_next (&focus_candidates, timestamp);
@ -989,14 +986,13 @@ meta_window_x11_focus (MetaWindow *window,
MetaWindowX11 *window_x11 = META_WINDOW_X11 (window);
MetaWindowX11Private *priv =
meta_window_x11_get_instance_private (window_x11);
/* For output-only or shaded windows, focus the frame.
/* For output-only windows, focus the frame.
* This seems to result in the client window getting key events
* though, so I don't know if it's icccm-compliant.
*
* Still, we have to do this or keynav breaks for these windows.
*/
if (window->frame &&
(window->shaded || !meta_window_is_focusable (window)))
if (window->frame && !meta_window_is_focusable (window))
{
meta_topic (META_DEBUG_FOCUS,
"Focusing frame of %s", window->desc);
@ -1333,11 +1329,7 @@ meta_window_x11_move_resize_internal (MetaWindow *window,
/* Compute new frame size */
new_w = window->rect.width + borders.invisible.left + borders.invisible.right;
if (window->shaded)
new_h = borders.total.top + borders.total.bottom;
else
new_h = window->rect.height + borders.invisible.top + borders.invisible.bottom;
new_h = window->rect.height + borders.invisible.top + borders.invisible.bottom;
if (new_w != window->frame->rect.width ||
new_h != window->frame->rect.height)
@ -2254,11 +2246,6 @@ meta_window_x11_set_net_wm_state (MetaWindow *window)
unsigned long data[13];
i = 0;
if (window->shaded)
{
data[i] = x11_display->atom__NET_WM_STATE_SHADED;
++i;
}
if (priv->wm_state_modal)
{
data[i] = x11_display->atom__NET_WM_STATE_MODAL;
@ -2289,7 +2276,7 @@ meta_window_x11_set_net_wm_state (MetaWindow *window)
data[i] = x11_display->atom__NET_WM_STATE_FULLSCREEN;
++i;
}
if (!meta_window_showing_on_its_workspace (window) || window->shaded)
if (!meta_window_showing_on_its_workspace (window))
{
data[i] = x11_display->atom__NET_WM_STATE_HIDDEN;
++i;
@ -3132,26 +3119,6 @@ meta_window_x11_client_message (MetaWindow *window,
meta_XFree (str2);
}
if (first == x11_display->atom__NET_WM_STATE_SHADED ||
second == x11_display->atom__NET_WM_STATE_SHADED)
{
gboolean shade;
guint32 timestamp;
/* Stupid protocol has no timestamp; of course, shading
* sucks anyway so who really cares that we're forced to do
* a roundtrip here?
*/
timestamp = meta_display_get_current_time_roundtrip (window->display);
shade = (action == _NET_WM_STATE_ADD ||
(action == _NET_WM_STATE_TOGGLE && !window->shaded));
if (shade && window->has_shade_func)
meta_window_shade (window, timestamp);
else
meta_window_unshade (window, timestamp);
}
if (first == x11_display->atom__NET_WM_STATE_FULLSCREEN ||
second == x11_display->atom__NET_WM_STATE_FULLSCREEN)
{
@ -4087,11 +4054,6 @@ meta_window_x11_set_allowed_actions_hint (MetaWindow *window)
data[i] = x11_display->atom__NET_WM_ACTION_MINIMIZE;
++i;
}
if (window->has_shade_func)
{
data[i] = x11_display->atom__NET_WM_ACTION_SHADE;
++i;
}
/* sticky according to EWMH is different from mutter's sticky;
* mutter doesn't support EWMH sticky
*/