Blame modules/input/imcedilla.c

Packit Service fb6fa5
/* GTK - The GIMP Toolkit
Packit Service fb6fa5
 * Copyright (C) 2000 Red Hat Software
Packit Service fb6fa5
 *
Packit Service fb6fa5
 * This library is free software; you can redistribute it and/or
Packit Service fb6fa5
 * modify it under the terms of the GNU Library General Public
Packit Service fb6fa5
 * License as published by the Free Software Foundation; either
Packit Service fb6fa5
 * version 2 of the License, or (at your option) any later version.
Packit Service fb6fa5
 *
Packit Service fb6fa5
 * This library is distributed in the hope that it will be useful,
Packit Service fb6fa5
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service fb6fa5
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service fb6fa5
 * Library General Public License for more details.
Packit Service fb6fa5
 *
Packit Service fb6fa5
 * You should have received a copy of the GNU Library General Public
Packit Service fb6fa5
 * License along with this library; if not, write to the
Packit Service fb6fa5
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Packit Service fb6fa5
 * Boston, MA 02111-1307, USA.
Packit Service fb6fa5
 *
Packit Service fb6fa5
 * Author: Owen Taylor <otaylor@redhat.com>
Packit Service fb6fa5
 *
Packit Service fb6fa5
 */
Packit Service fb6fa5
Packit Service fb6fa5
#include "config.h"
Packit Service fb6fa5
#include <string.h>
Packit Service fb6fa5
Packit Service fb6fa5
#include "gtk/gtk.h"
Packit Service fb6fa5
#include "gdk/gdkkeysyms.h"
Packit Service fb6fa5
Packit Service fb6fa5
#include "gtk/gtkimmodule.h"
Packit Service fb6fa5
#include "gtk/gtkintl.h"
Packit Service fb6fa5
Packit Service fb6fa5
Packit Service fb6fa5
GType type_cedilla = 0;
Packit Service fb6fa5
Packit Service fb6fa5
static void cedilla_class_init (GtkIMContextSimpleClass *class);
Packit Service fb6fa5
static void cedilla_init (GtkIMContextSimple *im_context);
Packit Service fb6fa5
Packit Service fb6fa5
static void
Packit Service fb6fa5
cedilla_register_type (GTypeModule *module)
Packit Service fb6fa5
{
Packit Service fb6fa5
  const GTypeInfo object_info =
Packit Service fb6fa5
  {
Packit Service fb6fa5
    sizeof (GtkIMContextSimpleClass),
Packit Service fb6fa5
    (GBaseInitFunc) NULL,
Packit Service fb6fa5
    (GBaseFinalizeFunc) NULL,
Packit Service fb6fa5
    (GClassInitFunc) cedilla_class_init,
Packit Service fb6fa5
    NULL,           /* class_finalize */
Packit Service fb6fa5
    NULL,           /* class_data */
Packit Service fb6fa5
    sizeof (GtkIMContextSimple),
Packit Service fb6fa5
    0,
Packit Service fb6fa5
    (GInstanceInitFunc) cedilla_init,
Packit Service fb6fa5
  };
Packit Service fb6fa5
Packit Service fb6fa5
  type_cedilla = 
Packit Service fb6fa5
    g_type_module_register_type (module,
Packit Service fb6fa5
				 GTK_TYPE_IM_CONTEXT_SIMPLE,
Packit Service fb6fa5
				 "GtkIMContextCedillaTranslit",
Packit Service fb6fa5
				 &object_info, 0);
Packit Service fb6fa5
}
Packit Service fb6fa5
Packit Service fb6fa5
/* The difference between this and the default input method is the handling
Packit Service fb6fa5
 * of C+acute - this method produces C WITH CEDILLA rather than C WITH ACUTE.
Packit Service fb6fa5
 * For languages that use CCedilla and not acute, this is the preferred mapping,
Packit Service fb6fa5
 * and is particularly important for pt_BR, where the us-intl keyboard is
Packit Service fb6fa5
 * used extensively.
Packit Service fb6fa5
 */
