/* m17n-gui.c -- body of the GUI API.
- Copyright (C) 2003, 2004
+ Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
National Institute of Advanced Industrial Science and Technology (AIST)
Registration Number H15PRO112
MDeviceLibraryInterface *interface;
MSTRUCT_CALLOC (interface, MERROR_WIN);
- interface->library = malloc (strlen (lib)
+ interface->library = malloc (strlen (M17N_MODULE_DIR) + 1
+ + strlen (lib)
+ strlen (DLOPEN_SHLIB_EXT) + 1);
- sprintf (interface->library, "%s%s", lib, DLOPEN_SHLIB_EXT);
+ sprintf (interface->library, "%s/%s%s", M17N_MODULE_DIR, lib,
+ DLOPEN_SHLIB_EXT);
if (! device_library_list)
device_library_list = mplist ();
mplist_add (device_library_list, name, interface);
void
m17n_init_win (void)
{
- int mdebug_mask = MDEBUG_INIT;
+ int mdebug_flag = MDEBUG_INIT;
merror_code = MERROR_NONE;
if (m17n__gui_initialized++)
return;
m17n_init ();
+ m17n_init_flt ();
if (merror_code != MERROR_NONE)
{
m17n__gui_initialized--;
void
m17n_fini_win (void)
{
- int mdebug_mask = MDEBUG_FINI;
+ int mdebug_flag = MDEBUG_FINI;
MPlist *plist;
if (m17n__gui_initialized == 0
MDEBUG_POP_TIME ();
MDEBUG_PRINT_TIME ("FINI", (stderr, " to finalize the gui modules."));
MDEBUG_POP_TIME ();
+ m17n_fini_flt ();
m17n_fini ();
}
These are the symbols to use in a parameter to create a frame. See
the function mframe () for details.
- #Mdevice, #Mdisplay, #Mscreen, #Mdrawable, #Mdepth, and #Mcolormap
- are also keys of a frame property. */
+ @b Mdevice, @b Mdisplay, @b Mscreen, @b Mdrawable, @b Mdepth, and
+ @b Mcolormap are also keys of a frame property. */
/***ja
@name ÊÑ¿ô¡§ ¥Õ¥ì¡¼¥à¥Ñ¥é¥á¡¼¥¿ÍÑ¥¡¼
¥Õ¥ì¡¼¥à¤òÀ¸À®¤¹¤ëºÝ¤Î¥Ñ¥é¥á¡¼¥¿¤ËÍѤ¤¤ë¥·¥ó¥Ü¥ë¡£¾Ü¤·¤¯¤Ï´Ø¿ô
mframe () ¤ÎÀâÌÀ»²¾È¡£
- #Mdevice¡¢ #Mdisplay¡¢ #Mscreen¡¢ #Mdrawable¡¢ #Mdepth¡¢#Mcolormap
- ¤Ï¥Õ¥ì¡¼¥à¥×¥í¥Ñ¥Æ¥£¤Î¥¡¼¤Ç¤â¤¢¤ë¡£ */
+ @b Mdevice¡¢ @b Mdisplay¡¢ @b Mscreen¡¢ @b Mdrawable¡¢ @b Mdepth¡¢
+ @b Mcolormap ¤Ï¥Õ¥ì¡¼¥à¥×¥í¥Ñ¥Æ¥£¤Î¥¡¼¤Ç¤â¤¢¤ë¡£ */
/*=*/
<ul>
- <li> #Mdevice, the value must be one of #Mx, #Mgd, and #Mnil.
+ <li> @b Mdevice, the value must be one of #Mx, @b Mgd, and #Mnil.
If the value is #Mx, the frame is for X Window System. The
argument #MDrawWindow specified together with the frame must be of
type @c Window. The frame is both readable and writable, thus all
GUI functions can be used.
- If the value is #Mgd, the frame is for an image object of GD
+ If the value is @b Mgd, the frame is for an image object of GD
library. The argument #MDrawWindow specified together with the
frame must be of type @c gdImagePtr. The frame is writable
only, thus functions minput_XXX can't be used for the frame.
</ul>
- In addition, if the value of the key #Mdevice is #Mx, the
+ In addition, if the value of the key @b Mdevice is #Mx, the
following keys are recognized. They are to specify the root
window and the depth of drawables that can be used with the frame.
<ul>
- <li> #Mdrawable, the value type must be <tt>Drawable</tt>.
+ <li> @b Mdrawable, the value type must be <tt>Drawable</tt>.
- A parameter of key #Mdisplay must also be specified. The
+ A parameter of key @b Mdisplay must also be specified. The
created frame can be used for drawables whose root window and
depth are the same as those of the specified drawable on the
specified display.
- When this parameter is specified, the parameter of key #Mscreen
+ When this parameter is specified, the parameter of key @b Mscreen
is ignored.
- <li> #Mwidget, the value type must be <tt>Widget</tt>.
+ <li> @b Mwidget, the value type must be <tt>Widget</tt>.
The created frame can be used for drawables whose root window and
depth are the same as those of the specified widget.
If a parameter of key #Mface is not specified, the default face
is created from the resources of the widget.
- When this parameter is specified, the parameters of key #Mdisplay,
- #Mscreen, #Mdrawable, #Mdepth are ignored.
+ When this parameter is specified, the parameters of key @b Mdisplay,
+ @b Mscreen, @b Mdrawable, @b Mdepth are ignored.
- <li> #Mdepth, the value type must be <tt>unsigned</tt>.
+ <li> @b Mdepth, the value type must be <tt>unsigned</tt>.
The created frame can be used for drawables of the specified
depth.
- <li> #Mscreen, the value type must be <tt>(Screen *)</tt>.
+ <li> @b Mscreen, the value type must be <tt>(Screen *)</tt>.
The created frame can be used for drawables whose root window is
the same as the root window of the specified screen, and depth is
the same at the default depth of the screen.
- When this parameter is specified, parameter of key #Mdisplay is
+ When this parameter is specified, parameter of key @b Mdisplay is
ignored.
- <li> #Mdisplay, the value type must be <tt>(Display *)</tt>.
+ <li> @b Mdisplay, the value type must be <tt>(Display *)</tt>.
The created frame can be used for drawables whose root window is
the same as the root window for the default screen of the display,
and depth is the same as the default depth of the screen.
- <li> #Mcolormap, the value type must be <tt>(Colormap)</tt>.
+ <li> @b Mcolormap, the value type must be <tt>(Colormap)</tt>.
The created frame uses the specified colormap.
- <li> #Mfont, the value must be #Mx, #Mfreetype, or #Mxft.
+ <li> @b Mfont, the value must be #Mx, #Mfreetype, or #Mxft.
The created frame uses the specified font backend. The value #Mx
instructs to use X core fonts, #Mfreetype to use local fonts
<ul>
- <li> #Mdevice. ÃÍ¤Ï #Mx, #Mgd, #Mnil ¤Î¤¤¤º¤ì¤«¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
+ <li> @b Mdevice. ÃÍ¤Ï #Mx, @b Mgd, #Mnil ¤Î¤¤¤º¤ì¤«¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
Ãͤ¬ #Mx ¤Ê¤é¤Ð¡¢¿·¤·¤¤¥Õ¥ì¡¼¥à¤Ï X ¥¦¥£¥ó¥É¥¦¥·¥¹¥Æ¥àÍѤǤ¢¤ë¡£
¤³¤Î¥Õ¥ì¡¼¥à¤È¶¦¤Ë»ØÄꤵ¤ì¤¿°ú¿ô #MDrawWindow ¤Ï¡¢ @c Window
·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£¥Õ¥ì¡¼¥à¤ÏÆɤ߽ñ¤¤È¤â¤Ë²Äǽ¤Ç¤¢¤ê¡¢¤¹¤Ù¤Æ¤ÎGUI
´Ø¿ô¤¬»ÈÍѤǤ¤ë¡£
- Ãͤ¬ #Mgd ¤Ê¤é¤Ð¡¢¿·¤·¤¤¥Õ¥ì¡¼¥à¤Ï GD
+ Ãͤ¬ @b Mgd ¤Ê¤é¤Ð¡¢¿·¤·¤¤¥Õ¥ì¡¼¥à¤Ï GD
¥é¥¤¥Ö¥é¥ê¤Î¥¤¥á¡¼¥¸¥ª¥Ö¥¸¥§¥¯¥ÈÍѤǤ¢¤ë¡£¤³¤Î¥Õ¥ì¡¼¥à¤È¶¦¤Ë»ØÄꤵ¤ì¤¿°ú¿ô
#MDrawWindow ¤Ï¡¢ @c gdImagePtr ·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£¥Õ¥ì¡¼¥à¤Ï½ñ¤½Ð¤·ÀìÍѤǤ¢¤ê¡¢
minput_ ¤Ç»Ï¤Þ¤ë̾Á°¤Î´Ø¿ô¤Ï»ÈÍѤǤ¤Ê¤¤¡£
</ul>
- ¤³¤ì¤é¤Î¥¡¼¤Ë²Ã¤¨¡¢#Mdevice ¤Î¥¡¼¤¬ #Mx
+ ¤³¤ì¤é¤Î¥¡¼¤Ë²Ã¤¨¡¢@b Mdevice ¤Î¥¡¼¤¬ #Mx
¤Ç¤¢¤ë¾ì¹ç¤Ë¸Â¤ê°Ê²¼¤Î¥¡¼¤âǧ¼±¤µ¤ì¤ë¡£°Ê²¼¤Î¥¡¼¤Ï¥ë¡¼¥È¥¦¥£¥ó¥É¥¦¤È¡¢¥Õ¥ì¡¼¥à¤ÇÍøÍѤǤ¤ë
drawable ¤Î¿¼¤µ¤ò»ØÄꤹ¤ë¡£
<ul>
- <li> #Mdrawable. ÃÍ¤Ï <tt>Drawable</tt> ·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
+ <li> @b Mdrawable. ÃÍ¤Ï <tt>Drawable</tt> ·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
- ¥¡¼ #Mdisplay ¤ò»ý¤Ä¥Ñ¥é¥á¡¼¥¿¤â»ØÄꤵ¤ì¤Æ¤¤¤ëɬÍפ¬¤¢¤ë¡£
+ ¥¡¼ @b Mdisplay ¤ò»ý¤Ä¥Ñ¥é¥á¡¼¥¿¤â»ØÄꤵ¤ì¤Æ¤¤¤ëɬÍפ¬¤¢¤ë¡£
À¸À®¤µ¤ì¤¿¥Õ¥ì¡¼¥à¤Ï¡¢»ØÄꤵ¤ì¤¿¥Ç¥£¥¹¥×¥ì¥¤¾å¤Î»ØÄꤵ¤ì¤¿ drawable
¤ÈƱ¤¸¥ë¡¼¥È¥¦¥£¥ó¥É¥¦¤È¿¼¤µ¤ò»ý¤Ä drawable ¤ËÍѤ¤¤é¤ì¤ë¡£
- ¤³¤Î¥Ñ¥é¥á¡¼¥¿¤¬¤¢¤ë¾ì¹ç¤Ë¤Ï¡¢#Mscreen ¤ò¥¡¼¤È¤¹¤ë¥Ñ¥é¥á¡¼¥¿¤Ï̵»ë¤µ¤ì¤ë¡£
+ ¤³¤Î¥Ñ¥é¥á¡¼¥¿¤¬¤¢¤ë¾ì¹ç¤Ë¤Ï¡¢@b Mscreen ¤ò¥¡¼¤È¤¹¤ë¥Ñ¥é¥á¡¼¥¿¤Ï̵»ë¤µ¤ì¤ë¡£
- <li> #Mwidget. ÃÍ¤Ï <tt>Widget</tt> ·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
+ <li> @b Mwidget. ÃÍ¤Ï <tt>Widget</tt> ·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
À¸À®¤µ¤ì¤¿¥Õ¥ì¡¼¥à¤Ï¡¢»ØÄꤷ¤¿¥¦¥£¥¸¥§¥Ã¥È¤ÈƱ¤¸¥ë¡¼¥È¥¦¥£¥ó¥É¥¦¤È¿¼¤µ¤ò»ý¤Ä
drawable ¤ËÍѤ¤¤é¤ì¤ë¡£
¥¡¼ #Mface ¤ò»ý¤Ä¥Ñ¥é¥á¡¼¥¿¤¬¤Ê¤±¤ì¤Ð¡¢¥Ç¥Õ¥©¥ë¥È¤Î¥Õ¥§¡¼¥¹¤Ï¤³¤Î
¥¦¥£¥¸¥§¥Ã¥È¤Î¥ê¥½¡¼¥¹¤«¤éºî¤é¤ì¤ë¡£
- ¤³¤Î¥Ñ¥é¥á¡¼¥¿¤¬¤¢¤ë¾ì¹ç¤Ë¤Ï¡¢#Mdisplay, #Mscreen, #Mdrawable,
- #Mdepth ¤ò¥¡¼¤È¤¹¤ë¥Ñ¥é¥á¡¼¥¿¤Ï̵»ë¤µ¤ì¤ë¡£
+ ¤³¤Î¥Ñ¥é¥á¡¼¥¿¤¬¤¢¤ë¾ì¹ç¤Ë¤Ï¡¢@b Mdisplay, @b Mscreen, @b Mdrawable,
+ @b Mdepth ¤ò¥¡¼¤È¤¹¤ë¥Ñ¥é¥á¡¼¥¿¤Ï̵»ë¤µ¤ì¤ë¡£
- <li> #Mdepth. ÃÍ¤Ï <tt>unsigned</tt> ·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
+ <li> @b Mdepth. ÃÍ¤Ï <tt>unsigned</tt> ·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
À¸À®¤µ¤ì¤¿¥Õ¥ì¡¼¥à¤Ï¡¢»ØÄꤷ¤¿¿¼¤µ¤Î drawable ¤ËÍѤ¤¤é¤ì¤ë¡£
- <li> #Mscreen. ÃÍ¤Ï <tt>(Screen *)</tt> ·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
+ <li> @b Mscreen. ÃÍ¤Ï <tt>(Screen *)</tt> ·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
À¸À®¤·¤¿¥Õ¥ì¡¼¥à¤Ï¡¢»ØÄꤷ¤¿¥¹¥¯¥ê¡¼¥ó¤ÈƱ¤¸¥ë¡¼¥È¥¦¥£¥ó¥É¥¦¤ò»ý¤Á¡¢¥¹¥¯¥ê¡¼¥ó¤Î¥Ç¥Õ¥©¥ë¥È¤Î¿¼¤µ¤ÈƱ¤¸¿¼¤µ¤ò»ý¤Ä drawable ¤ËÍѤ¤¤é¤ì¤ë¡£
- ¤³¤Î¥Ñ¥é¥á¡¼¥¿¤¬¤¢¤ë¾ì¹ç¤Ë¤Ï¡¢#Mdisplay ¤ò¥¡¼¤È¤¹¤ë¥Ñ¥é¥á¡¼¥¿¤Ï̵»ë¤µ¤ì¤ë¡£
+ ¤³¤Î¥Ñ¥é¥á¡¼¥¿¤¬¤¢¤ë¾ì¹ç¤Ë¤Ï¡¢@b Mdisplay ¤ò¥¡¼¤È¤¹¤ë¥Ñ¥é¥á¡¼¥¿¤Ï̵»ë¤µ¤ì¤ë¡£
- <li> #Mdisplay. ÃÍ¤Ï <tt>(Display *)</tt> ·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
+ <li> @b Mdisplay. ÃÍ¤Ï <tt>(Display *)</tt> ·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
À¸À®¤µ¤ì¤¿¥Õ¥ì¡¼¥à¤Ï¡¢»ØÄꤷ¤¿¥Ç¥£¥¹¥×¥ì¥¤¤Î¥Ç¥Õ¥©¥ë¥È¥¹¥¯¥ê¡¼¥ó¤ÈƱ¤¸¥ë¡¼¥È¥¦¥£¥ó¥É¥¦¤ÈƱ¤¸¿¼¤µ¤ò»ý¤Ädrawables ¤ËÍѤ¤¤é¤ì¤ë¡£
- <li> #Mcolormap. ÃÍ¤Ï <tt>(Colormap)</tt> ·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
+ <li> @b Mcolormap. ÃÍ¤Ï <tt>(Colormap)</tt> ·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
À¸À®¤µ¤ì¤¿¥Õ¥ì¡¼¥à¤Ï¡¢»ØÄꤷ¤¿¥«¥é¡¼¥Þ¥Ã¥×¤ò»ÈÍѤ¹¤ë¡£
if (! interface->handle)
{
if (! (interface->handle = dlopen (interface->library, RTLD_NOW))
- || ! (*(void **) (&interface->init)
- = dlsym (interface->handle, "device_init"))
- || ! (*(void **) (&interface->open)
- = dlsym (interface->handle, "device_open"))
- || ! (*(void **) (&interface->fini)
- = dlsym (interface->handle, "device_fini"))
+ || ! (interface->init
+ = (int (*) ()) dlsym (interface->handle, "device_init"))
+ || ! (interface->open
+ = (int (*) (MFrame *, MPlist *)) dlsym (interface->handle,
+ "device_open"))
+ || ! (interface->fini
+ = (int (*) ()) dlsym (interface->handle, "device_fini"))
|| (*interface->init) () < 0)
{
fprintf (stderr, "%s\n", (char *) dlerror ());