Skip to content

Commit 0b15ea1

Browse files
committed
hidpi: fix tray icon spacing with window-scaling > 1
1 parent ff04f33 commit 0b15ea1

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

applets/notification_area/system-tray/na-tray-child.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,8 @@ na_tray_child_get_preferred_width (GtkWidget *widget,
120120
gint *minimal_width,
121121
gint *natural_width)
122122
{
123+
gint scale;
124+
scale = gtk_widget_get_scale_factor (widget);
123125
GTK_WIDGET_CLASS (na_tray_child_parent_class)->get_preferred_width (widget,
124126
minimal_width,
125127
natural_width);
@@ -129,13 +131,18 @@ na_tray_child_get_preferred_width (GtkWidget *widget,
129131

130132
if (*natural_width < 16)
131133
*natural_width = 16;
134+
135+
*minimal_width = *minimal_width / scale;
136+
*natural_width = *natural_width / scale;
132137
}
133138

134139
static void
135140
na_tray_child_get_preferred_height (GtkWidget *widget,
136141
gint *minimal_height,
137142
gint *natural_height)
138143
{
144+
gint scale;
145+
scale = gtk_widget_get_scale_factor (widget);
139146
GTK_WIDGET_CLASS (na_tray_child_parent_class)->get_preferred_height (widget,
140147
minimal_height,
141148
natural_height);
@@ -145,6 +152,9 @@ na_tray_child_get_preferred_height (GtkWidget *widget,
145152

146153
if (*natural_height < 16)
147154
*natural_height = 16;
155+
156+
*minimal_height = *minimal_height / scale;
157+
*natural_height = *natural_height / scale;
148158
}
149159

150160
static void

applets/notification_area/system-tray/na-tray.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,8 @@ tray_added (NaTrayManager *manager,
127127

128128
na_host_emit_item_added (NA_HOST (tray), NA_ITEM (icon));
129129

130-
gtk_widget_show (GTK_WIDGET (icon));
130+
/*Does not seem to be needed anymore and can cause a render issue with hidpi*/
131+
/*gtk_widget_show (GTK_WIDGET (icon));*/
131132
}
132133

133134
static void

0 commit comments

Comments
 (0)