Packit Service fb6fa5
static guint16 cedilla_compose_seqs[] = {
Packit Service fb6fa5
  GDK_dead_acute,	GDK_C,	0,	0,	0,	0x00C7,	/* LATIN_CAPITAL_LETTER_C_WITH_CEDILLA */
Packit Service fb6fa5
  GDK_dead_acute,	GDK_c,	0,	0,	0,	0x00E7,	/* LATIN_SMALL_LETTER_C_WITH_CEDILLA */
Packit Service fb6fa5
  GDK_Multi_key,	GDK_apostrophe,	GDK_C,  0,      0,      0x00C7, /* LATIN_CAPITAL_LETTER_C_WITH_CEDILLA */
Packit Service fb6fa5
  GDK_Multi_key,	GDK_apostrophe,	GDK_c,  0,      0,      0x00E7, /* LATIN_SMALL_LETTER_C_WITH_CEDILLA */
Packit Service fb6fa5
  GDK_Multi_key,	GDK_C,  GDK_apostrophe,	0,      0,      0x00C7, /* LATIN_CAPITAL_LETTER_C_WITH_CEDILLA */
Packit Service fb6fa5
  GDK_Multi_key,	GDK_c,  GDK_apostrophe,	0,      0,      0x00E7, /* LATIN_SMALL_LETTER_C_WITH_CEDILLA */
Packit Service fb6fa5
};
Packit Service fb6fa5
Packit Service fb6fa5
static void
Packit Service fb6fa5
cedilla_class_init (GtkIMContextSimpleClass *class)
Packit Service fb6fa5
{
Packit Service fb6fa5
}
Packit Service fb6fa5
Packit Service fb6fa5
static void
Packit Service fb6fa5
cedilla_init (GtkIMContextSimple *im_context)
Packit Service fb6fa5
{
Packit Service fb6fa5
  gtk_im_context_simple_add_table (im_context,
Packit Service fb6fa5
				   cedilla_compose_seqs,
Packit Service fb6fa5
				   4,
Packit Service fb6fa5
				   G_N_ELEMENTS (cedilla_compose_seqs) / (4 + 2));
Packit Service fb6fa5
}
Packit Service fb6fa5
Packit Service fb6fa5
static const GtkIMContextInfo cedilla_info = { 
Packit Service fb6fa5
  "cedilla",		           /* ID */
Packit Service fb6fa5
  N_("Cedilla"),                   /* Human readable name */
Packit Service fb6fa5
  GETTEXT_PACKAGE,		   /* Translation domain */
Packit Service fb6fa5
  GTK_LOCALEDIR,		   /* Dir for bindtextdomain */
Packit Service fb6fa5
  "az:ca:co:fr:gv:oc:pt:sq:tr:wa"  /* Languages for which this module is the default */
Packit Service fb6fa5
};
Packit Service fb6fa5
Packit Service fb6fa5
static const GtkIMContextInfo *info_list[] = {
Packit Service fb6fa5
  &cedilla_info
Packit Service fb6fa5
};
Packit Service fb6fa5
Packit Service fb6fa5
#ifndef INCLUDE_IM_cedilla
Packit Service fb6fa5
#define MODULE_ENTRY(type, function) G_MODULE_EXPORT type im_module_ ## function
Packit Service fb6fa5
#else
Packit Service fb6fa5
#define MODULE_ENTRY(type, function) type _gtk_immodule_cedilla_ ## function
Packit Service fb6fa5
#endif
Packit Service fb6fa5
Packit Service fb6fa5
MODULE_ENTRY (void, init) (GTypeModule *module)
Packit Service fb6fa5
{
Packit Service fb6fa5
  cedilla_register_type (module);
Packit Service fb6fa5
}
Packit Service fb6fa5
Packit Service fb6fa5
MODULE_ENTRY (void, exit) (void)
Packit Service fb6fa5
{
Packit Service fb6fa5
}
Packit Service fb6fa5
Packit Service fb6fa5
MODULE_ENTRY (void, list) (const GtkIMContextInfo ***contexts,
Packit Service fb6fa5
			   int                      *n_contexts)
Packit Service fb6fa5
{
Packit Service fb6fa5
  *contexts = info_list;
Packit Service fb6fa5
  *n_contexts = G_N_ELEMENTS (info_list);
Packit Service fb6fa5
}
Packit Service fb6fa5
Packit Service fb6fa5
MODULE_ENTRY (GtkIMContext *, create) (const gchar *context_id)
Packit Service fb6fa5
{
Packit Service fb6fa5
  if (strcmp (context_id, "cedilla") == 0)
Packit Service fb6fa5
    return g_object_new (type_cedilla, NULL);
Packit Service fb6fa5
  else
Packit Service fb6fa5
    return NULL;
Packit Service fb6fa5
}