[gupnp-tools] av-cp: Fix default resolution
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp-tools] av-cp: Fix default resolution
- Date: Tue, 24 Nov 2015 21:53:53 +0000 (UTC)
commit e852337c6cf7408fb0cc9461b493de3366ef6fd6
Author: Jens Georg <mail jensge org>
Date: Tue Nov 24 22:48:41 2015 +0100
av-cp: Fix default resolution
Scale to 40% of screen size, but keep aspect ratio of 5/4.
Signed-off-by: Jens Georg <mail jensge org>
https://bugzilla.gnome.org/show_bug.cgi?id=697954
src/av-cp/gui.c | 16 ++++++++++++++--
1 files changed, 14 insertions(+), 2 deletions(-)
---
diff --git a/src/av-cp/gui.c b/src/av-cp/gui.c
index a0d96fe..f1385ae 100644
--- a/src/av-cp/gui.c
+++ b/src/av-cp/gui.c
@@ -90,6 +90,8 @@ init_ui (void)
{
gint window_width, window_height;
GError *error = NULL;
+ double w = 0.0;
+ double h = 0.0;
builder = gtk_builder_new ();
g_assert (builder != NULL);
@@ -115,8 +117,18 @@ init_ui (void)
g_assert (rescan_button != NULL);
/* 40% of the screen but don't get bigger than 1000x800 */
- window_width = CLAMP ((gdk_screen_width () * 40 / 100), 10, 1000);
- window_height = CLAMP ((gdk_screen_height () * 40 / 100), 10, 800);
+ w = gdk_screen_width () * 0.4;
+ h = gdk_screen_height () * 0.4;
+
+ /* Keep 5/4 aspect */
+ if (w/h > 1.25) {
+ h = w / 1.25;
+ } else {
+ w = h * 1.25;
+ }
+
+ window_width = CLAMP ((int) w, 10, 1000);
+ window_height = CLAMP ((int) h, 10, 800);
gtk_window_set_default_size (GTK_WINDOW (main_window),
window_width,
window_height);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]