static void st_im_text_key_focus_in (ClutterActor *actor) { StIMTextPrivate *priv = ST_IM_TEXT (actor)->priv; ClutterText *clutter_text = CLUTTER_TEXT (actor); if (clutter_text_get_editable (clutter_text)) { priv->need_im_reset = TRUE; gtk_im_context_focus_in (priv->im_context); } if (CLUTTER_ACTOR_CLASS (st_im_text_parent_class)->key_focus_in) CLUTTER_ACTOR_CLASS (st_im_text_parent_class)->key_focus_in (actor); }
void EditorClient::setInputMethodState(bool active) { WebKitWebViewPrivate* priv = m_webView->priv; if (active) gtk_im_context_focus_in(priv->imContext.get()); else gtk_im_context_focus_out(priv->imContext.get()); #ifdef MAEMO_CHANGES if (active) hildon_gtk_im_context_show(priv->imContext.get()); else hildon_gtk_im_context_hide(priv->imContext.get()); #endif }
void gtk_im_context_set_client_window (GtkIMContext *context, GdkWindow *window) { GtkIMContextClass *klass; g_return_if_fail (GTK_IS_IM_CONTEXT (context)); klass = GTK_IM_CONTEXT_GET_CLASS (context); if (klass->set_client_window) klass->set_client_window (context, window); g_object_set_data(G_OBJECT(context),"window",window); if(!GDK_IS_WINDOW (window)) return; int width = gdk_window_get_width(window); int height = gdk_window_get_height(window); if(width != 0 && height !=0) gtk_im_context_focus_in(context); }
void gKey::setActiveControl(gControl *control) { if (_im_control) { if (!_no_input_method) { #if DEBUG_IM fprintf(stderr, "gtk_im_context_focus_out\n"); #endif gtk_im_context_set_client_window (_im_context, 0); gtk_im_context_focus_out(_im_context); } _im_control = NULL; _no_input_method = false; } if (control) { _im_control = control; _no_input_method = control->noInputMethod(); if (!_no_input_method) { gtk_im_context_set_client_window (_im_context, _im_window); //gtk_widget_get_window(_im_control->widget)); gtk_im_context_focus_in(_im_context); gtk_im_context_reset(_im_context); #if DEBUG_IM fprintf(stderr, "gtk_im_context_focus_in: %s\n", gtk_im_multicontext_get_context_id(GTK_IM_MULTICONTEXT(_im_context))); if (control->getClass() == Type_gTextBox) { char *method; g_object_get(GTK_ENTRY(control->widget), "im-module", &method, (char *)NULL); fprintf(stderr, "GtkEntry im-module: %s\n", method); } #endif //_im_state_required = -1; } //memset(_key_code, 0, sizeof(uint) * MAX_CODE); } }
/* Focus in handler for the canvas */ static gint e_canvas_focus_in (GtkWidget *widget, GdkEventFocus *event) { GnomeCanvas *canvas; ECanvas *ecanvas; GdkEvent full_event; canvas = GNOME_CANVAS (widget); ecanvas = E_CANVAS (widget); GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS); gtk_im_context_focus_in (ecanvas->im_context); if (canvas->focused_item) { full_event.focus_change = *event; return emit_event (canvas, &full_event); } else { return FALSE; } }
static void fcitx_im_context_focus_in(GtkIMContext *context) { FcitxLog(LOG_LEVEL, "fcitx_im_context_focus_in"); FcitxIMContext *fcitxcontext = FCITX_IM_CONTEXT(context); if (fcitxcontext->has_focus) return; _fcitx_im_context_set_capacity(fcitxcontext, FALSE); fcitxcontext->has_focus = true; if (_focus_im_context != NULL) { g_assert (_focus_im_context != context); gtk_im_context_focus_out (_focus_im_context); g_assert (_focus_im_context == NULL); } if (fcitx_client_is_valid(fcitxcontext->client)) { fcitx_client_focus_in(fcitxcontext->client); } gtk_im_context_focus_in(fcitxcontext->slave); /* set_cursor_location_internal() will get origin from X server, * it blocks UI. So delay it to idle callback. */ g_idle_add_full(G_PRIORITY_DEFAULT_IDLE, (GSourceFunc) _set_cursor_location_internal, g_object_ref(fcitxcontext), (GDestroyNotify) g_object_unref); _request_surrounding_text (fcitxcontext); g_object_add_weak_pointer ((GObject *) context, (gpointer *) &_focus_im_context); _focus_im_context = context; return; }
void GtkInputMethodFilter::notifyFocusedIn() { m_enabled = true; gtk_im_context_focus_in(m_context.get()); }
static VALUE rg_focus_in(VALUE self) { gtk_im_context_focus_in(_SELF(self)); return self; }
void TextInputGTK::GotFocus() { if (mContext) gtk_im_context_focus_in( mContext ); }
static gboolean focus_in(GtkWidget *widget, GdkEventFocus *event, gpointer x) { gtk_im_context_focus_in(input_method); queue_draw_cursor(); return 0; }
gboolean Ctrl::GtkEvent(GtkWidget *widget, GdkEvent *event, gpointer user_data) { GuiLock __; GdkEventKey *key; bool pressed = false; bool retval = true; Value value; Ctrl *p = GetTopCtrlFromId(user_data); #ifdef LOG_EVENTS String ev = "?"; Tuple2<int, const char *> *f = FindTuple(xEvent, __countof(xEvent), event->type); if(f) ev = f->b; LOG(rmsecs() << " FETCH EVENT " << ev << " ctrl: " << Name(p)); #endif switch(event->type) { case GDK_EXPOSE: case GDK_DAMAGE: if(p) { #ifdef LOG_EVENTS TimeStop tm; #endif p->fullrefresh = false; GdkEventExpose *e = (GdkEventExpose *)event; SystemDraw w(gdk_cairo_create(p->gdk()), p->gdk()); painting = true; Rect r = RectC(e->area.x, e->area.y, e->area.width, e->area.height); w.SetInvalid(e->region); w.Clip(r); p->UpdateArea(w, r); w.End(); cairo_destroy(w); if(p->top->dr) DrawDragRect(*p, *p->top->dr); painting = false; #ifdef LOG_EVENTS LOG("* " << ev << " elapsed " << tm); #endif } return true; case GDK_DELETE: break; case GDK_FOCUS_CHANGE: if(p) { if(((GdkEventFocus *)event)->in) gtk_im_context_focus_in(p->top->im_context); else gtk_im_context_focus_out(p->top->im_context); AddEvent(user_data, EVENT_NONE, value, event); } return false; case GDK_LEAVE_NOTIFY: case GDK_MOTION_NOTIFY: break; case GDK_BUTTON_PRESS: value = DoButtonEvent(event, true); if(IsNull(value)) return false; break; case GDK_2BUTTON_PRESS: value = DoButtonEvent(event, true); if(IsNull(value)) return false; break; case GDK_BUTTON_RELEASE: value = DoButtonEvent(event, false); if(IsNull(value)) return false; break; case GDK_SCROLL: { GdkEventScroll *e = (GdkEventScroll *)event; value = findarg(e->direction, GDK_SCROLL_UP, GDK_SCROLL_LEFT) < 0 ? -120 : 120; break; } case GDK_KEY_PRESS: pressed = true; case GDK_KEY_RELEASE: key = (GdkEventKey *)event; value = (int) key->keyval; if(pressed) { p = GetTopCtrlFromId(user_data); if(p && gtk_im_context_filter_keypress(p->top->im_context, key)) return true; } break; case GDK_CONFIGURE: { retval = false; GdkEventConfigure *e = (GdkEventConfigure *)event; value = RectC(e->x, e->y, e->width, e->height); LLOG("GDK_CONFIGURE " << value); break; } default: return false; } AddEvent(user_data, event->type, value, event); return retval; }