< prev index next >

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

Print this page




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


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




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


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


< prev index next >