fix for combo boxes not grabbing the mouse on linux (fixes bugs 7898 and 26273) r=waqar

This commit is contained in:
pavlov%netscape.com 2000-02-11 22:26:36 +00:00
Родитель 0a21c89366
Коммит e883a22ccd
2 изменённых файлов: 24 добавлений и 12 удалений

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

@ -378,7 +378,7 @@ nsComboboxControlFrame::ShowPopup(PRBool aShowPopup)
void void
nsComboboxControlFrame::ShowList(nsIPresContext* aPresContext, PRBool aShowList) nsComboboxControlFrame::ShowList(nsIPresContext* aPresContext, PRBool aShowList)
{ {
nsIWidget * widget = nsnull; nsCOMPtr<nsIWidget> widget;
// Get parent view // Get parent view
nsIFrame * listFrame; nsIFrame * listFrame;
@ -387,25 +387,31 @@ nsComboboxControlFrame::ShowList(nsIPresContext* aPresContext, PRBool aShowList)
listFrame->GetView(aPresContext, &view); listFrame->GetView(aPresContext, &view);
NS_ASSERTION(view != nsnull, "nsComboboxControlFrame view is null"); NS_ASSERTION(view != nsnull, "nsComboboxControlFrame view is null");
if (view) { if (view) {
view->GetWidget(widget); view->GetWidget(*getter_AddRefs(widget));
}
if (nsnull != widget) {
widget->CaptureRollupEvents((nsIRollupListener *)this, !mDroppedDown, PR_TRUE);
NS_RELEASE(widget);
} }
} }
if (PR_TRUE == aShowList) { if (PR_TRUE == aShowList) {
ShowPopup(PR_TRUE); ShowPopup(PR_TRUE);
mDroppedDown = PR_TRUE; mDroppedDown = PR_TRUE;
// The listcontrol frame will call back to the nsComboboxControlFrame's ListWasSelected // The listcontrol frame will call back to the nsComboboxControlFrame's ListWasSelected
// which will stop the capture. // which will stop the capture.
mListControlFrame->AboutToDropDown(); mListControlFrame->AboutToDropDown();
mListControlFrame->CaptureMouseEvents(aPresContext, PR_TRUE); mListControlFrame->CaptureMouseEvents(aPresContext, PR_TRUE);
} else { } else {
ShowPopup(PR_FALSE); ShowPopup(PR_FALSE);
mDroppedDown = PR_FALSE; mDroppedDown = PR_FALSE;
} }
nsCOMPtr<nsIPresShell> presShell;
aPresContext->GetShell(getter_AddRefs(presShell));
presShell->FlushPendingNotifications();
if (widget)
widget->CaptureRollupEvents((nsIRollupListener *)this, mDroppedDown, PR_TRUE);
} }

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

@ -378,7 +378,7 @@ nsComboboxControlFrame::ShowPopup(PRBool aShowPopup)
void void
nsComboboxControlFrame::ShowList(nsIPresContext* aPresContext, PRBool aShowList) nsComboboxControlFrame::ShowList(nsIPresContext* aPresContext, PRBool aShowList)
{ {
nsIWidget * widget = nsnull; nsCOMPtr<nsIWidget> widget;
// Get parent view // Get parent view
nsIFrame * listFrame; nsIFrame * listFrame;
@ -387,25 +387,31 @@ nsComboboxControlFrame::ShowList(nsIPresContext* aPresContext, PRBool aShowList)
listFrame->GetView(aPresContext, &view); listFrame->GetView(aPresContext, &view);
NS_ASSERTION(view != nsnull, "nsComboboxControlFrame view is null"); NS_ASSERTION(view != nsnull, "nsComboboxControlFrame view is null");
if (view) { if (view) {
view->GetWidget(widget); view->GetWidget(*getter_AddRefs(widget));
}
if (nsnull != widget) {
widget->CaptureRollupEvents((nsIRollupListener *)this, !mDroppedDown, PR_TRUE);
NS_RELEASE(widget);
} }
} }
if (PR_TRUE == aShowList) { if (PR_TRUE == aShowList) {
ShowPopup(PR_TRUE); ShowPopup(PR_TRUE);
mDroppedDown = PR_TRUE; mDroppedDown = PR_TRUE;
// The listcontrol frame will call back to the nsComboboxControlFrame's ListWasSelected // The listcontrol frame will call back to the nsComboboxControlFrame's ListWasSelected
// which will stop the capture. // which will stop the capture.
mListControlFrame->AboutToDropDown(); mListControlFrame->AboutToDropDown();
mListControlFrame->CaptureMouseEvents(aPresContext, PR_TRUE); mListControlFrame->CaptureMouseEvents(aPresContext, PR_TRUE);
} else { } else {
ShowPopup(PR_FALSE); ShowPopup(PR_FALSE);
mDroppedDown = PR_FALSE; mDroppedDown = PR_FALSE;
} }
nsCOMPtr<nsIPresShell> presShell;
aPresContext->GetShell(getter_AddRefs(presShell));
presShell->FlushPendingNotifications();
if (widget)
widget->CaptureRollupEvents((nsIRollupListener *)this, mDroppedDown, PR_TRUE);
} }