From e883a22ccd4b046882478e565bcfa6c6712a6d5a Mon Sep 17 00:00:00 2001 From: "pavlov%netscape.com" Date: Fri, 11 Feb 2000 22:26:36 +0000 Subject: [PATCH] fix for combo boxes not grabbing the mouse on linux (fixes bugs 7898 and 26273) r=waqar --- layout/forms/nsComboboxControlFrame.cpp | 18 ++++++++++++------ .../html/forms/src/nsComboboxControlFrame.cpp | 18 ++++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/layout/forms/nsComboboxControlFrame.cpp b/layout/forms/nsComboboxControlFrame.cpp index 062ca5fd144..e55c10f131c 100644 --- a/layout/forms/nsComboboxControlFrame.cpp +++ b/layout/forms/nsComboboxControlFrame.cpp @@ -378,7 +378,7 @@ nsComboboxControlFrame::ShowPopup(PRBool aShowPopup) void nsComboboxControlFrame::ShowList(nsIPresContext* aPresContext, PRBool aShowList) { - nsIWidget * widget = nsnull; + nsCOMPtr widget; // Get parent view nsIFrame * listFrame; @@ -387,25 +387,31 @@ nsComboboxControlFrame::ShowList(nsIPresContext* aPresContext, PRBool aShowList) listFrame->GetView(aPresContext, &view); NS_ASSERTION(view != nsnull, "nsComboboxControlFrame view is null"); if (view) { - view->GetWidget(widget); - } - if (nsnull != widget) { - widget->CaptureRollupEvents((nsIRollupListener *)this, !mDroppedDown, PR_TRUE); - NS_RELEASE(widget); + view->GetWidget(*getter_AddRefs(widget)); } } if (PR_TRUE == aShowList) { ShowPopup(PR_TRUE); mDroppedDown = PR_TRUE; + // The listcontrol frame will call back to the nsComboboxControlFrame's ListWasSelected // which will stop the capture. mListControlFrame->AboutToDropDown(); mListControlFrame->CaptureMouseEvents(aPresContext, PR_TRUE); + } else { ShowPopup(PR_FALSE); mDroppedDown = PR_FALSE; } + + nsCOMPtr presShell; + aPresContext->GetShell(getter_AddRefs(presShell)); + presShell->FlushPendingNotifications(); + + if (widget) + widget->CaptureRollupEvents((nsIRollupListener *)this, mDroppedDown, PR_TRUE); + } diff --git a/layout/html/forms/src/nsComboboxControlFrame.cpp b/layout/html/forms/src/nsComboboxControlFrame.cpp index 062ca5fd144..e55c10f131c 100644 --- a/layout/html/forms/src/nsComboboxControlFrame.cpp +++ b/layout/html/forms/src/nsComboboxControlFrame.cpp @@ -378,7 +378,7 @@ nsComboboxControlFrame::ShowPopup(PRBool aShowPopup) void nsComboboxControlFrame::ShowList(nsIPresContext* aPresContext, PRBool aShowList) { - nsIWidget * widget = nsnull; + nsCOMPtr widget; // Get parent view nsIFrame * listFrame; @@ -387,25 +387,31 @@ nsComboboxControlFrame::ShowList(nsIPresContext* aPresContext, PRBool aShowList) listFrame->GetView(aPresContext, &view); NS_ASSERTION(view != nsnull, "nsComboboxControlFrame view is null"); if (view) { - view->GetWidget(widget); - } - if (nsnull != widget) { - widget->CaptureRollupEvents((nsIRollupListener *)this, !mDroppedDown, PR_TRUE); - NS_RELEASE(widget); + view->GetWidget(*getter_AddRefs(widget)); } } if (PR_TRUE == aShowList) { ShowPopup(PR_TRUE); mDroppedDown = PR_TRUE; + // The listcontrol frame will call back to the nsComboboxControlFrame's ListWasSelected // which will stop the capture. mListControlFrame->AboutToDropDown(); mListControlFrame->CaptureMouseEvents(aPresContext, PR_TRUE); + } else { ShowPopup(PR_FALSE); mDroppedDown = PR_FALSE; } + + nsCOMPtr presShell; + aPresContext->GetShell(getter_AddRefs(presShell)); + presShell->FlushPendingNotifications(); + + if (widget) + widget->CaptureRollupEvents((nsIRollupListener *)this, mDroppedDown, PR_TRUE); + }