[maemo-developers] [maemo-developers] VirtualKeyboard service/API

From: Antonio Gomes tonikitoo at gmail.com
Date: Mon Jan 23 22:23:53 EET 2006
hi Aaron,


> I didn't mention this in my last e-mail, but you'll also need to setup a
> signal handler for the GtkIMContext object's "commit" signal.


I have it (the 'commit' signal) already connected and also its callback
defined as it is in your post at
http://maemo.org/pipermail/maemo-developers/2006-January/002337.html - cool
!!! ...  But problem begins after creating the IM_Context object and
associating it with the GdkWindow of my GtkMozEmbed object : the
mozilla_engine stop recognizing any input from the vkb, except if I press
'backspace' ...

bwt, in 'commit_cb' method, it prints what I type at the console but doesn't
add nothing at the HTML form (detail: it does with no context associated or
if I type from the physical keyboard) ...

 static  gboolean
gtk_moz_embed_im_context_commit_cb (GtkIMContext *ctx, const  gchar
*str, GtkMozEmbed *aEmbed) {
  gunichar uChar = 0;
  guint keyval = 0;
  gchar *text2 = (gchar *) str;

  printf ("\n [GTK_MOZ_EMBED] it gets here '%s'\n", str);

  *// the string is in UTF-8 format--iterate through the characters*
  *while*  (*text2) {
	uChar = g_utf8_get_char(text2);
	keyval = gdk_unicode_to_keyval(uChar);

	*//*
	*// do something with the character here*
	*//*
	text2 = g_utf8_next_char(text2);
  }
}


ps: again, I'm able to pop up / hide the vkb, but not to typing into it ...

many thanks for you attention


> Aaron
>
> On Sat, 21 Jan 2006, Antonio Gomes wrote:
>
> > Aaron,
> >
> > I got the kb syncrhnized with the focus (in/out) events of HTML forms
> (the
> > focus in -> vk pops up and vice-versa) - many thanks, btw.
> >
> > But no text can be entered from typing frm the vk ... And before getting
> the
> > "synchronism" working (partially), I was able to do so. Could it be a
> > 'context' problems ?
> >
> > Thoughts ?
> >
> > thanks
> >
> > On 1/20/06, Aaron Levinson <alevinsn at aracnet.com> wrote:
> > >
> > > I have to admit that I don't understand why you would need to use this
>
> > > specialized function in your case.  The situation with osso-xterm is a
> > > specialized one, since the GtkIMContext object's window needs to be
> > > activated as the result of a menu action.  In your case, however, you
> > > already have a GtkWidget (GtkMozEmbed), so you should be able to do
> the
> > > following:
> > >
> > > 1.  Create a GtkIMMultiContext in the "constructor" for your object.
> > > 2.  In the realize function for your class (or as a response to the
> > > "realize" signal), call gtk_im_context_set_client_window().  Also call
> it
> > > for unrealize.
> > > 3.  Handle the "focus-in" and "focus-out" signals appropriately for
> the
> > > widget by calling gtk_im_context_focus_in() and
> > > gtk_im_context_focus_out(), respectively.
> > > 4.  Set up key-press and key-release signal handlers for the widget
> and
> > > call gtk_im_context_filter_keypress() in each signal handler.
> > >
> > > Take a look at the source code for vncviewer or osso-xterm for
> examples.
> > > You can also examine the code for various GTK classes, such as
> > > GtkTextEntry.  Also, you can refer back to some previous e-mails that
> I
> > > wrote to this list regarding input methods.
> > >
> > > Aaron
> > >
> > > On Fri, 20 Jan 2006, Aaron Levinson wrote:
> > >
> > > > You can use gtk_im_context_show() to force the window for a
> GtkIMContext
> > > > object to be displayed.  This function isn't mentioned in the
> > > > documentation for the class, but it is in the include file.  An
> example
> > > of
> > > > using this function can be found in the osso-xterm code.
> > > >
> > > > Aaron
> > > >
> > > > On Fri, 20 Jan 2006, Antonio Gomes wrote:
> > > >
> > > > > otherwise, there is no way to force it Pop UP manually ?
> > > > >
> > > > > regards
> > > > >
> > > > >
> > > > > On 1/20/06, Antonio Gomes <tonikitoo at gmail.com> wrote:
> > > > > >
> > > > > >
> > > > > > On 1/18/06, Aaron Levinson <alevinsn at aracnet.com> wrote:
> > > > > >
> > > > > > Hi Aaron,
> > > > > >
> > > > > > One possibility is to use gdk_window_foreign_new() to wrap the
> > > native
> > > > > > > window in a GdkWindow object.
> > > > > >
> > > > > >
> > > > > > Maybe I can jump this first step, once I already have a
> GtkWidget
> > > the
> > > > > > wraps mozilla guts the make easier called GtkMozEmbed, provided
> by
> > > the
> > > > > > mozilla embedding API. Make sense for you ?
> > > > > >
> > > > > >
> > > > > > > Then, after creating a GtkIMMulticontext,
> > > > > > > you could try using gtk_im_context_set_client_window() with
> the
> > > new
> > > > > > > GdkWindow object.  You'll want to listen for key-press and
> > > key-release
> > > > > > > signals (hard to do without a GtkWidget, but you should be
> able to
> > > > > > > handle
> > > > > > > this by listening for these signals on the HildonApp widget),
> and
> > > when
> > > > > > > you
> > > > > > > get these signals you can route them to the GtkIMContext that
> you
> > > > > > > created
> > > > > > > earlier if appropriate.  Also, look for other e-mails
> regarding
> > > input
> > > > > > > methods in the archives for this e-mail list.  Maybe this will
> > > work,
> > > > > > > although I'm not too hopeful.  You might also consider
> creating a
> > > > > > > special
> > > > > > > GtkWidget class that can wrap an arbitrary GdkWindow.  I would
> > > have
> > > > > > > suggested the GtkPlug class, but GtkPlug widgets are top-level
>
> > > widgets,
> > > > > > > which won't work here.
> > > > > >
> > > > > >
> > > > > >
> > > > > > Please note that the virtual keyboard is provided in the form of
> a
> > > GTK
> > > > > > > input method, and you'll basically need to use the standard
> GTK
> > > > > > > mechanisms
> > > > > > > for working with input methods if you want to use it.
> > > > > >
> > > > > >
> > > > > > but I'm already using Vb successfully and there is no
> synchronising
> > > > > > between the rendered HTML forms and the Kb ... (focus in -> pop
> up
> > > vk /
> > > > > > focus out -> vk gets down).
> > > > > >
> > > > > > many thanks
> > > > > >
> > > > > >
> > > > > > > > Hi there,
> > > > > > > >
> > > > > > > > I'm wondering how I can get the Virtual Keyboard service to
> > > > > > > synchronize with
> > > > > > > > non GTK_Widgets (like HTML forms on mozilla-webpages) ?
> > > > > > > >
> > > > > > > > Actually, I have some methods already implemented regarding
> > > this, and
> > > > > > > I just
> > > > > > > > need communication with VK side (from APIs or whatever). Is
> > > there is
> > > > > > > any API
> > > > > > > > to use it, or GTK mask/hide it in its guts ?
>
>
--
--Antonio Gomes
http:// tonikitoo (dot) blogspot (dot) com (slash)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maemo.org/pipermail/maemo-developers/attachments/20060123/93377c91/attachment.htm 
More information about the maemo-developers mailing list