summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorStephan Schäfer <ssa@openoffice.org>2001-10-24 07:57:18 +0000
committerStephan Schäfer <ssa@openoffice.org>2001-10-24 07:57:18 +0000
commit79a4054a619bfa6cc6175d7b91beba0ea79ad868 (patch)
treeb916ccb231f8094bfbf9db52a6c5272dfde1b717 /vcl
parent62a43258ed485313a2547b72e1e9d215e7eb6563 (diff)
#89519# Systemwindow rework
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/app/help.cxx10
-rw-r--r--vcl/source/window/dialog.cxx10
-rw-r--r--vcl/source/window/floatwin.cxx54
-rw-r--r--vcl/source/window/menu.cxx33
-rw-r--r--vcl/source/window/window.cxx100
-rw-r--r--vcl/source/window/winproc.cxx52
-rw-r--r--vcl/unx/inc/salframe.h5
-rw-r--r--vcl/unx/source/window/salframe.cxx264
-rw-r--r--vcl/win/inc/salframe.h5
-rw-r--r--vcl/win/source/window/salframe.cxx241
10 files changed, 572 insertions, 202 deletions
diff --git a/vcl/source/app/help.cxx b/vcl/source/app/help.cxx
index b86ad07fa5ac..6a43e3c8939d 100644
--- a/vcl/source/app/help.cxx
+++ b/vcl/source/app/help.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: help.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: mt $ $Date: 2001-04-20 07:33:31 $
+ * last change: $Author: ssa $ $Date: 2001-10-24 08:47:17 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -615,7 +615,11 @@ void ImplSetHelpWindowPos( Window* pHelpWin, USHORT nHelpWinStyle, USHORT nStyle
{
Point aPos = rPos;
Size aSz = pHelpWin->GetSizePixel();
- Rectangle aScreenRect = pHelpWin->ImplGetFrameWindow()->GetDesktopRectPixel();
+ //Rectangle aScreenRect = pHelpWin->ImplGetFrameWindow()->GetDesktopRectPixel();
+ // GetDesktopRectPixel only makes sense for system windows, the help window
+ // however is (still) a VCL window, so we have to align it with the frame window:
+ Rectangle aScreenRect( Point(), pHelpWin->ImplGetFrameWindow()->GetSizePixel() );
+
if ( nHelpWinStyle == HELPWINSTYLE_QUICK )
{
if ( !(nStyle & QUICKHELP_NOAUTOPOS) )
diff --git a/vcl/source/window/dialog.cxx b/vcl/source/window/dialog.cxx
index 5326962f0a32..12480ee0a05f 100644
--- a/vcl/source/window/dialog.cxx
+++ b/vcl/source/window/dialog.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: dialog.cxx,v $
*
- * $Revision: 1.10 $
+ * $Revision: 1.11 $
*
- * last change: $Author: th $ $Date: 2001-08-07 11:54:21 $
+ * last change: $Author: ssa $ $Date: 2001-10-24 08:49:02 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -426,6 +426,9 @@ void Dialog::ImplCenterDialog()
Point aDeskPos = aDeskRect.TopLeft();
Size aDeskSize = aDeskRect.GetSize();
Size aWinSize = GetSizePixel();
+ Window *pWindow = this;
+ while ( pWindow->mpBorderWindow )
+ pWindow = pWindow->mpBorderWindow;
Point aWinPos( ((aDeskSize.Width() - aWinSize.Width()) / 2) + aDeskPos.X(),
((aDeskSize.Height() - aWinSize.Height()) / 2) + aDeskPos.Y() );
@@ -440,7 +443,8 @@ void Dialog::ImplCenterDialog()
if ( aWinPos.Y() < aDeskPos.Y() )
aWinPos.Y() = aDeskPos.Y();
- SetPosPixel( aWinPos );
+ //SetPosPixel( aWinPos );
+ SetPosPixel( pWindow->ScreenToOutputPixel( aWinPos ) );
}
// -----------------------------------------------------------------------
diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx
index 5d9f2c68edfc..b7fa3e95a5d9 100644
--- a/vcl/source/window/floatwin.cxx
+++ b/vcl/source/window/floatwin.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: floatwin.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: th $ $Date: 2001-08-23 13:41:53 $
+ * last change: $Author: ssa $ $Date: 2001-10-24 08:49:02 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -86,7 +86,9 @@
#ifndef _SV_FLOATWIN_HXX
#include <floatwin.hxx>
#endif
-
+#ifndef _SV_WINDOW_H
+#include <window.h>
+#endif
#ifndef _SV_RC_H
#include <rc.h>
#endif
@@ -98,6 +100,7 @@
void FloatingWindow::ImplInit( Window* pParent, WinBits nStyle )
{
mbFloatWin = TRUE;
+ mbInCleanUp = FALSE;
if ( !pParent )
pParent = Application::GetAppWindow();
@@ -105,7 +108,7 @@ void FloatingWindow::ImplInit( Window* pParent, WinBits nStyle )
DBG_ASSERT( pParent, "FloatWindow::FloatingWindow(): - pParent == NULL and no AppWindow exists" );
// no Border, then we dont need a border window
- if ( !nStyle )
+ if ( !(nStyle & (WB_BORDER|WB_MOVEABLE|WB_SIZEABLE)) )
{
if ( nStyle & WB_SYSTEMWINDOW )
mbFrame = TRUE;
@@ -239,6 +242,18 @@ Point FloatingWindow::ImplCalcPos( Window* pWindow,
Point aPos;
Size aSize = pWindow->GetSizePixel();
Rectangle aScreenRect = pWindow->ImplGetFrameWindow()->GetDesktopRectPixel();
+
+ // convert....
+ Window* pW = pWindow;
+ if ( pW->mpRealParent )
+ pW = pW->mpRealParent;
+
+ Rectangle normRect( rRect ); // rRect is already relative to top-level window
+ normRect.SetPos( pW->ScreenToOutputPixel( normRect.TopLeft() ) );
+
+ Rectangle devRect( pW->OutputToAbsoluteScreenPixel( normRect.TopLeft() ),
+ pW->OutputToAbsoluteScreenPixel( normRect.BottomRight() ) );
+
USHORT nArrangeAry[5];
USHORT nArrangeIndex;
BOOL bLeft;
@@ -288,26 +303,26 @@ Point FloatingWindow::ImplCalcPos( Window* pWindow,
switch ( nArrangeAry[nArrangeIndex] )
{
case FLOATWIN_POPUPMODE_LEFT:
- aPos.X() = rRect.Left()-aSize.Width();
- aPos.Y() = rRect.Top();
+ aPos.X() = devRect.Left()-aSize.Width();
+ aPos.Y() = devRect.Top();
aPos.Y() -= pWindow->mnTopBorder;
if ( aPos.X() < aScreenRect.Left() )
bBreak = FALSE;
break;
case FLOATWIN_POPUPMODE_RIGHT:
- aPos = rRect.TopRight();
+ aPos = devRect.TopRight();
aPos.Y() -= pWindow->mnTopBorder;
if ( aPos.X()+aSize.Width() > aScreenRect.Right() )
bBreak = FALSE;
break;
case FLOATWIN_POPUPMODE_UP:
- aPos.X() = rRect.Left();
- aPos.Y() = rRect.Top()-aSize.Height();
+ aPos.X() = devRect.Left();
+ aPos.Y() = devRect.Top()-aSize.Height();
if ( aPos.Y() < aScreenRect.Top() )
bBreak = FALSE;
break;
case FLOATWIN_POPUPMODE_DOWN:
- aPos = rRect.BottomLeft();
+ aPos = devRect.BottomLeft();
if ( aPos.Y()+aSize.Height() > aScreenRect.Bottom() )
bBreak = FALSE;
break;
@@ -322,7 +337,7 @@ Point FloatingWindow::ImplCalcPos( Window* pWindow,
if ( aPos.Y()+aSize.Height() > aScreenRect.Bottom() )
{
bTop = TRUE;
- aPos.Y() = rRect.Bottom()-aSize.Height();
+ aPos.Y() = devRect.Bottom()-aSize.Height();
if ( aPos.Y() < aScreenRect.Top() )
aPos.Y() = aScreenRect.Top();
}
@@ -332,7 +347,7 @@ Point FloatingWindow::ImplCalcPos( Window* pWindow,
if ( aPos.X()+aSize.Width() > aScreenRect.Right() )
{
bLeft = TRUE;
- aPos.X() = rRect.Right()-aSize.Width();
+ aPos.X() = devRect.Right()-aSize.Width();
if ( aPos.X() < aScreenRect.Left() )
aPos.X() = aScreenRect.Left();
}
@@ -356,7 +371,10 @@ Point FloatingWindow::ImplCalcPos( Window* pWindow,
aPos.Y() = aScreenRect.Top();
rArrangeIndex = nArrangeIndex;
- return aPos;
+
+ aPos = pW->AbsoluteScreenToOutputPixel( aPos );
+ // caller expects cordinates relative to top-level win
+ return pW->OutputToScreenPixel( aPos );
}
// -----------------------------------------------------------------------
@@ -607,13 +625,12 @@ void FloatingWindow::StartPopupMode( const Rectangle& rRect, ULONG nFlags )
}
else
*/
- Show();
-
// FloatingWindow in Liste der Fenster aufnehmen, die sich im PopupModus
// befinden
ImplSVData* pSVData = ImplGetSVData();
mpNextFloat = pSVData->maWinData.mpFirstFloat;
pSVData->maWinData.mpFirstFloat = this;
+ Show( TRUE, SHOW_NOACTIVATE );
}
// -----------------------------------------------------------------------
@@ -668,10 +685,13 @@ void FloatingWindow::ImplEndPopupMode( USHORT nFlags, ULONG nFocusId )
ImplSVData* pSVData = ImplGetSVData();
+ mbInCleanUp = TRUE; // prevent killing this window due to focus change while working with it
+
// Bei allen nachfolgenden PopupMode-Fenster den Modus auch beenden
- while ( pSVData->maWinData.mpFirstFloat != this )
+ while ( pSVData->maWinData.mpFirstFloat && pSVData->maWinData.mpFirstFloat != this )
pSVData->maWinData.mpFirstFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL );
+
// Fenster aus der Liste austragen
pSVData->maWinData.mpFirstFloat = mpNextFloat;
mpNextFloat = NULL;
@@ -728,6 +748,8 @@ void FloatingWindow::ImplEndPopupMode( USHORT nFlags, ULONG nFocusId )
}
}
}
+
+ mbInCleanUp = FALSE;
}
// -----------------------------------------------------------------------
diff --git a/vcl/source/window/menu.cxx b/vcl/source/window/menu.cxx
index 3715ee0666fe..7eb193c5c587 100644
--- a/vcl/source/window/menu.cxx
+++ b/vcl/source/window/menu.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: menu.cxx,v $
*
- * $Revision: 1.15 $
+ * $Revision: 1.16 $
*
- * last change: $Author: mt $ $Date: 2001-10-09 13:56:47 $
+ * last change: $Author: ssa $ $Date: 2001-10-24 08:49:02 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -125,7 +125,6 @@
#ifndef _VCL_I18NHELP_HXX
#include <i18nhelp.hxx>
#endif
-
#ifndef _ISOLANG_HXX
#include <tools/isolang.hxx>
#endif
@@ -1943,6 +1942,12 @@ USHORT PopupMenu::ImplExecute( Window* pW, const Rectangle& rRect, ULONG nPopupM
nFocusId = Window::SaveFocus();
bRealExecute = TRUE;
}
+ else
+ {
+ // assure that only one menu is open at a time
+ if( pStartedFrom->bIsMenuBar && pSVData->maWinData.mpFirstFloat )
+ pSVData->maWinData.mpFirstFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL );
+ }
DBG_ASSERT( !ImplGetWindow(), "Win?!" );
Rectangle aRect( rRect );
@@ -2002,7 +2007,7 @@ USHORT PopupMenu::ImplExecute( Window* pW, const Rectangle& rRect, ULONG nPopupM
aMnemonicGenerator.CreateMnemonic( pItemList->GetDataFromPos(n)->aText );
}
- MenuFloatingWindow* pWin = new MenuFloatingWindow( this, pW, nStyle );
+ MenuFloatingWindow* pWin = new MenuFloatingWindow( this, pW, nStyle | WB_SYSTEMWINDOW );
pWindow = pWin;
Size aSz = ImplCalcSize( pWin );
@@ -2305,8 +2310,9 @@ IMPL_LINK( MenuFloatingWindow, PopupEnd, FloatingWindow*, pPopup )
{
if ( pActivePopup )
{
- DBG_ASSERT( !pActivePopup->ImplGetWindow(), "PopupEnd, obwohl pActivePopup MIT Window!" );
- pActivePopup->bCanceled = TRUE;
+ //DBG_ASSERT( !pActivePopup->ImplGetWindow(), "PopupEnd, obwohl pActivePopup MIT Window!" );
+ KillActivePopup(); // should be ok to just remove it
+ //pActivePopup->bCanceled = TRUE;
}
bInExecute = FALSE;
pMenu->bInCallback = TRUE;
@@ -2351,7 +2357,10 @@ IMPL_LINK( MenuFloatingWindow, HighlightChanged, Timer*, pTimer )
{
if ( pActivePopup && ( pActivePopup != pData->pSubMenu ) )
{
+ ULONG nOldFlags = GetPopupModeFlags();
+ SetPopupModeFlags( GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE );
KillActivePopup();
+ SetPopupModeFlags( nOldFlags );
}
if ( pData->bEnabled && pData->pSubMenu && pData->pSubMenu->GetItemCount() && ( pData->pSubMenu != pActivePopup ) )
{
@@ -2389,7 +2398,10 @@ IMPL_LINK( MenuFloatingWindow, HighlightChanged, Timer*, pTimer )
// die lange im Activate Rescheduled haben und jetzt schon nicht mehr
// angezeigt werden sollen.
Menu* pTest = pActivePopup;
+ ULONG nOldFlags = GetPopupModeFlags();
+ SetPopupModeFlags( GetPopupModeFlags() | FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE );
USHORT nRet = pActivePopup->ImplExecute( this, Rectangle( aItemTopLeft, aItemBottomRight ), FLOATWIN_POPUPMODE_RIGHT, pMenu, pTimer ? FALSE : TRUE );
+ SetPopupModeFlags( nOldFlags );
// nRet != 0, wenn es waerend Activate() abgeschossen wurde...
if ( !nRet && ( pActivePopup == pTest ) && pActivePopup->ImplGetWindow() )
@@ -2454,6 +2466,9 @@ void MenuFloatingWindow::KillActivePopup( PopupMenu* pThisOnly )
{
if ( pActivePopup && ( !pThisOnly || ( pThisOnly == pActivePopup ) ) )
{
+ //if( pActivePopup->pWindow->mbFloatWin )
+ if( ((FloatingWindow *) pActivePopup->pWindow)->IsInCleanUp() )
+ return; // kill it later
if ( pActivePopup->bInCallback )
pActivePopup->bCanceled = TRUE;
@@ -2469,6 +2484,7 @@ void MenuFloatingWindow::KillActivePopup( PopupMenu* pThisOnly )
pPopup->ImplGetFloatingWindow()->StopExecute();
delete pPopup->pWindow;
pPopup->pWindow = NULL;
+
Update();
}
}
@@ -3088,6 +3104,7 @@ void MenuBarWindow::ImplCreatePopup( BOOL bPreSelectFirst )
}
pData = pMenu->pItemList->GetDataFromPos( nHighlightedItem );
// Point MyPos = GetPosPixel();
+// Point aItemTopLeft( MyPos.X()+nX, MyPos.Y() );
Point aItemTopLeft( nX, 0 );
Point aItemBottomRight( aItemTopLeft );
aItemBottomRight.X() += pData->aSz.Width();
@@ -3117,6 +3134,10 @@ void MenuBarWindow::KillActivePopup()
{
if ( pActivePopup )
{
+ //if( pActivePopup->pWindow->mbFloatWin )
+ if( ((FloatingWindow *) pActivePopup->pWindow)->IsInCleanUp() )
+ return; // kill it later
+
if ( pActivePopup->bInCallback )
pActivePopup->bCanceled = TRUE;
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 29a39a5b74e3..9b9f123c4c90 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: window.cxx,v $
*
- * $Revision: 1.43 $
+ * $Revision: 1.44 $
*
- * last change: $Author: hro $ $Date: 2001-10-19 14:55:57 $
+ * last change: $Author: ssa $ $Date: 2001-10-24 08:49:02 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -556,7 +556,7 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, const ::com::sun::star::
if ( nStyle & WB_APP )
nFrameStyle |= SAL_FRAME_STYLE_DEFAULT;
if ( mbFloatWin || ((GetType() == WINDOW_BORDERWINDOW) && ((ImplBorderWindow*)this)->mbFloatWindow) )
- nFrameStyle = 0;
+ nFrameStyle = SAL_FRAME_STYLE_FLOAT; // hmmm, was '0' before ????
SalFrame* pParentFrame = NULL;
if ( pParent )
@@ -2942,6 +2942,16 @@ void Window::ImplPosSizeWindow( long nX, long nY,
}
}
+/* if ( nFlags & (WINDOW_POSSIZE_X|WINDOW_POSSIZE_Y) )
+ {
+ POINT aPt;
+ aPt.x = maPos.X();
+ aPt.y = maPos.Y();
+ ClientToScreen( mpFrame->maFrameData.mhWnd , &aPt );
+ maPos.X() = aPt.x;
+ maPos.Y() = aPt.y;
+ }
+*/
if ( bNewPos || bNewSize )
{
#ifndef REMOTE_APPSERVER
@@ -3602,11 +3612,18 @@ void Window::ImplGrabFocus( USHORT nFlags )
if ( !mpFrameData->mbHasFocus )
#endif
{
- // Hier setzen wir schon den Focus um, da ToTop() den Focus
- // nicht auf ein anderes Fenster setzen darf
- DBG_WARNING( "Window::GrabFocus() - Frame doesn't have the focus" );
- mpFrame->ToTop( 0 );
- return;
+ // menue windows never get the system focus
+ // the application will keep the focus
+ if( mbFloatWin )
+ return;
+ else
+ {
+ // Hier setzen wir schon den Focus um, da ToTop() den Focus
+ // nicht auf ein anderes Fenster setzen darf
+ DBG_WARNING( "Window::GrabFocus() - Frame doesn't have the focus" );
+ mpFrame->ToTop( 0 );
+ return;
+ }
}
Window* pOldFocusWindow = pSVData->maWinData.mpFocusWin;
@@ -5952,21 +5969,29 @@ void Window::SetPosSizePixel( long nX, long nY,
if ( pWindow->mbFrame )
{
- // Nur Groessenaenderungen werden beruecksichtig
- if ( (nFlags & WINDOW_POSSIZE_SIZE) == WINDOW_POSSIZE_SIZE )
- {
- if ( !(nFlags & WINDOW_POSSIZE_WIDTH) )
- nWidth = pWindow->mnOutWidth;
- if ( !(nFlags & WINDOW_POSSIZE_HEIGHT) )
- nHeight = pWindow->mnOutHeight;
-
- pWindow->mpFrame->SetClientSize( nWidth, nHeight );
- // Resize should be called directly. If we havn't
- // set the correct size, we get a second resize from
- // the system with the correct size. This can be happend
- // if the size is to small or to lare.
- ImplHandleResize( pWindow, nWidth, nHeight );
- }
+ if ( !(nFlags & WINDOW_POSSIZE_WIDTH) )
+ nWidth = pWindow->mnOutWidth;
+ if ( !(nFlags & WINDOW_POSSIZE_HEIGHT) )
+ nHeight = pWindow->mnOutHeight;
+
+ long nOldWidth = pWindow->mnOutWidth;
+ long nOldHeight = pWindow->mnOutHeight;
+
+ USHORT nSysFlags=0;
+ if( nFlags & WINDOW_POSSIZE_WIDTH )
+ nSysFlags |= SAL_FRAME_POSSIZE_WIDTH;
+ if( nFlags & WINDOW_POSSIZE_HEIGHT )
+ nSysFlags |= SAL_FRAME_POSSIZE_HEIGHT;
+ if( nFlags & WINDOW_POSSIZE_X )
+ nSysFlags |= SAL_FRAME_POSSIZE_X;
+ if( nFlags & WINDOW_POSSIZE_Y )
+ nSysFlags |= SAL_FRAME_POSSIZE_Y;
+ pWindow->mpFrame->SetPosSize( nX, nY, nWidth, nHeight, nSysFlags );
+ // Resize should be called directly. If we havn't
+ // set the correct size, we get a second resize from
+ // the system with the correct size. This can be happend
+ // if the size is to small or to large.
+ ImplHandleResize( pWindow, nWidth, nHeight );
}
else
{
@@ -5980,18 +6005,16 @@ void Window::SetPosSizePixel( long nX, long nY,
Rectangle Window::GetDesktopRectPixel() const
{
-/*
Rectangle rRect;
mpFrameWindow->mpFrame->GetWorkArea( rRect );
return rRect;
- */
- return Rectangle( ScreenToOutputPixel( Point() ), mpFrameWindow->GetOutputSizePixel() );
}
// -----------------------------------------------------------------------
Point Window::OutputToScreenPixel( const Point& rPos ) const
{
+ // relative to top level parent
return Point( rPos.X()+mnOutOffX, rPos.Y()+mnOutOffY );
}
@@ -5999,11 +6022,36 @@ Point Window::OutputToScreenPixel( const Point& rPos ) const
Point Window::ScreenToOutputPixel( const Point& rPos ) const
{
+ // relative to top level parent
return Point( rPos.X()-mnOutOffX, rPos.Y()-mnOutOffY );
}
// -----------------------------------------------------------------------
+Point Window::OutputToAbsoluteScreenPixel( const Point& rPos ) const
+{
+ // relative to the screen
+ Point p = OutputToScreenPixel( rPos );
+ SalFrame::Geometry g = mpFrame->GetGeometry();
+ p.X() += g.nX;
+ p.Y() += g.nY;
+ return p;
+}
+
+// -----------------------------------------------------------------------
+
+Point Window::AbsoluteScreenToOutputPixel( const Point& rPos ) const
+{
+ // relative to the screen
+ Point p = ScreenToOutputPixel( rPos );
+ SalFrame::Geometry g = mpFrame->GetGeometry();
+ p.X() -= g.nX;
+ p.Y() -= g.nY;
+ return p;
+}
+
+// -----------------------------------------------------------------------
+
void Window::Scroll( long nHorzScroll, long nVertScroll, USHORT nFlags )
{
DBG_CHKTHIS( Window, ImplDbgCheckWindow );
diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx
index e8848fc4ead7..bee72302c22a 100644
--- a/vcl/source/window/winproc.cxx
+++ b/vcl/source/window/winproc.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: winproc.cxx,v $
*
- * $Revision: 1.32 $
+ * $Revision: 1.33 $
*
- * last change: $Author: th $ $Date: 2001-08-13 11:36:36 $
+ * last change: $Author: ssa $ $Date: 2001-10-24 08:49:02 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -761,7 +761,8 @@ long ImplHandleMouseEvent( Window* pWindow, USHORT nSVEvent, BOOL bMouseLeave,
// Fenster bei Klick nach vorne bringen
if ( nSVEvent == EVENT_MOUSEBUTTONDOWN )
{
- pChild->ToTop();
+ if( !pChild->mbFloatWin ) // totop for floating windows would change the focus
+ pChild->ToTop();
if ( aDelData.IsDelete() )
return 1;
}
@@ -910,7 +911,10 @@ static Window* ImplGetKeyInputWindow( Window* pWindow )
// find window - is every time the window which has currently the
// focus or the last time the focus.
- Window* pChild = pWindow->mpFrameData->mpFocusWin;
+ // the first floating window always has the focus
+ Window* pChild = pSVData->maWinData.mpFirstFloat;
+ if( !pChild )
+ pChild = pWindow->mpFrameData->mpFocusWin;
// no child - than no input
if ( !pChild )
@@ -1390,8 +1394,9 @@ void ImplHandleResize( Window* pWindow, long nNewWidth, long nNewHeight )
pWindow->mbWaitSystemResize = FALSE;
if ( pWindow->IsReallyVisible() )
pWindow->ImplSetClipFlag();
- if ( pWindow->IsVisible() || pWindow->ImplGetWindow()->mbAllResize )
- pWindow->Resize();
+ if ( pWindow->IsVisible() || pWindow->ImplGetWindow()->mbAllResize ||
+ ( pWindow->mbFrame && pWindow->mpClientWindow ) ) // propagate resize for system border windows
+ pWindow->Resize(); // otherwise menues cannot be positioned
else
pWindow->mbCallResize = TRUE;
}
@@ -1404,6 +1409,25 @@ void ImplHandleResize( Window* pWindow, long nNewWidth, long nNewHeight )
// -----------------------------------------------------------------------
+void ImplHandleMove( Window* pWindow, long nNewX, long nNewY )
+{
+ ImplSVData* pSVData = ImplGetSVData();
+ if ( pSVData->maWinData.mpFirstFloat && pWindow->ImplIsRealParentPath( pSVData->maWinData.mpFirstFloat ) )
+ {
+ if ( !(pSVData->maWinData.mpFirstFloat->GetPopupModeFlags() & FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE) )
+ pSVData->maWinData.mpFirstFloat->EndPopupMode( FLOATWIN_POPUPMODEEND_CANCEL | FLOATWIN_POPUPMODEEND_CLOSEALL );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void ImplHandleMoveResize( Window* pWindow, long nNewX, long nNewY, long nNewWidth, long nNewHeight )
+{
+ ImplHandleResize( pWindow, nNewWidth, nNewHeight );
+}
+
+// -----------------------------------------------------------------------
+
static void ImplActivateFloatingWindows( Window* pWindow, BOOL bActive )
{
// Zuerst alle ueberlappenden Fenster ueberpruefen
@@ -1459,6 +1483,7 @@ IMPL_LINK( Window, ImplAsyncFocusHdl, void*, EMPTYARG )
}
else
{
+/*
Window* pFocusWin = mpFrameData->mpFocusWin;
if ( pFocusWin )
{
@@ -1504,6 +1529,7 @@ IMPL_LINK( Window, ImplAsyncFocusHdl, void*, EMPTYARG )
// Alle FloatingFenster deaktiv zeichnen
if ( mpFrameData->mbStartFocusState != bHasFocus )
ImplActivateFloatingWindows( this, bHasFocus );
+*/
}
return 0;
@@ -1879,6 +1905,13 @@ long ImplWindowFrameProc( void* pInst, SalFrame* pFrame,
}
break;
+ case SALEVENT_MOVE:
+ {
+ SalFrame::Geometry g = ((Window*)pInst)->mpFrame->GetGeometry();
+ ImplHandleMove( (Window*)pInst, g.nX, g.nY );
+ }
+ break;
+
case SALEVENT_RESIZE:
{
long nNewWidth;
@@ -1888,6 +1921,13 @@ long ImplWindowFrameProc( void* pInst, SalFrame* pFrame,
}
break;
+ case SALEVENT_MOVERESIZE:
+ {
+ SalFrame::Geometry g = ((Window*)pInst)->mpFrame->GetGeometry();
+ ImplHandleMoveResize( (Window*)pInst, g.nX, g.nY, g.nWidth, g.nHeight );
+ }
+ break;
+
case SALEVENT_GETFOCUS:
ImplHandleGetFocus( (Window*)pInst );
break;
diff --git a/vcl/unx/inc/salframe.h b/vcl/unx/inc/salframe.h
index c65ecf7302c1..1deff9fc6b55 100644
--- a/vcl/unx/inc/salframe.h
+++ b/vcl/unx/inc/salframe.h
@@ -2,9 +2,9 @@
*
* $RCSfile: salframe.h,v $
*
- * $Revision: 1.16 $
+ * $Revision: 1.17 $
*
- * last change: $Author: pl $ $Date: 2001-10-12 09:20:59 $
+ * last change: $Author: ssa $ $Date: 2001-10-24 08:56:39 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -207,6 +207,7 @@ class SalFrameData
void GetPosSize( Rectangle &rPosSize );
void SetSize ( const Size &rSize );
+ void Center();
void SetPosSize( const Rectangle &rPosSize );
void Minimize();
void Maximize();
diff --git a/vcl/unx/source/window/salframe.cxx b/vcl/unx/source/window/salframe.cxx
index 9b95417229ef..1f386872d6af 100644
--- a/vcl/unx/source/window/salframe.cxx
+++ b/vcl/unx/source/window/salframe.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: salframe.cxx,v $
*
- * $Revision: 1.89 $
+ * $Revision: 1.90 $
*
- * last change: $Author: pl $ $Date: 2001-10-19 13:19:21 $
+ * last change: $Author: ssa $ $Date: 2001-10-24 08:57:18 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -122,6 +122,9 @@
#include <psprint/printerinfomanager.hxx>
#endif
#endif
+#ifndef _SV_FLOATWIN_HXX
+#include <floatwin.hxx>
+#endif
#include <svapp.hxx>
@@ -663,7 +666,24 @@ inline SalFrameData::SalFrameData( SalFrame *pFrame )
mnIconID = 0; // ICON_DEFAULT
}
-SalFrame::SalFrame() : maFrameData( this ) {}
+SalFrame::SalFrame() : maFrameData( this )
+{
+ memset( &maGeometry, 0, sizeof(maGeometry) );
+}
+
+const SalFrame::Geometry& SalFrame::GetGeometry()
+{
+ maGeometry.nX = maFrameData.aPosSize_.Left();
+ maGeometry.nY = maFrameData.aPosSize_.Top();
+ maGeometry.nWidth = maFrameData.aPosSize_.GetWidth();
+ maGeometry.nHeight = maFrameData.aPosSize_.GetHeight();
+ maGeometry.nLeftDecoration = maFrameData.nLeft_;
+ maGeometry.nRightDecoration = maFrameData.nRight_;
+ maGeometry.nTopDecoration = maFrameData.nTop_;
+ maGeometry.nBottomDecoration = maFrameData.nBottom_;
+
+ return maGeometry;
+}
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
inline SalFrameData::~SalFrameData()
@@ -952,6 +972,18 @@ void SalFrame::Show( BOOL bVisible )
}
XSync( _GetXDisplay(), False );
+ if (maFrameData.mpParent != NULL && maFrameData.nStyle_ == 0)
+ {
+ ImplSVData* pSVData = ImplGetSVData();
+ if (pSVData->maWinData.mpFirstFloat != NULL)
+ {
+ ULONG nMode =
+ pSVData->maWinData.mpFirstFloat->GetPopupModeFlags();
+ pSVData->maWinData.mpFirstFloat->SetPopupModeFlags(
+ nMode | FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE);
+ }
+ XSetInputFocus(_GetXDisplay(), maFrameData.GetWindow(), RevertToParent, 0);
+ }
maFrameData.Call( SALEVENT_RESIZE, NULL );
/*
@@ -996,7 +1028,11 @@ void SalFrame::ToTop( USHORT nFlags )
it != maFrameData.maChildren.end(); ++it )
(*it)->ToTop( nFlags );
}
-
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void SalFrame::GetWorkArea( Rectangle& rWorkArea )
+{
+ rWorkArea = maFrameData.pDisplay_->getWMAdaptor()->getWorkArea( 0 );
+}
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void SalFrame::GetClientSize( long &rWidth, long &rHeight )
{
@@ -1021,29 +1057,23 @@ void SalFrame::GetClientSize( long &rWidth, long &rHeight )
}
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-void SalFrame::SetClientSize( long nWidth, long nHeight )
+
+void SalFrameData::Center( )
{
- if( maFrameData.nStyle_ & SAL_FRAME_STYLE_FLOAT )
- {
- maFrameData.SetPosSize( Rectangle(
- Point( maFrameData.aPosSize_.Left(), maFrameData.aPosSize_.Top() ),
- Size( nWidth, nHeight ) ) );
- return;
- }
XLIB_Window aDummy;
int nX, nY, nScreenWidth, nScreenHeight;
int nRealScreenWidth, nRealScreenHeight;
int nScreenX = 0, nScreenY = 0;
- nScreenWidth = _GetDisplay()->GetScreenSize().Width();
- nScreenHeight = _GetDisplay()->GetScreenSize().Height();
+ nScreenWidth = GetDisplay()->GetScreenSize().Width();
+ nScreenHeight = GetDisplay()->GetScreenSize().Height();
nRealScreenWidth = nScreenWidth;
nRealScreenHeight = nScreenHeight;
- if( maFrameData.mpParent )
+ if( mpParent )
{
- SalFrame* pFrame = maFrameData.mpParent;
+ SalFrame* pFrame = mpParent;
while( pFrame->maFrameData.mpParent )
pFrame = pFrame->maFrameData.mpParent;
if( pFrame->maFrameData.aPosSize_.IsEmpty() )
@@ -1053,7 +1083,7 @@ void SalFrame::SetClientSize( long nWidth, long nHeight )
{
XLIB_Window aRoot;
unsigned int bw, depth;
- XGetGeometry( maFrameData.GetXDisplay(),
+ XGetGeometry( GetXDisplay(),
pFrame->maFrameData.hForeignTopLevelWindow_,
&aRoot,
&nScreenX, &nScreenY,
@@ -1070,71 +1100,82 @@ void SalFrame::SetClientSize( long nWidth, long nHeight )
}
}
- nX = maFrameData.aPosSize_.Left();
- nY = maFrameData.aPosSize_.Top();
-
- if ( maFrameData.bDefaultPosition_ )
+ SalFrameData* pParentData = mpParent ? &mpParent->maFrameData : NULL;
+ if( pParentData && pParentData->nShowState_ == SHOWSTATE_NORMAL )
{
- SalFrameData* pParentData = maFrameData.mpParent ? &maFrameData.mpParent->maFrameData : NULL;
- if( pParentData && pParentData->nShowState_ == SHOWSTATE_NORMAL )
+ if( aPosSize_.GetWidth() >= pParentData->aPosSize_.GetWidth() &&
+ aPosSize_.GetHeight() >= pParentData->aPosSize_.GetHeight() )
{
- if( nWidth >= pParentData->aPosSize_.GetWidth() &&
- nHeight >= pParentData->aPosSize_.GetHeight() )
- {
- nX = pParentData->aPosSize_.Left()+40;
- nY = pParentData->aPosSize_.Top()+40;
- }
- else
- {
- // center the window relative to the top level frame
- nX = (nScreenWidth - nWidth ) / 2 + nScreenX;
- nY = (nScreenHeight - nHeight) / 2 + nScreenY;
- }
+ nX = nScreenX + 40;
+ nY = nScreenY + 40;
}
else
{
- // center the window relative to screen
- nX = (nRealScreenWidth - nWidth ) / 2;
- nY = (nRealScreenHeight - nHeight) / 2;
+ // center the window relative to the top level frame
+ nX = (nScreenWidth - aPosSize_.GetWidth() ) / 2 + nScreenX;
+ nY = (nScreenHeight - aPosSize_.GetHeight()) / 2 + nScreenY;
}
- nX = nX < 0 ? 0 : nX;
- nY = nY < 0 ? 0 : nY;
-
- if( maFrameData.nShowState_ == SHOWSTATE_NORMAL)
- maFrameData.bDefaultPosition_ = False;
}
-
- // once centered, we leave the window where it is with new size
- // but only if it does not run out of screen (unless user placed it there)
-
- if( nWidth > maFrameData.aPosSize_.GetWidth() )
+ else
{
- if ( nX + nWidth > nRealScreenWidth )
- nX = nRealScreenWidth - nWidth;
- nX = nX < 0 ? 0 : nX;
+ // center the window relative to screen
+ nX = (nRealScreenWidth - aPosSize_.GetWidth() ) / 2;
+ nY = (nRealScreenHeight - aPosSize_.GetHeight()) / 2;
}
- if( nHeight > maFrameData.aPosSize_.GetHeight() )
+ nX = nX < 0 ? 0 : nX;
+ nY = nY < 0 ? 0 : nY;
+
+ bDefaultPosition_ = False;
+ if( mpParent )
{
- if ( nY + nHeight > nRealScreenHeight )
- nY = nRealScreenHeight - nHeight;
- // guess: size of top window decoration is 20
- nY = nY < 20 ? 20 : nY;
+ nX -= mpParent->maFrameData.aPosSize_.Left();
+ nY -= mpParent->maFrameData.aPosSize_.Top();
}
Point aPoint ( nX, nY );
- Size aSize ( nWidth, nHeight );
- maFrameData.SetPosSize( Rectangle( aPoint, aSize ) );
+ SetPosSize( Rectangle( aPoint, aPosSize_.GetSize() ) );
}
-#if 0
-void SalFrame::SetClientPosSize( const Rectangle& rRect )
+// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+void SalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight, USHORT nFlags )
{
if( maFrameData.nStyle_ & SAL_FRAME_STYLE_CHILD )
return;
- maFrameData.SetPosSize( rRect );
+ // relative positioning in SalFrameData::SetPosSize
+
+ Rectangle aPosSize( maFrameData.aPosSize_ );
+ aPosSize.Justify();
+
+ if( ! ( nFlags & SAL_FRAME_POSSIZE_X ) )
+ {
+ nX = aPosSize.Left();
+ if( maFrameData.mpParent )
+ nX -= maFrameData.mpParent->maFrameData.aPosSize_.Left();
+ }
+ if( ! ( nFlags & SAL_FRAME_POSSIZE_Y ) )
+ {
+ nY = aPosSize.Top();
+ if( maFrameData.mpParent )
+ nY -= maFrameData.mpParent->maFrameData.aPosSize_.Top();
+ }
+ if( ! ( nFlags & SAL_FRAME_POSSIZE_WIDTH ) )
+ nWidth = aPosSize.GetWidth();
+ if( ! ( nFlags & SAL_FRAME_POSSIZE_HEIGHT ) )
+ nHeight = aPosSize.GetHeight();
+
+ aPosSize = Rectangle( Point( nX, nY ), Size( nWidth, nHeight ) );
+
+ if( maFrameData.bDefaultPosition_
+ && ! ( nFlags & ( SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y ) ) )
+ {
+ maFrameData.aPosSize_.SetSize( aPosSize.GetSize() );
+ maFrameData.Center();
+ }
+ else
+ maFrameData.SetPosSize( aPosSize );
+ maFrameData.bDefaultPosition_ = False;
}
-#endif
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
void SalFrame::SetAlwaysOnTop( BOOL bOnTop )
@@ -1238,7 +1279,7 @@ SalFrame::SetWindowState( const SalFrameState *pState )
if (pWM->supportsICCCMPos())
maFrameData.SetPosSize( aPosSize );
else
- SetClientSize (aPosSize.GetWidth(), aPosSize.GetHeight());
+ SetPosSize( 0, 0, aPosSize.GetWidth(), aPosSize.GetHeight(), SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT );
}
}
@@ -1414,18 +1455,13 @@ void SalFrameData::SetPosSize( const Rectangle &rPosSize )
if ( !values.width || !values.height || aPosSize_ == rPosSize )
return;
+#ifdef DEBUG
+ fprintf(stderr, "SalFrameData::SetPosSize( %dx%d+%d+%d )\n",
+ rPosSize.GetWidth(), rPosSize.GetHeight(),
+ rPosSize.Left(), rPosSize.Top() );
+#endif
- if( ! ( nStyle_ & ( SAL_FRAME_STYLE_CHILD | SAL_FRAME_STYLE_FLOAT ) ) )
- {
- MarkWindowAsGoodPositioned( XtWindow( hShell_ ) );
-
- if( !(pDisplay_->GetProperties() & PROPERTY_SUPPORT_WM_ClientPos) )
- {
- values.x -= nLeft_;
- values.y -= nTop_;
- }
- }
- if( ( nStyle_ & SAL_FRAME_STYLE_FLOAT ) && mpParent )
+ if( mpParent )
{
XLIB_Window aChild;
// coordinates are relative to parent, so translate to root coordinates
@@ -1437,6 +1473,24 @@ void SalFrameData::SetPosSize( const Rectangle &rPosSize )
& aChild );
}
+ bool bMoved = false;
+ bool bSized = false;
+ if( values.x != aPosSize_.Left() || values.y != aPosSize_.Top() )
+ bMoved = true;
+ if( values.width != aPosSize_.GetWidth() || values.height != aPosSize_.GetHeight() )
+ bSized = true;
+
+ if( ! ( nStyle_ & ( SAL_FRAME_STYLE_CHILD | SAL_FRAME_STYLE_FLOAT ) ) )
+ {
+ MarkWindowAsGoodPositioned( XtWindow( hShell_ ) );
+
+ if( !(pDisplay_->GetProperties() & PROPERTY_SUPPORT_WM_ClientPos) )
+ {
+ values.x -= nLeft_;
+ values.y -= nTop_;
+ }
+ }
+
if( ! ( nStyle_ & SAL_FRAME_STYLE_SIZEABLE ) )
{
Arg args[10];
@@ -1450,8 +1504,13 @@ void SalFrameData::SetPosSize( const Rectangle &rPosSize )
XMoveResizeWindow( GetXDisplay(), GetShellWindow(), values.x, values.y, values.width, values.height );
XMoveResizeWindow( GetXDisplay(), GetWindow(), 0, 0, values.width, values.height );
- aPosSize_ = rPosSize;
- Call ( SALEVENT_RESIZE, NULL );
+ aPosSize_ = Rectangle( Point( values.x, values.y ), Size( values.width, values.height ) );;
+ if( bSized && ! bMoved )
+ Call ( SALEVENT_RESIZE, NULL );
+ else if( bMoved && ! bSized )
+ Call ( SALEVENT_MOVE, NULL );
+ else
+ Call ( SALEVENT_MOVERESIZE, NULL );
// allow the external status window to reposition
if (mbInputFocus && mpInputContext != NULL)
@@ -2028,8 +2087,12 @@ long SalFrameData::HandleMouseEvent( XEvent *pEvent )
// is "a little tricky"
// on some wm however, this leads to closing our menues before the menu event
// was fired (#89867), so we cancel this now
- // if( nStyle_ & SAL_FRAME_STYLE_CHILD )
- // XSetInputFocus( GetDisplay()->GetDisplay(), GetWindow(), RevertToParent, CurrentTime );
+ //if( nStyle_ & SAL_FRAME_STYLE_CHILD )
+ //XSetInputFocus( GetDisplay()->GetDisplay(), GetWindow(), RevertToParent, CurrentTime );
+
+ // let mouse events reach the correct window
+ XUngrabPointer( GetXDisplay(), CurrentTime );
+
if( pEvent->xbutton.button == Button1 ||
pEvent->xbutton.button == Button2 ||
pEvent->xbutton.button == Button3 )
@@ -2407,7 +2470,19 @@ long SalFrameData::HandleFocusEvent( XFocusChangeEvent *pEvent )
}
#endif
mbInputFocus = True;
- return Call( SALEVENT_GETFOCUS, 0 );
+ ImplSVData* pSVData = ImplGetSVData();
+
+
+
+ long nRet = Call( SALEVENT_GETFOCUS, 0 );
+ if ((mpParent != NULL && nStyle_ == 0)
+ && pSVData->maWinData.mpFirstFloat )
+ {
+ ULONG nMode = pSVData->maWinData.mpFirstFloat->GetPopupModeFlags();
+ pSVData->maWinData.mpFirstFloat->SetPopupModeFlags(
+ nMode & ~(FLOATWIN_POPUPMODE_NOAPPFOCUSCLOSE));
+ }
+ return nRet;
}
else
{
@@ -2510,6 +2585,7 @@ long SalFrameData::HandleSizeEvent( XConfigureEvent *pEvent )
{
if ( pEvent->window != XtWindow( hShell_ )
&& pEvent->window != XtWindow( hComposite_ )
+ && pEvent->window != hStackingWindow_
&& pEvent->window != hForeignParent_
&& pEvent->window != hForeignTopLevelWindow_ )
{
@@ -2536,6 +2612,17 @@ long SalFrameData::HandleSizeEvent( XConfigureEvent *pEvent )
XtSetArg(args[n], XtNwidth, pEvent->width); n++;
XtSetValues( hShell_, args, n );
}
+
+ if( pEvent->window == hStackingWindow_ )
+ {
+ if( aPosSize_.Left() != pEvent->x || aPosSize_.Top() != pEvent->y )
+ {
+ aPosSize_ = Rectangle( Point( pEvent->x, pEvent->y ), Size( pEvent->width, pEvent->height ) );
+ Call( SALEVENT_MOVE, NULL );
+ }
+ return 1;
+ }
+
if( SHOWSTATE_UNKNOWN == nShowState_ )
{
nShowState_ = SHOWSTATE_NORMAL;
@@ -2590,11 +2677,25 @@ long SalFrameData::HandleSizeEvent( XConfigureEvent *pEvent )
IMPL_LINK( SalFrameData, HandleResizeTimer, void*, pDummy )
{
+ bool bMoved = false;
+ bool bSized = true;
+ if( maResizeBuffer.Left() != aPosSize_.Left() ||
+ maResizeBuffer.Top() != aPosSize_.Top() )
+ bMoved = true;
+ if( maResizeBuffer.GetWidth() != aPosSize_.GetWidth() ||
+ maResizeBuffer.GetHeight() != aPosSize_.GetHeight() )
+ bSized = true;
+
aPosSize_ = maResizeBuffer;
// update children's position
RepositionChildren();
- Call( SALEVENT_RESIZE, NULL );
+ if( bSized && ! bMoved )
+ Call ( SALEVENT_RESIZE, NULL );
+ else if( bMoved && ! bSized )
+ Call ( SALEVENT_MOVE, NULL );
+ else
+ Call ( SALEVENT_MOVERESIZE, NULL );
SalPaintEvent aPEvt;
@@ -3129,6 +3230,8 @@ long SalFrameData::Dispatch( XEvent *pEvent )
nRet = HandleSizeEvent( &pEvent->xconfigure );
if( pEvent->xconfigure.window == hStackingWindow_ )
+ nRet = HandleSizeEvent( &pEvent->xconfigure );
+#if 0
{
// update position here as well as in HandleSizeEvent
// if the window is only moved this is the only
@@ -3143,6 +3246,7 @@ long SalFrameData::Dispatch( XEvent *pEvent )
&hDummy );
aPosSize_.SetPos( Point( nX, nY ) );
}
+#endif
RepositionChildren();
break;
}
diff --git a/vcl/win/inc/salframe.h b/vcl/win/inc/salframe.h
index d38ff373495a..0e7e4e5c7cfd 100644
--- a/vcl/win/inc/salframe.h
+++ b/vcl/win/inc/salframe.h
@@ -2,9 +2,9 @@
*
* $RCSfile: salframe.h,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: th $ $Date: 2001-08-07 12:49:38 $
+ * last change: $Author: ssa $ $Date: 2001-10-24 08:52:44 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -103,6 +103,7 @@ public:
BOOL mbFixBorder; // has window a fixed border
BOOL mbSizeBorder; // has window a sizeable border
BOOL mbNoIcon; // is an window without an icon
+ BOOL mbFloatWin; // is a FloatingWindow
BOOL mbFullScreen; // TRUE: in full screen mode
BOOL mbPresentation; // TRUE: Presentation Mode running
BOOL mbInShow; // innerhalb eines Show-Aufrufs
diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx
index 6d9fc934d9d6..106294659045 100644
--- a/vcl/win/source/window/salframe.cxx
+++ b/vcl/win/source/window/salframe.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: salframe.cxx,v $
*
- * $Revision: 1.25 $
+ * $Revision: 1.26 $
*
- * last change: $Author: as $ $Date: 2001-10-10 07:54:45 $
+ * last change: $Author: ssa $ $Date: 2001-10-24 08:53:13 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -183,6 +183,7 @@ SalFrame* ImplSalCreateFrame( SalInstance* pInst,
DWORD nSysStyle = 0;
DWORD nExSysStyle = 0;
BOOL bSubFrame = FALSE;
+ BOOL bSaveBits = FALSE;
// determine creation data
if ( nSalFrameStyle & SAL_FRAME_STYLE_CHILD )
@@ -233,6 +234,12 @@ SalFrame* ImplSalCreateFrame( SalInstance* pInst,
nExSysStyle |= WS_EX_TOOLWINDOW;
}
}
+ if ( nSalFrameStyle & SAL_FRAME_STYLE_FLOAT )
+ {
+ nExSysStyle |= WS_EX_TOOLWINDOW;
+ pFrame->maFrameData.mbFloatWin = TRUE;
+ bSaveBits = TRUE;
+ }
// init frame data
pFrame->maFrameData.mnStyle = nSalFrameStyle;
@@ -671,10 +678,14 @@ SalFrame::SalFrame()
maFrameData.mbSpezIME = FALSE;
maFrameData.mbAtCursorIME = FALSE;
maFrameData.mbCandidateMode = FALSE;
+ maFrameData.mbFloatWin = FALSE;
maFrameData.mbNoIcon = FALSE;
+
memset( &maFrameData.maState, 0, sizeof( SalFrameState ) );
maFrameData.maSysData.nSize = sizeof( SystemEnvData );
+ memset( &maGeometry, 0, sizeof( Geometry ) );
+
// Daten ermitteln, wenn erster Frame angelegt wird
if ( !pSalData->mpFirstFrame )
{
@@ -743,6 +754,12 @@ SalFrame::~SalFrame()
// -----------------------------------------------------------------------
+const SalFrame::Geometry& SalFrame::GetGeometry()
+{
+ return maGeometry;
+}
+
+// -----------------------------------------------------------------------
SalGraphics* SalFrame::GetGraphics()
{
if ( maFrameData.mbGraphics )
@@ -899,6 +916,10 @@ static void ImplSalShow( HWND hWnd, BOOL bVisible )
pFrame->maFrameData.mbOverwriteState = TRUE;
pFrame->maFrameData.mbInShow = TRUE;
ShowWindow( hWnd, pFrame->maFrameData.mnShowState );
+ if ( pFrame->maFrameData.mbFloatWin )
+ pFrame->maFrameData.mnShowState = SW_SHOWNOACTIVATE;
+ else
+ pFrame->maFrameData.mnShowState = SW_SHOW;
// Damit Taskleiste unter W98 auch gleich ausgeblendet wird
if ( pFrame->maFrameData.mbPresentation )
{
@@ -907,7 +928,7 @@ static void ImplSalShow( HWND hWnd, BOOL bVisible )
SetForegroundWindow( hWndParent );
SetForegroundWindow( hWnd );
}
- pFrame->maFrameData.mnShowState = SW_SHOW;
+
pFrame->maFrameData.mbInShow = FALSE;
// Direct Paint only, if we get the SolarMutx
@@ -983,48 +1004,86 @@ void SalFrame::SetMinClientSize( long nWidth, long nHeight )
// -----------------------------------------------------------------------
-void SalFrame::SetClientSize( long nWidth, long nHeight )
+void SalFrame::SetPosSize( long nX, long nY, long nWidth, long nHeight,
+ USHORT nFlags )
{
BOOL bVisible = (GetWindowStyle( maFrameData.mhWnd ) & WS_VISIBLE) != 0;
if ( !bVisible )
- maFrameData.mnShowState = SW_SHOWNORMAL;
+ {
+ if ( maFrameData.mbFloatWin )
+ maFrameData.mnShowState = SW_SHOWNOACTIVATE;
+ else
+ maFrameData.mnShowState = SW_SHOWNORMAL;
+ }
else
{
if ( IsIconic( maFrameData.mhWnd ) || IsZoomed( maFrameData.mhWnd ) )
- ShowWindow( maFrameData.mhWnd, SW_RESTORE );
+ ShowWindow( maFrameData.mhWnd, SW_RESTORE );
}
- // Fenstergroesse berechnen
- RECT aWinRect;
+ USHORT nEvent = 0;
+ UINT nPosSize = 0;
+ RECT aClientRect, aWindowRect;
+ GetClientRect( maFrameData.mhWnd, &aClientRect ); // x,y always 0,0, but width and height without border
+ GetWindowRect( maFrameData.mhWnd, &aWindowRect ); // x,y in screen coordinates, width and height with border
+
+ if ( !(nFlags & (SAL_FRAME_POSSIZE_X | SAL_FRAME_POSSIZE_Y)) )
+ nPosSize |= SWP_NOMOVE;
+ else
+ {
+ //DBG_ASSERT( nX && nY, " Windowposition of (0,0) requested!" );
+ nEvent = SALEVENT_MOVE;
+ }
+ if ( !(nFlags & (SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT)) )
+ nPosSize |= SWP_NOSIZE;
+ else
+ nEvent = (nEvent == SALEVENT_MOVE) ? SALEVENT_MOVERESIZE : SALEVENT_RESIZE;
+
+ if ( !(nFlags & SAL_FRAME_POSSIZE_X) )
+ nX = aWindowRect.left;
+ if ( !(nFlags & SAL_FRAME_POSSIZE_Y) )
+ nY = aWindowRect.top;
+ if ( !(nFlags & SAL_FRAME_POSSIZE_WIDTH) )
+ nWidth = aClientRect.right-aClientRect.left;
+ if ( !(nFlags & SAL_FRAME_POSSIZE_HEIGHT) )
+ nHeight = aClientRect.bottom-aClientRect.top;
+
+ // Calculate window size including the border
+ RECT aWinRect;
aWinRect.left = 0;
- aWinRect.right = (int)nWidth;
+ aWinRect.right = (int)nWidth-1;
aWinRect.top = 0;
- aWinRect.bottom = (int)nHeight;
- AdjustWindowRectEx( &aWinRect,
- GetWindowStyle( maFrameData.mhWnd ),
- FALSE,
- GetWindowExStyle( maFrameData.mhWnd ) );
- nWidth = aWinRect.right-aWinRect.left;
- nHeight = aWinRect.bottom-aWinRect.top;
-
- // Position so berechnen, das Fenster zentiert auf dem Desktop
- // angezeigt wird
- int nX;
- int nY;
- int nScreenX;
- int nScreenY;
- int nScreenWidth;
- int nScreenHeight;
+ aWinRect.bottom = (int)nHeight-1;
+ AdjustWindowRectEx( &aWinRect, GetWindowStyle( maFrameData.mhWnd ),
+ FALSE, GetWindowExStyle( maFrameData.mhWnd ) );
+ nWidth = aWinRect.right - aWinRect.left + 1;
+ nHeight = aWinRect.bottom - aWinRect.top + 1;
- RECT aRect;
- SystemParametersInfo( SPI_GETWORKAREA, 0, &aRect, 0 );
- nScreenX = aRect.left;
- nScreenY = aRect.top;
- nScreenWidth = aRect.right-aRect.left;
- nScreenHeight = aRect.bottom-aRect.top;
+ if ( ::GetParent( maFrameData.mhWnd ) )
+ {
+ POINT aPt;
+ aPt.x = nX;
+ aPt.y = nY;
+ ClientToScreen( ::GetParent( maFrameData.mhWnd ), &aPt );
+ nX = aPt.x;
+ nY = aPt.y;
+ }
- if ( maFrameData.mbDefPos )
+ if ( maFrameData.mbDefPos && (nPosSize & SWP_NOMOVE)) // we got no positioning request, so choose default position
{
+ // center window
+ int nScreenX;
+ int nScreenY;
+ int nScreenWidth;
+ int nScreenHeight;
+
+ RECT aRect;
+ SystemParametersInfo( SPI_GETWORKAREA, 0, &aRect, 0 );
+ nScreenX = aRect.left;
+ nScreenY = aRect.top;
+ nScreenWidth = aRect.right-aRect.left;
+ nScreenHeight = aRect.bottom-aRect.top;
+
HWND hWndParent = ::GetParent( maFrameData.mhWnd );
// Search for TopLevel Frame
while ( hWndParent && (GetWindowStyle( hWndParent ) & WS_CHILD) )
@@ -1069,42 +1128,52 @@ void SalFrame::SetClientSize( long nWidth, long nHeight )
if ( nY < nScreenY )
nY = nScreenY;
- if ( bVisible )
- maFrameData.mbDefPos = FALSE;
+ //if ( bVisible )
+ // maFrameData.mbDefPos = FALSE;
+
+ maFrameData.mbDefPos = FALSE; // center only once
+ nPosSize &= ~SWP_NOMOVE; // activate positioning
+ nEvent = SALEVENT_MOVERESIZE;
}
- else
+
+
+ SetWindowPos( maFrameData.mhWnd, 0, nX, nY, (int)nWidth, (int)nHeight, SWP_NOZORDER | SWP_NOACTIVATE | nPosSize );
+
+ if( !(nPosSize & SWP_NOMOVE) )
{
- RECT aWinRect;
- GetWindowRect( maFrameData.mhWnd, &aWinRect );
- nX = aWinRect.left;
- nY = aWinRect.top;
- // Window should be visible in the screen, so we adjust the window
- // if the size would be bigger
- if ( nWidth > aWinRect.right-aWinRect.left )
- {
- if ( nX+nWidth > nScreenX+nScreenWidth )
- nX = (nScreenX+nScreenWidth) - nWidth;
- if ( nX < nScreenX )
- nX = nScreenX;
- }
- if ( nHeight > aWinRect.bottom-aWinRect.top )
- {
- if ( nY+nHeight > nScreenY+nScreenHeight )
- nY = (nScreenY+nScreenHeight) - nHeight;
- if ( nY < nScreenY )
- nY = nScreenY;
- }
+ maGeometry.nX = nX;
+ maGeometry.nY = nY;
+ }
+ if( !(nPosSize & SWP_NOSIZE) )
+ {
+ maGeometry.nWidth = nWidth;
+ maGeometry.nHeight = nHeight;
}
- SetWindowPos( maFrameData.mhWnd, 0, nX, nY, (int)nWidth, (int)nHeight, SWP_NOZORDER | SWP_NOACTIVATE );
+ // Notification -- really ???
+ if( nEvent )
+ maFrameData.mpProc( maFrameData.mpInst, this, nEvent, NULL );
+}
+
+// -----------------------------------------------------------------------
+
+void SalFrame::GetWorkArea( Rectangle &rRect )
+{
+ RECT aRect;
+ SystemParametersInfo( SPI_GETWORKAREA, 0, &aRect, 0 );
+ rRect.nLeft = aRect.left;
+ rRect.nRight = aRect.right-1;
+ rRect.nTop = aRect.top;
+ rRect.nBottom = aRect.bottom-1;
}
// -----------------------------------------------------------------------
void SalFrame::GetClientSize( long& rWidth, long& rHeight )
{
- rWidth = maFrameData.mnWidth;
- rHeight = maFrameData.mnHeight;
+ Geometry rGeo = GetGeometry();
+ rWidth = rGeo.nWidth;
+ rHeight = rGeo.nHeight;
}
// -----------------------------------------------------------------------
@@ -2506,6 +2575,9 @@ static long ImplHandleMouseActivateMsg( HWND hWnd )
if ( !pFrame )
return 0;
+ if ( pFrame->maFrameData.mbFloatWin )
+ return TRUE;
+
SalMouseActivateEvent aMouseActivateEvt;
POINT aPt;
GetCursorPos( &aPt );
@@ -3062,6 +3134,53 @@ static void ImplHandlePaintMsg2( HWND hWnd, RECT* pRect )
// -----------------------------------------------------------------------
+static void UpdateFrameGeometry( HWND hWnd, SalFrame* pFrame )
+{
+ if( !pFrame )
+ return;
+
+ RECT aRect;
+ GetWindowRect( hWnd, &aRect );
+ /// calc coordinates of client area, ie without border
+ if ( GetWindowStyle( hWnd ) & WS_CAPTION )
+ {
+ aRect.top += GetSystemMetrics(SM_CYCAPTION);
+ }
+ if ( GetWindowStyle( hWnd ) & WS_BORDER )
+ {
+ aRect.left += GetSystemMetrics(SM_CXBORDER);
+ aRect.top += GetSystemMetrics(SM_CYBORDER);
+ }
+ if ( GetWindowStyle( hWnd ) & WS_THICKFRAME )
+ {
+ aRect.left += GetSystemMetrics(SM_CXEDGE);
+ aRect.top += GetSystemMetrics(SM_CYEDGE);
+ }
+ pFrame->maGeometry.nX = aRect.left;
+ pFrame->maGeometry.nY = aRect.top;
+
+ GetClientRect( hWnd, &aRect );
+ pFrame->maGeometry.nWidth = aRect.right - aRect.left;
+ pFrame->maGeometry.nHeight = aRect.bottom - aRect.top;
+}
+
+// -----------------------------------------------------------------------
+
+static void ImplCallMoveHdl( HWND hWnd )
+{
+ SalFrame* pFrame = GetWindowPtr( hWnd );
+ if ( pFrame )
+ {
+ pFrame->maFrameData.mpProc( pFrame->maFrameData.mpInst, pFrame,
+ SALEVENT_MOVE, 0 );
+ // Um doppelte Paints von VCL und SAL zu vermeiden
+ if ( IsWindowVisible( hWnd ) && !pFrame->maFrameData.mbInShow )
+ UpdateWindow( hWnd );
+ }
+}
+
+// -----------------------------------------------------------------------
+
static void ImplHandleMoveMsg( HWND hWnd )
{
if ( ImplSalYieldMutexTryToAcquire() )
@@ -3069,6 +3188,8 @@ static void ImplHandleMoveMsg( HWND hWnd )
SalFrame* pFrame = GetWindowPtr( hWnd );
if ( pFrame )
{
+ UpdateFrameGeometry( hWnd, pFrame );
+
if ( GetWindowStyle( hWnd ) & WS_VISIBLE )
pFrame->maFrameData.mbDefPos = FALSE;
@@ -3084,6 +3205,8 @@ static void ImplHandleMoveMsg( HWND hWnd )
// Status merken
ImplSaveFrameState( pFrame );
+ // Call Hdl
+ ImplCallMoveHdl( hWnd );
}
ImplSalYieldMutexRelease();
@@ -3125,6 +3248,8 @@ static void ImplHandleSizeMsg( HWND hWnd, WPARAM wParam, LPARAM lParam )
SalFrame* pFrame = GetWindowPtr( hWnd );
if ( pFrame )
{
+ UpdateFrameGeometry( hWnd, pFrame );
+
pFrame->maFrameData.mnWidth = (int)LOWORD(lParam);
pFrame->maFrameData.mnHeight = (int)HIWORD(lParam);
// Status merken