diff --git a/widget/src/gtk2/Makefile.in b/widget/src/gtk2/Makefile.in --- a/widget/src/gtk2/Makefile.in +++ b/widget/src/gtk2/Makefile.in @@ -140,16 +140,22 @@ EXTRA_DSO_LDOPTS += \ $(XLIBS) \ $(XEXT_LIBS) \ $(XCOMPOSITE_LIBS) \ $(MOZ_GTK2_LIBS) \ -lthebes \ $(LCMS_LIBS) \ $(NULL) +ifdef MOZ_PLATFORM_HILDON +ifdef MOZ_ENABLE_GCONF +EXTRA_DSO_LDOPTS += $(MOZ_GCONF_LIBS) +endif +endif + ifdef MOZ_X11 EXTRA_DSO_LDOPTS += -lgtkxtbin -lXrender endif EXPORTS = \ nsGTKToolkit.h \ nsIImageToPixbuf.h \ mozdrawingarea.h \ @@ -162,16 +168,22 @@ DEFINES += -DNATIVE_THEME_SUPPORT DEFINES += -DNATIVE_THEME_SUPPORT endif include $(topsrcdir)/config/rules.mk CFLAGS += $(MOZ_GTK2_CFLAGS) $(MOZ_STARTUP_NOTIFICATION_CFLAGS) CXXFLAGS += $(MOZ_GTK2_CFLAGS) $(MOZ_STARTUP_NOTIFICATION_CFLAGS) +ifdef MOZ_PLATFORM_HILDON +ifdef MOZ_ENABLE_GCONF +CXXFLAGS += $(MOZ_GCONF_CFLAGS) +endif +endif + DEFINES += -DUSE_XIM DEFINES += -DCAIRO_GFX ifdef MOZ_ENABLE_POSTSCRIPT DEFINES += -DUSE_POSTSCRIPT EXTRA_DSO_LDOPTS += -lgfxpsshar endif diff --git a/widget/src/gtk2/nsWindow.cpp b/widget/src/gtk2/nsWindow.cpp --- a/widget/src/gtk2/nsWindow.cpp +++ b/widget/src/gtk2/nsWindow.cpp @@ -112,16 +112,23 @@ static const char sAccessibilityKey [] = #include "nsAutoPtr.h" #include "gfxPlatformGtk.h" #include "gfxContext.h" #include "gfxImageSurface.h" #ifdef MOZ_X11 #include "gfxXlibSurface.h" +#endif + +#if defined(MOZ_PLATFORM_HILDON) && defined(MOZ_ENABLE_GCONF) +#include "gconf/gconf-client.h" +static PRBool gWidgetCompletionEnabled = PR_FALSE; +static const char sWidgetCompletionGConfPref [] = + "/apps/osso/inputmethod/hildon-im-languages/en_GB/word-completion"; #endif #ifdef MOZ_DFB extern "C" { #ifdef MOZ_DIRECT_DEBUG #define DIRECT_ENABLE_DEBUG #endif @@ -2808,19 +2815,43 @@ nsWindow::OnContainerFocusInEvent(GtkWid // Return if someone has blocked events for this widget. This will // happen if someone has called gtk_widget_grab_focus() from // nsWindow::SetFocus() and will prevent recursion. if (mContainerBlockFocus) { LOGFOCUS(("Container focus is blocked [%p]\n", (void *)this)); return; } - if (mIsTopLevel) + if (mIsTopLevel) { mActivatePending = PR_TRUE; - +#if defined(MOZ_PLATFORM_HILDON) && defined(MOZ_ENABLE_GCONF) + // For mobile/maemo, it is desired to disable the word completion widget + // at the bottom of the screen for some reasons: it interacts badly with + // keyboard events sometimes and disabling it will give more screen space + // for web content. So whenever a topLevel mobile window gets the focus we + // verify what is the current state of the widget-completion through query + // the proper gconf property. If it is enabled, we store the property value + // and disable it. Where the toplevel window loses the focus we restore the + // previous state of the widget completion property so other applications in + // the system do not get affected. See 'OnContainerFocusOutEvent'. + if (mWindowType == eWindowType_toplevel) + if (GConfClient *gConfClient = gconf_client_get_default()) { + GError* error = nsnull; + gWidgetCompletionEnabled = gconf_client_get_bool(gConfClient, + sWidgetCompletionGConfPref, + &error); + if (error) + g_error_free(error); + else if (gWidgetCompletionEnabled) + gconf_client_set_bool(gConfClient, sWidgetCompletionGConfPref, + PR_FALSE, nsnull); + g_object_unref(gConfClient); + } +#endif + } // Unset the urgency hint, if possible GtkWidget* top_window = nsnull; GetToplevelWidget(&top_window); if (top_window && (GTK_WIDGET_VISIBLE(top_window))) SetUrgencyHint(top_window, PR_FALSE); // dispatch a got focus event DispatchGotFocusEvent(); @@ -2849,16 +2880,26 @@ nsWindow::OnContainerFocusOutEvent(GtkWi } #endif /* MOZ_X11 */ // Figure out if the focus widget is the child of this window. If // it is, send a focus out and deactivate event for it. if (!gFocusWindow) return; +#if defined(MOZ_PLATFORM_HILDON) && defined(MOZ_ENABLE_GCONF) + if (mIsTopLevel && mWindowType == eWindowType_toplevel) + if(GConfClient *gConfClient = gconf_client_get_default()) { + GError* error = nsnull; + gconf_client_set_bool(gConfClient, sWidgetCompletionGConfPref, gWidgetCompletionEnabled, &error); + if (error) + g_error_free(error); + g_object_unref(gConfClient); + } +#endif GdkWindow *tmpWindow; tmpWindow = (GdkWindow *)gFocusWindow->GetNativeData(NS_NATIVE_WINDOW); nsWindow *tmpnsWindow = get_window_for_gdk_window(tmpWindow); while (tmpWindow && tmpnsWindow) { // found it! if (tmpnsWindow == this) goto foundit;