@@ -283,8 +283,8 @@ preview_window_thumbnail (WnckWindow *wnck_window,
283283 }
284284
285285 * thumbnail_scale = scale = gdk_window_get_scale_factor (window );
286- width = gdk_window_get_width (window ) * scale ;
287- height = gdk_window_get_height (window ) * scale ;
286+ width = gdk_window_get_width (window );
287+ height = gdk_window_get_height (window );
288288
289289 /* Strip invisible resize borders using _NET_FRAME_EXTENTS */
290290 if (frame != win )
@@ -304,10 +304,10 @@ preview_window_thumbnail (WnckWindow *wnck_window,
304304
305305 if (XGetWindowAttributes (xdpy , win , & wa ))
306306 {
307- int vis_w = (wa .width + ext [0 ] + ext [1 ]) * scale ;
308- int vis_h = (wa .height + ext [2 ] + ext [3 ]) * scale ;
309- int border_x = (wa .x - (int ) ext [0 ]) * scale ;
310- int border_y = (wa .y - (int ) ext [2 ]) * scale ;
307+ int vis_w = (wa .width + ext [0 ] + ext [1 ]) / scale ;
308+ int vis_h = (wa .height + ext [2 ] + ext [3 ]) / scale ;
309+ int border_x = (wa .x - (int ) ext [0 ]) / scale ;
310+ int border_y = (wa .y - (int ) ext [2 ]) / scale ;
311311
312312 if (border_x > 0 && vis_w < width )
313313 {
@@ -328,24 +328,24 @@ preview_window_thumbnail (WnckWindow *wnck_window,
328328 /* Scale to configured size while maintaining aspect ratio */
329329 if (width > height )
330330 {
331- int max_size = MIN (width , tasklist -> thumbnail_size * scale );
331+ int max_size = MIN (width , tasklist -> thumbnail_size );
332332 ratio = (double ) max_size / (double ) width ;
333- * thumbnail_width = max_size ;
334- * thumbnail_height = (int ) ((double ) height * ratio );
333+ * thumbnail_width = max_size * scale ;
334+ * thumbnail_height = (int ) ((double ) height * ratio ) * scale ;
335335 }
336336 else
337337 {
338- int max_size = MIN (height , tasklist -> thumbnail_size * scale );
338+ int max_size = MIN (height , tasklist -> thumbnail_size );
339339 ratio = (double ) max_size / (double ) height ;
340- * thumbnail_height = max_size ;
341- * thumbnail_width = (int ) ((double ) width * ratio );
340+ * thumbnail_height = max_size * scale ;
341+ * thumbnail_width = (int ) ((double ) width * ratio ) * scale ;
342342 }
343343
344344 gdk_x11_display_error_trap_push (gdk_window_get_display (window ));
345345
346346 GdkPixbuf * pixbuf = gdk_pixbuf_get_from_window (window ,
347- src_x / scale , src_y / scale ,
348- width / scale , height / scale );
347+ src_x , src_y ,
348+ width , height );
349349
350350 if (gdk_x11_display_error_trap_pop (gdk_window_get_display (window )) || pixbuf == NULL )
351351 {
@@ -358,7 +358,9 @@ preview_window_thumbnail (WnckWindow *wnck_window,
358358 * thumbnail_height );
359359 cairo_surface_set_device_scale (thumbnail , scale , scale );
360360 cr = cairo_create (thumbnail );
361- cairo_scale (cr , ratio , ratio );
361+ cairo_scale (cr ,
362+ (double ) * thumbnail_width / scale / gdk_pixbuf_get_width (pixbuf ),
363+ (double ) * thumbnail_height / scale / gdk_pixbuf_get_height (pixbuf ));
362364 gdk_cairo_set_source_pixbuf (cr , pixbuf , 0 , 0 );
363365 cairo_paint (cr );
364366 cairo_destroy (cr );
0 commit comments