@@ -75,17 +75,10 @@ panel_struts_get_monitor_geometry (GdkScreen *screen,
75
75
int * width ,
76
76
int * height )
77
77
{
78
- GdkDisplay * display ;
79
- int scale ;
80
-
81
- /* Use scale factor to bring strut dimensions up to application pixels to support HiDPI displays */
82
- display = gdk_screen_get_display (screen );
83
- scale = gdk_monitor_get_scale_factor (gdk_display_get_monitor (display , monitor ));
84
-
85
- * x = panel_multiscreen_x (screen , monitor ) * scale ;
86
- * y = panel_multiscreen_y (screen , monitor ) * scale ;
87
- * width = panel_multiscreen_width (screen , monitor ) * scale ;
88
- * height = panel_multiscreen_height (screen , monitor ) * scale ;
78
+ * x = panel_multiscreen_x (screen , monitor );
79
+ * y = panel_multiscreen_y (screen , monitor );
80
+ * width = panel_multiscreen_width (screen , monitor );
81
+ * height = panel_multiscreen_height (screen , monitor );
89
82
}
90
83
91
84
static PanelStrut *
@@ -263,6 +256,7 @@ panel_struts_set_window_hint (PanelToplevel *toplevel)
263
256
int monitor_x , monitor_y , monitor_width , monitor_height ;
264
257
int screen_width , screen_height ;
265
258
int leftmost , rightmost , topmost , bottommost ;
259
+ int scale ;
266
260
267
261
widget = GTK_WIDGET (toplevel );
268
262
@@ -274,10 +268,11 @@ panel_struts_set_window_hint (PanelToplevel *toplevel)
274
268
return ;
275
269
}
276
270
271
+ scale = gtk_widget_get_scale_factor (widget );
277
272
strut_size = strut -> allocated_strut_size ;
278
273
279
- screen_width = WidthOfScreen (gdk_x11_screen_get_xscreen (strut -> screen ));
280
- screen_height = HeightOfScreen (gdk_x11_screen_get_xscreen (strut -> screen ));
274
+ screen_width = WidthOfScreen (gdk_x11_screen_get_xscreen (strut -> screen )) / scale ;
275
+ screen_height = HeightOfScreen (gdk_x11_screen_get_xscreen (strut -> screen )) / scale ;
281
276
282
277
panel_struts_get_monitor_geometry (strut -> screen ,
283
278
strut -> monitor ,
@@ -322,8 +317,8 @@ panel_struts_set_window_hint (PanelToplevel *toplevel)
322
317
panel_xutils_set_strut (gtk_widget_get_window (widget ),
323
318
strut -> orientation ,
324
319
strut_size ,
325
- strut -> allocated_strut_start ,
326
- strut -> allocated_strut_end );
320
+ strut -> allocated_strut_start * scale ,
321
+ strut -> allocated_strut_end * scale );
327
322
}
328
323
329
324
void
@@ -449,24 +444,32 @@ panel_struts_register_strut (PanelToplevel *toplevel,
449
444
strut -> geometry .y = monitor_y ;
450
445
strut -> geometry .width = strut -> strut_end - strut -> strut_start + 1 ;
451
446
strut -> geometry .height = strut -> strut_size / scale ;
447
+ if (scale > 1 )
448
+ strut -> geometry .width -= (strut -> strut_size / scale );
452
449
break ;
453
450
case PANEL_ORIENTATION_BOTTOM :
454
451
strut -> geometry .x = strut -> strut_start ;
455
452
strut -> geometry .y = monitor_y + monitor_height - strut -> strut_size ;
456
453
strut -> geometry .width = strut -> strut_end - strut -> strut_start + 1 ;
457
454
strut -> geometry .height = strut -> strut_size / scale ;
455
+ if (scale > 1 )
456
+ strut -> geometry .width -= (strut -> strut_size / scale );
458
457
break ;
459
458
case PANEL_ORIENTATION_LEFT :
460
459
strut -> geometry .x = monitor_x ;
461
460
strut -> geometry .y = strut -> strut_start ;
462
461
strut -> geometry .width = strut -> strut_size / scale ;
463
462
strut -> geometry .height = strut -> strut_end - strut -> strut_start + 1 ;
463
+ if (scale > 1 )
464
+ strut -> geometry .height -= (strut -> strut_size / scale );
464
465
break ;
465
466
case PANEL_ORIENTATION_RIGHT :
466
467
strut -> geometry .x = monitor_x + monitor_width - strut -> strut_size ;
467
468
strut -> geometry .y = strut -> strut_start ;
468
469
strut -> geometry .width = strut -> strut_size / scale ;
469
470
strut -> geometry .height = strut -> strut_end - strut -> strut_start + 1 ;
471
+ if (scale > 1 )
472
+ strut -> geometry .height -= (strut -> strut_size / scale );
470
473
break ;
471
474
}
472
475
0 commit comments