diff options
author | Alexandra Buzila | 2015-01-12 09:06:28 +0000 |
---|---|---|
committer | Arun Thondapu | 2015-04-23 10:24:04 +0000 |
commit | b73210b3ae347e174d94d1d65890dbcff0242ce4 (patch) | |
tree | e0f162a58e990d58b5a35aecc2c5d25bed11e4f6 /bundles/org.eclipse.swt/Eclipse SWT/gtk | |
parent | 1f910fb2129bc04b508cae95ff4a02f4aa339c24 (diff) | |
download | eclipse.platform.swt-b73210b3ae347e174d94d1d65890dbcff0242ce4.tar.gz eclipse.platform.swt-b73210b3ae347e174d94d1d65890dbcff0242ce4.tar.xz eclipse.platform.swt-b73210b3ae347e174d94d1d65890dbcff0242ce4.zip |
Bug 445456 - Ignored style hints for shells
Shells with a parent can't have any button on the titlebar except for
the close one, when running Metacity. This fix enables the minimize and
maximize buttons for child shells, by removing the
GDK_WINDOW_TYPE_HINT_DIALOG type hint and calling the
gdk_window_set_functions method when setting the decorations of a shell.
The code was tested against CentOS release 6.6, Metacity 2.28.0 and
gtk2-2.2423-6.
Change-Id: If320be2ac9ecd7fe3090a164add1015b4ff0f228
Signed-off-by: Alexandra Buzila <abuzila@eclipsesource.com>
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java | 43 |
1 files changed, 35 insertions, 8 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java index c6e99c999c..42160c006c 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java @@ -697,11 +697,18 @@ void createHandle (int index) { if (parent != null) { OS.gtk_window_set_transient_for (shellHandle, parent.topHandle ()); OS.gtk_window_set_destroy_with_parent (shellHandle, true); - if (!isUndecorated ()) { - OS.gtk_window_set_type_hint (shellHandle, OS.GDK_WINDOW_TYPE_HINT_DIALOG); - } else { - OS.gtk_window_set_skip_taskbar_hint (shellHandle, true); - } + OS.gtk_window_set_skip_taskbar_hint(shellHandle, true); + + /* + * For systems running Metacity, by applying the dialog type hint + * to a window only the close button can be placed on the title bar. + * The style hints for the minimize and maximize buttons are ignored. + * See bug 445456. + * + */ +// if (!isUndecorated ()) { +// OS.gtk_window_set_type_hint (shellHandle, OS.GDK_WINDOW_TYPE_HINT_DIALOG); +// } } /* * Feature in GTK. The window size must be set when the window @@ -1528,13 +1535,24 @@ long /*int*/ gtk_realize (long /*int*/ widget) { long /*int*/ window = gtk_widget_get_window (shellHandle); if ((style & SWT.SHELL_TRIM) != SWT.SHELL_TRIM) { int decorations = 0; + int functions = 0; if ((style & SWT.NO_TRIM) == 0) { - if ((style & SWT.MIN) != 0) decorations |= OS.GDK_DECOR_MINIMIZE; - if ((style & SWT.MAX) != 0) decorations |= OS.GDK_DECOR_MAXIMIZE; - if ((style & SWT.RESIZE) != 0) decorations |= OS.GDK_DECOR_RESIZEH; + if ((style & SWT.MIN) != 0) { + decorations |= OS.GDK_DECOR_MINIMIZE; + functions |= OS.GDK_FUNC_MINIMIZE; + } + if ((style & SWT.MAX) != 0) { + decorations |= OS.GDK_DECOR_MAXIMIZE; + functions |= OS.GDK_FUNC_MAXIMIZE; + } + if ((style & SWT.RESIZE) != 0) { + decorations |= OS.GDK_DECOR_RESIZEH; + functions |= OS.GDK_FUNC_RESIZE; + } if ((style & SWT.BORDER) != 0) decorations |= OS.GDK_DECOR_BORDER; if ((style & SWT.MENU) != 0) decorations |= OS.GDK_DECOR_MENU; if ((style & SWT.TITLE) != 0) decorations |= OS.GDK_DECOR_TITLE; + if ((style & SWT.CLOSE) != 0) functions |= OS.GDK_FUNC_CLOSE; /* * Feature in GTK. Under some Window Managers (Sawmill), in order * to get any border at all from the window manager it is necessary to @@ -1542,8 +1560,17 @@ long /*int*/ gtk_realize (long /*int*/ widget) { * kind of border is requested. */ if ((style & SWT.RESIZE) != 0) decorations |= OS.GDK_DECOR_BORDER; + functions |= OS.GDK_FUNC_MOVE; } OS.gdk_window_set_decorations (window, decorations); + + /* + * For systems running Metacity, this call forces the style hints to + * be displayed in a window's titlebar. Otherwise, the decorations + * set by the function gdk_window_set_decorations (window, + * decorations) are ignored by the window manager. + */ + OS.gdk_window_set_functions(window, functions); } if ((style & SWT.ON_TOP) != 0) { OS.gdk_window_set_override_redirect (window, true); |