United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6176814 Metalworks frame maximizes after the move
JDK-6176814 : Metalworks frame maximizes after the move

Details
Type:
Bug
Submit Date:
2004-10-11
Status:
Closed
Updated Date:
2011-01-19
Project Name:
JDK
Resolved Date:
2005-02-12
Component:
client-libs
OS:
linux,generic,windows_xp
Sub-Component:
java.awt
CPU:
x86,generic
Priority:
P2
Resolution:
Fixed
Affected Versions:
5.0,6
Fixed Versions:

Related Reports
Backport:
Duplicate:
Relates:
Relates:
Relates:

Sub Tasks

Description
Run Metalworks demo on Linux (XToolkit)
Press left mouse button on a title and move the frame around
Release the button - the frame will become maximized

Regression from 1.4.2, XToolkit-only behavior
###@###.### 10/11/04 09:09 GMT

Reproducible with any JFrame that has DefaultLookAndFeelDecorated set to true.
###@###.### 10/13/04 14:51 GMT

                                    

Comments
EVALUATION

Should drop lastWindowRef to null in XWindow.java:handleMotionNotify() if mouse had been moving. This way we could avoid extra MouseClickEvent if we had dragged the mouse between MousePress and MouseRelease.
According to MToolkit implementation (canvas.c), this is the correct behaviour.
###@###.### 10/13/04 14:41 GMT

See also bug 6179679 which I've just closed as a duplicate. Also, I see 5039416 in the "see also" section and it sounds VERY similar. Are they the same bug or slightly different?
###@###.### 2004-11-19 20:08:40 GMT

The fix for this bug is not delivered into JDK5.0_01. It will appear in JDK5.0_04.
###@###.### 2005-03-09 08:59:35 GMT

 Our XWindow.java code lack of multiclick handling. So, when user drags mouse on the screen on Linux box  this leads to delivering double clicks when user expects single clicks and single click when user expects  no clicks at all. To fix this we introduced AWT_MULTICLICK_SMUDGE variable to describe an area (actually  this is a rectangle) where mouse moves with holding mouse button treated as non_dragging moves  (in this case we suppose that user just want to click multiple times). If user moved mouse a lot and leaves  the  SMUDGE_AREA we change our local variables and supress an additional MOUSE_CLICK generation ( we suppose that user started dragging ).
###@###.### 2005-03-09 09:09:39 GMT

There is a complete information about our plans for this CR:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=2123586

###@###.### 2005-06-17 08:02:28 GMT
                                     
2004-10-13
SUGGESTED FIX

*** /tmp/geta5845	
--- XWindow.java	
***************
*** 26,32 ****
      private static Logger insLog = Logger.getLogger("sun.awt.X11.insets.XWindow");
      private static Logger eventLog = Logger.getLogger("sun.awt.X11.event.XWindow");
      private static final Logger focusLog = Logger.getLogger("sun.awt.X11.focus.XWindow");
! 
      // ButtonXXX events stuff
      static int rbutton = 0;
      static int lastX = 0, lastY = 0;
--- 26,36 ----
      private static Logger insLog = Logger.getLogger("sun.awt.X11.insets.XWindow");
      private static Logger eventLog = Logger.getLogger("sun.awt.X11.event.XWindow");
      private static final Logger focusLog = Logger.getLogger("sun.awt.X11.focus.XWindow");
!   /* If a motion comes in while a multi-click is pending,
!    * allow a smudge factor so that moving the mouse by a small
!    * amount does not wipe out the multi-click state variables.
!    */
!     private final static int AWT_MULTICLICK_SMUDGE = 4;
      // ButtonXXX events stuff
      static int rbutton = 0;
      static int lastX = 0, lastY = 0;
***************
*** 614,624 ****
          if (isEventDisabled(xme)) {
              return;
          }
!         /* To be done :
!            add multiclick checking 
          */
!         clickCount = 0;
!         //lastWindowRef = null;
  
          long jWhen = XToolkit.nowMillisUTC_offset(xme.get_time());
          int modifiers = getModifiers(xme.get_state(),0,0);
--- 618,640 ----
          if (isEventDisabled(xme)) {
              return;
          }
!         /* 
!            Fix for 6176814 .  Add multiclick checking.
          */
!         int x = xme.get_x();
!         int y = xme.get_y();
!         XWindow lastWindow = (lastWindowRef != null) ? ((XWindow)lastWindowRef.get()):(null);
!         
!         if (!(lastWindow == this &&
!               (xme.get_time() - lastTime) < XToolkit.getMultiClickTime()  &&
!               (Math.abs(lastX - x) < AWT_MULTICLICK_SMUDGE &&
!                Math.abs(lastY - y) < AWT_MULTICLICK_SMUDGE))) {
!           clickCount = 0;
!           lastWindowRef = null;
!           lastTime = 0;
!           lastX = 0;
!           lastY = 0;
!         }
  
          long jWhen = XToolkit.nowMillisUTC_offset(xme.get_time());
          int modifiers = getModifiers(xme.get_state(),0,0);
***************
*** 629,636 ****
              MouseEvent.MOUSE_MOVED;
          Component source = (Component)getEventSource();
          
-         int x = xme.get_x();
-         int y = xme.get_y();
          if (xme.get_window() != window) {
              Point localXY = toLocal(xme.get_x_root(), xme.get_y_root());
              x = localXY.x;
--- 645,650 ----

###@###.### 2004-12-01 08:59:31 GMT
                                     
2004-12-01



Hardware and Software, Engineered to Work Together