Commit aab0e5f7 authored by Alberts Muktupāvels's avatar Alberts Muktupāvels

remove reduced-resources setting

Reduced resources setting was used to disable minimize effect and
to show wireframe when moving or resizing windows.

Minimize effect still can be disabled by using enable-animations
setting from org.gnome.desktop.interface schema. And if you are
really trying to reduce resource usage you probably already have
animations disabled.

Wireframe mode has not been updated/fixed to work with CSD windows
and/or to exclude shadow/resize area from SSD windows. Also quickly
testing with and without compositor wireframe sometimes leaves
parts of frame on screen.

Considering that there has not been any bug report about broken
wireframe mode I think it is time to remove it instead of wasting
time trying to fix something that nobody is using.
parent 7e9767a7
Pipeline #164268 passed with stages
in 7 minutes and 40 seconds
......@@ -364,22 +364,6 @@ A: This one is also in rationales.txt. Because "ouija board" UI, where
http://pobox.com/~hp/free-software-ui.html
http://pobox.com/~hp/features.html
Q: Why does wireframe move/resize suck?
A: You can turn it on with the reduced_resources setting.
But: it has low usability, and is a pain
to implement, and there's no reason opaque move/resize should be a
problem on any setup that can run a modern desktop worth a darn to
begin with.
Read these and the bugzilla stuff before asking/commenting:
http://pobox.com/~hp/free-software-ui.html
http://pobox.com/~hp/features.html
The reason we had to add wireframe anyway was broken
proprietary apps that can't handle lots of resize events.
Q: Why no XYZ?
A: You are probably getting the idea by now - check rationales.txt,
......
......@@ -52,20 +52,6 @@
</description>
</key>
<key name="reduced-resources" type="b">
<default>false</default>
<summary>If true, trade off usability for less resource usage</summary>
<description>
If true, Metacity will give the user less feedback by using wireframes,
avoiding animations, or other means. This is a significant reduction
in usability for many users, but may allow legacy applications to
continue working, and may also be a useful tradeoff
for terminal servers.
However, the wireframe feature is disabled when accessibility is on.
</description>
</key>
<child schema="org.gnome.metacity.keybindings" name="keybindings" />
<child schema="org.gnome.metacity.theme" name="theme" />
......
......@@ -179,11 +179,7 @@ struct _MetaDisplay
gulong grab_mask;
guint grab_have_pointer : 1;
guint grab_have_keyboard : 1;
guint grab_wireframe_active : 1;
guint grab_was_cancelled : 1; /* Only used in wireframe mode */
guint grab_frame_action : 1;
MetaRectangle grab_wireframe_rect;
MetaRectangle grab_wireframe_last_xor_rect;
/* During a resize operation, the directions in which we've broken
* out of the initial maximization state */
guint grab_resize_unmaximize : 2; /* MetaMaximizeFlags */
......@@ -193,8 +189,6 @@ struct _MetaDisplay
MetaResizePopup *grab_resize_popup;
gint64 grab_last_moveresize_time;
guint32 grab_motion_notify_time;
int grab_wireframe_last_display_width;
int grab_wireframe_last_display_height;
GList* grab_old_window_stacking;
MetaEdgeResistanceData *grab_edge_resistance_data;
unsigned int grab_last_user_action_was_snap;
......
......@@ -523,7 +523,6 @@ meta_display_open (void)
#endif
the_display->grab_op = META_GRAB_OP_NONE;
the_display->grab_wireframe_active = FALSE;
the_display->grab_window = NULL;
the_display->grab_screen = NULL;
the_display->grab_resize_popup = NULL;
......@@ -3691,7 +3690,6 @@ meta_display_begin_grab_op (MetaDisplay *display,
display->grab_motion_notify_time = 0;
display->grab_old_window_stacking = NULL;
display->grab_last_user_action_was_snap = FALSE;
display->grab_was_cancelled = FALSE;
display->grab_frame_action = frame_action;
if (display->grab_resize_timeout_id)
......@@ -3706,19 +3704,7 @@ meta_display_begin_grab_op (MetaDisplay *display,
&display->grab_initial_window_pos);
display->grab_anchor_window_pos = display->grab_initial_window_pos;
display->grab_wireframe_active =
(meta_prefs_get_reduced_resources () && !meta_prefs_get_gnome_accessibility ()) &&
(meta_grab_op_is_resizing (display->grab_op) ||
meta_grab_op_is_moving (display->grab_op));
if (display->grab_wireframe_active)
{
meta_window_calc_showing (display->grab_window);
meta_window_begin_wireframe (window);
}
if (!display->grab_wireframe_active &&
meta_grab_op_is_resizing (display->grab_op) &&
if (meta_grab_op_is_resizing (display->grab_op) &&
display->grab_window->sync_request_counter != None)
{
meta_window_create_sync_request_alarm (display->grab_window);
......@@ -3892,28 +3878,6 @@ meta_display_end_grab_op (MetaDisplay *display,
display->grab_old_window_stacking = NULL;
}
if (display->grab_wireframe_active)
{
display->grab_wireframe_active = FALSE;
meta_window_end_wireframe (display->grab_window);
if (!display->grab_was_cancelled)
{
if (meta_grab_op_is_moving (display->grab_op))
meta_window_move (display->grab_window,
TRUE,
display->grab_wireframe_rect.x,
display->grab_wireframe_rect.y);
if (meta_grab_op_is_resizing (display->grab_op))
meta_window_resize_with_gravity (display->grab_window,
TRUE,
display->grab_wireframe_rect.width,
display->grab_wireframe_rect.height,
meta_resize_gravity_from_grab_op (display->grab_op));
}
meta_window_calc_showing (display->grab_window);
}
if (display->grab_have_pointer)
{
meta_topic (META_DEBUG_WINDOW_OPS,
......
......@@ -1010,17 +1010,8 @@ meta_window_edge_resistance_for_move (MetaWindow *window,
MetaRectangle old_outer, proposed_outer, new_outer;
gboolean is_resize;
if (window == window->display->grab_window &&
window->display->grab_wireframe_active)
{
meta_window_get_xor_rect (window,
&window->display->grab_wireframe_rect,
&old_outer);
}
else
{
meta_window_get_outer_rect (window, &old_outer);
}
meta_window_get_outer_rect (window, &old_outer);
proposed_outer = old_outer;
proposed_outer.x += (*new_x - old_x);
proposed_outer.y += (*new_y - old_y);
......@@ -1103,17 +1094,8 @@ meta_window_edge_resistance_for_resize (MetaWindow *window,
int proposed_outer_width, proposed_outer_height;
gboolean is_resize;
if (window == window->display->grab_window &&
window->display->grab_wireframe_active)
{
meta_window_get_xor_rect (window,
&window->display->grab_wireframe_rect,
&old_outer);
}
else
{
meta_window_get_outer_rect (window, &old_outer);
}
meta_window_get_outer_rect (window, &old_outer);
proposed_outer_width = old_outer.width + (*new_width - old_width);
proposed_outer_height = old_outer.height + (*new_height - old_height);
meta_rectangle_resize_with_gravity (&old_outer,
......
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/**
* \file effects.c "Special effects" other than compositor effects.
*
* Before we had a serious compositor, we supported swooping
* rectangles for minimising and so on. These are still supported
* today, even when the compositor is enabled. The file contains two
* parts:
*
* 1) A set of functions, each of which implements a special effect.
* (Only the minimize function does anything interesting; we should
* probably get rid of the rest.)
*
* 2) A set of functions for moving a highlighted wireframe box around
* the screen, optionally with height and width shown in the middle.
* This is used for moving and resizing when reduced_resources is set.
*
* There was formerly a system which allowed callers to drop in their
* own handlers for various things; it was never used (people who want
* their own handlers can just modify this file, after all) and it added
* a good deal of extra complexity, so it has been removed. If you want it,
* it can be found in svn r3769.
*
* Once upon a time there were three different ways of drawing the box
* animation: window wireframe, window opaque, and root. People who had
* the shape extension theoretically had the choice of all three, and
* people who didn't weren't given the choice of the wireframe option.
* In practice, though, the opaque animation was never perfect, so it came
* down to the wireframe option for those who had the extension and
* the root option for those who didn't; there was actually no way of choosing
* any other option anyway. Work on the opaque animation stopped in 2002;
* anyone who wants something like that these days will be using the
* compositor anyway.
*
* In svn r3769 this was made explicit.
*/
/*
* Copyright (C) 2001 Anders Carlsson, Havoc Pennington
*
......@@ -275,198 +239,3 @@ draw_box_animation (MetaScreen *screen,
/* kick changes onto the server */
XFlush (context->screen->display->xdisplay);
}
void
meta_effects_begin_wireframe (MetaScreen *screen,
const MetaRectangle *rect,
int width,
int height)
{
/* Grab the X server to avoid screen dirt */
meta_display_grab (screen->display);
meta_ui_push_delay_exposes (screen->ui);
meta_effects_update_wireframe (screen,
NULL, -1, -1,
rect, width, height);
}
static void
draw_xor_rect (MetaScreen *screen,
const MetaRectangle *rect,
int width,
int height)
{
/* The lines in the center can't overlap the rectangle or each
* other, or the XOR gets reversed. So we have to draw things
* a bit oddly.
*/
XSegment segments[8];
MetaRectangle shrunk_rect;
int i;
#define LINE_WIDTH META_WIREFRAME_XOR_LINE_WIDTH
/* We don't want the wireframe going outside the window area.
* It makes it harder for the user to position windows and it exposes other
* annoying bugs.
*/
shrunk_rect = *rect;
shrunk_rect.x += LINE_WIDTH / 2 + LINE_WIDTH % 2;
shrunk_rect.y += LINE_WIDTH / 2 + LINE_WIDTH % 2;
shrunk_rect.width -= LINE_WIDTH + 2 * (LINE_WIDTH % 2);
shrunk_rect.height -= LINE_WIDTH + 2 * (LINE_WIDTH % 2);
XDrawRectangle (screen->display->xdisplay,
screen->xroot,
screen->root_xor_gc,
shrunk_rect.x, shrunk_rect.y,
shrunk_rect.width, shrunk_rect.height);
/* Don't put lines inside small rectangles where they won't fit */
if (shrunk_rect.width < (LINE_WIDTH * 4) ||
shrunk_rect.height < (LINE_WIDTH * 4))
return;
if ((width >= 0) && (height >= 0))
{
XGCValues gc_values = { 0 };
if (XGetGCValues (screen->display->xdisplay,
screen->root_xor_gc,
GCFont, &gc_values))
{
char *text;
int text_length;
XFontStruct *font_struct;
int text_width, text_height;
int box_x, box_y;
int box_width, box_height;
font_struct = XQueryFont (screen->display->xdisplay,
gc_values.font);
if (font_struct != NULL)
{
text = g_strdup_printf ("%d x %d", width, height);
text_length = strlen (text);
text_width = text_length * font_struct->max_bounds.width;
text_height = font_struct->max_bounds.descent +
font_struct->max_bounds.ascent;
box_width = text_width + 2 * LINE_WIDTH;
box_height = text_height + 2 * LINE_WIDTH;
box_x = shrunk_rect.x + (shrunk_rect.width - box_width) / 2;
box_y = shrunk_rect.y + (shrunk_rect.height - box_height) / 2;
if ((box_width < shrunk_rect.width) &&
(box_height < shrunk_rect.height))
{
XFillRectangle (screen->display->xdisplay,
screen->xroot,
screen->root_xor_gc,
box_x, box_y,
box_width, box_height);
XDrawString (screen->display->xdisplay,
screen->xroot,
screen->root_xor_gc,
box_x + LINE_WIDTH,
box_y + LINE_WIDTH + font_struct->max_bounds.ascent,
text, text_length);
}
g_free (text);
XFreeFontInfo (NULL, font_struct, 1);
if ((box_width + LINE_WIDTH) >= (shrunk_rect.width / 3))
return;
if ((box_height + LINE_WIDTH) >= (shrunk_rect.height / 3))
return;
}
}
}
/* Two vertical lines at 1/3 and 2/3 */
segments[0].x1 = shrunk_rect.x + shrunk_rect.width / 3;
segments[0].y1 = shrunk_rect.y + LINE_WIDTH / 2 + LINE_WIDTH % 2;
segments[0].x2 = segments[0].x1;
segments[0].y2 = shrunk_rect.y + shrunk_rect.height - LINE_WIDTH / 2;
segments[1] = segments[0];
segments[1].x1 = shrunk_rect.x + (shrunk_rect.width / 3) * 2;
segments[1].x2 = segments[1].x1;
/* Now make two horizontal lines at 1/3 and 2/3, but not
* overlapping the verticals
*/
segments[2].x1 = shrunk_rect.x + LINE_WIDTH / 2 + LINE_WIDTH % 2;
segments[2].x2 = segments[0].x1 - LINE_WIDTH / 2;
segments[2].y1 = shrunk_rect.y + shrunk_rect.height / 3;
segments[2].y2 = segments[2].y1;
segments[3] = segments[2];
segments[3].x1 = segments[2].x2 + LINE_WIDTH;
segments[3].x2 = segments[1].x1 - LINE_WIDTH / 2;
segments[4] = segments[3];
segments[4].x1 = segments[3].x2 + LINE_WIDTH;
segments[4].x2 = shrunk_rect.x + shrunk_rect.width - LINE_WIDTH / 2;
/* Second horizontal line is just like the first, but
* shifted down
*/
i = 5;
while (i < 8)
{
segments[i] = segments[i - 3];
segments[i].y1 = shrunk_rect.y + (shrunk_rect.height / 3) * 2;
segments[i].y2 = segments[i].y1;
++i;
}
XDrawSegments (screen->display->xdisplay,
screen->xroot,
screen->root_xor_gc,
segments,
G_N_ELEMENTS (segments));
}
void
meta_effects_update_wireframe (MetaScreen *screen,
const MetaRectangle *old_rect,
int old_width,
int old_height,
const MetaRectangle *new_rect,
int new_width,
int new_height)
{
if (old_rect)
draw_xor_rect (screen, old_rect, old_width, old_height);
if (new_rect)
draw_xor_rect (screen, new_rect, new_width, new_height);
XFlush (screen->display->xdisplay);
}
void
meta_effects_end_wireframe (MetaScreen *screen,
const MetaRectangle *old_rect,
int old_width,
int old_height)
{
meta_effects_update_wireframe (screen,
old_rect, old_width, old_height,
NULL, -1, -1);
meta_display_ungrab (screen->display);
meta_ui_pop_delay_exposes (screen->ui);
}
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/**
* \file effects.h "Special effects" other than compositor effects.
*
* Before we had a serious compositor, we supported swooping
* rectangles for minimising and so on. These are still supported
* today, even when the compositor is enabled. The file contains two
* parts:
*
* 1) A set of functions, each of which implements a special effect.
* (Only the minimize function does anything interesting; we should
* probably get rid of the rest.)
*
* 2) A set of functions for moving a highlighted wireframe box around
* the screen, optionally with height and width shown in the middle.
* This is used for moving and resizing when reduced_resources is set.
*
* There was formerly a system which allowed callers to drop in their
* own handlers for various things; it was never used (people who want
* their own handlers can just modify this file, after all) and it added
* a good deal of extra complexity, so it has been removed. If you want it,
* it can be found in svn r3769.
*/
/*
* Copyright (C) 2001 Anders Carlsson, Havoc Pennington
*
......@@ -56,54 +33,4 @@ void meta_effect_run_minimize (MetaWindow *window,
MetaRectangle *window_rect,
MetaRectangle *target);
/**
* Grabs the server and paints a wireframe rectangle on the screen.
* Since this involves starting a grab, please be considerate of other
* users and don't keep the grab for long. You may move the wireframe
* around using meta_effects_update_wireframe() and remove it, and undo
* the grab, using meta_effects_end_wireframe().
*
* \param screen The screen to draw the rectangle on.
* \param rect The size of the rectangle to draw.
* \param width The width to display in the middle (or 0 not to)
* \param height The width to display in the middle (or 0 not to)
*/
void meta_effects_begin_wireframe (MetaScreen *screen,
const MetaRectangle *rect,
int width,
int height);
/**
* Moves a wireframe rectangle around after its creation by
* meta_effects_begin_wireframe(). (Perhaps we ought to remember the old
* positions and not require people to pass them in?)
*
* \param old_rect Where the rectangle is now
* \param old_width The width that was displayed on it (or 0 if there wasn't)
* \param old_height The height that was displayed on it (or 0 if there wasn't)
* \param new_rect Where the rectangle is going
* \param new_width The width that will be displayed on it (or 0 not to)
* \param new_height The height that will be displayed on it (or 0 not to)
*/
void meta_effects_update_wireframe (MetaScreen *screen,
const MetaRectangle *old_rect,
int old_width,
int old_height,
const MetaRectangle *new_rect,
int new_width,
int new_height);
/**
* Removes a wireframe rectangle from the screen and ends the grab started by
* meta_effects_begin_wireframe().
*
* \param old_rect Where the rectangle is now
* \param old_width The width that was displayed on it (or 0 if there wasn't)
* \param old_height The height that was displayed on it (or 0 if there wasn't)
*/
void meta_effects_end_wireframe (MetaScreen *screen,
const MetaRectangle *old_rect,
int width,
int height);
#endif /* META_EFFECTS_H */
......@@ -1400,9 +1400,7 @@ process_mouse_move_resize_grab (MetaDisplay *display,
/* End move or resize and restore to original state. If the
* window was a maximized window that had been "shaken loose" we
* need to remaximize it. In normal cases, we need to do a
* moveresize now to get the position back to the original. In
* wireframe mode, we just need to set grab_was_cancelled to tru
* to avoid avoid moveresizing to the position of the wireframe.
* moveresize now to get the position back to the original.
*/
if (window->shaken_loose)
meta_window_maximize (window,
......@@ -1410,15 +1408,13 @@ process_mouse_move_resize_grab (MetaDisplay *display,
META_MAXIMIZE_VERTICAL);
else if (window->tile_mode == META_TILE_LEFT || window->tile_mode == META_TILE_RIGHT)
meta_window_tile (window);
else if (!display->grab_wireframe_active)
else
meta_window_move_resize (display->grab_window,
TRUE,
display->grab_initial_window_pos.x,
display->grab_initial_window_pos.y,
display->grab_initial_window_pos.width,
display->grab_initial_window_pos.height);
else
display->grab_was_cancelled = TRUE;
/* End grab */
return FALSE;
......@@ -1449,15 +1445,7 @@ process_keyboard_move_grab (MetaDisplay *display,
if (is_modifier (display, event->xkey.keycode))
return TRUE;
if (display->grab_wireframe_active)
{
x = display->grab_wireframe_rect.x;
y = display->grab_wireframe_rect.y;
}
else
{
meta_window_get_position (window, &x, &y);
}
meta_window_get_position (window, &x, &y);
smart_snap = (event->xkey.state & ShiftMask) != 0;
......@@ -1476,23 +1464,19 @@ process_keyboard_move_grab (MetaDisplay *display,
/* End move and restore to original state. If the window was a
* maximized window that had been "shaken loose" we need to
* remaximize it. In normal cases, we need to do a moveresize
* now to get the position back to the original. In wireframe
* mode, we just need to set grab_was_cancelled to tru to avoid
* avoid moveresizing to the position of the wireframe.
* now to get the position back to the original.
*/
if (window->shaken_loose)
meta_window_maximize (window,
META_MAXIMIZE_HORIZONTAL |
META_MAXIMIZE_VERTICAL);
else if (!display->grab_wireframe_active)
else
meta_window_move_resize (display->grab_window,
TRUE,
display->grab_initial_window_pos.x,
display->grab_initial_window_pos.y,
display->grab_initial_window_pos.width,
display->grab_initial_window_pos.height);
else
display->grab_was_cancelled = TRUE;
}
/* When moving by increments, we still snap to edges if the move
......@@ -1547,10 +1531,7 @@ process_keyboard_move_grab (MetaDisplay *display,
"Computed new window location %d,%d due to keypress\n",
x, y);
if (display->grab_wireframe_active)
old_rect = display->grab_wireframe_rect;
else
meta_window_get_client_root_coords (window, &old_rect);
meta_window_get_client_root_coords (window, &old_rect);
meta_window_edge_resistance_for_move (window,
old_rect.x,
......@@ -1560,16 +1541,7 @@ process_keyboard_move_grab (MetaDisplay *display,
smart_snap,
TRUE);
if (display->grab_wireframe_active)
{
meta_window_update_wireframe (window, x, y,
display->grab_wireframe_rect.width,
display->grab_wireframe_rect.height);
}
else
{
meta_window_move (window, TRUE, x, y);
}
meta_window_move (window, TRUE, x, y);
meta_window_update_keyboard_move (window);
}
......@@ -1768,21 +1740,13 @@ process_keyboard_resize_grab (MetaDisplay *display,
if (keysym == XK_Escape)
{
/* End resize and restore to original state. If not in
* wireframe mode, we need to do a moveresize now to get the
* position back to the original. If we are in wireframe mode,
* we need to avoid moveresizing to the position of the
* wireframe.
*/
if (!display->grab_wireframe_active)
meta_window_move_resize (display->grab_window,
TRUE,
display->grab_initial_window_pos.x,
display->grab_initial_window_pos.y,
display->grab_initial_window_pos.width,
display->grab_initial_window_pos.height);
else
display->grab_was_cancelled = TRUE;
/* End resize and restore to original state. */
meta_window_move_resize (display->grab_window,
TRUE,
display->grab_initial_window_pos.x,
display->grab_initial_window_pos.y,
di