Closed Bug 609696 Opened 14 years ago Closed 14 years ago

Provide scriptable api for Fennec front end to display input method section dialog

Categories

(Core Graveyard :: Widget: Android, defect)

ARM
Android
defect
Not set
normal

Tracking

(fennec2.0b3+)

RESOLVED FIXED
Tracking Status
fennec 2.0b3+ ---

People

(Reporter: blassey, Assigned: wesj)

References

Details

(Keywords: inputmethod)

Attachments

(2 files, 2 obsolete files)

+++ This bug was initially created as a clone of Bug #590602 +++

Right now, there is no way to change, from inside Fennec, the type of keyboard that I want to use.
It would be good if the user can choose different keyboards(input methods) from inside the Fennec browser. The way Android browser does it right now is to hold the tap on a text field to get a context menu, which gives you the option to choose your input method type. The way to test it right now is to use Swype on android.
Blocks: 590602
No longer depends on: 590602
Assignee: nobody → blassey.bugs
I have a patch that creates and implements this interface, among other stuff (I was trying to see how hard it would be port all of our formhelper stuff to use android native things). It looks something like:

interface nsIAndroidIMEService : nsISupports
{
  void ShowInputMethodPicker();
};

I can clean out the other cruft and give this a shot if you don't mind lassey?
sure, got for it
Attached patch Fix v1 (obsolete) — Splinter Review
Like I said, this adds an interface:

interface nsIAndroidIMEService : nsISupports
{
  void ShowInputMethodPicker();
};

in widget, and implements it with "@mozilla.org/android/imeservice;1".
Attachment #488360 - Flags: review?(blassey.bugs)
Comment on attachment 488360 [details] [diff] [review]
Fix v1

You will need to get superreview from roc since you're adding an interface to widget.

nsIAndroidIMEService isn't a particularly good name. Other platforms have the concept of input method switching, so you'll most likely want to implement this as a new function in nsIWidget.
Attachment #488360 - Flags: review?(blassey.bugs)
Comment on attachment 488360 [details] [diff] [review]
Fix v1

I'm fine with moving this somewhere else. Just not sure where it would fit. Or we can create a more generic nsIIMEService or nsIFormHelperService maybe? Or if we really want to get fancy, we can attach them to the window context like the ctypes stuff does. nsIWidget isn't scriptable, so even if we put these methods in there, we will need an interface to call into them through.

pinging roc for feedback
Attachment #488360 - Flags: feedback?(roc)
I think having this as a service is fine. It's what we do for nsIFilePicker etc. I would just call it nsIIMEPicker so it can be reused on other platforms. Also, the show method should just be called 'show'.
Attached patch Patch v2 (obsolete) — Splinter Review
Change interface names and methods, but only implemented in android builds.
Attachment #488360 - Attachment is obsolete: true
Attachment #488923 - Flags: superreview?(roc)
Attachment #488923 - Flags: review?(mwu)
Attachment #488360 - Flags: feedback?(roc)
Comment on attachment 488923 [details] [diff] [review]
Patch v2

>diff --git a/embedding/android/GeckoAppShell.java b/embedding/android/GeckoAppShell.java
>--- a/embedding/android/GeckoAppShell.java
>+++ b/embedding/android/GeckoAppShell.java
>@@ -573,9 +573,15 @@ class GeckoAppShell
>     public static int getDpi() {
>          DisplayMetrics metrics = new DisplayMetrics();
>          GeckoApp.mAppContext.getWindowManager().getDefaultDisplay().getMetrics(metrics);
>          return metrics.densityDpi;
>     }
>     public static String showFilePicker() {
>         return GeckoApp.mAppContext.showFilePicker();
>     }
>+    public static void showInputMethodPicker() {
>+        Log.i("GeckoAppShell", "showInputMethodPicker\n");
>+
Avoid logging spew.

>+        InputMethodManager imm = (InputMethodManager) GeckoApp.surfaceView.getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
>+        imm.showInputMethodPicker();       
>+    }
> }
>diff --git a/widget/public/Makefile.in b/widget/public/Makefile.in
>--- a/widget/public/Makefile.in
>+++ b/widget/public/Makefile.in
>@@ -108,16 +108,17 @@ XPIDLSRCS	= \
> 		nsIScreen.idl \
> 		nsIScreenManager.idl \
> 		nsIPrintSession.idl \
> 		nsIPrintSettings.idl \
> 		nsIPrintSettingsService.idl \
> 		nsIPrintOptions.idl \
> 		nsIIdleService.idl \
> 		nsIGfxInfo.idl \
>+    nsIIMEPicker.idl \
Align properly.

