diff --git a/widget/src/os2/Makefile.in b/widget/src/os2/Makefile.in index 3579bab6cbeb..d903e33456cc 100644 --- a/widget/src/os2/Makefile.in +++ b/widget/src/os2/Makefile.in @@ -49,7 +49,6 @@ endif CPPSRCS = \ nsAppShell.cpp \ nsBidiKeyboard.cpp \ - nsCanvas.cpp \ nsClipboard.cpp \ nsFilePicker.cpp \ nsFrameWindow.cpp \ diff --git a/widget/src/os2/nsCanvas.cpp b/widget/src/os2/nsCanvas.cpp deleted file mode 100644 index f5af9f1eba87..000000000000 --- a/widget/src/os2/nsCanvas.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - * License for the specific language governing rights and limitations - * under the License. - * - * The Original Code is the Mozilla OS/2 libraries. - * - * The Initial Developer of the Original Code is John Fairhurst, - * . Portions created by John Fairhurst are - * Copyright (C) 1999 John Fairhurst. All Rights Reserved. - * - * Contributor(s): Henry Sobotka 01/2000 review and update - * - * This Original Code has been modified by IBM Corporation. - * Modifications made by IBM described herein are - * Copyright (c) International Business Machines - * Corporation, 2000 - * - * Modifications to Mozilla code or documentation - * identified per MPL Section 3.3 - * - * Date Modified by Description of modification - * 03/31/2000 IBM Corp. @JSK32365 - Set WS_CLIPSIBLINGS on - * nsCanvas objects to fix bleed-through - * 04/31/2000 IBM Corp. Change parms to DispatchMouseEvent to match Windows. - * - */ - -// nscanvas - basic window class that dispatches paint events. - -#include "nsCanvas.h" -#include - -extern BOOL g_bHandlingMouseClick; - -PRBool nsCanvas::DispatchMouseEvent( PRUint32 aEventType, MPARAM mp1, MPARAM mp2) -{ - PRBool rc = PR_FALSE; - - // Don't capture mb2 so that drag'n'drop works. - - if( mEventCallback || mMouseListener) - { - switch( aEventType) - { - case NS_MOUSE_LEFT_BUTTON_DOWN: - case NS_MOUSE_MIDDLE_BUTTON_DOWN: - WinSetCapture( HWND_DESKTOP, mWnd); - break; - - case NS_MOUSE_LEFT_BUTTON_UP: - case NS_MOUSE_MIDDLE_BUTTON_UP: - WinSetCapture( HWND_DESKTOP, 0); // release - break; - - default: - break; - } - rc = nsWindow::DispatchMouseEvent( aEventType, mp1, mp2); - } - -// Mousemove messages mustn't propagate to get cursors working. Try commenting -// this block out & then move the mouse over a link. - - if( aEventType == NS_MOUSE_MOVE) - rc = PR_TRUE; - - return rc; -} - - -ULONG nsCanvas::WindowStyle() -{ - return BASE_CONTROL_STYLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; -} diff --git a/widget/src/os2/nsCanvas.h b/widget/src/os2/nsCanvas.h deleted file mode 100644 index 373f92f2ec07..000000000000 --- a/widget/src/os2/nsCanvas.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * The contents of this file are subject to the Mozilla Public License - * Version 1.1 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - * License for the specific language governing rights and limitations - * under the License. - * - * The Original Code is the Mozilla OS/2 libraries. - * - * The Initial Developer of the Original Code is John Fairhurst, - * . Portions created by John Fairhurst are - * Copyright (C) 1999 John Fairhurst. All Rights Reserved. - * - * Contributor(s): - * This Original Code has been modified by IBM Corporation. - * Modifications made by IBM described herein are - * Copyright (c) International Business Machines - * Corporation, 2000 - * - * Modifications to Mozilla code or documentation - * identified per MPL Section 3.3 - * - * Date Modified by Description of modification - * 04/12/2000 IBM Corp. Changed params on DispatchMouseEvent to match Windows.. - * - */ - -#ifndef _nscanvas_h -#define _nscanvas_h - -// nscanvas - this is the NS_CHILD_CID class which contains content. -// The main code added in here is to do painting. - -#include "nswindow.h" - -class nsCanvas : public nsWindow -{ - public: - nsCanvas() {}; - - protected: - virtual PRBool DispatchMouseEvent( PRUint32 aEventType, MPARAM mp1, MPARAM mp2); - virtual ULONG WindowStyle(); -}; - -#endif diff --git a/widget/src/os2/nsWidgetFactory.cpp b/widget/src/os2/nsWidgetFactory.cpp index 92ceb4661e2d..f8e5833df511 100644 --- a/widget/src/os2/nsWidgetFactory.cpp +++ b/widget/src/os2/nsWidgetFactory.cpp @@ -48,7 +48,7 @@ // class definition headers #include "nsAppShell.h" #include "nsBidiKeyboard.h" -#include "nsCanvas.h" +#include "nsWindow.h" #include "nsDragService.h" #include "nsILocalFile.h" #include "nsFilePicker.h" @@ -68,7 +68,7 @@ // objects that just require generic constructors NS_GENERIC_FACTORY_CONSTRUCTOR(nsBidiKeyboard) -NS_GENERIC_FACTORY_CONSTRUCTOR(nsCanvas) +NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindow) NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboard) NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardHelper) NS_GENERIC_FACTORY_CONSTRUCTOR(nsFilePicker) @@ -227,10 +227,10 @@ static const nsModuleComponentInfo components[] = NS_BIDIKEYBOARD_CID, "@mozilla.org/widget/bidikeyboard;1", nsBidiKeyboardConstructor }, - { "OS/2 Canvas", + { "OS/2 Child Window", NS_CHILD_CID, "@mozilla.org/widget/child_window/os2;1", - nsCanvasConstructor }, + nsWindowConstructor }, { "OS/2 Clipboard", NS_CLIPBOARD_CID, "@mozilla.org/widget/clipboard;1", diff --git a/widget/src/os2/nsWindow.cpp b/widget/src/os2/nsWindow.cpp index 1d8017fb06f6..0f9d6fc106bd 100644 --- a/widget/src/os2/nsWindow.cpp +++ b/widget/src/os2/nsWindow.cpp @@ -2208,9 +2208,11 @@ PRBool nsWindow::ProcessMessage( ULONG msg, MPARAM mp1, MPARAM mp2, MRESULT *rc) // behaviour (see nsEditorEventListeners.cpp) case WM_BUTTON1DOWN: + WinSetCapture( HWND_DESKTOP, mWnd); result = DispatchMouseEvent( NS_MOUSE_LEFT_BUTTON_DOWN, mp1, mp2); break; case WM_BUTTON1UP: + WinSetCapture( HWND_DESKTOP, 0); // release result = DispatchMouseEvent( NS_MOUSE_LEFT_BUTTON_UP, mp1, mp2); break; case WM_BUTTON1DBLCLK: @@ -2218,9 +2220,11 @@ PRBool nsWindow::ProcessMessage( ULONG msg, MPARAM mp1, MPARAM mp2, MRESULT *rc) break; case WM_BUTTON2DOWN: + WinSetCapture( HWND_DESKTOP, mWnd); result = DispatchMouseEvent( NS_MOUSE_RIGHT_BUTTON_DOWN, mp1, mp2); break; case WM_BUTTON2UP: + WinSetCapture( HWND_DESKTOP, 0); // release result = DispatchMouseEvent( NS_MOUSE_RIGHT_BUTTON_UP, mp1, mp2); break; case WM_BUTTON2DBLCLK: @@ -2269,7 +2273,9 @@ PRBool nsWindow::ProcessMessage( ULONG msg, MPARAM mp1, MPARAM mp2, MRESULT *rc) ptlLastPos.y = (SHORT)SHORT2FROMMP(mp1); } } - result = DispatchMouseEvent( NS_MOUSE_MOVE, mp1, mp2); + DispatchMouseEvent( NS_MOUSE_MOVE, mp1, mp2); + // don't propogate mouse move or the OS will change the pointer + result = PR_TRUE; break; case WM_MOUSEENTER: result = DispatchMouseEvent( NS_MOUSE_ENTER, mp1, mp2); @@ -3309,3 +3315,7 @@ PCSZ nsWindow::WindowClass() return className; } +ULONG nsWindow::WindowStyle() +{ + return BASE_CONTROL_STYLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS; +} diff --git a/widget/src/os2/nsWindow.h b/widget/src/os2/nsWindow.h index 7d4b38171fba..4dc770fe1590 100644 --- a/widget/src/os2/nsWindow.h +++ b/widget/src/os2/nsWindow.h @@ -183,7 +183,7 @@ protected: static nsWindow* gCurrentWindow; // nsWindow methods subclasses must provide for creation to work virtual PCSZ WindowClass(); - virtual ULONG WindowStyle() = 0; + virtual ULONG WindowStyle(); // hooks subclasses may wish to override! virtual void PostCreateWidget() {}