Changeset 177 for trunk/src/plugins/org.eclipse.swt
- Timestamp:
- Aug 18, 2009, 3:19:00 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/plugins/org.eclipse.swt/Eclipse SWT/pm/org/eclipse/swt/widgets/Control.java
r176 r177 472 472 473 473 //@@TODO (dmik): debug code, remove when no more necessary 474 //System.out.println (475 //"Control.createHandle(): Window has been created:\n" +476 //" hwnd = " + Integer.toHexString (handle) + "\n" +477 //" hwnd.parent = hwnd.owner = " + Integer.toHexString (parent.handle) + "\n" +478 //" class = " + windowClass() + "\n" +479 //" style = " + Integer.toHexString (widgetStyle())480 //);474 System.out.println ( 475 "Control.createHandle(): Window has been created:\n" + 476 " hwnd = " + Integer.toHexString (handle) + "\n" + 477 " hwnd.parent = hwnd.owner = " + Integer.toHexString (parent.handle) + "\n" + 478 " class = " + windowClass() + "\n" + 479 " style = " + Integer.toHexString (widgetStyle()) 480 ); 481 481 482 482 //@@TODO(dmik): DBCS handling? … … 1775 1775 } 1776 1776 1777 //@@TODO(dmik): later 1778 //boolean sendMouseEvent (int type, int button, int msg, int wParam, int lParam) { 1779 // Event event = new Event (); 1780 // event.button = button; 1781 // event.x = (short) (lParam & 0xFFFF); 1782 // event.y = (short) (lParam >> 16); 1777 boolean sendMouseEvent (int type, int button, int msg, int mp1, int mp2) { 1778 Event event = new Event (); 1779 event.button = button; 1780 event.x = (short) (mp1 & 0xFFFF); 1781 event.y = (short) (mp1 >> 16); 1782 int keyState = mp2 >> 16; 1783 //@@TODO(lpino): Remove debug 1784 System.out.println("Control::sendMouseEvent -> X= " + event.x + " Y= " + event.y); 1785 System.out.println("Control::sendMouseEvent -> MP2= " + Integer.toHexString(keyState)); 1783 1786 // if (OS.GetKeyState (OS.VK_MENU) < 0) event.stateMask |= SWT.ALT; 1784 // if ((wParam & OS.MK_SHIFT) != 0) event.stateMask |= SWT.SHIFT;1785 // if ((wParam & OS.MK_CONTROL) != 0) event.stateMask |= SWT.CONTROL;1786 // if ((wParam & OS.MK_LBUTTON) != 0) event.stateMask |= SWT.BUTTON1;1787 if ((keyState & OS.KC_SHIFT) != 0) event.stateMask |= SWT.SHIFT; 1788 if ((keyState & OS.KC_CTRL) != 0) event.stateMask |= SWT.CONTROL; 1789 if (button == 1) event.stateMask |= SWT.BUTTON1; 1787 1790 // if ((wParam & OS.MK_MBUTTON) != 0) event.stateMask |= SWT.BUTTON2; 1788 1791 // if ((wParam & OS.MK_RBUTTON) != 0) event.stateMask |= SWT.BUTTON3; 1789 //switch (type) {1790 //case SWT.MouseDown:1791 //case SWT.MouseDoubleClick:1792 //if (button == 1) event.stateMask &= ~SWT.BUTTON1;1793 //if (button == 2) event.stateMask &= ~SWT.BUTTON2;1794 //if (button == 3) event.stateMask &= ~SWT.BUTTON3;1795 //break;1796 //case SWT.MouseUp:1797 //if (button == 1) event.stateMask |= SWT.BUTTON1;1798 //if (button == 2) event.stateMask |= SWT.BUTTON2;1799 //if (button == 3) event.stateMask |= SWT.BUTTON3;1800 //break;1801 //}1802 // return sendMouseEvent (type, msg, wParam, lParam, event);1803 //}1804 1805 //@@TODO(dmik) 1806 //boolean sendMouseEvent (int type, int msg, int wParam, int lParam, Event event) {1807 //postEvent (type, event);1808 //return true;1809 //}1792 switch (type) { 1793 case SWT.MouseDown: 1794 case SWT.MouseDoubleClick: 1795 if (button == 1) event.stateMask &= ~SWT.BUTTON1; 1796 if (button == 2) event.stateMask &= ~SWT.BUTTON2; 1797 if (button == 3) event.stateMask &= ~SWT.BUTTON3; 1798 break; 1799 case SWT.MouseUp: 1800 if (button == 1) event.stateMask |= SWT.BUTTON1; 1801 if (button == 2) event.stateMask |= SWT.BUTTON2; 1802 if (button == 3) event.stateMask |= SWT.BUTTON3; 1803 break; 1804 } 1805 return sendMouseEvent (type, msg, mp1, mp2, event); 1806 } 1807 1808 1809 boolean sendMouseEvent (int type, int msg, int wParam, int lParam, Event event) { 1810 postEvent (type, event); 1811 return true; 1812 } 1810 1813 1811 1814 /** … … 2945 2948 // case OS.WM_ADJUSTWINDOWPOS: result = WM_ADJUSTWINDOWPOS (mp1, mp2); break; 2946 2949 // case OS.WM_BUTTON2DBLCLK: result = WM_BUTTON2DBLCLK (mp1, mp2); break; 2950 case OS.WM_BUTTON1DOWN: result = WM_BUTTON1DOWN (mp1, mp2); break; 2951 // case OS.WM_BUTTON1UP: result = WM_BUTTON1UP (mp1, mp2); break; 2952 // case OS.WM_BUTTON1CLICK: result = WM_BUTTON1CLICK (mp1, mp2); break; 2947 2953 case OS.WM_CALCVALIDRECTS: result = WM_CALCVALIDRECTS (mp1, mp2); break; 2948 2954 case OS.WM_CHAR: result = WM_CHAR (mp1, mp2); break; … … 2978 2984 // case OS.WM_KEYDOWN: result = WM_KEYDOWN (wParam, lParam); break; 2979 2985 // case OS.WM_KEYUP: result = WM_KEYUP (wParam, lParam); break; 2980 // case OS.WM_LBUTTONDBLCLK: result = WM_LBUTTONDBLCLK (wParam, lParam); break;2986 case OS.WM_BUTTON1DBLCLK: result = WM_BUTTON1DBLCLK (mp1, mp2); break; 2981 2987 // case OS.WM_LBUTTONDOWN: result = WM_LBUTTONDOWN (wParam, lParam); break; 2982 2988 // case OS.WM_LBUTTONUP: result = WM_LBUTTONUP (wParam, lParam); break; … … 3321 3327 3322 3328 //@@TODO (dmik): later 3323 //LRESULT WM_LBUTTONDBLCLK (int wParam, int lParam) {3324 ///*3325 //* Feature in Windows. Windows sends the following3326 //* messages when the user double clicks the mouse:3327 //*3328 //* WM_LBUTTONDOWN - mouse down3329 //* WM_LBUTTONUP - mouse up3330 //* WM_LBUTTONDBLCLK - double click3331 //* WM_LBUTTONUP - mouse up3332 //*3333 //* Applications that expect matching mouse down/up3334 //* pairs will not see the second mouse down. The3335 //* fix is to send a mouse down event.3336 //*/3329 MRESULT WM_BUTTON1DBLCLK (int mp1, int mp2) { 3330 /* 3331 * Feature in Windows. Windows sends the following 3332 * messages when the user double clicks the mouse: 3333 * 3334 * WM_LBUTTONDOWN - mouse down 3335 * WM_LBUTTONUP - mouse up 3336 * WM_LBUTTONDBLCLK - double click 3337 * WM_LBUTTONUP - mouse up 3338 * 3339 * Applications that expect matching mouse down/up 3340 * pairs will not see the second mouse down. The 3341 * fix is to send a mouse down event. 3342 */ 3337 3343 // sendMouseEvent (SWT.MouseDown, 1, OS.WM_LBUTTONDOWN, wParam, lParam); 3338 // sendMouseEvent (SWT.MouseDoubleClick, 1, OS.WM_LBUTTONDBLCLK, wParam, lParam);3339 // int result = callWindowProc (OS.WM_LBUTTONDBLCLK, wParam, lParam);3340 // if (OS.GetCapture () != handle) OS.SetCapture (handle);3341 // return new LRESULT (result);3342 //}3343 // 3344 //LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {3345 //boolean dragging = false, mouseDown = true;3344 sendMouseEvent (SWT.MouseDoubleClick, 1, OS.WM_BUTTON1DBLCLK, mp1, mp2); 3345 int result = callWindowProc (OS.WM_BUTTON1DBLCLK, mp1, mp2); 3346 if (OS.WinQueryCapture (OS.HWND_DESKTOP) != handle) OS.WinSetCapture (OS.HWND_DESKTOP, handle); 3347 return new MRESULT (result); 3348 } 3349 3350 MRESULT WM_BUTTON1DOWN (int mp1, int mp2) { 3351 boolean dragging = false, mouseDown = true; 3346 3352 // if (hooks (SWT.DragDetect)) { 3347 3353 // POINT pt = new POINT (); … … 3361 3367 // } 3362 3368 // } 3363 // sendMouseEvent (SWT.MouseDown, 1, OS.WM_LBUTTONDOWN, wParam, lParam); 3364 // int result = callWindowProc (OS.WM_LBUTTONDOWN, wParam, lParam); 3365 // if (mouseDown) { 3366 // if (OS.GetCapture () != handle) OS.SetCapture (handle); 3367 // } 3369 sendMouseEvent (SWT.MouseDown, 1, OS.WM_BUTTON1DOWN, mp1, mp2); 3370 // int result = callWindowProc (OS.WM_BUTTON1DOWN, mp1, mp2); 3371 int result = 0; 3372 if (mouseDown) { 3373 int hwnd = OS.WinQueryCapture (OS.HWND_DESKTOP); 3374 int hwnd2 = OS.WinQueryWindow(handle, OS.QW_PARENT); 3375 int hwnd3 = OS.WinQueryActiveWindow(OS.HWND_DESKTOP); 3376 System.out.println("Control::WM_BUTTON1DOWN -> Window = " + Integer.toHexString(handle) + " Window Activa = " + Integer.toHexString(hwnd) + " Padre = " + Integer.toHexString(hwnd2)); 3377 if (OS.WinQueryCapture (OS.HWND_DESKTOP) != handle){ 3378 OS.WinSetCapture (OS.HWND_DESKTOP, handle); 3379 } 3380 if(OS.WinQueryWindow(handle, OS.QW_PARENT) == OS.WinQueryActiveWindow(OS.HWND_DESKTOP)){ 3381 System.out.println("Control::WM_BUTTON1DOWN"); 3382 } 3383 // OS.WinSetActiveWindow (OS.HWND_DESKTOP, handle); 3384 } 3368 3385 // if (dragging) { 3369 3386 // postEvent (SWT.DragDetect); … … 3395 3412 // } 3396 3413 // } 3397 // return new LRESULT (result);3398 //}3399 // 3414 return new MRESULT (result); 3415 } 3416 3400 3417 //LRESULT WM_LBUTTONUP (int wParam, int lParam) { 3401 3418 // sendMouseEvent (SWT.MouseUp, 1, OS.WM_LBUTTONUP, wParam, lParam); 3402 3419 // int result = callWindowProc (OS.WM_LBUTTONUP, wParam, lParam); 3403 3420 // if ((wParam & (OS.MK_LBUTTON | OS.MK_MBUTTON | OS.MK_RBUTTON)) == 0) { 3404 // if (OS. GetCapture () == handle) OS.ReleaseCapture ();3421 // if (OS.WinQueryCapture () == handle) OS.ReleaseCapture (); 3405 3422 // } 3406 3423 // return new LRESULT (result);
Note:
See TracChangeset
for help on using the changeset viewer.