summaryrefslogtreecommitdiff
path: root/src/core
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/core
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/core')
-rw-r--r--src/core/screen-private.h3
-rw-r--r--src/core/screen.c50
2 files changed, 47 insertions, 6 deletions
diff --git a/src/core/screen-private.h b/src/core/screen-private.h
index c1552ab0..6cd720d7 100644
--- a/src/core/screen-private.h
+++ b/src/core/screen-private.h
@@ -36,6 +36,7 @@
#include "display-private.h"
#include "screen.h"
#include <X11/Xutil.h>
+#include <gdk/gdk.h>
#include "ui.h"
typedef struct _MetaXineramaScreenInfo MetaXineramaScreenInfo;
@@ -193,6 +194,8 @@ void meta_screen_update_workspace_layout (MetaScreen *scree
void meta_screen_update_workspace_names (MetaScreen *screen);
void meta_screen_queue_workarea_recalc (MetaScreen *screen);
+GdkMonitor* meta_screen_get_current_monitor (void);
+
Window meta_create_offscreen_window (Display *xdisplay,
Window parent,
long valuemask);
diff --git a/src/core/screen.c b/src/core/screen.c
index 4b74ed72..8e1448ec 100644
--- a/src/core/screen.c
+++ b/src/core/screen.c
@@ -1214,7 +1214,7 @@ meta_screen_update_cursor (MetaScreen *screen)
XFreeCursor (screen->display->xdisplay, xcursor);
}
-#define MAX_PREVIEW_SIZE 150.0
+#define MAX_PREVIEW_SCALE 10.0
static GdkPixbuf *
get_window_pixbuf (MetaWindow *window,
@@ -1224,6 +1224,8 @@ get_window_pixbuf (MetaWindow *window,
MetaDisplay *display;
cairo_surface_t *surface;
GdkPixbuf *pixbuf, *scaled;
+ GdkMonitor *monitor;
+ GdkRectangle rect;
double ratio;
display = window->display;
@@ -1246,17 +1248,30 @@ get_window_pixbuf (MetaWindow *window,
*width = gdk_pixbuf_get_width (pixbuf);
*height = gdk_pixbuf_get_height (pixbuf);
- /* Scale pixbuf to max dimension MAX_PREVIEW_SIZE */
+ monitor = meta_screen_get_current_monitor ();
+ if (monitor != NULL)
+ {
+ gdk_monitor_get_geometry (monitor, &rect);
+ }
+ else
+ {
+ rect.width = window->screen->rect.width;
+ rect.height = window->screen->rect.height;
+ }
+
+ /* Scale pixbuf to max dimension based on monitor size */
if (*width > *height)
{
- ratio = ((double) *width) / MAX_PREVIEW_SIZE;
- *width = (int) MAX_PREVIEW_SIZE;
+ int max_preview_width = rect.width / MAX_PREVIEW_SCALE;
+ ratio = ((double) *width) / max_preview_width;
+ *width = (int) max_preview_width;
*height = (int) (((double) *height) / ratio);
}
else
{
- ratio = ((double) *height) / MAX_PREVIEW_SIZE;
- *height = (int) MAX_PREVIEW_SIZE;
+ int max_preview_height = rect.height / MAX_PREVIEW_SCALE;
+ ratio = ((double) *height) / max_preview_height;
+ *height = (int) max_preview_height;
*width = (int) (((double) *width) / ratio);
}
@@ -1797,6 +1812,29 @@ meta_screen_get_current_xinerama (MetaScreen *screen)
return &screen->xinerama_infos[screen->last_xinerama_index];
}
+GdkMonitor *
+meta_screen_get_current_monitor ()
+{
+ GdkDisplay *display;
+ GdkSeat *seat;
+ GdkDevice *device;
+ GdkMonitor *current;
+ gint x, y;
+
+ display = gdk_display_get_default ();
+ seat = gdk_display_get_default_seat (display);
+ device = gdk_seat_get_pointer (seat);
+
+ gdk_device_get_position (device, NULL, &x, &y);
+ current = gdk_display_get_monitor_at_point (display, x, y);
+
+ if (current != NULL) {
+ return current;
+ }
+
+ return gdk_display_get_primary_monitor (display);
+}
+
#define _NET_WM_ORIENTATION_HORZ 0
#define _NET_WM_ORIENTATION_VERT 1