Beispiel #1
0
/** Initialize the various GTK-level thinks in a display after the internal
 *  data has been set.
 * @param ddisp A display with all non-GTK/GDK items set.
 */
static void
initialize_display_widgets(DDisplay *ddisp)
{
  Diagram *dia = ddisp->diagram;
  gchar *filename;

  g_return_if_fail (dia && dia->filename);

  ddisp->im_context = gtk_im_multicontext_new();
  g_signal_connect (G_OBJECT (ddisp->im_context), "commit",
                    G_CALLBACK (ddisplay_im_context_commit), ddisp);
  ddisp->preedit_string = NULL;
  g_signal_connect (G_OBJECT (ddisp->im_context), "preedit_changed",
                    G_CALLBACK (ddisplay_im_context_preedit_changed),
                    ddisp);
  ddisp->preedit_attrs = NULL;
  
  filename = strrchr(dia->filename, G_DIR_SEPARATOR);
  if (filename==NULL) {
    filename = dia->filename;
  } else {
    filename++;
  }
  create_display_shell(ddisp, prefs.new_view.width, prefs.new_view.height,
		       filename, prefs.new_view.use_menu_bar);

  ddisplay_update_statusbar (ddisp);

  ddisplay_set_cursor(ddisp, current_cursor);
}
Beispiel #2
0
void
gimp_text_tool_editor_init (GimpTextTool *text_tool)
{
  text_tool->im_context     = gtk_im_multicontext_new ();
  text_tool->needs_im_reset = FALSE;

  text_tool->preedit_string = NULL;
  text_tool->preedit_cursor = 0;
  text_tool->overwrite_mode = FALSE;
  text_tool->x_pos          = -1;

  g_signal_connect (text_tool->im_context, "commit",
                    G_CALLBACK (gimp_text_tool_im_commit),
                    text_tool);
  g_signal_connect (text_tool->im_context, "preedit-start",
                    G_CALLBACK (gimp_text_tool_im_preedit_start),
                    text_tool);
  g_signal_connect (text_tool->im_context, "preedit-end",
                    G_CALLBACK (gimp_text_tool_im_preedit_end),
                    text_tool);
  g_signal_connect (text_tool->im_context, "preedit-changed",
                    G_CALLBACK (gimp_text_tool_im_preedit_changed),
                    text_tool);

}
Beispiel #3
0
struct nsgtk_treeview *nsgtk_treeview_create(unsigned int flags,
		GtkWindow *window, GtkScrolledWindow *scrolled,
 		GtkDrawingArea *drawing_area)
{
	struct nsgtk_treeview *tv;	
	
	assert(drawing_area != NULL);

	tv = malloc(sizeof(struct nsgtk_treeview));
	if (tv == NULL) {
		LOG(("malloc failed"));
		warn_user("NoMemory", 0);
		return NULL;
	}
	
	tv->window = window;
	tv->scrolled = scrolled;
	tv->drawing_area = drawing_area;
	tv->input_method = gtk_im_multicontext_new();
	tv->tree = tree_create(flags, &nsgtk_tree_callbacks, tv);
	tv->mouse_state = 0;
	tv->mouse_pressed = false;
	
	nsgtk_widget_override_background_color(GTK_WIDGET(drawing_area), 
					       GTK_STATE_NORMAL,
					       0, 0xffff, 0xffff, 0xffff);

	nsgtk_connect_draw_event(GTK_WIDGET(drawing_area), G_CALLBACK(nsgtk_tree_window_draw_event), tv->tree);
	
#define CONNECT(obj, sig, callback, ptr) \
	g_signal_connect(G_OBJECT(obj), (sig), G_CALLBACK(callback), (ptr))
	CONNECT(drawing_area, "button-press-event",
			nsgtk_tree_window_button_press_event,
			tv);
	CONNECT(drawing_area, "button-release-event",
			nsgtk_tree_window_button_release_event,
  			tv);
	CONNECT(drawing_area, "motion-notify-event",
			nsgtk_tree_window_motion_notify_event,
  			tv);
	CONNECT(drawing_area, "key-press-event",
			nsgtk_tree_window_keypress_event,
  			tv);
	CONNECT(drawing_area, "key-release-event",
			nsgtk_tree_window_keyrelease_event,
			tv);


	/* input method */
	gtk_im_context_set_client_window(tv->input_method,
			nsgtk_widget_get_window(GTK_WIDGET(tv->window)));
	gtk_im_context_set_use_preedit(tv->input_method, FALSE);
	/* input method signals */
	CONNECT(tv->input_method, "commit",
			nsgtk_tree_window_input_method_commit,
			tv);

	return tv;
}
Beispiel #4
0
static void
e_canvas_init (ECanvas *canvas)
{
	canvas->selection = NULL;
	canvas->cursor = NULL;
	canvas->im_context = gtk_im_multicontext_new ();
	canvas->tooltip_window = NULL;
}
static void
st_im_text_init (StIMText *self)
{
  StIMTextPrivate *priv;

  self->priv = priv = ST_IM_TEXT_GET_PRIVATE (self);

  priv->im_context = gtk_im_multicontext_new ();
  g_signal_connect (priv->im_context, "commit",
                    G_CALLBACK (st_im_text_commit_cb), self);
}
Beispiel #6
0
void gKey::init()
{
	GdkWindowAttr attr;

	attr.event_mask = GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK;
	attr.width = attr.height = 1;
	attr.wclass = GDK_INPUT_ONLY;
	attr.window_type = GDK_WINDOW_TOPLEVEL;

	_im_window = gdk_window_new(NULL, &attr, 0);

	_im_context = gtk_im_multicontext_new();
  g_signal_connect (_im_context, "commit", G_CALLBACK(cb_im_commit), NULL);
}
Beispiel #7
0
 GtkWidget *CreateTerminalWindow(void)
 {
	input_method = gtk_im_multicontext_new();

	load_font_sizes();

	terminal = gtk_event_box_new();
	gtk_widget_set_app_paintable(terminal,TRUE);
	gtk_widget_set_redraw_on_allocate(terminal,TRUE);

	g_signal_connect(G_OBJECT(terminal), "destroy", 			G_CALLBACK(destroy), NULL);

/*
	g_signal_connect(G_OBJECT(terminal), "direction-changed",	G_CALLBACK(direction_changed), NULL);
	g_signal_connect(G_OBJECT(terminal), "style-set",			G_CALLBACK(style_set), NULL);
*/

	// Configure terminal widget
    GTK_WIDGET_SET_FLAGS(terminal, GTK_CAN_DEFAULT|GTK_CAN_FOCUS);

    // http://developer.gnome.org/doc/API/2.0/gdk/gdk-Events.html#GdkEventMask
    gtk_widget_add_events(terminal,GDK_KEY_PRESS_MASK|GDK_KEY_RELEASE_MASK|GDK_BUTTON_PRESS_MASK|GDK_BUTTON_MOTION_MASK|GDK_BUTTON_RELEASE_MASK|GDK_POINTER_MOTION_MASK|GDK_ENTER_NOTIFY_MASK);

    g_signal_connect(G_OBJECT(terminal),		"expose_event",  		G_CALLBACK(expose),					0);
    g_signal_connect(G_OBJECT(terminal),		"configure-event",		G_CALLBACK(configure),				0);
    g_signal_connect(G_OBJECT(terminal),		"size-allocate",		G_CALLBACK(size_allocate),			0);
    g_signal_connect(G_OBJECT(terminal),		"key-press-event",		G_CALLBACK(key_press),				0);
    g_signal_connect(G_OBJECT(terminal),		"key-release-event",	G_CALLBACK(key_release),			0);
    g_signal_connect(G_OBJECT(terminal),		"realize",				G_CALLBACK(realize),				0);
    g_signal_connect(G_OBJECT(terminal),		"focus-in-event",		G_CALLBACK(focus_in),				0);
    g_signal_connect(G_OBJECT(terminal),		"focus-out-event",		G_CALLBACK(focus_out),				0);

    // Connect mouse events
    g_signal_connect(G_OBJECT(terminal), 		"button-press-event",	G_CALLBACK(mouse_button_press),		0);
    g_signal_connect(G_OBJECT(terminal), 		"button-release-event",	G_CALLBACK(mouse_button_release),	0);
    g_signal_connect(G_OBJECT(terminal), 		"motion-notify-event",	G_CALLBACK(mouse_motion),    		0);
    g_signal_connect(G_OBJECT(terminal), 		"enter-notify-event",	G_CALLBACK(mouse_enter),    		0);
    g_signal_connect(G_OBJECT(terminal), 		"scroll-event",			G_CALLBACK(mouse_scroll),			0);

	// Connect input method events
    g_signal_connect(G_OBJECT(input_method),	"commit",				G_CALLBACK(im_commit),				0);

	register_tchange(CROSSHAIR,set_crosshair);
	register_tchange(CURSOR_POS,set_showcursor);
	register_tchange(CURSOR_BLINK,set_blink);
	register_tchange(RECTANGLE_SELECT,set_rectangle_select);
	register_tchange(INSERT,set_insert);

	return terminal;
 }
