Fix bug #72313. Focus problems on linux. This adds a flag to nsIWidget::SetFocus() that says to raise the window. We only raise the window from one place, window.focus(). This builds and runs on at least linux and the mac. r=jst,brendan,hyatt a=leaf

This commit is contained in:
blizzard%redhat.com 2001-03-19 17:56:04 +00:00
Родитель ffc6a23c5a
Коммит ef1092aba4
28 изменённых файлов: 30 добавлений и 29 удалений

Просмотреть файл

@ -1647,7 +1647,8 @@ NS_IMETHODIMP GlobalWindowImpl::Focus()
nsCOMPtr<nsIWidget> widget;
vm->GetWidget(getter_AddRefs(widget));
if (widget)
result = widget->SetFocus();
// raise the window since this was a focus call on the window.
result = widget->SetFocus(PR_TRUE);
}
}

Просмотреть файл

@ -416,7 +416,7 @@ class nsIWidget : public nsISupports {
/**
* Give focus to this widget.
*/
NS_IMETHOD SetFocus(void) = 0;
NS_IMETHOD SetFocus(PRBool aRaise = PR_FALSE) = 0;
/**
* Get this widget's outside dimensions relative to its parent widget

Просмотреть файл

@ -1048,7 +1048,7 @@ NS_METHOD nsWindow::Enable(PRBool bState)
// Give the focus to this component
//
//-------------------------------------------------------------------------
NS_METHOD nsWindow::SetFocus(void)
NS_METHOD nsWindow::SetFocus(PRBool aRaise)
{
//
// Switch to the "main gui thread" if necessary... This method must

Просмотреть файл

@ -109,7 +109,7 @@ public:
PRInt32 aHeight,
PRBool aRepaint);
NS_IMETHOD Enable(PRBool bState);
NS_IMETHOD SetFocus(void);
NS_IMETHOD SetFocus(PRBool aRaise);
NS_IMETHOD GetBounds(nsRect &aRect);
NS_IMETHOD GetClientBounds(nsRect &aRect);
NS_IMETHOD SetBackgroundColor(const nscolor &aColor);

Просмотреть файл

@ -689,7 +689,7 @@ NS_IMETHODIMP nsWidget::Enable(PRBool bState)
// Give the focus to this component
//
//-------------------------------------------------------------------------
NS_IMETHODIMP nsWidget::SetFocus(void)
NS_IMETHODIMP nsWidget::SetFocus(PRBool aRaise)
{
// call this so that any cleanup will happen that needs to...
LoseFocus();

Просмотреть файл

@ -112,7 +112,7 @@ public:
PRInt32 aHeight, PRBool aRepaint);
NS_IMETHOD Enable(PRBool aState);
NS_IMETHOD SetFocus(void);
NS_IMETHOD SetFocus(PRBool aRaise);
virtual void LoseFocus(void);

Просмотреть файл

@ -1075,7 +1075,7 @@ NS_IMETHODIMP nsWindow::SetCursor(nsCursor aCursor)
}
NS_IMETHODIMP
nsWindow::SetFocus(void)
nsWindow::SetFocus(PRBool aRaise)
{
PRBool sendActivate = gJustGotActivate;
gJustGotActivate = PR_FALSE;
@ -1090,7 +1090,7 @@ nsWindow::SetFocus(void)
toplevel = gtk_widget_get_toplevel(top_mozarea);
// map the window if the pref says to
if (gRaiseWindows)
if (gRaiseWindows && aRaise)
GetAttention();
#ifdef DEBUG_FOCUS

Просмотреть файл

@ -85,7 +85,7 @@ public:
NS_IMETHOD InvalidateRegion(const nsIRegion* aRegion, PRBool aIsSynchronous);
NS_IMETHOD SetBackgroundColor(const nscolor &aColor);
NS_IMETHOD SetCursor(nsCursor aCursor);
NS_IMETHOD SetFocus(void);
NS_IMETHOD SetFocus(PRBool aRaise);
NS_IMETHOD GetAttention(void);
NS_IMETHOD Destroy();

Просмотреть файл

@ -522,7 +522,7 @@ static Boolean we_are_front_process()
// Set the focus on this component
//
//-------------------------------------------------------------------------
NS_IMETHODIMP nsWindow::SetFocus(void)
NS_IMETHODIMP nsWindow::SetFocus(PRBool aRaise)
{
gEventDispatchHandler.SetFocus(this);

Просмотреть файл

@ -119,7 +119,7 @@ public:
NS_IMETHOD Resize(PRInt32 aX, PRInt32 aY,PRInt32 aWidth,PRInt32 aHeight, PRBool aRepaint);
NS_IMETHOD Enable(PRBool bState);
NS_IMETHOD SetFocus(void);
NS_IMETHOD SetFocus(PRBool aRaise);
NS_IMETHOD SetBounds(const nsRect &aRect);
NS_IMETHOD GetBounds(nsRect &aRect);

Просмотреть файл

@ -679,7 +679,7 @@ NS_METHOD nsWindow::Enable(PRBool bState)
// Give the focus to this component
//
//-------------------------------------------------------------------------
NS_METHOD nsWindow::SetFocus(void)
NS_METHOD nsWindow::SetFocus(PRBool aRaise)
{
// Go get the parent of all widget's to determine which widget
// tree to use to set the focus.

Просмотреть файл

@ -88,7 +88,7 @@ public:
PRInt32 aHeight,
PRBool aRepaint);
NS_IMETHOD Enable(PRBool bState);
NS_IMETHOD SetFocus(void);
NS_IMETHOD SetFocus(PRBool aRaise);
NS_IMETHOD GetBounds(nsRect &aRect);
virtual nscolor GetForegroundColor(void);
NS_IMETHOD SetForegroundColor(const nscolor &aColor);

Просмотреть файл

@ -1251,7 +1251,7 @@ NS_METHOD nsWindow::Enable(PRBool bState)
// Give the focus to this component
//
//-------------------------------------------------------------------------
NS_METHOD nsWindow::SetFocus(void)
NS_METHOD nsWindow::SetFocus(PRBool aRaise)
{
//
// Switch to the "main gui thread" if necessary... This method must

Просмотреть файл

@ -102,7 +102,7 @@ class nsWindow : public nsBaseWidget,
NS_IMETHOD GetClientBounds( nsRect &aRect);
NS_IMETHOD GetBorderSize( PRInt32 &aWidth, PRInt32 &aHeight);
NS_IMETHOD Enable( PRBool bState);
NS_IMETHOD SetFocus();
NS_IMETHOD SetFocus(PRBool aRaise);
NS_IMETHOD IsVisible( PRBool &aState);
NS_IMETHOD PlaceBehind(nsIWidget *aWidget, PRBool aActivate);

Просмотреть файл

@ -491,7 +491,7 @@ NS_METHOD nsWidget::Enable( PRBool bState ) {
// Give the focus to this component
//
//-------------------------------------------------------------------------
NS_METHOD nsWidget::SetFocus( void ) {
NS_METHOD nsWidget::SetFocus(PRBool aRaise) {
// call this so that any cleanup will happen that needs to...
LooseFocus();

Просмотреть файл

@ -93,7 +93,7 @@ public:
PRInt32 aHeight, PRBool aRepaint);
NS_IMETHOD Enable(PRBool aState);
NS_IMETHOD SetFocus(void);
NS_IMETHOD SetFocus(PRBool aRaise);
virtual void LooseFocus(void);

Просмотреть файл

@ -286,7 +286,7 @@ NS_IMETHODIMP nsWindow::SetBackgroundColor( const nscolor &aColor ) {
}
NS_IMETHODIMP nsWindow::SetFocus( void ) {
NS_IMETHODIMP nsWindow::SetFocus(PRBool aRaise) {
return nsWidget::SetFocus();
}

Просмотреть файл

@ -84,7 +84,7 @@ public:
NS_IMETHOD Invalidate(const nsRect &aRect, PRBool aIsSynchronous);
NS_IMETHOD InvalidateRegion(const nsIRegion* aRegion, PRBool aIsSynchronous);
NS_IMETHOD SetBackgroundColor(const nscolor &aColor);
NS_IMETHOD SetFocus(void);
NS_IMETHOD SetFocus(PRBool aRaise);
NS_IMETHOD GetAttention(void);
NS_IMETHOD Update(void);

Просмотреть файл

@ -538,7 +538,7 @@ NS_METHOD nsWidget::Enable(PRBool bState)
// Give the focus to this component
//
//-------------------------------------------------------------------------
NS_METHOD nsWidget::SetFocus(void)
NS_METHOD nsWidget::SetFocus(PRBool aRaise)
{
PR_LOG(QtWidgetsLM,
PR_LOG_DEBUG,

Просмотреть файл

@ -91,7 +91,7 @@ public:
PRBool aRepaint);
NS_IMETHOD Enable(PRBool aState);
NS_IMETHOD SetFocus(void);
NS_IMETHOD SetFocus(PRBool aRaise);
PRBool OnResize(nsSizeEvent event);
virtual PRBool OnResize(nsRect &aRect);

Просмотреть файл

@ -152,7 +152,7 @@ NS_METHOD nsWindow::RemoveTooltips()
return NS_OK;
}
NS_METHOD nsWindow::SetFocus()
NS_METHOD nsWindow::SetFocus(PRBool aRaise)
{
PR_LOG(QtWidgetsLM,
PR_LOG_DEBUG,

Просмотреть файл

@ -87,7 +87,7 @@ public:
NS_IMETHOD BeginResizingChildren(void);
NS_IMETHOD EndResizingChildren(void);
NS_IMETHOD SetFocus(void);
NS_IMETHOD SetFocus(PRBool aRaise);
virtual PRBool IsChild() const;
virtual PRBool IsPopup() const { return mIsPopup; };

Просмотреть файл

@ -1634,7 +1634,7 @@ NS_METHOD nsWindow::Enable(PRBool bState)
// Give the focus to this component
//
//-------------------------------------------------------------------------
NS_METHOD nsWindow::SetFocus(void)
NS_METHOD nsWindow::SetFocus(PRBool aRaise)
{
//
// Switch to the "main gui thread" if necessary... This method must

Просмотреть файл

@ -236,7 +236,7 @@ public:
PRInt32 aHeight,
PRBool aRepaint);
NS_IMETHOD Enable(PRBool bState);
NS_IMETHOD SetFocus(void);
NS_IMETHOD SetFocus(PRBool aRaise);
NS_IMETHOD GetBounds(nsRect &aRect);
NS_IMETHOD GetClientBounds(nsRect &aRect);
NS_IMETHOD SetBackgroundColor(const nscolor &aColor);

Просмотреть файл

@ -516,7 +516,7 @@ NS_IMETHODIMP nsWidget::Enable(PRBool bState)
return NS_OK;
}
NS_IMETHODIMP nsWidget::SetFocus(void)
NS_IMETHODIMP nsWidget::SetFocus(PRBool aRaise)
{
if (mBaseWindow) {

Просмотреть файл

@ -88,7 +88,7 @@ public:
PRBool aRepaint);
NS_IMETHOD Enable(PRBool bState);
NS_IMETHOD SetFocus(void);
NS_IMETHOD SetFocus(PRBool aRaise);
NS_IMETHOD SetName(const char * aName);
NS_IMETHOD SetBackgroundColor(const nscolor &aColor);
virtual nsIFontMetrics* GetFont(void);

Просмотреть файл

@ -322,7 +322,7 @@ NS_IMETHODIMP nsWindow::InvalidateRegion(const nsIRegion* aRegion, PRBool aIsSyn
}
NS_IMETHODIMP nsWindow::SetFocus(void)
NS_IMETHODIMP nsWindow::SetFocus(PRBool aRaise)
{
nsEventStatus status;
nsGUIEvent event;

Просмотреть файл

@ -94,7 +94,7 @@ class nsWindow : public nsWidget
PRBool aRepaint);
NS_IMETHOD SetFocus(void);
NS_IMETHOD SetFocus(PRBool aRaise);
virtual PRBool OnExpose(nsPaintEvent &event);
NS_IMETHOD GetAttention(void);