⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ui.c

📁 LINUX X11 16 key 中文简单输入源代码
💻 C
字号:
#include "vk.h"
#include "ui.h"
#include "all.h"
#include "../xpm/bg.xpm"
#include "../xpm/next.xpm"
#include "../xpm/prev.xpm"
#include "../xpm/py_top.xpm"
#include "../xpm/py_sel.xpm"
#include <X11/Xlocale.h>
#include <X11/Xutil.h>
#include <X11/xpm.h>
#include <X11/Xft/Xft.h>
#include <X11/cursorfont.h>
#include <ft2build.h>
#include <iconv.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <error.h>

Display        *dpy;
int             iScreen;

XftDraw        *xftDraw = NULL;
Bool            bUseAA = True;

XftFont        	*ListWinFont = NULL;
XftFont		*VKLabelFont = NULL;
XftFont         *PYListWinFont = NULL;
XftFont         *ZHListWinFont = NULL;
int             ListWinFontSize = 25;
int		VKLabelFontSize = 10;
int		PYListWinFontSize = 8;
int             ZHListWinFontSize = 25;

iconv_t         convUTF8;

GC              dimGC;
GC              lightGC;

char            strFontName[100] = FONT_NAME;
Window   VKWindow;
WINDOW_COLOR    VKWindowColor = { NULL, NULL, {0, 220 << 8, 220 << 8, 220 << 8}};
MESSAGE_COLOR   VKWindowAlphaColor = { NULL, {0, 80 << 8, 0, 0}};
MESSAGE_COLOR   VKWindowFontColor = { NULL, {0, 220 << 8, 220 << 8, 220 << 8}};
XImage         	*pVKLogo = NULL;

int		iCur_X = 0;
int		iCur_Y = 0;
int		iPrev_X = -1;
int		iPrev_Y = -1;
extern int              iClear;
extern int 		iNum_VK ;
extern int	   	iCur_VK;
extern int		iCur_PYW;
extern int		iCur_PYS;
extern int 	iCur_ZHW;
extern int      iCur_PUTS;
extern int	iCur_SCW;
extern char	Cur_py_win[PY_WIN_NUM][STR_SIZE];
extern char     Cur_py_buf[PY_NUM][STR_SIZE];
extern char 	Cur_zh_buf[PY_NUM][ZH_NUM][STR_SIZE];
extern char	Cur_put_win[PUT_WIN_NUM][STR_SIZE];
extern VKS      vks[];
extern char    *vk_sc[4];


Bool IsInBox (int x0, int y0, int x1, int y1, int x2, int y2)
{
    if (x0 >= x1 && x0 <= x2 && y0 >= y1 && y0 <= y2)
	return True;

    return False;
}

int StringWidth (char *str, XftFont * font)
{
    XGlyphInfo      extents;
    char            str1[100];
    char           *ps;
    size_t          l1, l2;
    int             il;

    if (!font)
	return 0;

    il = l1 = strlen (str);
    l2 = 99;
    ps = str1;

    l1 = iconv (convUTF8, (char **) &str, &l1, &ps, &l2);
    *ps = '\0';
    XftTextExtentsUtf8 (dpy, font, (FcChar8 *) str1, strlen (str1), &extents);

    return extents.xOff;
}

int FontHeight (XftFont * font)
{
    XGlyphInfo      extents;
    char            str1[] = "Ay

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -