summaryrefslogtreecommitdiff
path: root/recipes/swt/files/swt-hildon.patch
diff options
context:
space:
mode:
authorDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
committerDenys Dmytriyenko <denis@denix.org>2009-03-17 14:32:59 -0400
commit709c4d66e0b107ca606941b988bad717c0b45d9b (patch)
tree37ee08b1eb308f3b2b6426d5793545c38396b838 /recipes/swt/files/swt-hildon.patch
parentfa6cd5a3b993f16c27de4ff82b42684516d433ba (diff)
rename packages/ to recipes/ per earlier agreement
See links below for more details: http://thread.gmane.org/gmane.comp.handhelds.openembedded/21326 http://thread.gmane.org/gmane.comp.handhelds.openembedded/21816 Signed-off-by: Denys Dmytriyenko <denis@denix.org> Acked-by: Mike Westerhof <mwester@dls.net> Acked-by: Philip Balister <philip@balister.org> Acked-by: Khem Raj <raj.khem@gmail.com> Acked-by: Marcin Juszkiewicz <hrw@openembedded.org> Acked-by: Koen Kooi <koen@openembedded.org> Acked-by: Frans Meulenbroeks <fransmeulenbroeks@gmail.com>
Diffstat (limited to 'recipes/swt/files/swt-hildon.patch')
-rw-r--r--recipes/swt/files/swt-hildon.patch263
1 files changed, 263 insertions, 0 deletions
diff --git a/recipes/swt/files/swt-hildon.patch b/recipes/swt/files/swt-hildon.patch
new file mode 100644
index 0000000000..90ceb1ee0e
--- /dev/null
+++ b/recipes/swt/files/swt-hildon.patch
@@ -0,0 +1,263 @@
+Index: swt-source/make_linux.mak
+===================================================================
+--- swt-source.orig/make_linux.mak 2007-06-20 12:01:22.000000000 +0200
++++ swt-source/make_linux.mak 2008-10-08 01:36:56.000000000 +0200
+@@ -45,8 +45,8 @@
+ CAIROLIBS = `pkg-config --libs-only-L cairo` -lcairo
+
+ # Do not use pkg-config to get libs because it includes unnecessary dependencies (i.e. pangoxft-1.0)
+-GTKCFLAGS = `pkg-config --cflags gtk+-2.0`
+-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
++GTKCFLAGS = `pkg-config --cflags gtk+-2.0 hildon-1 hildon-fm-2`
++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
+
+ CDE_LIBS = -L$(CDE_HOME)/lib -R$(CDE_HOME)/lib -lXt -lX11 -lDtSvc
+
+@@ -74,8 +74,6 @@
+ -Wno-non-virtual-dtor \
+ -fPIC \
+ -I. \
+- -I$(JAVA_HOME)/include \
+- -I$(JAVA_HOME)/include/linux \
+ ${SWT_PTR_CFLAGS}
+ MOZILLALIBS = -shared -Wl,--version-script=mozilla_exports -Bsymbolic
+ MOZILLAEXCLUDES = -DNO_XPCOMGlueShutdown -DNO_XPCOMGlueStartup
+@@ -96,8 +94,6 @@
+ -DSWT_VERSION=$(SWT_VERSION) \
+ $(NATIVE_STATS) \
+ -DLINUX -DGTK \
+- -I$(JAVA_HOME)/include \
+- -I$(JAVA_HOME)/include/linux \
+ -fPIC \
+ ${SWT_PTR_CFLAGS}
+ LIBS = -shared -fPIC
+Index: swt-source/os.c
+===================================================================
+--- swt-source.orig/os.c 2008-06-05 13:31:52.000000000 +0200
++++ swt-source/os.c 2008-10-08 01:36:56.000000000 +0200
+@@ -17,6 +17,9 @@
+ #include "os_structs.h"
+ #include "os_stats.h"
+
++#include <hildon/hildon-program.h>
++#include <hildon/hildon-window.h>
++
+ #define OS_NATIVE(func) Java_org_eclipse_swt_internal_gtk_OS_##func
+
+ #ifndef NO_Call
+@@ -7133,9 +7136,18 @@
+ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1container_1add)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1)
+ {
++ GtkContainer *container = (GtkContainer *) arg0;
++ GtkWidget *widget = (GtkWidget *) arg1;
+ OS_NATIVE_ENTER(env, that, _1gtk_1container_1add_FUNC);
+- gtk_container_add((GtkContainer *)arg0, (GtkWidget *)arg1);
+- OS_NATIVE_EXIT(env, that, _1gtk_1container_1add_FUNC);
++ if (GTK_CHECK_TYPE (widget, GTK_TYPE_MENU)
++ && !strcmp(gtk_menu_get_title(GTK_MENU(widget)), "__main_menu__"))
++ {
++ hildon_window_set_menu(HILDON_WINDOW(container), GTK_MENU(widget));
++ }
++ else
++ gtk_container_add((GtkContainer *)arg0, (GtkWidget *)arg1);
++
++ OS_NATIVE_EXIT(env, that, _1gtk_1container_1add_FUNC);
+ }
+ #endif
+
+@@ -9375,9 +9387,12 @@
+ JNIEXPORT jint JNICALL OS_NATIVE(_1gtk_1menu_1bar_1new)
+ (JNIEnv *env, jclass that)
+ {
++ GtkWidget *menu;
+ jint rc = 0;
+ OS_NATIVE_ENTER(env, that, _1gtk_1menu_1bar_1new_FUNC);
+- rc = (jint)gtk_menu_bar_new();
++ menu = gtk_menu_new();
++ gtk_menu_set_title(menu, "__main_menu__");
++ rc = (jint) menu;
+ OS_NATIVE_EXIT(env, that, _1gtk_1menu_1bar_1new_FUNC);
+ return rc;
+ }
+@@ -15849,8 +15864,23 @@
+ (JNIEnv *env, jclass that, jint arg0)
+ {
+ jint rc = 0;
++ HildonProgram *p;
++ GtkWidget *w;
+ OS_NATIVE_ENTER(env, that, _1gtk_1window_1new_FUNC);
+- rc = (jint)gtk_window_new((GtkWindowType)arg0);
++/*
++ if (GTK_WINDOW_TOPLEVEL == (GtkWindowType) arg0)
++ {
++*/
++ p = hildon_program_get_instance();
++ w = hildon_window_new();
++ hildon_program_add_window(p, HILDON_WINDOW(w));
++/* gtk_window_fullscreen(GTK_WINDOW(w));*/
++/*
++ }
++ else
++ w = gtk_window_new(GTK_WINDOW_POPUP);
++*/
++ rc = (jint) w;
+ OS_NATIVE_EXIT(env, that, _1gtk_1window_1new_FUNC);
+ return rc;
+ }
+Index: swt-source/org/eclipse/swt/widgets/Menu.java
+===================================================================
+--- swt-source.orig/org/eclipse/swt/widgets/Menu.java 2008-06-05 13:31:08.000000000 +0200
++++ swt-source/org/eclipse/swt/widgets/Menu.java 2008-10-08 01:36:56.000000000 +0200
+@@ -287,9 +287,17 @@
+ if ((style & SWT.BAR) != 0) {
+ handle = OS.gtk_menu_bar_new ();
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
++ if (parent instanceof Shell)
++ {
++ int /*long*/ shellHandle = ((Shell) parent).shellHandle;
++ OS.gtk_container_add (shellHandle, handle);
++ }
++ else
++ {
+ int /*long*/ vboxHandle = parent.vboxHandle;
+ OS.gtk_container_add (vboxHandle, handle);
+ OS.gtk_box_set_child_packing (vboxHandle, handle, false, true, 0, OS.GTK_PACK_START);
++ }
+ } else {
+ handle = OS.gtk_menu_new ();
+ if (handle == 0) error (SWT.ERROR_NO_HANDLES);
+Index: swt-source/org/eclipse/swt/internal/gtk/OS.java
+===================================================================
+--- swt-source.orig/org/eclipse/swt/internal/gtk/OS.java 2008-06-05 13:32:08.000000000 +0200
++++ swt-source/org/eclipse/swt/internal/gtk/OS.java 2008-10-08 01:36:56.000000000 +0200
+@@ -473,6 +473,11 @@
+ public static final byte[] window_state_event = ascii("window-state-event");
+
+ /** Properties */
++ /* Maemo hildon specific - border added due to toolbar */
++ public static final byte[] toolbar_borders = ascii("toolbar-borders");
++ /* Maemo hildon specific - border added due to skin graphics area */
++ public static final byte[] borders = ascii("borders");
++
+ public static final byte[] active = ascii("active");
+ public static final byte[] background_gdk = ascii("background-gdk");
+ public static final byte[] button_relief = ascii("button-relief");
+Index: swt-source/org/eclipse/swt/widgets/Shell.java
+===================================================================
+--- swt-source.orig/org/eclipse/swt/widgets/Shell.java 2008-06-05 13:31:10.000000000 +0200
++++ swt-source/org/eclipse/swt/widgets/Shell.java 2008-10-08 01:36:56.000000000 +0200
+@@ -1067,6 +1067,14 @@
+ int /*long*/ gtk_size_allocate (int /*long*/ widget, int /*long*/ allocation) {
+ int width = OS.GTK_WIDGET_WIDTH (shellHandle);
+ int height = OS.GTK_WIDGET_HEIGHT (shellHandle);
++
++ if (!fullScreen)
++ {
++ GtkBorder b = getMaemoBorder(false);
++ width -= (b.left + b.right);
++ height -= (b.top + b.bottom);
++ }
++
+ if (!resized || oldWidth != width || oldHeight != height) {
+ oldWidth = width;
+ oldHeight = height;
+@@ -1472,14 +1480,53 @@
+ if ((state & FOREIGN_HANDLE) != 0) return;
+ Monitor monitor = getMonitor ();
+ Rectangle rect = monitor.getClientArea ();
++/*
+ int width = rect.width * 5 / 8;
+ int height = rect.height * 5 / 8;
++*/
++
++ int width = rect.width;
++ int height = rect.height;
++
++ // Instead of some arbitrary defaults we can use the complete "application
++ // area" on the maemo platform.
++ if (!fullScreen)
++ {
++ GtkBorder b = getMaemoBorder(false);
++ width -= (b.left + b.right);
++ height -= (b.top + b.bottom);
++ }
++
+ if ((style & SWT.RESIZE) != 0) {
+ OS.gtk_window_resize (shellHandle, width, height);
+ }
+ resizeBounds (width, height, false);
+ }
+
++/**
++ * Retrieves the "borders" or "toolbar-borders" property
++ * from the Shell.
++ *
++ * That is neccessary to calculate correct Shell sizes on
++ * the Maemo platform.
++ *
++ */
++private GtkBorder getMaemoBorder(boolean wantToolbarBorder)
++{
++ GtkBorder b = new GtkBorder();
++
++ int /*long*/ [] result = new int /*long*/[1];
++ OS.gtk_widget_style_get(shellHandle,
++ (wantToolbarBorder ? OS.toolbar_borders
++ : OS.borders),
++ result, 0);
++
++ if (result[0] != 0)
++ OS.memmove(b, result[0], GtkBorder.sizeof);
++
++ return b;
++}
++
+ public void setMaximized (boolean maximized) {
+ checkWidget();
+ super.setMaximized (maximized);
+Index: swt-source/os_custom.c
+===================================================================
+--- swt-source.orig/os_custom.c 2008-06-05 13:31:50.000000000 +0200
++++ swt-source/os_custom.c 2008-10-08 01:36:56.000000000 +0200
+@@ -13,6 +13,8 @@
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
++#include <hildon/hildon-file-chooser-dialog.h>
++
+ #include "swt.h"
+ #include "os_structs.h"
+ #include "os_stats.h"
+@@ -41,11 +43,22 @@
+ {
+ jbyte *lparg0=NULL;
+ SWT_PTR rc = 0;
++ GtkWidget *widget = NULL;
+ OS_NATIVE_ENTER(env, that, _1gtk_1file_1chooser_1dialog_1new_FUNC);
+ if (arg0) if ((lparg0 = (*env)->GetByteArrayElements(env, arg0, NULL)) == NULL) goto fail;
+ /*
+ rc = (SWT_PTR)gtk_file_chooser_dialog_new(lparg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
+ */
++ /* Remaining arguments are thrown away as they cannot be used for the
++ * HildonFileChooserDialog anyways.
++ */
++ widget = (SWT_PTR) hildon_file_chooser_dialog_new(arg1, (GtkFileChooserAction) arg2);
++ gtk_window_set_title(GTK_WINDOW(widget), (const gchar *) lparg0);
++
++ rc = (SWT_PTR) widget;
++#if 0
++// The code is not supposed to run on AMD64.
++
+ {
+ static int initialized = 0;
+ static void *handle = NULL;
+@@ -70,6 +83,8 @@
+ rc = (SWT_PTR)(*fptr)(lparg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
+ }
+ }
++#endif
++
+ fail:
+ if (arg0 && lparg0) (*env)->ReleaseByteArrayElements(env, arg0, lparg0, 0);
+ OS_NATIVE_EXIT(env, that, _1gtk_1file_1chooser_1dialog_1new_FUNC);