< prev index next >

src/java.desktop/unix/classes/sun/awt/X11/XComponentPeer.java

Print this page




 270         catch (PrivilegedActionException ex) {
 271             throw new NoClassDefFoundError("java.awt.SequencedEvent.");
 272         }
 273         catch (InstantiationException e) {
 274             assert false;
 275         }
 276         catch (IllegalAccessException e) {
 277             assert false;
 278         }
 279         catch (InvocationTargetException e) {
 280             assert false;
 281         }
 282 
 283         return null;
 284     }
 285 
 286     // TODO: consider moving it to KeyboardFocusManagerPeerImpl
 287     @SuppressWarnings("deprecation")
 288     public final boolean requestFocus(Component lightweightChild, boolean temporary,
 289                                       boolean focusedWindowChangeAllowed, long time,
 290                                       CausedFocusEvent.Cause cause)
 291     {
 292         if (XKeyboardFocusManagerPeer.
 293             processSynchronousLightweightTransfer(target, lightweightChild, temporary,
 294                                                   focusedWindowChangeAllowed, time))
 295         {
 296             return true;
 297         }
 298 
 299         int result = XKeyboardFocusManagerPeer.
 300             shouldNativelyFocusHeavyweight(target, lightweightChild,
 301                                            temporary, focusedWindowChangeAllowed,
 302                                            time, cause);
 303 
 304         switch (result) {
 305           case XKeyboardFocusManagerPeer.SNFH_FAILURE:
 306               return false;
 307           case XKeyboardFocusManagerPeer.SNFH_SUCCESS_PROCEED:
 308               // Currently we just generate focus events like we deal with lightweight instead of calling
 309               // XSetInputFocus on native window
 310               if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {


 510     /* This method is intended to be over-ridden by peers to perform user interaction */
 511     void handleJavaMouseEvent(MouseEvent e) {
 512         switch (e.getID()) {
 513           case MouseEvent.MOUSE_PRESSED:
 514               if (target == e.getSource() &&
 515                   !target.isFocusOwner() &&
 516                   XKeyboardFocusManagerPeer.shouldFocusOnClick(target))
 517               {
 518                   XWindowPeer parentXWindow = getParentTopLevel();
 519                   Window parentWindow = ((Window)parentXWindow.getTarget());
 520                   // Simple windows are non-focusable in X terms but focusable in Java terms.
 521                   // As X-non-focusable they don't receive any focus events - we should generate them
 522                   // by ourselfves.
 523 //                   if (parentXWindow.isFocusableWindow() /*&& parentXWindow.isSimpleWindow()*/ &&
 524 //                       !(getCurrentNativeFocusedWindow() == parentWindow))
 525 //                   {
 526 //                       setCurrentNativeFocusedWindow(parentWindow);
 527 //                       WindowEvent wfg = new WindowEvent(parentWindow, WindowEvent.WINDOW_GAINED_FOCUS);
 528 //                       parentWindow.dispatchEvent(wfg);
 529 //                   }
 530                   XKeyboardFocusManagerPeer.requestFocusFor(target, CausedFocusEvent.Cause.MOUSE_EVENT);
 531               }
 532               break;
 533         }
 534     }
 535 
 536     /* This method is intended to be over-ridden by peers to perform user interaction */
 537     void handleJavaKeyEvent(KeyEvent e) {
 538     }
 539 
 540     /* This method is intended to be over-ridden by peers to perform user interaction */
 541     void handleJavaMouseWheelEvent(MouseWheelEvent e) {
 542     }
 543 
 544 
 545     /* This method is intended to be over-ridden by peers to perform user interaction */
 546     void handleJavaInputMethodEvent(InputMethodEvent e) {
 547     }
 548 
 549     void handleF10JavaKeyEvent(KeyEvent e) {
 550         if (e.getID() == KeyEvent.KEY_PRESSED && e.getKeyCode() == KeyEvent.VK_F10) {




 270         catch (PrivilegedActionException ex) {
 271             throw new NoClassDefFoundError("java.awt.SequencedEvent.");
 272         }
 273         catch (InstantiationException e) {
 274             assert false;
 275         }
 276         catch (IllegalAccessException e) {
 277             assert false;
 278         }
 279         catch (InvocationTargetException e) {
 280             assert false;
 281         }
 282 
 283         return null;
 284     }
 285 
 286     // TODO: consider moving it to KeyboardFocusManagerPeerImpl
 287     @SuppressWarnings("deprecation")
 288     public final boolean requestFocus(Component lightweightChild, boolean temporary,
 289                                       boolean focusedWindowChangeAllowed, long time,
 290                                       FocusEvent.Cause cause)
 291     {
 292         if (XKeyboardFocusManagerPeer.
 293             processSynchronousLightweightTransfer(target, lightweightChild, temporary,
 294                                                   focusedWindowChangeAllowed, time))
 295         {
 296             return true;
 297         }
 298 
 299         int result = XKeyboardFocusManagerPeer.
 300             shouldNativelyFocusHeavyweight(target, lightweightChild,
 301                                            temporary, focusedWindowChangeAllowed,
 302                                            time, cause);
 303 
 304         switch (result) {
 305           case XKeyboardFocusManagerPeer.SNFH_FAILURE:
 306               return false;
 307           case XKeyboardFocusManagerPeer.SNFH_SUCCESS_PROCEED:
 308               // Currently we just generate focus events like we deal with lightweight instead of calling
 309               // XSetInputFocus on native window
 310               if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {


 510     /* This method is intended to be over-ridden by peers to perform user interaction */
 511     void handleJavaMouseEvent(MouseEvent e) {
 512         switch (e.getID()) {
 513           case MouseEvent.MOUSE_PRESSED:
 514               if (target == e.getSource() &&
 515                   !target.isFocusOwner() &&
 516                   XKeyboardFocusManagerPeer.shouldFocusOnClick(target))
 517               {
 518                   XWindowPeer parentXWindow = getParentTopLevel();
 519                   Window parentWindow = ((Window)parentXWindow.getTarget());
 520                   // Simple windows are non-focusable in X terms but focusable in Java terms.
 521                   // As X-non-focusable they don't receive any focus events - we should generate them
 522                   // by ourselfves.
 523 //                   if (parentXWindow.isFocusableWindow() /*&& parentXWindow.isSimpleWindow()*/ &&
 524 //                       !(getCurrentNativeFocusedWindow() == parentWindow))
 525 //                   {
 526 //                       setCurrentNativeFocusedWindow(parentWindow);
 527 //                       WindowEvent wfg = new WindowEvent(parentWindow, WindowEvent.WINDOW_GAINED_FOCUS);
 528 //                       parentWindow.dispatchEvent(wfg);
 529 //                   }
 530                   XKeyboardFocusManagerPeer.requestFocusFor(target, FocusEvent.Cause.MOUSE_EVENT);
 531               }
 532               break;
 533         }
 534     }
 535 
 536     /* This method is intended to be over-ridden by peers to perform user interaction */
 537     void handleJavaKeyEvent(KeyEvent e) {
 538     }
 539 
 540     /* This method is intended to be over-ridden by peers to perform user interaction */
 541     void handleJavaMouseWheelEvent(MouseWheelEvent e) {
 542     }
 543 
 544 
 545     /* This method is intended to be over-ridden by peers to perform user interaction */
 546     void handleJavaInputMethodEvent(InputMethodEvent e) {
 547     }
 548 
 549     void handleF10JavaKeyEvent(KeyEvent e) {
 550         if (e.getID() == KeyEvent.KEY_PRESSED && e.getKeyCode() == KeyEvent.VK_F10) {


< prev index next >