Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 358376

Summary: Provide ability to handle reopen-events (user clicks dock icon for running application)
Product: [Eclipse Project] Platform Reporter: Thomas Singer <eclipse>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: christoph.wulf, daniel_megert, dormoose, gheorghe, lshanmug, markus.kell.r, rafaelkarst, Silenio_Quarti, superstippi
Version: 4.1Flags: Silenio_Quarti: review+
Target Milestone: 4.3 RC1   
Hardware: PC   
OS: Mac OS X   
Whiteboard:
Attachments:
Description Flags
a rough idea for a change none

Description Thomas Singer CLA 2011-09-21 05:08:48 EDT
Build Identifier: 

On OS X, applications may not show windows while still running. Usually, there are two options to open a new application window: using the menu bar or clicking the dock icon. The first one is already supported by SWT 3.7, but not the second one (at least I did not found a possibility). Please add support for these reopen events. When clicking on the dock icon and the application shows at least one window, bring it to front. For the case where no application window is visible, we need API to be notified about the dock icon click, so we can show a new window.

Reproducible: Always
Comment 1 Rafael Karst CLA 2012-03-27 19:49:16 EDT
I agree, at least it should be easier to find a documentation to catch this kind of event from dock icon.
Comment 2 Rafael Karst CLA 2012-03-27 19:50:38 EDT
Please change the bug to a major issue, otherwise it will not receive investigation by set team.
Comment 3 Thomas Singer CLA 2012-03-28 00:49:44 EDT
I can't change the priority, but you can vote for this issue.
Comment 4 Thomas Singer CLA 2012-10-24 07:32:42 EDT
API suggestion: 
display.getSystemTaskBar().getItem(null).addListener(SWT.TaskItemClicked, new Listener() {
  public void handleEvent(Event event) {
   event.doit = true;
  }
});

Coarse implementation idea:
org.eclipse.swt.widgets.Display#applicationProc: instead of returning 1, invoke all TaskItemClicked listeners and dependent on the doit flag return the right value (I guess 0 or 1).
Comment 5 Thomas Singer CLA 2012-10-25 06:43:29 EDT
Created attachment 222761 [details]
a rough idea for a change
Comment 6 Thomas Singer CLA 2012-11-08 03:54:07 EST
Please try to solve this issue shortly. It shouldn't have influence on existing code.
Comment 7 Rafael Karst CLA 2012-11-08 08:06:13 EST
the way the things are going, we should create a fork of current swt and fix it...
Comment 8 Thomas Singer CLA 2012-11-08 11:01:31 EST
Unfortunately, I don't know how to build SWT jar files...
Comment 9 Rafael Karst CLA 2012-11-08 12:27:53 EST
I haven't checked out but, I'm pretty sure there should be something at the SWT GIT repository source... Anyway... I had reported another bug on Mac OSX platform  for SWT project and they actually fixed it pretty fast... Maybe try to create a new issue with a critical severity, at least we hope to get their attention. :-) That is what i did... You'll say that this is not fair... but, what is fair? Windows platform receives a lot more attention that Mac OSX platform, and yet there is Linux... there are some platform specific features that could be easily covered by SWT and their not, or their partially covered. 

Hope i have helped!

Best regards!
Comment 10 Bogdan Gheorghe CLA 2012-12-12 15:11:29 EST
We'd like to look at this for the next milestone.
Comment 11 Thomas Singer CLA 2013-01-24 04:13:32 EST
I'm excited to give a first implementation a try. When is 4.3 M5 expected to be released?
Comment 12 Thomas Singer CLA 2013-02-05 16:55:23 EST
4.3M5 is out since January-31-2013, but after comparing the sources with 4.3M4, this issue seems not to be fixed yet, though still scheduled.
Comment 13 Thomas Singer CLA 2013-04-23 12:48:43 EDT
Have you given up to fix this issue soon?
Comment 14 Stephan Aßmus CLA 2013-05-15 06:09:16 EDT
This is a 3 line fix. Listening for SWT.Activate on Display was the first thing I tried when trying to implement the feature. So it is absolutely intuitive. Why not apply this 3-line patch and fix a critical flaw on Mac OS X expected application behavior? As it is, one cannot let applications keep running after their last windows was closed, even though it is now possible to install a proper menu via Display.getMenuBar(). When the user clicks the Dock icon, the app shows no reaction and appears to hang, even though all is fine.
Comment 15 Silenio Quarti CLA 2013-05-16 12:33:23 EDT
Patch looks fine.
Comment 16 Bogdan Gheorghe CLA 2013-05-16 12:34:30 EDT
Patch released. Should be available in the next build. Thanks!
Comment 17 Thomas Singer CLA 2013-05-26 09:45:00 EDT
Thanks to Stephan, for bringing this issue up again, and thanks to Silenio and Bogdan for implementing the fix.