summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2015-10-06 00:21:48 +0200
committerJavier <dev.git@javispedro.com>2015-10-06 00:21:48 +0200
commitcd72d4b9e3273c0d2db520270ae3158cb714f1f6 (patch)
treee6deed9aa1bd57a167790265f7a19660b1ef1d61
parenta22a6f9956c7911b8301d9a44ab16deab2694975 (diff)
downloadmdock-cd72d4b9e3273c0d2db520270ae3158cb714f1f6.tar.gz
mdock-cd72d4b9e3273c0d2db520270ae3158cb714f1f6.zip
early hidpi supportHEADmaster
-rw-r--r--libmdock/thumbnailer.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/libmdock/thumbnailer.c b/libmdock/thumbnailer.c
index 0e3d44c..f5030db 100644
--- a/libmdock/thumbnailer.c
+++ b/libmdock/thumbnailer.c
@@ -73,6 +73,7 @@ void thumbnailer_schedule_update(WnckWindow *window)
void thumbnailer_update_thumbnail(WnckWindow *window)
{
GdkDisplay *display = gdk_display_get_default();
+ GdkScreen *screen = gdk_display_get_default_screen(display);
ThumbnailData *tdata = g_object_get_qdata(G_OBJECT(window), mdock_thumbnail_data_quark());
g_return_if_fail(tdata);
@@ -80,17 +81,21 @@ void thumbnailer_update_thumbnail(WnckWindow *window)
GdkWindow *root = gdk_get_default_root_window();
+ gdouble scale = MAX(gdk_screen_get_resolution(screen), 96.0) / 96.0;
+ const gint max_w = THUMBNAIL_MAX_WIDTH * scale,
+ max_h = THUMBNAIL_MAX_HEIGHT * scale;
+
int screen_x, screen_y, win_x, win_y, win_w, win_h, thumb_w, thumb_h, cur_w, cur_h;
gdk_window_get_origin(root, &screen_x, &screen_y);
wnck_window_get_client_window_geometry(window, &win_x, &win_y, &win_w, &win_h);
- if (win_w > THUMBNAIL_MAX_WIDTH || win_h > THUMBNAIL_MAX_HEIGHT) {
+ if (win_w > max_w || win_h > max_h) {
if (win_h > win_w) {
- thumb_w = (THUMBNAIL_MAX_HEIGHT * win_w) / win_h;
- thumb_h = THUMBNAIL_MAX_HEIGHT;
+ thumb_w = (max_h * win_w) / win_h;
+ thumb_h = max_h;
} else {
- thumb_w = THUMBNAIL_MAX_WIDTH;
- thumb_h = (THUMBNAIL_MAX_WIDTH * win_h) / win_w;
+ thumb_w = max_w;
+ thumb_h = (max_w * win_h) / win_w;
}
} else {
thumb_w = win_w;