wonx/key.c
Hiroaki Sakai d3f3c6903d Corresponding to colorization. Added XColorGC class for GC management. (It diverted from XFireworks)
Corresponding to colorization, transparent (transparent color) judgment processing from the WWPalette class
I moved to the WWDisplay class.

Changed the pixel of WWLCDPanel to unsigned short int *.  (Color correspondence)

Change the storage format of text fonts.  (WWTextFonts.c)

In text display, when displaying WWDisplay_GetForegroundColor (),
Fix to copy by looking at WWDisplay_GetBackgroundColor ().  (WWText.c)
(It is no longer necessary to reserve an array of WWCharacter in the WWText class,
Which to delete)

Added palette of border color to WWDisplay class.

We made correspondence to colorization, and added other various corrections.
(Character data storage method, text display, border color processing etc)

With display_control (), display_status (), the bit shift of the border color
Fixed a bug that was 7.  (Fixed to 8)

Key input such as F1 is also accepted during loop waiting for interrupt in while (1) {/ * none * /}
Fixed as.  (WonXSystem.c's timer interrupt callback function
Add WonXDisplay_PrintData () to WonXTimer_Callback ())

Added fcntl_attention.h, filesys.h, indirect.h, oswork.h, process.h.
(Just include the contents or include appropriate files)

In wonx_configure.h,
Fixed a bug that was supposed to be.

Version 2.0 - from wonx-2.0.tar.gz
2018-03-07 23:07:10 +00:00

203 lines
5.2 KiB
C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*****************************************************************************/
/* ここから */
/*****************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include "wonx_include/key.h"
#include "WonX.h"
/*****************************************************************************/
/* 互換関数の定義 */
/*****************************************************************************/
/*
* Xサーバとの同期の整合性がとれなくなるなどの問題が考えられるので
* 互換関数の内部は UNIXTimer_Pause(), UNIXTimer_Unpause() でくくり,
* タイマ割り込みを一時停止して処理を行うまたunpause するまえに,
* かならず sync するようにする.
*/
/*
* タイマの一時停止の2重解除の問題が出てくるので,
* 互換関数から互換関数を呼んではいけない.
* (一時停止はネストされるが,いちおう)
* 似たような処理をする関数の場合は,必ず static な別関数に処理をまとめ,
* そっちを呼び出すようにすること.
* 引数の表示の問題もあるしね.
*/
int key_press_check(void)
{
XDisplay x_display;
int ret;
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : key_press_check() : \n"); fflush(stdout);
x_display = WonXDisplay_GetXDisplay(WonX_GetWonXDisplay());
XDisplay_Sync(x_display);
ret = XDisplay_GetKeyPress(x_display);
WonXDisplay_Sync(WonX_GetWonXDisplay());
printf("call : key_press_check() : return value = 0x%04x\n", (int)ret);
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return (ret);
}
int key_hit_check(void)
{
XDisplay x_display;
int ret;
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : key_hit_check() : \n"); fflush(stdout);
x_display = WonXDisplay_GetXDisplay(WonX_GetWonXDisplay());
XDisplay_Sync(x_display);
ret = XDisplay_GetKeyPress(x_display);
WonXDisplay_Sync(WonX_GetWonXDisplay());
printf("call : key_hit_check() : return value = 0x%04x\n", (int)ret);
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return (ret);
}
int key_wait(void)
{
XDisplay x_display;
int ret;
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : key_wait() : \n"); fflush(stdout);
x_display = WonXDisplay_GetXDisplay(WonX_GetWonXDisplay());
/*
* 以下はホットスポットになり得るので注意!
*/
ret = 0;
do {
XDisplay_Sync(x_display);
ret = XDisplay_GetKeyPress(x_display);
} while (ret == 0);
WonXDisplay_Sync(WonX_GetWonXDisplay());
printf("call : key_wait() : return value = 0x%04x\n", (int)ret);
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return (ret);
}
void key_set_repeat(int rate, int delay)
{
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : key_set_repeat() : rate = %d, delay = %d\n", rate, delay);
fflush(stdout);
WonXDisplay_Sync(WonX_GetWonXDisplay());
printf("call : key_set_repeat() : return value = none\n"); fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return;
}
int key_get_repeat(void)
{
int ret;
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : key_get_repeat() : \n"); fflush(stdout);
ret = 0;
WonXDisplay_Sync(WonX_GetWonXDisplay());
printf("call : key_get_repeat() : return value = 0x%04x\n", (int)ret);
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return (ret);
}
int key_hit_check_with_repeat(void)
{
XDisplay x_display;
int ret;
if (!WonX_IsCreated()) WonX_Create();
/* タイマを一時停止する */
UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
printf("call : key_hit_check_with_repeat() : \n"); fflush(stdout);
x_display = WonXDisplay_GetXDisplay(WonX_GetWonXDisplay());
XDisplay_Sync(x_display);
ret = XDisplay_GetKeyPress(x_display);
WonXDisplay_Sync(WonX_GetWonXDisplay());
printf("call : key_hit_check_with_repeat() : return value = 0x%04x\n",
(int)ret);
fflush(stdout);
/* タイマをもとに戻す */
UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
return (ret);
}
/*****************************************************************************/
/* ここまで */
/*****************************************************************************/
/*****************************************************************************/
/* End of File. */
/*****************************************************************************/