summaryrefslogtreecommitdiff
path: root/src/ui/tabpopup.c
diff options
context:
space:
mode:
authorVictor Kareh <[email protected]>2019-01-22 10:54:54 -0500
committerlukefromdc <[email protected]>2019-01-31 20:00:19 +0000
commit8abba9a150e4004004609ff7a1c72a188f170d5f (patch)
tree73898365c201433d6c0325676f1440d76bf8ef06 /src/ui/tabpopup.c
parenta931b089754c0fc3e43705e9ac2137803274dced (diff)
downloadmarco-8abba9a150e4004004609ff7a1c72a188f170d5f.tar.bz2
marco-8abba9a150e4004004609ff7a1c72a188f170d5f.tar.xz
Increase icon size on tab and workspace popups
Alt+Tab and Workspace popups should be sized relative to the monitor size. This way they look nice and large regardless of the display resolution. Also, given much larger modern resolutions, icon sizes should be larger by default.
Diffstat (limited to 'src/ui/tabpopup.c')
-rw-r--r--src/ui/tabpopup.c43
1 files changed, 34 insertions, 9 deletions
diff --git a/src/ui/tabpopup.c b/src/ui/tabpopup.c
index 8cfeb3ec..49524d80 100644
--- a/src/ui/tabpopup.c
+++ b/src/ui/tabpopup.c
@@ -68,7 +68,8 @@ static GtkWidget* selectable_image_new (GdkPixbuf *pixbuf);
static void select_image (GtkWidget *widget);
static void unselect_image (GtkWidget *widget);
-static GtkWidget* selectable_workspace_new (MetaWorkspace *workspace);
+static GtkWidget* selectable_workspace_new (MetaWorkspace *workspace,
+ int entry_count);
static void select_workspace (GtkWidget *widget);
static void unselect_workspace (GtkWidget *widget);
@@ -361,7 +362,7 @@ meta_ui_tab_popup_new (const MetaTabEntry *entries,
}
else
{
- image = selectable_workspace_new ((MetaWorkspace *) te->key);
+ image = selectable_workspace_new ((MetaWorkspace *) te->key, entry_count);
}
te->widget = image;
@@ -753,23 +754,47 @@ struct _MetaSelectWorkspaceClass
static GType meta_select_workspace_get_type (void) G_GNUC_CONST;
#define SELECT_OUTLINE_WIDTH 2
-#define MINI_WORKSPACE_WIDTH 48
+#define MINI_WORKSPACE_SCALE 2
static GtkWidget*
-selectable_workspace_new (MetaWorkspace *workspace)
+selectable_workspace_new (MetaWorkspace *workspace, int entry_count)
{
GtkWidget *widget;
- double screen_aspect;
+ GdkMonitor *monitor;
+ GdkRectangle rect;
+ int mini_workspace_width, mini_workspace_height;
+ double mini_workspace_ratio;
widget = g_object_new (meta_select_workspace_get_type (), NULL);
- screen_aspect = (double) workspace->screen->rect.height /
- (double) workspace->screen->rect.width;
+ monitor = meta_screen_get_current_monitor ();
+ if (monitor != NULL)
+ {
+ gdk_monitor_get_geometry (monitor, &rect);
+ }
+ else
+ {
+ rect.width = workspace->screen->rect.width;
+ rect.height = workspace->screen->rect.height;
+ }
+
+ if (workspace->screen->rect.width < workspace->screen->rect.height)
+ {
+ mini_workspace_ratio = (double) workspace->screen->rect.width / (double) workspace->screen->rect.height;
+ mini_workspace_height = (int) ((double) rect.height / entry_count - SELECT_OUTLINE_WIDTH * 2);
+ mini_workspace_width = (int) ((double) mini_workspace_height * mini_workspace_ratio);
+ }
+ else
+ {
+ mini_workspace_ratio = (double) workspace->screen->rect.height / (double) workspace->screen->rect.width;
+ mini_workspace_width = (int) ((double) rect.width / entry_count - SELECT_OUTLINE_WIDTH * 2);
+ mini_workspace_height = (int) ((double) mini_workspace_width * mini_workspace_ratio);
+ }
/* account for select rect */
gtk_widget_set_size_request (widget,
- MINI_WORKSPACE_WIDTH + SELECT_OUTLINE_WIDTH * 2,
- MINI_WORKSPACE_WIDTH * screen_aspect + SELECT_OUTLINE_WIDTH * 2);
+ mini_workspace_width / MINI_WORKSPACE_SCALE,
+ mini_workspace_height / MINI_WORKSPACE_SCALE);
META_SELECT_WORKSPACE (widget)->workspace = workspace;