1 Index: swt/swt-source/make_linux.mak
2 ===================================================================
3 --- swt.orig/swt-source/make_linux.mak 2007-06-20 12:01:22.000000000 +0200
4 +++ swt/swt-source/make_linux.mak 2008-02-14 11:32:49.000000000 +0100
6 CAIROLIBS = `pkg-config --libs-only-L cairo` -lcairo
8 # Do not use pkg-config to get libs because it includes unnecessary dependencies (i.e. pangoxft-1.0)
9 -GTKCFLAGS = `pkg-config --cflags gtk+-2.0`
10 -GTKLIBS = `pkg-config --libs-only-L gtk+-2.0 gthread-2.0` -lgtk-x11-2.0 -lgthread-2.0 -L/usr/X11R6/lib $(XLIB64) -lXtst
11 +GTKCFLAGS = `pkg-config --cflags gtk+-2.0 hildon-1 hildon-fm-2`
12 +GTKLIBS = -lhildon-1 -lhildonfm `pkg-config --libs-only-L gtk+-2.0 gthread-2.0` -lgtk-x11-2.0 -lgthread-2.0 -L/usr/X11R6/lib $(XLIB64) -lXtst
14 CDE_LIBS = -L$(CDE_HOME)/lib -R$(CDE_HOME)/lib -lXt -lX11 -lDtSvc
17 -Wno-non-virtual-dtor \
20 - -I$(JAVA_HOME)/include \
21 - -I$(JAVA_HOME)/include/linux \
23 MOZILLALIBS = -shared -Wl,--version-script=mozilla_exports -Bsymbolic
24 MOZILLAEXCLUDES = -DNO_XPCOMGlueShutdown -DNO_XPCOMGlueStartup
26 -DSWT_VERSION=$(SWT_VERSION) \
29 - -I$(JAVA_HOME)/include \
30 - -I$(JAVA_HOME)/include/linux \
34 Index: swt/swt-source/os.c
35 ===================================================================
36 --- swt.orig/swt-source/os.c 2007-10-30 16:24:28.000000000 +0100
37 +++ swt/swt-source/os.c 2008-02-14 09:32:49.000000000 +0100
39 #include "os_structs.h"
42 +#include <hildon/hildon-program.h>
43 +#include <hildon/hildon-window.h>
45 #define OS_NATIVE(func) Java_org_eclipse_swt_internal_gtk_OS_##func
48 @@ -7015,9 +7018,18 @@
49 JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1container_1add)
50 (JNIEnv *env, jclass that, jint arg0, jint arg1)
52 + GtkContainer *container = (GtkContainer *) arg0;
53 + GtkWidget *widget = (GtkWidget *) arg1;
54 OS_NATIVE_ENTER(env, that, _1gtk_1container_1add_FUNC);
55 - gtk_container_add((GtkContainer *)arg0, (GtkWidget *)arg1);
56 - OS_NATIVE_EXIT(env, that, _1gtk_1container_1add_FUNC);
57 + if (GTK_CHECK_TYPE (widget, GTK_TYPE_MENU)
58 + && !strcmp(gtk_menu_get_title(GTK_MENU(widget)), "__main_menu__"))
60 + hildon_window_set_menu(HILDON_WINDOW(container), GTK_MENU(widget));
63 + gtk_container_add((GtkContainer *)arg0, (GtkWidget *)arg1);
65 + OS_NATIVE_EXIT(env, that, _1gtk_1container_1add_FUNC);
69 @@ -9121,9 +9133,12 @@
70 JNIEXPORT jint JNICALL OS_NATIVE(_1gtk_1menu_1bar_1new)
71 (JNIEnv *env, jclass that)
75 OS_NATIVE_ENTER(env, that, _1gtk_1menu_1bar_1new_FUNC);
76 - rc = (jint)gtk_menu_bar_new();
77 + menu = gtk_menu_new();
78 + gtk_menu_set_title(menu, "__main_menu__");
80 OS_NATIVE_EXIT(env, that, _1gtk_1menu_1bar_1new_FUNC);
83 @@ -15464,8 +15479,23 @@
84 (JNIEnv *env, jclass that, jint arg0)
89 OS_NATIVE_ENTER(env, that, _1gtk_1window_1new_FUNC);
90 - rc = (jint)gtk_window_new((GtkWindowType)arg0);
92 + if (GTK_WINDOW_TOPLEVEL == (GtkWindowType) arg0)
95 + p = hildon_program_get_instance();
96 + w = hildon_window_new();
97 + hildon_program_add_window(p, HILDON_WINDOW(w));
98 +/* gtk_window_fullscreen(GTK_WINDOW(w));*/
102 + w = gtk_window_new(GTK_WINDOW_POPUP);
105 OS_NATIVE_EXIT(env, that, _1gtk_1window_1new_FUNC);
108 Index: swt/swt-source/org/eclipse/swt/widgets/Menu.java
109 ===================================================================
110 --- swt.orig/swt-source/org/eclipse/swt/widgets/Menu.java 2007-05-31 18:03:50.000000000 +0200
111 +++ swt/swt-source/org/eclipse/swt/widgets/Menu.java 2008-02-14 09:05:04.000000000 +0100
113 if ((style & SWT.BAR) != 0) {
114 handle = OS.gtk_menu_bar_new ();
115 if (handle == 0) error (SWT.ERROR_NO_HANDLES);
116 + if (parent instanceof Shell)
118 + int /*long*/ shellHandle = ((Shell) parent).shellHandle;
119 + OS.gtk_container_add (shellHandle, handle);
123 int /*long*/ vboxHandle = parent.vboxHandle;
124 OS.gtk_container_add (vboxHandle, handle);
125 OS.gtk_box_set_child_packing (vboxHandle, handle, false, true, 0, OS.GTK_PACK_START);
128 handle = OS.gtk_menu_new ();
129 if (handle == 0) error (SWT.ERROR_NO_HANDLES);
130 Index: swt/swt-source/org/eclipse/swt/internal/gtk/OS.java
131 ===================================================================
132 --- swt.orig/swt-source/org/eclipse/swt/internal/gtk/OS.java 2007-10-30 16:06:36.000000000 +0100
133 +++ swt/swt-source/org/eclipse/swt/internal/gtk/OS.java 2008-02-14 09:05:04.000000000 +0100
135 public static final byte[] window_state_event = ascii("window-state-event");
138 + /* Maemo hildon specific - border added due to toolbar */
139 + public static final byte[] toolbar_borders = ascii("toolbar-borders");
140 + /* Maemo hildon specific - border added due to skin graphics area */
141 + public static final byte[] borders = ascii("borders");
143 public static final byte[] active = ascii("active");
144 public static final byte[] background_gdk = ascii("background-gdk");
145 public static final byte[] button_relief = ascii("button-relief");
146 Index: swt/swt-source/org/eclipse/swt/widgets/Shell.java
147 ===================================================================
148 --- swt.orig/swt-source/org/eclipse/swt/widgets/Shell.java 2007-11-01 11:31:12.000000000 +0100
149 +++ swt/swt-source/org/eclipse/swt/widgets/Shell.java 2008-02-14 10:51:37.000000000 +0100
150 @@ -1028,6 +1028,14 @@
151 int /*long*/ gtk_size_allocate (int /*long*/ widget, int /*long*/ allocation) {
152 int width = OS.GTK_WIDGET_WIDTH (shellHandle);
153 int height = OS.GTK_WIDGET_HEIGHT (shellHandle);
157 + GtkBorder b = getMaemoBorder(false);
158 + width -= (b.left + b.right);
159 + height -= (b.top + b.bottom);
162 if (!resized || oldWidth != width || oldHeight != height) {
165 @@ -1384,14 +1392,53 @@
166 if ((state & FOREIGN_HANDLE) != 0) return;
167 Monitor monitor = getMonitor ();
168 Rectangle rect = monitor.getClientArea ();
170 int width = rect.width * 5 / 8;
171 int height = rect.height * 5 / 8;
174 + int width = rect.width;
175 + int height = rect.height;
177 + // Instead of some arbitrary defaults we can use the complete "application
178 + // area" on the maemo platform.
181 + GtkBorder b = getMaemoBorder(false);
182 + width -= (b.left + b.right);
183 + height -= (b.top + b.bottom);
186 if ((style & SWT.RESIZE) != 0) {
187 OS.gtk_window_resize (shellHandle, width, height);
189 resizeBounds (width, height, false);
193 + * Retrieves the "borders" or "toolbar-borders" property
196 + * That is neccessary to calculate correct Shell sizes on
197 + * the Maemo platform.
200 +private GtkBorder getMaemoBorder(boolean wantToolbarBorder)
202 + GtkBorder b = new GtkBorder();
204 + int /*long*/ [] result = new int /*long*/[1];
205 + OS.gtk_widget_style_get(shellHandle,
206 + (wantToolbarBorder ? OS.toolbar_borders
210 + if (result[0] != 0)
211 + OS.memmove(b, result[0], GtkBorder.sizeof);
216 public void setMaximized (boolean maximized) {
218 super.setMaximized (maximized);
219 Index: swt/swt-source/os_custom.c
220 ===================================================================
221 --- swt.orig/swt-source/os_custom.c 2007-05-31 18:04:22.000000000 +0200
222 +++ swt/swt-source/os_custom.c 2008-02-14 13:55:49.000000000 +0100
224 * IBM Corporation - initial API and implementation
225 *******************************************************************************/
227 +#include <hildon/hildon-file-chooser-dialog.h>
230 #include "os_structs.h"
231 #include "os_stats.h"
236 + GtkWidget *widget = NULL;
237 OS_NATIVE_ENTER(env, that, _1gtk_1file_1chooser_1dialog_1new_FUNC);
238 if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail;
240 rc = (SWT_PTR)gtk_file_chooser_dialog_new(lparg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
242 + /* Remaining arguments are thrown away as they cannot be used for the
243 + * HildonFileChooserDialog anyways.
245 + widget = (SWT_PTR) hildon_file_chooser_dialog_new(arg1, (GtkFileChooserAction) arg2);
246 + gtk_window_set_title(GTK_WINDOW(widget), (const gchar *) lparg0);
248 + rc = (SWT_PTR) widget;
250 +// The code is not supposed to run on AMD64.
253 static int initialized = 0;
254 static void *handle = NULL;
256 rc = (SWT_PTR)(*fptr)(lparg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
262 if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
263 OS_NATIVE_EXIT(env, that, _1gtk_1file_1chooser_1dialog_1new_FUNC);