Class SharedScreenEditorFrame

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class SharedScreenEditorFrame extends JFrame
A control panel for managing live screen sharing and region selection.

This frame provides a visual overview of all available graphics devices and active shared regions, allowing the user to toggle multimodal context in real-time. It uses asynchronous background tasks to capture thumbnails, ensuring the UI remains responsive even under display server constraints (Wayland/Pipewire).

Author:
anahata
See Also:
  • Field Details

    • agiPanel

      private final AgiPanel agiPanel
      The active AGI session context.
    • agi

      private final Agi agi
      The AGI session orchestrator instance.
    • screensToolkit

      private final Screens screensToolkit
      The specialized screens toolkit providing hardware access.
    • monitorsContainer

      private JPanel monitorsContainer
      Container for the monitor preview components.
    • regionsListPanel

      private JPanel regionsListPanel
      Panel listing all currently active shared regions.
    • monitorThumbnails

      private final Map<Integer,Image> monitorThumbnails
      Cache for monitor thumbnails to improve rendering performance.
    • PREVIEW_HEIGHT

      private final int PREVIEW_HEIGHT
      The standardized height for monitor and region previews.
      See Also:
  • Constructor Details

    • SharedScreenEditorFrame

      public SharedScreenEditorFrame(AgiPanel agiPanel)
      Constructs a new editor frame for the given AGI session.
      Parameters:
      agiPanel - The target AGI panel.
  • Method Details

    • initComponents

      private void initComponents()
      Initializes the UI components and layout.
    • refreshMonitors

      private void refreshMonitors()
      Refreshes the list of available graphics devices and captures new thumbnails asynchronously.

      This method triggers a background task for each screen to prevent EDT blocking which is critical for Wayland stability.

    • refreshRegionsList

      private void refreshRegionsList()
      Synchronizes the region list with the toolkit state and updates thumbnails asynchronously.

      For each active shared region, a background task performs the hardware capture to avoid Pipewire context errors.

    • startRegionSelection

      private void startRegionSelection()
      Initiates the interactive region selection process.
    • executeCaptureTask

      private <T> void executeCaptureTask(String name, Callable<T> backgroundLogic, Consumer<T> onDone)
      Executes a hardware capture task on a background thread.
      Type Parameters:
      T - The task result type.
      Parameters:
      name - Task name.
      backgroundLogic - The capture logic.
      onDone - Callback on completion.