comparison win/dw.c @ 968:0345e37d6c86

Removed some code that captured the mouse pointer and set focus in the render widget on Windows.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Wed, 04 May 2011 00:58:53 +0000
parents c8490b0d8577
children 69f620df0c47
comparison
equal deleted inserted replaced
967:c8490b0d8577 968:0345e37d6c86
65 COLORREF _foreground[THREAD_LIMIT]; 65 COLORREF _foreground[THREAD_LIMIT];
66 COLORREF _background[THREAD_LIMIT]; 66 COLORREF _background[THREAD_LIMIT];
67 HPEN _hPen[THREAD_LIMIT]; 67 HPEN _hPen[THREAD_LIMIT];
68 HBRUSH _hBrush[THREAD_LIMIT]; 68 HBRUSH _hBrush[THREAD_LIMIT];
69 char *_clipboard_contents[THREAD_LIMIT]; 69 char *_clipboard_contents[THREAD_LIMIT];
70 int _PointerOnWnd[THREAD_LIMIT];
71 70
72 BYTE _red[] = { 0x00, 0xbb, 0x00, 0xaa, 0x00, 0xbb, 0x00, 0xaa, 0x77, 71 BYTE _red[] = { 0x00, 0xbb, 0x00, 0xaa, 0x00, 0xbb, 0x00, 0xaa, 0x77,
73 0xff, 0x00, 0xee, 0x00, 0xff, 0x00, 0xff, 0xaa, 0x00 }; 72 0xff, 0x00, 0xee, 0x00, 0xff, 0x00, 0xff, 0xaa, 0x00 };
74 BYTE _green[] = { 0x00, 0x00, 0xbb, 0xaa, 0x00, 0x00, 0xbb, 0xaa, 0x77, 73 BYTE _green[] = { 0x00, 0x00, 0xbb, 0xaa, 0x00, 0x00, 0xbb, 0xaa, 0x77,
75 0x00, 0xff, 0xee, 0x00, 0x00, 0xee, 0xff, 0xaa, 0x00 }; 74 0x00, 0xff, 0xee, 0x00, 0x00, 0xee, 0xff, 0xaa, 0x00 };
2552 return DefWindowProc(hWnd, msg, mp1, mp2); 2551 return DefWindowProc(hWnd, msg, mp1, mp2);
2553 } 2552 }
2554 2553
2555 BOOL CALLBACK _rendwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2) 2554 BOOL CALLBACK _rendwndproc(HWND hWnd, UINT msg, WPARAM mp1, LPARAM mp2)
2556 { 2555 {
2557 RECT wndRect;
2558 POINTS points;
2559 POINT point;
2560 int threadid = dw_thread_id();
2561 BOOL rcode = TRUE; 2556 BOOL rcode = TRUE;
2562 2557
2563 switch( msg ) 2558 switch( msg )
2564 { 2559 {
2565 case WM_LBUTTONDOWN: 2560 case WM_LBUTTONDOWN:
2566 case WM_MBUTTONDOWN: 2561 case WM_MBUTTONDOWN:
2567 case WM_RBUTTONDOWN: 2562 case WM_RBUTTONDOWN:
2568 SetFocus(hWnd); 2563 SetFocus(hWnd);
2569 rcode = _wndproc(hWnd, msg, mp1, mp2); 2564 rcode = _wndproc(hWnd, msg, mp1, mp2);
2570 #ifndef SCROLLBOX_DEBUG
2571 _dw_log( "_renderproc: button down: %d\n", rcode );
2572 #endif
2573 break; 2565 break;
2574 case WM_MOUSEMOVE: 2566 case WM_MOUSEMOVE:
2575 if ( threadid < 0 || threadid >= THREAD_LIMIT )
2576 threadid = 0;
2577 /*
2578 * Set the mouse capture and focus on the renderbox
2579 * when the mouse moves into the window.
2580 */
2581 points = MAKEPOINTS(mp2); /* get the mouse point */
2582 point.x = points.x;
2583 point.y = points.y;
2584 SetCapture( hWnd ); /* Capture the mouse input */
2585
2586 GetWindowRect( hWnd, &wndRect );
2587 ClientToScreen( hWnd, &point );
2588
2589 if ( PtInRect( &wndRect, point ) )
2590 { // Test if the pointer is on the window
2591
2592 if ( _PointerOnWnd[threadid] == 0 )
2593 {
2594 SetFocus(hWnd);
2595 _PointerOnWnd[threadid] = 1;
2596 }
2597 }
2598 else
2599 {
2600 ReleaseCapture();
2601 _PointerOnWnd[threadid] = 0;
2602 }
2603 /* call our standard Windows procedure */ 2567 /* call our standard Windows procedure */
2604 rcode = _wndproc(hWnd, msg, mp1, mp2); 2568 rcode = _wndproc(hWnd, msg, mp1, mp2);
2605 break; 2569 break;
2606 case WM_LBUTTONUP: 2570 case WM_LBUTTONUP:
2607 case WM_MBUTTONUP: 2571 case WM_MBUTTONUP:
2608 case WM_RBUTTONUP: 2572 case WM_RBUTTONUP:
2609 rcode = _wndproc(hWnd, msg, mp1, mp2); 2573 rcode = _wndproc(hWnd, msg, mp1, mp2);
2610 #ifndef SCROLLBOX_DEBUG
2611 _dw_log( "_renderproc: button up: %d\n", rcode );
2612 #endif
2613 break; 2574 break;
2614 case WM_PAINT: 2575 case WM_PAINT:
2615 case WM_SIZE: 2576 case WM_SIZE:
2616 case WM_COMMAND: 2577 case WM_COMMAND:
2617 case WM_CHAR: 2578 case WM_CHAR:
2618 case WM_KEYDOWN: 2579 case WM_KEYDOWN:
2619 rcode = _wndproc(hWnd, msg, mp1, mp2); 2580 rcode = _wndproc(hWnd, msg, mp1, mp2);
2620 break; 2581 break;
2621 default: 2582 default:
2622 // rcode = DefWindowProc(hWnd, msg, mp1, mp2);
2623 break; 2583 break;
2624 } 2584 }
2625 /* only call the default Windows process if the user hasn't handled the message themselves */ 2585 /* only call the default Windows process if the user hasn't handled the message themselves */
2626 if ( rcode != 0 ) 2586 if ( rcode != 0 )
2627 rcode = DefWindowProc(hWnd, msg, mp1, mp2); 2587 rcode = DefWindowProc(hWnd, msg, mp1, mp2);
3803 _foreground[z] = RGB(128,128,128); 3763 _foreground[z] = RGB(128,128,128);
3804 _background[z] = DW_RGB_TRANSPARENT; 3764 _background[z] = DW_RGB_TRANSPARENT;
3805 _hPen[z] = CreatePen(PS_SOLID, 1, _foreground[z]); 3765 _hPen[z] = CreatePen(PS_SOLID, 1, _foreground[z]);
3806 _hBrush[z] = CreateSolidBrush(_foreground[z]); 3766 _hBrush[z] = CreateSolidBrush(_foreground[z]);
3807 _clipboard_contents[z] = NULL; 3767 _clipboard_contents[z] = NULL;
3808 _PointerOnWnd[z] = 0;
3809 } 3768 }
3810 3769
3811 /* Initialize Security for named events and memory */ 3770 /* Initialize Security for named events and memory */
3812 InitializeSecurityDescriptor(&_dwsd, SECURITY_DESCRIPTOR_REVISION); 3771 InitializeSecurityDescriptor(&_dwsd, SECURITY_DESCRIPTOR_REVISION);
3813 SetSecurityDescriptorDacl(&_dwsd, TRUE, (PACL) NULL, FALSE); 3772 SetSecurityDescriptorDacl(&_dwsd, TRUE, (PACL) NULL, FALSE);