Closed Bug 101843 Opened 23 years ago Closed 8 months ago

[review]Mac needs to generate NS_DISPLAYCHANGED event when the display depth changes

Categories

(Core Graveyard :: GFX: Mac, defect, P1)

PowerPC
macOS
defect

Tracking

(Not tracked)

RESOLVED INCOMPLETE
Future

People

(Reporter: kmcclusk, Unassigned)

References

()

Details

(Whiteboard: Fix described)

Attachments

(1 file)

This bug was split off from bug 6061. Changing bit depth/# of colors busts chrome, images On Mac we need to add a method to nsWindow which is called when the display has changed: PRBool nsWindow::ReportDisplayChange() { // nsEvent nsGUIEvent changeEvent; changeEvent.eventStructType = NS_GUI_EVENT; changeEvent.message = NS_DISPLAYCHANGED; changeEvent.time = PR_IntervalNow(); // nsGUIEvent changeEvent.widget = this; changeEvent.nativeMsg = nsnull; // dispatch event return (DispatchWindowEvent(changeEvent)); } The call to DisplayWindowEvent will take care of getting the message to the viewmanager.
Reassigning to Pierre since Don is on Sabbatical.
Assignee: kmcclusk → pierre
For more info, see the URL above or go to http://www.apple.com/developer/ and look for 'kAEDisplayNotice'
Status: NEW → ASSIGNED
Target Milestone: --- → mozilla0.9.6
Ref is here: http://developer.apple.com/techpubs/macosx/Carbon/graphics/DisplayManager/ Optimizing_DisplayManager/Conceptual/DisplayManager-7.html Note that you have to set a bit in your 'SIZE' flags to get send this event.
Blocks: 103889
Depends on: 6061
*** Bug 106238 has been marked as a duplicate of this bug. ***
Target Milestone: mozilla0.9.6 → mozilla0.9.8
Whiteboard: Fix described
*** Bug 114549 has been marked as a duplicate of this bug. ***
pink/sfraser: please r/sr Simon, a while back we exchanged the following emails... ---- > I see 2 ways of fixing this: > [...] > 2) COMify nsMacMessageSink to export IsRaptorWindow() and DispatchOSEvent() > and use these in an event handler that I register in AppRunner through the > functions you wrote... I think it would be more appropriate for some service to have an API that we can call that tells each window to send the NS_DISPLAYCHANGED event. nsIWindowWatcher looks like a good candidate, and is already called from the AE code. ---- The code changed quite a bit in the meanwhile and it allowed me to implement a patch all in the XPFE AppleEvents code. Another reason was that I did not want to modify some XP interfaces to implement functions that would only be used on the Mac. Look at the attached patch: I'm not sure you are going to like it but it works fine and we may even have to reuse it to propagate other events.
Priority: -- → P3
Summary: Mac needs to generate NS_DISPLAYCHANGED event when the display depth changes → [review]Mac needs to generate NS_DISPLAYCHANGED event when the display depth changes
Attached patch patchSplinter Review
Comments: I don't think nsAEGenericClass is the correct place for the display-changed handling code. Since this is an application-level event, it should live in nsAEApplicationClass.cpp. Also, I'm trying to keep the AppleEvent code as free as possible of real code; it should really just make a high-level call into some other class that does the real work. So I'd rather DispatchGUIEvent() and the guts of HandleSystemConfigNotice() move elsewhere. + nsISupports* child; + if (NS_SUCCEEDED(children->CurrentItem(&child))) { nsCOMPtr? + nsIWidget* childWidget = static_cast<nsIWidget*>(child); QueryInterface? + DispatchGUIEvent(childWidget, anEvent, PR_TRUE); This this recurses, I'd like to see a little paranoia; maybe check that childWidget != aWidget.
comments: 1) i don't like they typecast to nsIBidirectionalEnumerator on: + nsCOMPtr<nsIBidirectionalEnumerator> children(getter_AddRefs((nsIBidirectionalEnumerator*)aWidget->GetChildren())); it makes an assumption that the enumerator returned from GetChildren() is bidi, when the implementation may not be at all. Use QueryInterface to move between interfaces, not casts. 2) Again, same complaint here: + nsIWidget* childWidget = static_cast<nsIWidget*>(child); These assumptions _might_ be ok within the widget code (i still don't like them), but certainly not in xpfe/bootstrap.
Target Milestone: mozilla0.9.8 → mozilla0.9.9
Marking nsbeta1+. Pierre can you make the changes suggested by the reviewers?
Keywords: nsbeta1+
Reassigning to Don.
Assignee: pierre → dcone
Status: ASSIGNED → NEW
Priority: P3 → P2
Target Milestone: mozilla0.9.9 → mozilla1.0
nsbeta1- per adt triage
Keywords: nsbeta1+nsbeta1-
Target Milestone: mozilla1.0 → ---
Priority: P2 → P1
Target Milestone: --- → Future
Taking
Assignee: dcone → sfraser
Target Milestone: Future → mozilla1.1alpha
*** Bug 124236 has been marked as a duplicate of this bug. ***
Keywords: review
Component: GFX → GFX: Mac
Mozilla CFM build is dead; should this bug go with it?
Still applies to OS X.
OS: Mac System 9.x → MacOS X
Target Milestone: mozilla1.1alpha → Future
The docs listed above are outdated (and 404) Closest thing I can find surfing around developer.apple.com is here: http://developer.apple.com/documentation/Carbon/Reference/Display_Manager/displaymgr/function_group_5.html Which isn't an AppleEvent, but might be a more direct way to do it.
Assignee: sfraser_bugs → joshmoz
Product: Core → Core Graveyard
Assignee: joshmoz → nobody
Status: NEW → RESOLVED
Closed: 8 months ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: