Пример #1
0
Bool MyTriggerNotifyHandler (IMTriggerNotifyStruct * call_data)
{
    if (call_data->flag == 0) {
        /* Mainwindow always shows wrong input status, so fix it here */
        CurrentIC = (IC *) FindIC (call_data->icid);
        connect_id = call_data->connect_id;

        SetConnectID (call_data->connect_id, IS_CHN);
        icidSetIMState(call_data->icid, IS_CHN);

        EnterChineseMode (False);
        if (!bUseDBus)
            DrawMainWindow ();
    }

    SetTrackPos( (IMChangeICStruct *)call_data );
    if (bShowInputWindowTriggering && !bCorner) {
        DisplayInputWindow ();

#ifdef _ENABLE_TRAY
        if (!bUseDBus)
            DrawTrayWindow (ACTIVE_ICON, 0, 0, TRAY_ICON_HEIGHT, TRAY_ICON_WIDTH );
#endif
    }
    else
        return False;

    return True;
}
Пример #2
0
static void ClassicUIOnInputUnFocus(void *arg)
{
    FcitxClassicUI* classicui = (FcitxClassicUI*) arg;
    if (classicui->isSuspend)
        return;
    DrawMainWindow(classicui->mainWindow);
    DrawTrayWindow(classicui->trayWindow);
}
Пример #3
0
/* -------------------------------------------------------------------- */
void ToggleLandMarks(Widget w, XtPointer client, XtPointer call)
{
  LandMarks = !LandMarks;

  if (Interactive)
    DrawMainWindow();
 
}	/* END TOGGLELANDMARKS */
Пример #4
0
void ClassicUIOnTriggerOn(void* arg)
{
    FcitxClassicUI* classicui = (FcitxClassicUI*) arg;
    FcitxInstance *instance = classicui->owner;
    if (FcitxInstanceGetCurrentStatev2(instance) == IS_ACTIVE) {
        DrawMainWindow(classicui->mainWindow);
    }
    DrawTrayWindow(classicui->trayWindow);
}
Пример #5
0
void LightUIOnTriggerOn(void* arg)
{
    FcitxLightUI* lightui = (FcitxLightUI*) arg;
    FcitxInstance *instance = lightui->owner;
    if (FcitxInstanceGetCurrentState(instance) == IS_ACTIVE)
    {
        DrawMainWindow(lightui->mainWindow);
        ShowMainWindow(lightui->mainWindow);
    }
    DrawTrayWindow(lightui->trayWindow);
}
Пример #6
0
static void LightUIOnInputFocus(void *arg)
{
    FcitxLightUI* lightui = (FcitxLightUI*) arg;
    FcitxInstance *instance = lightui->owner;
    DrawMainWindow(lightui->mainWindow);
    if (FcitxInstanceGetCurrentStatev2(instance) == IS_ACTIVE)
    {
        ShowMainWindow(lightui->mainWindow);
    }
    DrawTrayWindow(lightui->trayWindow);
}
Пример #7
0
void MouseEvent(int event, int x, int y, int flags, void* param)
{
	bool shouldCalculate = false;

	// ===== Clear =====
	_cvWrapper.SetBlack(_imageName); 
	
	// ===== Mouse Events =====
	if (event == CV_EVENT_LBUTTONDOWN)
	{
		//_currentPolyline.push_back(AVector(x, y));
		_isMouseDown = true;
		shouldCalculate = false;
	}
	else if (event == CV_EVENT_LBUTTONUP)
	{
		_currentPolyline.push_back(AVector(x, y));
		_polylines.push_back(_currentPolyline);
		_currentPolyline.clear();
		_isMouseDown = false;
		shouldCalculate = true;
	}
	else if (_isMouseDown && event == CV_EVENT_MOUSEMOVE)
	{
		_currentPolyline.push_back(AVector(x, y));
		shouldCalculate = false;
	}

	// ===== kd tree
	if (shouldCalculate)
	{ 
		_nfWrapper = NANOFLANNWrapper();
		_nfWrapper.SetLineData(_nfWrapper.ConvertVectorsToLines(_polylines)); 
		_nfWrapper.CreateLineKDTree();
		_closestPt = _nfWrapper.PointPolygonTest(_queryPt);

		CalculateDistanceMap1();
		//CalculateDistanceMap2();
		DrawDistanceMap();

		CalculateInOut();
		DrawInOutMap();
	}

	// ===== Drawing =====
	DrawMainWindow();
	
}
Пример #8
0
int _tmain(int argc, _TCHAR* argv[])
{
	_cvWrapper.CreateImage(_imageName,       _sz, _sz, BGR_255);
	_cvWrapper.CreateImage(_distanceMapName, _sz, _sz, BGR_255);
	_cvWrapper.CreateImage(_inOutName,       _sz, _sz, BGR_255);

	_distanceMap1.CreateFloatImage(_sz);
	_inOutMap.CreateIntegerImage(_sz);

	DrawMainWindow();

	_cvWrapper.ShowImage(_imageName);
	_cvWrapper.SetMouseEvent(_imageName, MouseEvent);
	_cvWrapper.WaitKey();

	return 0;
}
Пример #9
0
void DisplaySkin(FcitxClassicUI* classicui, char * skinname)
{
    char *pivot = classicui->skinType;
    classicui->skinType = strdup(skinname);
    if (pivot)
        free(pivot);

    if (LoadSkinConfig(&classicui->skin, &classicui->skinType))
        FcitxInstanceEnd(classicui->owner);

#ifndef _ENABLE_PANGO
    GetValidFont(classicui->strUserLocale, &classicui->font);
    GetValidFont(classicui->strUserLocale, &classicui->menuFont);
#endif

    LoadInputMessage(&classicui->skin, classicui->inputWindow, classicui->font);

    DrawMainWindow(classicui->mainWindow);
    DrawInputWindow(classicui->inputWindow);
    DrawTrayWindow(classicui->trayWindow);

    SaveClassicUIConfig(classicui);
}
Пример #10
0
void ClassicUIOnTriggerOff(void* arg)
{
    FcitxClassicUI* classicui = (FcitxClassicUI*) arg;
    DrawMainWindow(classicui->mainWindow);
    DrawTrayWindow(classicui->trayWindow);
}
Пример #11
0
static void LightUIInputReset(void *arg)
{
    FcitxLightUI* lightui = (FcitxLightUI*) arg;
    DrawMainWindow(lightui->mainWindow);
}
Пример #12
0
void LightUIOnTriggerOff(void* arg)
{
    FcitxLightUI* lightui = (FcitxLightUI*) arg;
    DrawMainWindow(lightui->mainWindow);
    DrawTrayWindow(lightui->trayWindow);
}
Пример #13
0
static void LightUIOnInputUnFocus(void *arg)
{
    FcitxLightUI* lightui = (FcitxLightUI*) arg;
    DrawMainWindow(lightui->mainWindow);
    DrawTrayWindow(lightui->trayWindow);
}
Пример #14
0
int main_PY()
{
//    int             c;     //用于保存用户输入的参数
//   Bool            bBackground = True;
//   char        *imname=(char *)NULL;
    extern  Bool            bPYBaseDictLoaded;
    extern Bool            bPYOtherDictLoaded;
    initConfig();  //szj
    initConfig2();  //szj

    if (!InitX ()){};
    //exit (1);

    /*加载用户配置文件,通常是“~/.fcitx/config”,如果该文件不存在就从安装目录中拷贝
     * “/data/config”到“~/.fcitx/config”
     */

    LoadConfig (True);

    /*创建字体。实际上,就是根据用户的设置,使用xft读取字体的相关信息。
     * xft是x11提供的处理字体的相关函数集
     */
    CreateFont ();

    //根据字体计算输入窗口的高度
    CalculateInputWindowHeight ();

    /*加载配置文件,这个配置文件不是用户配置的,而是用于记录fctix的运行状态的,
     * 比如是全角还是半角等等。通常是“~/.fcitx/profile”,如果该文件不存在就从安装
     * 目录中拷贝“/data/profile”到“~/.fcitx/profile”
     */
    LoadProfile ();

    //加载标点字典文件
    LoadPuncDict ();
    //加载成语
    LoadQuickPhrase ();
    /*从 ~/.fcitx/AutoEng.dat (如果不存在,
     * 则从 /usr/local/share/fcitx/data/AutoEng.dat)
     * 读取需要自动转换到英文输入状态的情况的数据
     */
    LoadAutoEng ();

    //以下是界面的处理

    CreateMainWindow ();    //创建主窗口,即输入法状态窗口
    CreateVKWindow ();        //创建候选词窗口
    CreateInputWindow ();    //创建输入窗口
//szj    CreateAboutWindow ();    //创建关于窗口

    //处理颜色,即候选词窗口的颜色,也就是我们在“~/.fcitx/config”定义的那些颜色信息
    InitGC (inputWindow);

    //将本程序加入到输入法组,告诉系统,使用我输入字符
    SetIM ();

    //处理主窗口的显示
    if (hideMainWindow != HM_HIDE) {
    DisplayMainWindow ();
    DrawMainWindow ();
    }
    if (!bPYBaseDictLoaded)
    LoadPYBaseDict ();
    if (!bPYOtherDictLoaded)
    LoadPYOtherDict ();

    //以后台方式运行

#ifdef _ENABLE_TRAY
    CreateTrayWindow ();        //创建系统托盘窗口
    DrawTrayWindow (INACTIVE_ICON);    //显示托盘图标
#endif

    return 0;
}
Пример #15
0
static void ClassicUIUpdateStatus(void *arg, FcitxUIStatus* status)
{
    FcitxClassicUI* classicui = (FcitxClassicUI*) arg;
    DrawMainWindow(classicui->mainWindow);
}
Пример #16
0
int main(void)
{

	int i,j,k,x,y;
	//byte bi,bj;
	//byte cursize=1;

	//int cursorx=0,cursory=0;

	//byte spritecont=10,spritecont2=10+16;
	//byte sprconmeno,sprconpiu;
	//byte sprconmeno2,sprconpiu2;

	//byte terrancont=0,solidcont=0;

	//bool speed=false;
	//bool print=false,toggleprint=false;
	//bool moved=false,pushed=false;

	int nlevel;

	BITMAP *buffer;				//	Double-buffering
	BITMAP *textures;			//	Immagine globale delle texture
	BITMAP *sprites[256];		// 	Array degli sprite
	//RGB color[256];

	//char nomefile[30],errmess[20];
	//FILE *fp;


	T_Map mappa;


	strcpy(errmess,"");		// inizializzo la stringa

	if(!mappa.InitLevel()){
		strcpy(errmess,"Impossibile allocare la mappa");
		exit(0);
	}

	/////////// INPUT NOME FILE DELLA MAPPA   ///////////////////////
	printf("\n\t Inserta il nome del file della mappa(senza est.) : ");
	gets(nomefile);
	strcat(nomefile,".map");
	/////////////////////////////////////////////////////////////////

	if(!mappa.SetMapFile){
		printf("\n\t File non trovato");
	}

	nlevel=mappa.RetNLevel();

	printf("\n\t Numero attuale di livelli: %d",nlevel);
	printf("\n\t Inserta il numero di livelli da creare nella mappa:");
	printf("\n\t (0 per non aggiungerne)");
	scanf("%d",&i);
	if(i>0){
		nlevel+=i;
		mappa.SetNLevel(nlevel);
		mappa.AllocMap();
	}

	GameInit();

	textures=create_bitmap(128,128);

	mappa.SetTextureFile("D:\\DJGPP\\Game01\\IndexTxt.txt");

/////// Gestione delle texture... s�, lo so, lo so che sono tile
	for(y=0,i=0;y<16&&i<256;y++){
		for(x=0;x<16&&i<256;x++,i++){
			sprites[i]=create_sub_bitmap(textures,x*UNITX,
								y*UNITY,UNITX,UNITY);
		}
	}


/////////// INIZIALIZZAZIONE MATRICE DELLA FINESTRELLA /////
	for(i=0;i<WIMGY;i++){
		for(j=0;j<WIMGX;j++){
			miniwmask[i][j]=0;
		}
	}

////// INIZIALIZZAZIONE MATRICE DELLA LISTA DELLE TILE/////////////

	for(i=0;i<2;i++){
		for(j=0;j<20;j++){
			spritemask1[i][j]=0;
			spritemask2[i][j]=0;
		}
	}

///////////////// BUFFER PER IL DOUBLE BUFFERING //////////////

	buffer=create_bitmap(SCREEN_W,SCREEN_H);
	//show_mouse(buffer);

	clear_to_color(buffer,DESK_COL);
	//clear_to_color(lvldis,BACKG_COL);

//////////////////////////////////////////////////////////////////


/////////////////////////// PUTTAGGIO  ///////////////////////////

	DrawMainWindow();
	DrawMiniWindow();
	DrawTileLists();

	//show_mouse(buffer);

	blit(buffer,screen,0,0,0,0,SCREEN_W,SCREEN_H);
	//rectfill(screen,0,0,100,100,5);

//////////////////////////////////////////////////////////////////

////////////////// INPUT E CONTROLLI  ////////////////////////////

	while(!key[KEY_ESC]){

		if(key[KEY_RSHIFT]||key[KEY_LSHIFT]){
			speed=true;
		}else{
			speed=false;
		}
		if(key[KEY_P]){
			cursize=2;
			moved=true;
		}
		if(key[KEY_O]){
			cursize=1;
			moved=true;
		}

		if(key[KEY_SPACE]&&!pushed){
		 	print=true;
			pushed=true;
			moved=true;
		}

		if(key[KEY_T]&&!pushed){
			pushed=true;
			moved=true;
			if(toggleprint){
				toggleprint=false;
			}else{
				toggleprint=true;
			}
		}

		if(key[KEY_LEFT]&&cursorx&&!pushed){
			if(!speed)
				pushed=true;
			cursorx--;
			if(cursize==2&&cursorx)
				cursorx--;
			relx=cursorx*MUNITX;
			moved=true;
		}
		if(key[KEY_RIGHT]&&cursorx<NSPRITEX-cursize&&!pushed){
			if(!speed)
				pushed=true;
			cursorx++;
			if(cursize==2&&cursorx<NSPRITEX-cursize)
				cursorx++;
			relx=cursorx*MUNITX;
			moved=true;
		}
		if(key[KEY_UP]&&cursory&&!pushed){
			if(!speed)
				pushed=true;
			cursory--;
			if(cursize==2&&cursory)
				cursory--;
			rely=cursory*MUNITY;
			moved=true;
		}
		if(key[KEY_DOWN]&&cursory<NSPRITEY-cursize&&!pushed){
			if(!speed)
				pushed=true;
			cursory++;
			if(cursize==2&&cursory<NSPRITEY-cursize)
				cursory++;
			rely=cursory*MUNITY;
			moved=true;
		}

		if(key[KEY_PLUS_PAD]&&!pushed){
			//if(!button[KEY_PLUS_PAD]){
			pushed=true;
			BACKG_COL++;
			moved=true;
			//button[KEY_PLUS_PAD]=true;
			//}
		//}else{
		//	button[KEY_PLUS_PAD]=false;
		}
		if(key[KEY_Z]&&!pushed){
			if(!speed)
				pushed=true;

			//spritecont--;
			//spritecont2--;
			//relx=cursorx*MUNITX;
			moved=true;
		}
		if(key[KEY_X]&&!pushed){
			if(!speed)
				pushed=true;
			//spritecont++;
			//spritecont2++;
			//relx=cursorx*MUNITX;
			moved=true;
		}

		if(key[KEY_A]&&!pushed){
			if(!speed)
				pushed=true;
			if(terrancont>0)
				terrancont--;
			else
				terrancont=MAX_TERR;
			//spritecont2++;
			//relx=cursorx*MUNITX;
			moved=true;
		}
		if(key[KEY_S]&&!pushed){
			if(!speed)
				pushed=true;

			terrancont++;
			if(terrancont>MAX_TERR)
				terrancont=0;
			//spritecont2++;
			//relx=cursorx*MUNITX;
			moved=true;
		}

		if(key[KEY_Q]&&!pushed){
			if(!speed)
				pushed=true;
			if(solidcont>0)
				solidcont--;
			else
				solidcont=MAX_SOLID;
			//spritecont2++;
			//relx=cursorx*MUNITX;
			moved=true;
		}
		if(key[KEY_W]&&!pushed){
			if(!speed)
				pushed=true;

			solidcont++;
			if(solidcont>MAX_SOLID)
				solidcont=0;
			//spritecont2++;
			//relx=cursorx*MUNITX;
			moved=true;
		}

		if(key[KEY_F3]&&!pushed){
			pushed=true;

			fp=fopen(nomefile,"rb");
			if(fp!=NULL){
				if(!mappa.LoadLevel(fp))
					strcpy(errmess,"Unable to load");
				fclose(fp);

				for(i=0,k=0;i<NSPRITEY;i++){
					for(j=0;j<NSPRITEX;j++,k++){
						livello[i][j].solid=mappa.RetSolid(k);
						livello[i][j].terran=mappa.RetTerran(k);
					}
				}

			}

			moved=true;
		}

		if(key[KEY_F2]&&!pushed){
			pushed=true;

			/*
			for(i=0,k=0;i<NSPRITEY;i++){
					for(j=0;j<NSPRITEX;j++,k++){
					mappa.SetSolid(k,livello[i][j].solid);
					mappa.SetTerran(k,livello[i][j].terran);
				}
			}

			for(i=OVER_SPACE,k=0;i<OVER_SPACE+NSPRITEY;i++){
					for(j=LEFT_SPACE;j<LEFT_SPACE+NSPRITEX;j++,k++){
					mappa.SetSprite(k,livello[i][j].sprite);
				}
			}
			*/

			fp=fopen(nomefile,"wb");

			//mappa.SaveLevel(fp);

			fclose(fp);
		}

		if(key[KEY_F7]&&!pushed){
			pushed=true;

			for(i=0,k=0;i<NSPRITEY;i++){
				for(j=0;j<NSPRITEX;j++,k++){
					//fwrite(&livello[i][j],sizeof(level),1,fp);
					livello[i][j].solid=mappa.RetSolid(k);
					livello[i][j].terran=mappa.RetTerran(k);
				}
			}

			moved=true;
		}

		if(key[KEY_F5]&&!pushed){
			pushed=true;

			for(i=0,k=0;i<NSPRITEY;i++){
					for(j=0;j<NSPRITEX;j++,k++){
					mappa.SetSolid(k,livello[i][j].solid);
					mappa.SetTerran(k,livello[i][j].terran);
				}
			}

		}

		if(key[KEY_ENTER]){
			clear_to_color(buffer,0);
			for(i=OVER_SPACE,y=0;i<NSPRITEY-BOTTOM_SPACE;i++,y+=UNITY){
				for(j=LEFT_SPACE,x=0;j<NSPRITEX-RIGHT_SPACE;j++,x+=UNITX){
					blit(sprites[livello[i][j].sprite],buffer,0,0,
							x,y,UNITX,UNITY);
				}
			}
			vsync();
			blit(buffer,screen,0,0,0,0,SCREEN_W,SCREEN_H);

			while(!key[KEY_BACKSPACE]);
			moved=true;
		}

		if(print||toggleprint){
			livello[cursory][cursorx].sprite=spritecont;
			livello[cursory][cursorx].terran=terrancont;
			livello[cursory][cursorx].solid=solidcont;

			print=false;
			//stretch_blit(sprites[spritecont],lvldis,0,0,UNITX,UNITY,
			//				cursorx*MUNITX,cursory*MUNITY,MUNITX,MUNITY);
			if(cursize>1){
					livello[cursory][cursorx+1].sprite=spritecont+1;
					livello[cursory][cursorx+1].terran=terrancont;
					livello[cursory][cursorx+1].solid=solidcont;
			//		stretch_blit(sprites[spritecont+1],
			//					lvldis,0,0,UNITX,UNITY,(cursorx+1)*MUNITX,
			//								cursory*MUNITY,MUNITX,MUNITY);

					livello[cursory+1][cursorx].sprite=spritecont2;
					livello[cursory+1][cursorx].terran=terrancont;
					livello[cursory+1][cursorx].solid=solidcont;
			//		stretch_blit(sprites[spritecont2],
			//					lvldis,0,0,UNITX,UNITY,cursorx*MUNITX,
			//								(cursory+1)*MUNITY,MUNITX,MUNITY);

					livello[cursory+1][cursorx+1].sprite=spritecont2+1;
					livello[cursory+1][cursorx+1].terran=terrancont;
					livello[cursory+1][cursorx+1].solid=solidcont;
			//		stretch_blit(sprites[spritecont2+1],
			//					lvldis,0,0,UNITX,UNITY,(cursorx+1)*MUNITX,
			//								(cursory+1)*MUNITY,MUNITX,MUNITY);

			}
		}

		if(moved){
			clear_to_color(buffer,DESK_COL);


				// 	Puttaggio dello schema del livello : ex lvldis
			rectfill(buffer,0,0,XLAR,YLAR,BACKG_COL);
			//blit(lvldis,buffer,0,0,0,0,XLAR,YLAR);
			for(i=0,y=0;i<NSPRITEY;i++,y+=MUNITY){
				for(j=0,x=0;j<NSPRITEX;j++,x+=MUNITX){
					if(livello[i][j].sprite){
						stretch_blit(sprites[livello[i][j].sprite],
							buffer,0,0,UNITX,UNITY,x,y,MUNITX,MUNITY);
					}
				}
			}

				// Rettangoli dello schema

			//rect(buffer,LEFT_SPACE*MUNITX,OVER_SPACE*MUNITY,
			//	XLAR-(RIGHT_SPACE*MUNITX)-1,YLAR-(BOTTOM_SPACE*MUNITY)-1,
			//												CONF_COL);

			rect(buffer,relx,rely,relx+(cursize*MUNITX-1),
									rely+(cursize*MUNITY-1),CURS_COL);

				// Disegno della finestra laterale //
			for(i=cursory-2,bi=0;i<cursory+3;i++,bi++){
				for(j=cursorx-2,bj=0;j<cursorx+3;j++,bj++){
			 		if(i<0||j<0){
						windimg[bi][bj]=0;
					}else{
						windimg[bi][bj]=livello[i][j].sprite;
					}
				}
			}

			for(i=0,y=0;i<WIMGY;i++,y+=UNITY){
				for(j=0,x=SCREEN_W-(WIMGX*UNITX);j<WIMGX;j++,x+=UNITX){
					//temp=;
					blit(sprites[windimg[i][j]],buffer,0,0,x,y,UNITX,UNITY);
				}
			}

				// Se � premuto 'toggleprint' ( che � un Pokemon? )
			if(toggleprint){
				rectfill(buffer,300,110,320,130,CURS_COL);
			}else{
				rectfill(buffer,300,110,320,130,DESK_COL);
			}

			textprintf(buffer,font,250,60,255,"Sol : %d",solidcont);
			textprintf(buffer,font,250,70,255,"Terr: %d",terrancont);

				// Disegno elenco sprite
			if(spritecont>10){
				sprconmeno=spritecont-10;
			}else{
			 	sprconmeno=256-(10-spritecont);
			}
			if(spritecont<246){
				sprconpiu=spritecont+10;
			}else{
			 	sprconpiu=10-(256-spritecont);
			}
			if(spritecont2>10){
				sprconmeno2=spritecont2-10;
			}else{
			 	sprconmeno2=256-(10-spritecont2);
			}
			if(spritecont2<246){
				sprconpiu2=spritecont2+10;
			}else{
			 	sprconpiu2=10-(256-spritecont2);
			}

			for(bi=sprconmeno,bj=sprconmeno2,x=0;bi!=sprconpiu;bi++,bj++,x+=BIGUNITX){
				stretch_blit(sprites[bi],buffer,0,0,UNITX,UNITY,x,
						200,BIGUNITX,BIGUNITY);
				if(cursize>1){
					stretch_blit(sprites[bj],buffer,0,0,
						UNITX,UNITY,x,216,BIGUNITX,BIGUNITY);
				}
			}
			rect(buffer,160,199,160+(cursize*BIGUNITX),
									200+(cursize*BIGUNITY),CURS_COL);

			moved=false;
		}

		if(pushed){
			pushed=false;
			for(i=0;i<128;i++){
				if(key[i]){
					pushed=true;
					break;
				}
			}
		}

		show_mouse(buffer);
		vsync();
		blit(buffer,screen,0,0,0,0,SCREEN_W,SCREEN_H);
		show_mouse(NULL);
	}

		/// Distruzione Bitmap

	for(i=0;i<256;i++){
		destroy_bitmap(sprites[i]);
		//destroy_bitmap(texture[1][i]);
	}

	destroy_bitmap(textures);
	//destroy_bitmap(lvldis);
	destroy_bitmap(buffer);

	readkey();
	GameExit();

	printf("Programmed with DJGPP RHIDE Allegro");

	puts(errmess);

	getch();


	return 0;

}
Пример #17
0
Bool MySetFocusHandler (IMChangeFocusStruct * call_data)
{
    CurrentIC = (IC *) FindIC (call_data->icid);
    connect_id = call_data->connect_id;

    if (ConnectIDGetState (connect_id) != IS_CLOSED) {
        if (icidGetIMState(call_data->icid) == IS_CLOSED)
            IMPreeditStart (ims, (XPointer) call_data);

        EnterChineseMode (lastConnectID == connect_id);

        if (!bUseDBus)
            DrawMainWindow ();

        if (ConnectIDGetState (connect_id) == IS_CHN) {
            if (bVK)
                DisplayVKWindow ();
        }
        else {
            XUnmapWindow (dpy, inputWindow);
            if (!bUseDBus)
                XUnmapWindow (dpy, VKWindow);
        }
    }
    else {
        if (icidGetIMState(call_data->icid) != IS_CLOSED)
            IMPreeditEnd (ims, (XPointer) call_data);

        CloseInputWindow();
        if (!bUseDBus) {
            XUnmapWindow (dpy, VKWindow);

#ifdef _ENABLE_TRAY
            DrawTrayWindow (INACTIVE_ICON, 0, 0, TRAY_ICON_HEIGHT, TRAY_ICON_WIDTH );
#endif
            if (hideMainWindow == HM_SHOW) {
                DisplayMainWindow ();
                DrawMainWindow ();
            }
            else
                XUnmapWindow (dpy, mainWindow);
        }
#ifdef _ENABLE_DBUS
        else
            updatePropertyByConnectID(connect_id);
#endif

        icidSetIMState(call_data->icid, ConnectIDGetState (connect_id));
        lastConnectID = connect_id;
        //When application gets the focus, re-record the time.
        bStartRecordType = False;
        iHZInputed = 0;

        if (ConnectIDGetTrackCursor (connect_id) && bTrackCursor) {
            position * pos = ConnectIDGetPos(connect_id);

            if (pos) {
                iClientCursorX = pos->x;
                iClientCursorY = pos->y;
                if (!bUseDBus)
                    XMoveWindow (dpy, inputWindow, iClientCursorX, iClientCursorY);
#ifdef _ENABLE_DBUS
                else
                    KIMUpdateSpotLocation(iClientCursorX, iClientCursorY);
#endif
            }
        }

#ifdef _ENABLE_DBUS
        if (bUseDBus)
            registerProperties();
#endif
    }

    return True;
}
Пример #18
0
int MainWndLoop()
{
	Byte keyCode;
	Dword buttonID;
	int result;
	static bool firstTime = true;

	//
	startGameLevel = maxGameLevel;
	//
	if ( firstTime )
	{
		//
		mainWndFace.GetSize( mcx, mcy );
		//
		firstTime = false;
		//
		DrawMainWindow();
	}
	//
	kos_ChangeWindow( -1, -1, mcx + 1, mcy + 21 );
	//
	for ( result = MW_NONE; result == MW_NONE; )
	{
		switch( kos_WaitForEvent() )
		{
		case 1:
			DrawMainWindow();
			break;

		case 2:
			if ( kos_GetKey( keyCode ) )
			{
				//
				switch ( keyCode )
				{
				case 13:					// enter
					result = MW_START_GAME;
					break;

				case 27:					// escape
					result = MW_EXIT_APP;
					break;

				default:
					break;
				}
			}
			break;

		case 3:
			if ( kos_GetButtonID( buttonID ) )
			{
				//
				switch ( buttonID )
				{
				//
				case 1:
					result = MW_EXIT_APP;
					break;
				case BT_SIZE_X_MINUS:
					if ( --startGameLevel < 1 )
						startGameLevel = 1;
					else
						DrawMainWindow();
					break;

				//
				case BT_SIZE_X_PLUS:
					if ( ++startGameLevel > maxGameLevel )
						startGameLevel = maxGameLevel;
					else
						DrawMainWindow();
					break;

				//
				default:
					break;
				}
			}

		default:
			break;
		}
	}
	// кнопки
	kos_DefineButton(
		0, 0,
		0, 0,
		BT_SIZE_X_MINUS + 0x80000000,
		0
		);
	//
	kos_DefineButton(
		0, 0,
		0, 0,
		BT_SIZE_X_PLUS + 0x80000000,
		0
		);
	//
	return result;
}
Пример #19
0
static void LightUIUpdateStatus(void *arg, FcitxUIStatus* status)
{
    FcitxLightUI* lightui = (FcitxLightUI*) arg;
    DrawMainWindow(lightui->mainWindow);
}
Пример #20
0
/* -------------------------------------------------------------------- */
static void ApplyPreferences(Widget w, XtPointer client, XtPointer call)
{
  char	*p;

  p = XmTextFieldGetString(prefText[0]);
  SetColorNames(p);
  free(p);

  p = XmTextFieldGetString(prefText[1]);
  if (atoi(p) > 1)
    LineThickness = atoi(p);
  free(p);

  p = XmTextFieldGetString(prefText[2]);
  SetTemplateDirectory(p);
  free(p);

  p = XmTextFieldGetString(prefText[3]);
  if (strncmp(p, "Color", 5) == 0)
    printerSetup.color = true;
  free(p);

  p = XmTextFieldGetString(prefText[4]);
  printerSetup.lpCommand = p;
  free(p);

  p = XmTextFieldGetString(prefText[5]);
  tasVarName = p;
  free(p);

  p = XmTextFieldGetString(prefText[6]);
  strcpy(gpsVariables[1], p);
  free(p);

  p = XmTextFieldGetString(prefText[7]);
  strcpy(gpsVariables[0], p);
  free(p);

  p = XmTextFieldGetString(prefText[8]);
  strcpy(gpsVariables[2], p);
  free(p);

  p = XmTextFieldGetString(prefText[9]);
  strcpy(insVariables[1], p);
  free(p);

  p = XmTextFieldGetString(prefText[10]);
  strcpy(insVariables[0], p);
  free(p);

  p = XmTextFieldGetString(prefText[11]);
  strcpy(insVariables[2], p);
  free(p);

  p = XmTextFieldGetString(prefText[12]);
  strcpy(windVariables[0], p);
  free(p);

  p = XmTextFieldGetString(prefText[13]);
  strcpy(windVariables[1], p);
  free(p);

  p = XmTextFieldGetString(prefText[14]);
  strcpy(windVariables[2], p);
  free(p);

  DrawMainWindow();

}	/* END APPLYPREFERENCES */