コード例 #1
0
ファイル: e-canvas.c プロジェクト: UIKit0/evolution
static gint
canvas_focus_out_event (GtkWidget *widget,
                        GdkEventFocus *event)
{
	GnomeCanvas *canvas;
	ECanvas *ecanvas;
	GdkEvent full_event = { 0 };

	canvas = GNOME_CANVAS (widget);
	ecanvas = E_CANVAS (widget);

	/* XXX Can't access flags directly anymore, but is it really needed?
	 *     If so, could we call gtk_widget_send_focus_change() instead? */
#if 0
	GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
#endif

	gtk_im_context_focus_out (ecanvas->im_context);

	if (canvas->focused_item) {
		full_event.type = event->type;
		full_event.focus_change = *event;
		return canvas_emit_event (canvas, &full_event);
	} else {
		return FALSE;
	}
}
コード例 #2
0
ファイル: fcitximcontext-gio.c プロジェクト: eguopt/fcitx
static void
fcitx_im_context_focus_out(GtkIMContext *context)
{
    FcitxLog(LOG_LEVEL, "fcitx_im_context_focus_out");
    FcitxIMContext *fcitxcontext = FCITX_IM_CONTEXT(context);

    if (!fcitxcontext->has_focus) {
        return;
    }

    g_assert (context == _focus_im_context);
    g_object_remove_weak_pointer ((GObject *) context,
                                  (gpointer *) &_focus_im_context);
    _focus_im_context = NULL;

    fcitxcontext->has_focus = false;

    if (fcitx_client_is_valid(fcitxcontext->client)) {
        fcitx_client_focus_out(fcitxcontext->client);
    }

    fcitxcontext->cursor_pos = 0;
    if (fcitxcontext->preedit_string != NULL) {
        g_free(fcitxcontext->preedit_string);
        fcitxcontext->preedit_string = NULL;
        g_signal_emit(fcitxcontext, _signal_preedit_changed_id, 0);
        g_signal_emit(fcitxcontext, _signal_preedit_end_id, 0);
    }

    gtk_im_context_focus_out(fcitxcontext->slave);

    return;
}
コード例 #3
0
void GtkInputMethodFilter::setEnabled(bool enabled)
{
    m_enabled = enabled;
    if (enabled)
        gtk_im_context_focus_in(m_context.get());
    else
        gtk_im_context_focus_out(m_context.get());
}
コード例 #4
0
void GtkInputMethodFilter::notifyFocusedOut()
{
    if (!m_enabled)
        return;

    if (m_composingTextCurrently)
        confirmCurrentComposition();
    cancelContextComposition();
    gtk_im_context_focus_out(m_context.get());
    m_enabled = false;
}
コード例 #5
0
ファイル: gcompris_im.c プロジェクト: GNOME/gcompris
static gint
window_focus_callback (GtkWidget *widget,
		       GdkEventFocus *event,
		       gpointer user_data)
{
  GcomprisProperties	*properties = gc_prop_get ();
  if (event->in)
    gtk_im_context_focus_in (properties->context);
  else
    gtk_im_context_focus_out (properties->context);

  return FALSE;
}
コード例 #6
0
void InputMethodFilter::notifyFocusedOut()
{
#if ENABLE(API_TESTS)
    ASSERT(m_page || m_testingMode);
#else
    ASSERT(m_page);
#endif
    if (!m_enabled)
        return;

    confirmCurrentComposition();
    cancelContextComposition();
    gtk_im_context_focus_out(m_context.get());
}
コード例 #7
0
ファイル: st-im-text.c プロジェクト: cosimoc/gnome-shell
static void
st_im_text_key_focus_out (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_out (priv->im_context);
    }

  if (CLUTTER_ACTOR_CLASS (st_im_text_parent_class)->key_focus_out)
    CLUTTER_ACTOR_CLASS (st_im_text_parent_class)->key_focus_out (actor);
}
コード例 #8
0
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
}
コード例 #9
0
ファイル: gkey.cpp プロジェクト: ramonelalto/gambas
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);
	}
}
コード例 #10
0
ファイル: e-canvas.c プロジェクト: ebbywiselyn/evolution
/* Focus out handler for the canvas */
static gint
e_canvas_focus_out (GtkWidget *widget, GdkEventFocus *event)
{
	GnomeCanvas *canvas;
	ECanvas *ecanvas;
	GdkEvent full_event;

	canvas = GNOME_CANVAS (widget);
	ecanvas = E_CANVAS (widget);

	GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);

	gtk_im_context_focus_out (ecanvas->im_context);

	if (canvas->focused_item) {
		full_event.focus_change = *event;
		return emit_event (canvas, &full_event);
	} else {
		return FALSE;
	}
}
コード例 #11
0
ファイル: fcitximcontext-gio.c プロジェクト: eguopt/fcitx
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;
}
コード例 #12
0
ファイル: gimptexttool-editor.c プロジェクト: DevMaggio/gimp
void
gimp_text_tool_editor_halt (GimpTextTool *text_tool)
{
  GimpTextOptions *options = GIMP_TEXT_TOOL_GET_OPTIONS (text_tool);

  if (text_tool->style_overlay)
    {
      gtk_widget_destroy (text_tool->style_overlay);
      text_tool->style_overlay = NULL;
      text_tool->style_editor  = NULL;
    }

  g_signal_handlers_disconnect_by_func (options,
                                        gimp_text_tool_options_notify,
                                        text_tool);

  if (text_tool->editor_dialog)
    {
      g_signal_handlers_disconnect_by_func (text_tool->editor_dialog,
                                            gimp_text_tool_editor_destroy,
                                            text_tool);
      gtk_widget_destroy (text_tool->editor_dialog);
    }

  if (text_tool->proxy_text_view)
    {
      gtk_widget_destroy (text_tool->offscreen_window);
      text_tool->offscreen_window = NULL;
      text_tool->proxy_text_view = NULL;
    }

  text_tool->needs_im_reset = TRUE;
  gimp_text_tool_reset_im_context (text_tool);

  gtk_im_context_focus_out (text_tool->im_context);

  gtk_im_context_set_client_window (text_tool->im_context, NULL);
}
コード例 #13
0
ファイル: rbgtkimcontext.c プロジェクト: Mazwak/ruby-gnome2
static VALUE
rg_focus_out(VALUE self)
{
    gtk_im_context_focus_out(_SELF(self));
    return self;
}
コード例 #14
0
void TextInputGTK::LostFocus()
{
	if (mContext) gtk_im_context_focus_out( mContext );
}
コード例 #15
0
ファイル: terminal.c プロジェクト: laubstein/pw3270
 static gboolean focus_out(GtkWidget *widget, GdkEventFocus *event, gpointer x)
 {
	gtk_im_context_focus_out(input_method);
	queue_draw_cursor();
	return 0;
 }
コード例 #16
0
ファイル: GtkEvent.cpp プロジェクト: AbdelghaniDr/mirror
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;
}