/* # skkinput (Simple Kana-Kanji Input)
 * protocol.h --- Kinput Protocol
 * This file is part of skkinput.
 * Copyright (C) 1997
 * Takashi SAKAMOTO (sakamoto@yajima.kuis.kyoto-u.ac.jp)
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2, or (at your option)
 * any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with skkinput; see the file COPYING.  If not, write to
 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 */
#ifndef protocol_h
#define protocol_h

/* 変換サーバのプロフィールが入るプロパティ名 */
#define CONVERSION_PROFILE	"_CONVERSION_PROFILE"

/* 変換サーバの変換属性のプロパティのタイプ */
#define CONVERSION_ATTRIBUTE_TYPE	"_CONVERSION_ATTRIBUTE_TYPE"

/* プロトコルバージョン名 */
#define PROTOCOL_VERSION	"PROTOCOL-2.0"

#define MAKE_CONVERSION_ATTRIBUTE( code, len ) \
( ( unsigned long )( ( ( unsigned long )( code ) ) << 16 ) + ( len ) )

enum {
  CONVERSION_PROFILE_PROTOCOL_VERSION = 1,
  CONVERSION_PROFILE_SUPPORTED_STYLES,
  CONVERSION_PROFILE_SUPPORTED_EXTENSIONS,
  CONVERSION_PROFILE_EXTENSION_DATA,
} ;

/* クライアントから属性の変更が通知された時に何が変更されたのかを見 *
 * 切るのに利用される */
enum {
  CONVERSION_ATTRIBUTE_NASHI = 0,
  CONVERSION_ATTRIBUTE_HA_INDIRECT,
  CONVERSION_ATTRIBUTE_FOCUS_WINDOW,
  CONVERSION_ATTRIBUTE_BASHO_SHITEI,
  CONVERSION_ATTRIBUTE_CLIENT_AREA,
  CONVERSION_ATTRIBUTE_STATUS_AREA,
  CONVERSION_ATTRIBUTE_COLORMAP,
  CONVERSION_ATTRIBUTE_COLOR,
  CONVERSION_ATTRIBUTE_BACKGROUND_PIXMAP,
  CONVERSION_ATTRIBUTE_LINE_SPACING,
  CONVERSION_ATTRIBUTE_FONT_ATOMS,
  CONVERSION_ATTRIBUTE_CURSOR,
} ;

/*
 * 入力方式やイベントの送り方、プロトコルの拡張等の属性
 */
#define CONVERSION_ATTRIBUTE_NYUURYOKU_HOUSHIKI		(128)
#define CONVERSION_ATTRIBUTE_EVENT_NO_TOBASHIKATA	(129)
#define CONVERSION_ATTRIBUTE_KAKUCHOU			(255)

/*
 * 入力方式だった場合に何が指定できるのか。その種類について。
 */
#define CONVERSION_NYUURYOKU_HOUSHIKI_SEPARATEMADO	(1L)
#define CONVERSION_NYUURYOKU_HOUSHIKI_OFFTHESPOT	(2L)
#define CONVERSION_NYUURYOKU_HOUSHIKI_OVERTHESPOT	(4L)
#define CONVERSION_NYUURYOKU_HOUSHIKI_ONTHESPOT		(8L)

/*
 * 入力窓が出来た時にイベントをどのように飛ばすのかを指定するのに利用。
 */
#define CONVERSION_EVENT_TOBASHI_NASHI			(0L)
#define CONVERSION_EVENT_TOBASHI_ZENBU_SKKINPUT_HE	(1L)
#define CONVERSION_EVENT_TOBASHI_FOCUS_NO_HOUHE		(2L)

/*
 * その他。
 */
#define ULONG_UPPER16BIT(data)	\
  (((( unsigned long )( data )) >> 16 ) & 0xffffL )
#define ULONG_LOWER16BIT(data)	\
  ((( unsigned long )( data )) & 0xffffL )
#define USHORT_UPPER16BIT(data) \
  (( unsigned short )(((( unsigned long )( data )) >> 16 ) & 0xffffL ))
#define USHORT_LOWER16BIT(data) \
  (( unsigned short )(((( unsigned long )( data )) & 0xffffL )))

#define LENGTH_OF_ATTRIBUTE(data)	\
  ( ULONG_LOWER16BIT( ( data ) ) )
#define CODE_OF_ATTRIBUTE(data)		\
  ( ULONG_UPPER16BIT( ( data ) ) )
#endif
