From 689441ebab50f3c5b5eb2743a0929f7ccd32a78c Mon Sep 17 00:00:00 2001
From: Alex Shvartzkop <dudesuchamazing@gmail.com>
Date: Mon, 20 Jan 2025 22:13:45 +0300
Subject: [PATCH] Fix image size in Layer selector in Properties panel on
 hidpi.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/13105

(cherry picked from commit 8b24496b793a1fe545c2a07eaa4d870a6cd7f421)
---
 common/properties/pg_properties.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/common/properties/pg_properties.cpp b/common/properties/pg_properties.cpp
index e2f3740f7c..a7baaa0cc3 100644
--- a/common/properties/pg_properties.cpp
+++ b/common/properties/pg_properties.cpp
@@ -605,8 +605,12 @@ wxValidator* PGPROPERTY_ANGLE::DoGetValidator() const
 
 wxSize PGPROPERTY_COLORENUM::OnMeasureImage( int aItem ) const
 {
-    // TODO(JE) calculate size from window metrics?
-    return wxSize( 16, 12 );
+    wxSize size( 16, -1 );
+
+    if( wxPropertyGrid* pg = GetGrid() )
+        size = pg->FromDIP( size );
+
+    return size;
 }