@@ -49,12 +49,16 @@ def get_comm_logo_path(system_service: SystemService = None):
4949 return DEFAULT_COMM_LOGO_PATH
5050
5151
52- def load_svg_pixbuf (path , size ):
52+ def load_svg_texture (path , size ):
53+ """Load SVG as Gdk.Texture for better GTK4 scaling."""
5354 try :
54- return GdkPixbuf .Pixbuf .new_from_file_at_size (path , size , size )
55+ pixbuf = GdkPixbuf .Pixbuf .new_from_file_at_size (path , size , size )
56+ return Gdk .Texture .new_for_pixbuf (pixbuf )
5557 except GLib .Error as e :
5658 logger .error (f"Failed to load SVG { path } : { e } " )
57- return GdkPixbuf .Pixbuf .new (GdkPixbuf .Colorspace .RGB , True , 8 , size , size )
59+ # Create a fallback empty pixbuf and convert to texture
60+ pixbuf = GdkPixbuf .Pixbuf .new (GdkPixbuf .Colorspace .RGB , True , 8 , size , size )
61+ return Gdk .Texture .new_for_pixbuf (pixbuf )
5862
5963
6064class AppWindow (Adw .ApplicationWindow ):
@@ -234,10 +238,11 @@ def _add_step_button(self, box, step_info):
234238 button = Gtk .Button ()
235239 button .set_focusable (False )
236240 path = os .path .join (ASSETS_DIR , step_info ["file" ])
237- pixbuf = load_svg_pixbuf (path , 32 )
238- img = Gtk .Image .new_from_pixbuf (pixbuf )
241+ texture = load_svg_texture (path , 48 )
242+ img = Gtk .Image .new_from_paintable (texture )
243+ img .set_pixel_size (64 )
239244 button .set_child (img )
240- button .set_size_request (48 , 48 )
245+ button .set_size_request (64 , 64 )
241246 button .connect ("clicked" , self ._on_step_button_clicked , step_info ["name" ])
242247 button .add_css_class ("flat" )
243248
@@ -327,8 +332,9 @@ def _on_language_selected(self, view, selection):
327332 if os .path .exists (candidate )
328333 else os .path .join (ASSETS_DIR , "headerbar-locale.svg" )
329334 )
330- pixbuf = load_svg_pixbuf (path , 32 )
331- img .set_from_pixbuf (pixbuf )
335+ texture = load_svg_texture (path , 48 )
336+ img .set_from_paintable (texture )
337+ img .set_pixel_size (48 )
332338
333339 keyboard_layout = params .get ("keyboard" , "us" )
334340
0 commit comments