Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 173335 - On SLED10, modal dialog goes behind a shell with SWT.ON_TOP style bit
Summary: On SLED10, modal dialog goes behind a shell with SWT.ON_TOP style bit
Status: CLOSED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.2.1   Edit
Hardware: Other Linux-GTK
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Bogdan Gheorghe CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-02-07 14:47 EST by Mei Thom CLA
Modified: 2016-09-13 11:08 EDT (History)
5 users (show)

See Also:


Attachments
Snippet to demo the dialog going behind ON_TOP shell on SLED10 (2.71 KB, text/plain)
2007-02-07 14:50 EST, Mei Thom CLA
no flags Details
Patch to disable taskbar hints for windows with no trim (5.63 KB, patch)
2007-03-27 15:02 EDT, Bogdan Gheorghe CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mei Thom CLA 2007-02-07 14:47:33 EST
Build ID: 3.2.2

Steps To Reproduce:
1. On SLED10, on an application window, bring up a drop down shell that has SWT.ON_TOP style bit.
2. From the drop down shell, bring up a modal dialog like jface/InputDialog or SWT/MessageBox.
3. The dialog pops up in front of the drop down shell.
4. Click on the dialog and start dragging on the dialog, the dialog goes behind the drop down shell right away. 

Expected result: the dialog should stay in front of the drop down shell all the time no matter clicking or dragging on the dialog.

Actual result: Once click on the dialog, the drop down shell (with SWT.ON_TOP style bit) goes to the front right away. The dialog displays behind the drop down shell.


More information:
1. This behavior is only on SLED10. On Windows, the dialog always stays in front of the drop down shell.
2. This problem happens to any modal dialog like jface/InputDialog or SWT/MessageBox.
3. This problem may be related to PR#173218, which is a feature request for SWT to support ModalityListener interface.
4. Will provide a snippet to demo the problem.
Comment 1 Mei Thom CLA 2007-02-07 14:50:02 EST
Created attachment 58479 [details]
Snippet to demo the dialog going behind ON_TOP shell on SLED10

To bring up the dialog when running the snippet, please right mouse click on the drop down shell.
Comment 2 Bogdan Gheorghe CLA 2007-02-14 16:23:06 EST
Mei - I looked into this today and there doesn't seem to be a way to parent a dialog with an ON_TOP shell in GTK.

This led to a discussion about the intended use of ON_TOP shells which prompts me to ask: why are you wanting to have a dialog  parented by an ON_TOP shell? We're curious as to what your use case is and if there is another way that you can implement your code without having to rely on the ON_TOP style hint.
Comment 3 Mei Thom CLA 2007-02-14 17:29:19 EST
The shell that uses the ON_TOP bit is for a custom menu in our case. I can do without the ON_TOP style bit on Windows. But on Linux, I need to add the ON_TOP style bit to the shell of the custom menu for two reasons:
1. to avoid extra task items to display on the taskbar. When display the first root menu, one more task item is added to the taskbar in addition to the application's task item. Then when navigate down one level of submenu, another one task item is added to the task bar, etc.. Only when adding the ON_TOP bit to the shell of the custom menu, no more task item is added to the taskbar. 
2. On RHEL4, without the ON_TOP bit, when navigate down a couple levels of submenus, the application quits because of some XWindow error. Let me add the error message tomorrow since it's not on hand now.

In our use case, we bring up a context menu based on the selected menu item. When user clicks on the context menu item "Rename", the "Rename" InputDialog comes up with the custom menu staying up. User modifies the menu item label and clicks OK to dismiss the InputDialog. Then the modified menu item label is changed right away on the custom menu. However, when user tries to drag the InputDialog, the InputDialog goes to behind the custom menu.
Comment 4 Mei Thom CLA 2007-02-15 10:44:46 EST
Here is the crash error reported on REHL4 when navigate down a few levels of submenus:
The program 'DefaultPlatform' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadMatch (invalid parameter attributes)'.
  (Details: serial 26105 error_code 8 request_code 42 minor_code 0)
  
This error does not happen on SLED10. So on SLED10, only the reason 1 (creating extra task items on taskbar for each custom menu coming up) made it necessary to use the ON_TOP bit. But on RHEL4, both reasons 1 and 2 made this a must to avoid the problems. On Windows, I don't see any of these 2 problems and hence the ON_TOP bit can be optional to use.
Comment 5 Bogdan Gheorghe CLA 2007-02-20 12:31:28 EST
Can you attach some screenshots of your custom menu workflow? 

Does this represent an accurate summary of your desired workflow:

1. User selects an item from a regular menu.
2. A context menu pops up.
3. The user selects some action from the context menu. The action might open a dialog which requires the user to input some text. You want the context menu to stay open underneath while this dialog is open.
Comment 6 Bogdan Gheorghe CLA 2007-03-27 15:01:39 EDT
Here is a patch that will free you from having to use the ON_TOP style bit to stop  a window with no trim from showing up in the tray. You can now create a window with SWT.NO_TRIM or SWT.NONE etc. to serve as your custom menu.
Comment 7 Bogdan Gheorghe CLA 2007-03-27 15:02:28 EDT
Created attachment 62141 [details]
Patch to disable taskbar hints for windows with no trim
Comment 8 Bogdan Gheorghe CLA 2007-03-27 15:27:59 EDT
Fixed in HEAD > 20070327
Comment 9 Steve Northover CLA 2007-03-27 15:41:16 EDT
Wait a second, modal windows still open behind ON_TOP windows.  The patch allows Mei to avoid ON_TOP shells, but doesn't fix the problem.
Comment 10 Philipe Mulet CLA 2007-03-28 05:56:04 EDT
Are we committing to addressing this for 3.3M7 ? If so, pls retain a patch for the change, and pls provide some risk assessment for a 3.3M6 backport.
Comment 11 Steve Northover CLA 2007-03-28 07:37:48 EDT
No, we can't fix the bug that this report is talking about for 3.3, but we have stopped ON_TOP shells from appearing in task bar, which is the reason that Mei was using ON_TOP in the first place.

We should really open a new bug for that, add Mei to it, attach the patch and mark that one as fixed.  Your thoughts?
Comment 12 Philipe Mulet CLA 2007-03-28 08:47:54 EDT
Fine by me, if Mei also acknowledges the resolution.
Comment 13 Mei Thom CLA 2007-03-28 11:35:19 EDT
I am fine with Steve's suggestion. However, I still need to use the ON_TOP style bit because without the ON_TOP sytle bit, the custom menu navigation on RHEL4 would crash. Please see the error message in Comment #4. This does not happen on SELD10. I can try to gather more information on this problem on RHEL4 and open another bug report for that. 

But really thanks for fixing the task item problem. This will help to some extent.
Comment 14 Bogdan Gheorghe CLA 2007-03-28 12:59:53 EDT
OK, please open a new bug report for the RHEL4 X Window error you're getting and we can track that.
Comment 15 Bogdan Gheorghe CLA 2007-03-28 13:53:58 EDT
One more thing I wanted to mention before you open a new RHEL 4 bug. It would be great if we could get a stack trace from you for the crash you are getting on RHEL4. You can get more info about the crash if you set the Device.DEBUG flag:

Device.DEBUG = true; //add the line before you create the Display

For example:

Device.DEBUG = true;
Display display = new Display();
Shell shell = new Shell();
etc.

This will print out the stack trace when you get the X Window Error message. If you could change your code and reproduce the problem, it could help us pinpoint what's going wrong on RHEL 4.
Comment 16 Eric Williams CLA 2016-09-13 11:08:12 EDT
The snippet runs as expected for me. SLED10 is no longer supported for Oxygen.