void TextInputGTK::Setup()
{
	mContext = gtk_im_multicontext_new();
	if (mContext) {
		long handle = 0;
		if (REALGetPropValue( (REALobject)mControl, "Handle", &handle ) && handle != 0) {
			g_signal_connect_data( mContext, "commit", (GCallback)CommitCallback, mControl, NULL, GConnectFlags(0) );
			g_signal_connect_data( mContext, "preedit_changed", (GCallback)PreEditChangedCallback, mControl, NULL, GConnectFlags(0) );
			g_signal_connect_data( mContext, "preedit_start", (GCallback)PreEditStartCallback, mControl, NULL, GConnectFlags(0) );

			GtkWidget *widget = reinterpret_cast<GtkWidget *>(handle);
			gtk_im_context_set_client_window( mContext, widget->window );
		}
	}
}
Beispiel #9
0
static void
st_im_text_init (StIMText *self)
{
  StIMTextPrivate *priv;

  self->priv = priv = ST_IM_TEXT_GET_PRIVATE (self);

  priv->im_context = gtk_im_multicontext_new ();
  g_signal_connect (priv->im_context, "commit",
                    G_CALLBACK (st_im_text_commit_cb), self);
  g_signal_connect (priv->im_context, "preedit-changed",
                    G_CALLBACK (st_im_text_preedit_changed_cb), self);
  g_signal_connect (priv->im_context, "retrieve-surrounding",
                    G_CALLBACK (st_im_text_retrieve_surrounding_cb), self);
  g_signal_connect (priv->im_context, "delete-surrounding",
                    G_CALLBACK (st_im_text_delete_surrounding_cb), self);
}
GtkInputMethodFilter::GtkInputMethodFilter()
    : m_cursorOffset(0)
    , m_context(adoptGRef(gtk_im_multicontext_new()))
    , m_widget(0)
    , m_enabled(false)
    , m_composingTextCurrently(false)
    , m_filteringKeyEvent(false)
    , m_preeditChanged(false)
    , m_preventNextCommit(false)
    , m_justSentFakeKeyUp(false)
    , m_lastFilteredKeyPressCodeWithNoResults(GDK_KEY_VoidSymbol)
{
    g_signal_connect(m_context.get(), "commit", G_CALLBACK(handleCommitCallback), this);
    g_signal_connect(m_context.get(), "preedit-start", G_CALLBACK(handlePreeditStartCallback), this);
    g_signal_connect(m_context.get(), "preedit-changed", G_CALLBACK(handlePreeditChangedCallback), this);
    g_signal_connect(m_context.get(), "preedit-end", G_CALLBACK(handlePreeditEndCallback), this);
}
Beispiel #11
0
void
gc_im_init(GtkWidget *window)
{
  GcomprisProperties	*properties = gc_prop_get ();


  /* set IMContext */
  properties->context = gtk_im_multicontext_new ();

  if(gc_profile_get_current())
    {
      GHashTable *init_im =  g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
      init_im = gc_db_conf_with_table_get (gc_profile_get_current()->profile_id,
					      -1,
					      init_im );

      properties->default_context = g_hash_table_lookup ( init_im, "default_im");

      if (properties->default_context)
	g_setenv ("GTK_IM_MODULE",
		  properties->default_context,
		  TRUE);
    }

  gtk_im_context_set_client_window (properties->context,
                                    window->window);

  g_signal_connect (G_OBJECT (properties->context), "commit",
		    G_CALLBACK(im_context_commit_callback), NULL);

  g_signal_connect (G_OBJECT (properties->context), "preedit-changed",
		    G_CALLBACK(im_context_preedit_callback), NULL);

  g_signal_connect (GTK_WIDGET (window), "focus-in-event",
		    G_CALLBACK(window_focus_callback), NULL);

  g_signal_connect (GTK_WIDGET (window), "focus-out-event",
		    G_CALLBACK(window_focus_callback), NULL);

}
Beispiel #12
0
 wxGtkIMData()
 {
     context = gtk_im_multicontext_new();
     lastKeyEvent = NULL;
 }
Beispiel #13
0
 wxGtkIMData()
 {
     context = gtk_im_multicontext_new();
     lastKeyEvent = nullptr;
 }
static VALUE 
rg_initialize(VALUE self)
{
    G_INITIALIZE(self, gtk_im_multicontext_new());
    return Qnil;
}