OMWrap.c revision 1ab64890
11ab64890Smrg/* $Xorg: OMWrap.c,v 1.4 2000/08/17 19:44:47 cpqbld Exp $ */ 21ab64890Smrg/* 31ab64890Smrg * Copyright 1992, 1993 by TOSHIBA Corp. 41ab64890Smrg * 51ab64890Smrg * Permission to use, copy, modify, and distribute this software and its 61ab64890Smrg * documentation for any purpose and without fee is hereby granted, provided 71ab64890Smrg * that the above copyright notice appear in all copies and that both that 81ab64890Smrg * copyright notice and this permission notice appear in supporting 91ab64890Smrg * documentation, and that the name of TOSHIBA not be used in advertising 101ab64890Smrg * or publicity pertaining to distribution of the software without specific, 111ab64890Smrg * written prior permission. TOSHIBA make no representations about the 121ab64890Smrg * suitability of this software for any purpose. It is provided "as is" 131ab64890Smrg * without express or implied warranty. 141ab64890Smrg * 151ab64890Smrg * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 161ab64890Smrg * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 171ab64890Smrg * TOSHIBA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 181ab64890Smrg * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 191ab64890Smrg * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 201ab64890Smrg * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 211ab64890Smrg * SOFTWARE. 221ab64890Smrg * 231ab64890Smrg * Author: Katsuhisa Yano TOSHIBA Corp. 241ab64890Smrg * mopi@osa.ilab.toshiba.co.jp 251ab64890Smrg */ 261ab64890Smrg/* $XFree86: xc/lib/X11/OMWrap.c,v 1.4 2001/07/25 15:04:44 dawes Exp $ */ 271ab64890Smrg 281ab64890Smrg#ifdef HAVE_CONFIG_H 291ab64890Smrg#include <config.h> 301ab64890Smrg#endif 311ab64890Smrg#include "Xlibint.h" 321ab64890Smrg#include "Xlcint.h" 331ab64890Smrg 341ab64890SmrgXOM 351ab64890SmrgXOpenOM(Display *dpy, XrmDatabase rdb, _Xconst char *res_name, 361ab64890Smrg _Xconst char *res_class) 371ab64890Smrg{ 381ab64890Smrg XLCd lcd = _XOpenLC((char *) NULL); 391ab64890Smrg 401ab64890Smrg if (lcd == NULL) 411ab64890Smrg return (XOM) NULL; 421ab64890Smrg 431ab64890Smrg if (lcd->methods->open_om) 441ab64890Smrg return (*lcd->methods->open_om)(lcd, dpy, rdb, res_name, res_class); 451ab64890Smrg 461ab64890Smrg return (XOM) NULL; 471ab64890Smrg} 481ab64890Smrg 491ab64890SmrgStatus 501ab64890SmrgXCloseOM(XOM om) 511ab64890Smrg{ 521ab64890Smrg XOC oc, next; 531ab64890Smrg XLCd lcd = om->core.lcd; 541ab64890Smrg 551ab64890Smrg next = om->core.oc_list; 561ab64890Smrg 571ab64890Smrg while ((oc = next)) { 581ab64890Smrg next = oc->core.next; 591ab64890Smrg (*oc->methods->destroy)(oc); 601ab64890Smrg } 611ab64890Smrg 621ab64890Smrg om->core.oc_list = NULL; 631ab64890Smrg 641ab64890Smrg _XCloseLC(lcd); 651ab64890Smrg 661ab64890Smrg return (*om->methods->close)(om); 671ab64890Smrg} 681ab64890Smrg 691ab64890Smrgchar * 701ab64890SmrgXSetOMValues(XOM om, ...) 711ab64890Smrg{ 721ab64890Smrg va_list var; 731ab64890Smrg XlcArgList args; 741ab64890Smrg char *ret; 751ab64890Smrg int num_args; 761ab64890Smrg 771ab64890Smrg va_start(var, om); 781ab64890Smrg _XlcCountVaList(var, &num_args); 791ab64890Smrg va_end(var); 801ab64890Smrg 811ab64890Smrg va_start(var, om); 821ab64890Smrg _XlcVaToArgList(var, num_args, &args); 831ab64890Smrg va_end(var); 841ab64890Smrg 851ab64890Smrg if (args == (XlcArgList) NULL) 861ab64890Smrg return (char *) NULL; 871ab64890Smrg 881ab64890Smrg ret = (*om->methods->set_values)(om, args, num_args); 891ab64890Smrg 901ab64890Smrg Xfree(args); 911ab64890Smrg 921ab64890Smrg return ret; 931ab64890Smrg} 941ab64890Smrg 951ab64890Smrgchar * 961ab64890SmrgXGetOMValues(XOM om, ...) 971ab64890Smrg{ 981ab64890Smrg va_list var; 991ab64890Smrg XlcArgList args; 1001ab64890Smrg char *ret; 1011ab64890Smrg int num_args; 1021ab64890Smrg 1031ab64890Smrg va_start(var, om); 1041ab64890Smrg _XlcCountVaList(var, &num_args); 1051ab64890Smrg va_end(var); 1061ab64890Smrg 1071ab64890Smrg va_start(var, om); 1081ab64890Smrg _XlcVaToArgList(var, num_args, &args); 1091ab64890Smrg va_end(var); 1101ab64890Smrg 1111ab64890Smrg if (args == (XlcArgList) NULL) 1121ab64890Smrg return (char *) NULL; 1131ab64890Smrg 1141ab64890Smrg ret = (*om->methods->get_values)(om, args, num_args); 1151ab64890Smrg 1161ab64890Smrg Xfree(args); 1171ab64890Smrg 1181ab64890Smrg return ret; 1191ab64890Smrg} 1201ab64890Smrg 1211ab64890SmrgDisplay * 1221ab64890SmrgXDisplayOfOM(XOM om) 1231ab64890Smrg{ 1241ab64890Smrg return om->core.display; 1251ab64890Smrg} 1261ab64890Smrg 1271ab64890Smrgchar * 1281ab64890SmrgXLocaleOfOM(XOM om) 1291ab64890Smrg{ 1301ab64890Smrg return om->core.lcd->core->name; 1311ab64890Smrg} 132