display: Hide unsupported sizes

Sizes smaller than 675x530 aren't supported in the design, so
avoid them, unless they're bigger than the current output size
(so you could go up from them).

https://bugzilla.gnome.org/show_bug.cgi?id=626822
This commit is contained in:
Bastien Nocera 2011-02-01 02:28:52 +00:00
parent 8d2f8ac3ce
commit 1b97a789e8

View file

@ -44,6 +44,11 @@
#define CLOCK_SCHEMA "org.gnome.desktop.interface"
#define CLOCK_FORMAT_KEY "clock-format"
/* The minimum supported size for the panel, see:
* http://live.gnome.org/Design/SystemSettings */
#define MINIMUM_WIDTH 675
#define MINIMUM_HEIGHT 530
typedef struct App App;
typedef struct GrabInfo GrabInfo;
@ -136,6 +141,20 @@ idle_free (gchar *s)
return s;
}
static gboolean
should_show_resolution (gint output_width,
gint output_height,
gint width,
gint height)
{
if (width >= MIN (output_width, MINIMUM_WIDTH) &&
height >= MIN (output_height, MINIMUM_HEIGHT))
{
return TRUE;
}
return FALSE;
}
static void
on_screen_changed (GnomeRRScreen *scr,
gpointer data)
@ -650,9 +669,12 @@ rebuild_resolution_combo (App *app)
width = gnome_rr_mode_get_width (modes[i]);
height = gnome_rr_mode_get_height (modes[i]);
add_key (app->resolution_combo,
idle_free (make_resolution_string (width, height)),
width, height, 0, -1);
if (should_show_resolution (output_width, output_height, width, height))
{
add_key (app->resolution_combo,
idle_free (make_resolution_string (width, height)),
width, height, 0, -1);
}
}
current = idle_free (make_resolution_string (output_width, output_height));