Community
Participate
Working Groups
On Windows, if you create a Shell without the SWT.RESIZE flag, the shell is *not* resizeable. However, on GTK *and* Motif, the shell is resizeable. SWT version 3.002 In the following testcase, click on the "open dialog" button. The child shell should not be resizeable since RESIZE was not used, but both Motif and GTK use a resizeable shell. === testcase === import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.*; public class TestSWTDialog { public static void main(String[] args) { Display disp = new Display(); final Shell sh = new Shell(disp); sh.setLayout(new GridLayout()); Button but = new Button(sh, SWT.BORDER); but.setText("open dialog"); but.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { final Shell dialogShell = new Shell(sh, SWT.BORDER | SWT.CLOSE | SWT.TITLE); dialogShell.setText("test"); dialogShell.setBounds(300, 300, 300, 150); Button b = new Button(dialogShell, SWT.BORDER); final Label label = new Label(dialogShell, SWT.CENTER); label.setText("this is a test label"); label.setBounds(10, 20, 280, 60); b.setText("button 1"); b.setBounds(80, 100, 60, 20); dialogShell.setVisible(true); dialogShell.pack(); dialogShell.open(); } }); sh.pack(); sh.open(); while (!sh.isDisposed()) { if (!disp.readAndDispatch()) { disp.sleep(); } } } }
This is an issue with the Window Manager, not SWT. Please reopen this PR, (specifying the Window Manager) if you can find another application on the desktop that has the dialogs with the trim you expect. Thanks. A faster but less conclusive test is to run the SWT ControlExample and see if any of the native dialogs have the right trim (MessageBox, FileDialog etc). This should be the same as running another application as we don't play with the trim on the native dialogs but you never know ...
I have confirmed that MessageBox instances are also resizable on Motif and GTK. My WindowManager is Gnome on RH 8.0, and I suppose you're implying that Gnome doesn't support prevention of resizing. Is it possible that there are special Gnome APIs to enable this, either currently unexposed by SWT, or provided by the libswt-gnome-motif*.so and libswt-gnome-gtk*.so files?
I'm not convinced this can't be fixed. Try the following testcase on the IBM JDK on RedHat Linux. The window is *not* resizeable when setResizeable is set to false; when you try to do so, you never get the resize handle/cursor. Note: the JDK uses the Motif toolkit on Linux. testcase: ======== import java.awt.*; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; public class TestAwt { public static void main(String[] args) { final Frame f = new Frame("Hello World"); f.setSize(300, 300); f.setLayout(new GridLayout()); Label label = new Label("Hello World"); f.add(label); f.setVisible(true); f.setResizable(false); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { f.dispose(); System.exit(0); } }); } }
In the GTK codebase, the following code change to Shell.createHandle() would be helpful. It would allow the style of RESIZE to be omitted effectively. if ((style & SWT.RESIZE) != 0) { /* begin previous default code path */ OS.gtk_widget_set_size_request (shellHandle, 0, 0); OS.gtk_window_set_resizable (shellHandle, true); /* end previous default code path */ } else { OS.gtk_window_set_resizable (shellHandle, false); } Would this not be a reasonable change on the GTK platform?
I looked at this with SN and SSQ, and it's not a safe change to make at the beginning of a milestone week. Further investigation is needed, as there has been much pain in this area in the past.
ping (bugzilla didn't send notification on the last comment change).
*** Bug 55370 has been marked as a duplicate of this bug. ***
Do you think that something can probably be done in this area after your milestone has passed? We don't mind making the change in our own copy of SWT in the short term, but would like to have a "good feeling" that some code to block resizing could be implemented in SWT on the GTK platform in the future, since we like our builds to correspond with actual SWT versions from eclipse.org.
SSQ has been working on this. Did you release the code?
FWIW, in doing our builds based on SWT, we have been making the change I suggested in our local copy of SWT/GTK, and it seems to be working well. We were able to pass all the certification tests we had previously been failing due to lack of fixed size functionality.
Good for testing but not a good idea to ship like this. There were some problems with "windows that grew and grew until they filled the entire desktop". This possibly doesn't happen in BBAWT because you never create a Shell with the offending style?
Fixed > 20030330.
I can verify that this is fixed on GTK. If someone else can check out MOTIF, we can mark this as VERIFIED.