>diff --git a/widget/public/nsIIMEPicker.idl b/widget/public/nsIIMEPicker.idl
>new file mode 100644
>--- /dev/null
>+++ b/widget/public/nsIIMEPicker.idl
>@@ -0,0 +1,49 @@
>+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
>+ *
>+ * ***** BEGIN LICENSE BLOCK *****
>+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
>+ *
>+ * The contents of this file are subject to the Mozilla Public License Version
>+ * 1.1 (the "License"); you may not use this file except in compliance with
>+ * the License. You may obtain a copy of the License at
>+ * http://www.mozilla.org/MPL/
>+ *
>+ * Software distributed under the License is distributed on an "AS IS" basis,
>+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
>+ * for the specific language governing rights and limitations under the
>+ * License.
>+ *
>+ * The Original Code is the Mozilla browser.
>+ *
>+ * The Initial Developer of the Original Code is
>+ * Netscape Communications Corporation.
>+ * Portions created by the Initial Developer are Copyright (C) 1999
>+ * the Initial Developer. All Rights Reserved.
>+ *
Update this boilerplate.

>diff --git a/widget/src/android/Makefile.in b/widget/src/android/Makefile.in
>--- a/widget/src/android/Makefile.in
>+++ b/widget/src/android/Makefile.in
>@@ -59,16 +59,17 @@ CPPSRCS	= \
> 	AndroidBridge.cpp \
> 	AndroidJNI.cpp \
> 	nsWindow.cpp \
> 	nsLookAndFeel.cpp \
> 	nsScreenManagerAndroid.cpp \
> 	nsIdleServiceAndroid.cpp \
> 	nsClipboard.cpp \
> 	nsFilePicker.cpp \
>+  nsIMEPicker.cpp \
Fix alignment

>diff --git a/widget/src/android/nsIMEPicker.h b/widget/src/android/nsIMEPicker.h
>new file mode 100644
>--- /dev/null
>+++ b/widget/src/android/nsIMEPicker.h
>@@ -0,0 +1,58 @@
>+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
>+/* ***** BEGIN LICENSE BLOCK *****
>+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
>+ *
>+ * The contents of this file are subject to the Mozilla Public License Version
>+ * 1.1 (the "License"); you may not use this file except in compliance with
>+ * the License. You may obtain a copy of the License at
>+ * http://www.mozilla.org/MPL/
>+ *
>+ * Software distributed under the License is distributed on an "AS IS" basis,
>+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
>+ * for the specific language governing rights and limitations under the
>+ * License.
>+ *
>+ * The Original Code is mozilla.org code.
>+ *
>+ * The Initial Developer of the Original Code is
>+ * Netscape Communications Corporation.
>+ * Portions created by the Initial Developer are Copyright (C) 1998
>+ * the Initial Developer. All Rights Reserved.
>+ *
Update this boilerplate.

>+ * Contributor(s):
>+ *   Wes Johnston <wjohnston@mozilla.com>
>+ *
>+ * Alternatively, the contents of this file may be used under the terms of
>+ * either the GNU General Public License Version 2 or later (the "GPL"), or
>+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
>+ * in which case the provisions of the GPL or the LGPL are applicable instead
>+ * of those above. If you wish to allow use of your version of this file only
>+ * under the terms of either the GPL or the LGPL, and not to allow others to
>+ * use your version of this file under the terms of the MPL, indicate your
>+ * decision by deleting the provisions above and replace them with the notice
>+ * and other provisions required by the GPL or the LGPL. If you do not delete
>+ * the provisions above, a recipient may use your version of this file under
>+ * the terms of any one of the MPL, the GPL or the LGPL.
>+ *
>+ * ***** END LICENSE BLOCK ***** */
>+#ifndef __nsIMEPicker
>+#define __nsIMEPicker
>+
>+#include "nsIIMEPicker.h"
>+
>+class nsIMEPicker : public nsIIMEPicker
>+{
>+public:
>+  NS_DECL_ISUPPORTS
>+  NS_DECL_NSIIMEPICKER
>+
>+  nsIMEPicker();
>+
>+private:
>+  ~nsIMEPicker();
>+
>+protected:
>+  /* additional members */
remove this comment.
Attachment #488923 - Flags: review?(mwu) → review+
Assignee: blassey.bugs → wjohnston
(In reply to comment #8)
> Update this boilerplate.
In fact, you should always get a new copy of the boilerplate text from here instead of copying from another file:
http://www.mozilla.org/MPL/boilerplate-1.1/
Attachment #488923 - Flags: superreview?(roc) → superreview+
Ran this through try and everything looks fine.
Attachment #488923 - Attachment is obsolete: true
Attachment #489526 - Flags: superreview+
Attachment #489526 - Flags: review+
pushed:
http://hg.mozilla.org/mozilla-central/rev/83ba71fe17d7
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
This bug's patch left nsWidgetsCID.h with no newline at the end, which triggered this GCC warning in every file that included it:
> ../../dist/include/nsWidgetsCID.h:201: warning: backslash-newline at end of file
(I think it warns since the file ends with a #define, and there's no final newline to terminate the #define.)

Fixed in a followup push:
http://hg.mozilla.org/mozilla-central/rev/867f5e6e8ef8
This patch is causing Fennec Android builds to crash on startup. See bug 611297. I'll be backing this out as soon as the tree opens.
Attached patch bustage fixSplinter Review
This patch adds back some code that was dropped from the checkin patch
Attachment #489822 - Flags: review?(mwu)
Attachment #489822 - Flags: review?(mwu) → review+
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: