@@ -181,11 +181,20 @@ public static void drawSelection(Event event, org.eclipse.swt.graphics.Device de
181181 width = scrollable .getClientArea ().width ;
182182 }
183183
184+ int x = 0 ;
185+ if (width > 50 ) {
186+ x = 50 ;
187+ }
188+
184189 // Fill selection rectangle
185- gc .fillRectangle (0 , event .y , width , event .height );
190+ // Use event.x and event.width to respect the bounds provided by SWT,
191+ // which on some platforms (like GTK/Linux) excludes the image area
192+ gc .fillRectangle (x , event .y , width , event .height );
186193
187194 // Remove SELECTED and BACKGROUND flags to prevent native drawing from overwriting our custom colors
188- event .detail &= ~(SWT .SELECTED | SWT .BACKGROUND );
195+ // Note: On Linux/GTK, we must keep the SELECTED flag so that icons are still drawn
196+ // We only remove BACKGROUND to prevent the native background from overwriting our custom colors
197+ event .detail &= ~(SWT .SELECTED );
189198 }
190199
191200 /**
@@ -213,15 +222,15 @@ private void drawCustomSelection(Event event) {
213222 */
214223 public static Color getSelectionColor (String key , org .eclipse .swt .graphics .Device device ) {
215224 ColorRegistry registry = JFaceResources .getColorRegistry ();
216-
225+
217226 // Check if workbench has registered themed colors
218227 if (registry .hasValueFor (key )) {
219228 return registry .get (key );
220229 }
221-
230+
222231 // Fallback to system colors when workbench is not available
223232 RGB systemColor ;
224-
233+
225234 switch (key ) {
226235 case COLOR_SELECTION_BG_FOCUS :
227236 // Use system highlight color (title bar background) for focused selection
@@ -244,7 +253,7 @@ public static Color getSelectionColor(String key, org.eclipse.swt.graphics.Devic
244253 systemColor = device .getSystemColor (SWT .COLOR_LIST_SELECTION ).getRGB ();
245254 break ;
246255 }
247-
256+
248257 // Register the fallback color so we don't recompute it every time
249258 registry .put (key , systemColor );
250259 return registry .get (key );
0 commit comments