Opened 11 years ago

Closed 11 years ago

#12187 closed defect (fixed)

Child window on modal dialog in Cocoa

Reported by: gmeeker Owned by:
Priority: normal Milestone:
Component: wxOSX Version: stable-latest
Keywords: wxFRAME_FLOAT_ON_PARENT modal dialog Cocoa Cc:
Blocked By: Blocking:
Patch: yes

Description

A Photoshop plugin needs to display its UI as a modal dialog. We wish to display tool windows on top of that. wxFRAME_FLOAT_ON_PARENT or wxSTAY_ON_TOP will work in Carbon and Windows, but Cocoa needs setWorksWithModal called on the child window or the modal loop won't process its events.

This patch checks if the parent is modal, and if so calls setWorksWithModal. I'm open to other solutions to call setWorksWithModal.

Note that this is an unusual case and probably isn't an issue for application developers.

Attachments (2)

wxWidgets-workswhenmodal.diff download (1.4 KB) - added by gmeeker 11 years ago.
wxWidgets-workswhenmodal.2.diff download (1.7 KB) - added by gmeeker 11 years ago.
New patch that only calls worksWhenModal on floating frames

Download all attachments as: .zip

Change History (6)

Changed 11 years ago by gmeeker

comment:1 Changed 11 years ago by bdheller

This patch half works for me. When I applied it my floating panels (which in my case also need to work on top of a modal dialog) finally accepted input (thanks!).

However I also have the case of opening another modal dialog with the previous modal dialog as parent. With the patch applied both dialogs accepted input, which is obviously wrong.

After commenting out the entire "if (parentDialog == NULL && [m_macWindow isKindOfClass:[NSPanel class]])" clause, both cases worked for me.

Changed 11 years ago by gmeeker

New patch that only calls worksWhenModal on floating frames

comment:2 Changed 11 years ago by gmeeker

I think this updated patch should resolve the issue of nested modal dialogs by avoiding calls to worksWhenModal on dialogs themselves.

comment:3 Changed 11 years ago by bdheller

The new patch works perfectly for me. +1 for applying

comment:4 Changed 11 years ago by VZ

  • Resolution set to fixed
  • Status changed from new to closed

(In [65130]) Allow non-modal windows shown from modal dialogs to work in wxOSX.

Use kCGUtilityWindowLevel for such windows instead of kCGFloatingWindowLevel
and also call setWorksWhenModal:YES.

Closes #12187.

Note: See TracTickets for help on using tickets.