Project

General

Profile

base_patch.patch

Delia Mitric, 11/13/2025 10:07 AM

Download (3.3 KB)

View differences:

new/src/com/goldencode/p2j/ui/client/WindowManager.java 2025-11-13 14:00:53 +0000
2115 2115
      delayed.remove(wnd);
2116 2116
   }
2117 2117

  
2118
   public static boolean blockProcessing(MouseEvt evt, Widget<?> mouseSource)
2119
   {
2120
      int evtID = evt.getEvent().getID();
2121

  
2122
      if (evtID == MouseEvt.MOUSE_PRESSED  ||
2123
              evtID == MouseEvt.MOUSE_RELEASED ||
2124
              evtID == MouseEvt.MOUSE_CLICKED)
2125
      {
2126
         // Verify if there is an open drop-down menu
2127
         if (isDropBoxDisplayed())
2128
         {
2129
            if (mouseSource instanceof ComboBoxGuiImpl)
2130
            {
2131
               mouseSource = ((ComboBoxGuiImpl) mouseSource);
2132
               // Verify if the id of the mouse source's drop-down is the same as the active drop-down's id
2133
               if (!((ComboBoxGuiImpl) mouseSource).isDropDownActive())
2134
               {
2135
                  return true;
2136
               }
2137
            }
2138
            else if (mouseSource instanceof DropDownGuiImpl)
2139
            {
2140
               int dropDownId = mouseSource.getId().asInt();
2141
               if (!Arrays.stream(overlayWindowIds()).anyMatch(n -> n == dropDownId))
2142
               {
2143
                  return true;
2144
               }
2145
            }
2146
            else
2147
            {
2148
               return true;
2149
            }
2150
         }
2151
      }
2152

  
2153
      return false;
2154
   }
2155

  
2118 2156
   /**
2119 2157
    * Process GUI window events and dispatch it to specific method.
2120 2158
    * 
......
2153 2191
               gd.selectWindow(parent.topLevelWindow().getId().asInt());
2154 2192
               try
2155 2193
               {
2156
                  gd.handleMouseEvent(id.asInt(), evt.getEvent());
2194
                  if (!blockProcessing(evt, mouseSource))
2195
                  {
2196
                     gd.handleMouseEvent(id.asInt(), evt.getEvent());
2197
                  }
2157 2198
               }
2158 2199
               finally
2159 2200
               {
......
2440 2481
   }
2441 2482

  
2442 2483
   /**
2484
    * Checks whether a overlay window is currently displayed.
2485
    *
2486
    * @return   {@code true} if a visible overlay window exists; {@code false} otherwise.
2487
    */
2488
   public static boolean isDropBoxDisplayed()
2489
   {
2490
      return windowList().stream()
2491
              .filter(w -> w instanceof OverlayWindow<?>)
2492
              .anyMatch(w -> ((OverlayWindow) w).isVisible());
2493
   }
2494

  
2495
   public static int[] overlayWindowIds()
2496
   {
2497
      return windowList().stream()
2498
              .filter(w -> w instanceof OverlayWindow<?>)
2499
              .mapToInt(w -> w.getId().asInt())
2500
              .toArray();
2501
   }
2502

  
2503
   /**
2443 2504
    * Fires all registered size move listeners.
2444 2505
    *
2445 2506
    * @param   exec
new/src/com/goldencode/p2j/ui/client/gui/ComboBoxGuiImpl.java 2025-11-13 14:31:59 +0000
517 517
   @Override
518 518
   public void processFocusEvent(FocusEvent event)
519 519
   {
520
      if (WindowManager.isDropBoxDisplayed() && !isDropDownActive())
521
      {
522
         return;
523
      }
524
      
520 525
      super.processFocusEvent(event);
521 526
      
522 527
      if (event.id() == EventType.FOCUS_GAINED && event.isMouse())