178 }
179 FocusEvent fg = new FocusEvent(lightweightChild, FocusEvent.FOCUS_GAINED, false, currentOwner );
180 FocusEvent fl = null;
181 if (currentOwner != null) {
182 fl = new FocusEvent(currentOwner, FocusEvent.FOCUS_LOST, false, lightweightChild);
183 }
184
185 // TODO: do we need to wrap in sequenced?
186 if (fl != null) {
187 postEvent(XComponentPeer.wrapInSequenced(fl));
188 }
189 postEvent(XComponentPeer.wrapInSequenced(fg));
190 // End of Motif compatibility code
191 return true;
192 }
193
194 public boolean requestFocus(Component lightweightChild,
195 boolean temporary,
196 boolean focusedWindowChangeAllowed,
197 long time,
198 CausedFocusEvent.Cause cause)
199 {
200 int result = XKeyboardFocusManagerPeer
201 .shouldNativelyFocusHeavyweight(proxy, lightweightChild,
202 temporary, false, time, cause);
203
204 switch (result) {
205 case XKeyboardFocusManagerPeer.SNFH_FAILURE:
206 return false;
207 case XKeyboardFocusManagerPeer.SNFH_SUCCESS_PROCEED:
208 // Currently we just generate focus events like we deal with lightweight instead of calling
209 // XSetInputFocus on native window
210
211 /**
212 * The problems with requests in non-focused window arise because shouldNativelyFocusHeavyweight
213 * checks that native window is focused while appropriate WINDOW_GAINED_FOCUS has not yet
214 * been processed - it is in EventQueue. Thus, SNFH allows native request and stores request record
215 * in requests list - and it breaks our requests sequence as first record on WGF should be the last focus
216 * owner which had focus before WLF. So, we should not add request record for such requests
217 * but store this component in mostRecent - and return true as before for compatibility.
218 */
|
178 }
179 FocusEvent fg = new FocusEvent(lightweightChild, FocusEvent.FOCUS_GAINED, false, currentOwner );
180 FocusEvent fl = null;
181 if (currentOwner != null) {
182 fl = new FocusEvent(currentOwner, FocusEvent.FOCUS_LOST, false, lightweightChild);
183 }
184
185 // TODO: do we need to wrap in sequenced?
186 if (fl != null) {
187 postEvent(XComponentPeer.wrapInSequenced(fl));
188 }
189 postEvent(XComponentPeer.wrapInSequenced(fg));
190 // End of Motif compatibility code
191 return true;
192 }
193
194 public boolean requestFocus(Component lightweightChild,
195 boolean temporary,
196 boolean focusedWindowChangeAllowed,
197 long time,
198 FocusEvent.Cause cause)
199 {
200 int result = XKeyboardFocusManagerPeer
201 .shouldNativelyFocusHeavyweight(proxy, lightweightChild,
202 temporary, false, time, cause);
203
204 switch (result) {
205 case XKeyboardFocusManagerPeer.SNFH_FAILURE:
206 return false;
207 case XKeyboardFocusManagerPeer.SNFH_SUCCESS_PROCEED:
208 // Currently we just generate focus events like we deal with lightweight instead of calling
209 // XSetInputFocus on native window
210
211 /**
212 * The problems with requests in non-focused window arise because shouldNativelyFocusHeavyweight
213 * checks that native window is focused while appropriate WINDOW_GAINED_FOCUS has not yet
214 * been processed - it is in EventQueue. Thus, SNFH allows native request and stores request record
215 * in requests list - and it breaks our requests sequence as first record on WGF should be the last focus
216 * owner which had focus before WLF. So, we should not add request record for such requests
217 * but store this component in mostRecent - and return true as before for compatibility.
218 */
|