コード例 #1
0
void GameBase::ResetInactivity() const
{
#if defined(PHAL_PLATFORM_WCE)
    
    // Reset power saving mode timeout
    SystemIdleTimerReset();

#endif
}
コード例 #2
0
ファイル: Blank.cpp プロジェクト: damianob/xcsoar
void
CheckDisplayTimeOut(bool sticky)
{
#if defined(WIN32) && !defined(_WIN32_WCE)
  SystemIdleTimerReset();
#endif

  if (!sticky) {
    if (DisplayTimeOut < DISPLAYTIMEOUTMAX)
      DisplayTimeOut++;
  } else {
    // JMW don't let display timeout while a dialog is active
    ResetDisplayTimeOut();
    return;
  }
  if (DisplayTimeOut >= DISPLAYTIMEOUTMAX)
    BlankDisplay(true);
  else
    BlankDisplay(false);
}
コード例 #3
0
ファイル: Blank.cpp プロジェクト: galippi/xcsoar
void
CheckDisplayTimeOut(bool sticky)
{
#if defined(WIN32) && !defined(_WIN32_WCE)
  SystemIdleTimerReset();
#endif

  if (!sticky) {
    if (DisplayTimeOut < DISPLAYTIMEOUTMAX)
      DisplayTimeOut++;
  } else {
    // JMW don't let display timeout while a dialog is active,
    // but allow button presses to trigger redisplay
    if (DisplayTimeOut > 1)
      DisplayTimeOut = 1;
  }
  if (DisplayTimeOut >= DISPLAYTIMEOUTMAX)
    BlankDisplay(true);
  else
    BlankDisplay(false);
}
コード例 #4
0
ファイル: Blank.cpp プロジェクト: bugburner/xcsoar
void CheckDisplayTimeOut(bool sticky)
{
#ifndef WINDOWSPC
  SystemIdleTimerReset();
#endif

  if (!sticky) {
    if (DisplayTimeOut< DISPLAYTIMEOUTMAX)
      DisplayTimeOut++;
  } else {
    // JMW don't let display timeout while a dialog is active,
    // but allow button presses to trigger redisplay
    if (DisplayTimeOut>1) {
      DisplayTimeOut=1;
    }
  }
  if (DisplayTimeOut >= DISPLAYTIMEOUTMAX) {
    BlankDisplay(true);
  } else {
    BlankDisplay(false);
  }
}
コード例 #5
0
static LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{

    struct graphics_priv* gra_priv = (struct graphics_priv*)GetWindowLongPtr( hwnd , DWLP_USER );

    switch (Message)
    {
    case WM_CREATE:
    {
        if ( gra_priv )
        {
            RECT rc ;

            GetClientRect( hwnd, &rc );
            gra_priv->width = rc.right;
            gra_priv->height = rc.bottom;
            create_memory_dc(gra_priv);
        }
    }
    break;
    case WM_COMMAND:
        switch (LOWORD(wParam))
        {
        case WM_USER + 1:
            break;
        }
        break;
    case WM_CLOSE:
        DestroyWindow(hwnd);
        break;
    case WM_USER+1:
        if ( gra_priv )
        {
            RECT rc ;

            GetClientRect( hwnd, &rc );
            gra_priv->width = rc.right;
            gra_priv->height = rc.bottom;

            create_memory_dc(gra_priv);
            callback_list_call_attr_2(gra_priv->cbl, attr_resize, (void *)gra_priv->width, (void *)gra_priv->height);
        }
        break;
    case WM_USER+2:
    {
        struct callback_list *cbl = (struct callback_list*)wParam;
#ifdef HAVE_API_WIN32_CE
        /* FIXME: Reset the idle timer  need a better place */
        SystemIdleTimerReset();
#endif
        callback_list_call_0(cbl);
    }
    break;

    case WM_SIZE:
        if ( gra_priv )
        {
            gra_priv->width = LOWORD( lParam );
            gra_priv->height  = HIWORD( lParam );
            create_memory_dc(gra_priv);
            dbg(0, "resize gfx to: %d %d \n", gra_priv->width, gra_priv->height );
            callback_list_call_attr_2(gra_priv->cbl, attr_resize, (void *)gra_priv->width, (void *)gra_priv->height);
        }
        break;
    case WM_DESTROY:
#ifdef HAVE_API_WIN32_CE
        if ( gra_priv && gra_priv->window.priv )
        {
            struct window_priv *win_priv = gra_priv->window.priv;
            if (win_priv->hBackLight)
            {
                ReleasePowerRequirement(win_priv->hBackLight);
            }
        }
#endif
        PostQuitMessage(0);
        break;
    case WM_PAINT:
        if ( gra_priv && gra_priv->hMemDC)
        {
    	    struct graphics_priv* overlay;
            PAINTSTRUCT ps = { 0 };
            HDC hdc;
            profile(0, NULL);
            dbg(1, "WM_PAINT\n");
            overlay = gra_priv->overlays;

#ifndef FAST_TRANSPARENCY
			BitBlt( gra_priv->hPrebuildDC, 0, 0, gra_priv->width , gra_priv->height, gra_priv->hMemDC, 0, 0, SRCCOPY);
#endif
			while ( !gra_priv->disabled && overlay)
			{
				if ( !overlay->disabled && overlay->p.x >= 0 &&
					 overlay->p.y >= 0 &&
					 overlay->p.x < gra_priv->width &&
					 overlay->p.y < gra_priv->height )
				{
					int x,y;
					int destPixel, srcPixel;
                    int h,w;
#ifdef FAST_TRANSPARENCY
					if ( !overlay->hPrebuildDC )
					{
						overlay->hPrebuildBitmap = CreateBitmap(overlay->width,overlay->height,1,1,NULL);
						overlay->hPrebuildDC = CreateCompatibleDC(NULL);
						overlay->hOldPrebuildBitmap = SelectBitmap( overlay->hPrebuildDC, overlay->hPrebuildBitmap);
						SetBkColor(overlay->hMemDC,RGB(overlay->transparent_color.r >> 8,overlay->transparent_color.g >> 8,overlay->transparent_color.b >> 8));
						BitBlt(overlay->hPrebuildDC,0,0,overlay->width,overlay->height,overlay->hMemDC,0,0,SRCCOPY);
						BitBlt(overlay->hMemDC,0,0,overlay->width,overlay->height,overlay->hPrebuildDC,0,0,SRCINVERT);
					}

#else
					const COLORREF transparent_color = RGB(overlay->transparent_color.r >> 8,overlay->transparent_color.g >> 8,overlay->transparent_color.b >> 8);

					BitBlt( overlay->hPrebuildDC, 0, 0, overlay->width , overlay->height, overlay->hMemDC, 0, 0, SRCCOPY);

					h=overlay->height;
					w=overlay->width;
					if (w > gra_priv->width-overlay->p.x)
						w=gra_priv->width-overlay->p.x;
					if (h > gra_priv->height-overlay->p.y)
						h=gra_priv->height-overlay->p.y;
					for ( y = 0; y < h ;y++ )
					{
						for ( x = 0; x < w; x++ )
						{
							srcPixel = y*overlay->width+x;
							destPixel = ((overlay->p.y + y) * gra_priv->width) + (overlay->p.x + x);
							if ( overlay->pPixelData[srcPixel] == transparent_color )
							{
								destPixel = ((overlay->p.y + y) * gra_priv->width) + (overlay->p.x + x);

								gra_priv->pPixelData[destPixel] = RGB ( ((65535 - overlay->transparent_color.a) * GetRValue(gra_priv->pPixelData[destPixel]) + overlay->transparent_color.a * GetRValue(overlay->pPixelData[srcPixel])) / 65535,
																((65535 - overlay->transparent_color.a) * GetGValue(gra_priv->pPixelData[destPixel]) + overlay->transparent_color.a * GetGValue(overlay->pPixelData[srcPixel])) / 65535,
																((65535 - overlay->transparent_color.a) * GetBValue(gra_priv->pPixelData[destPixel]) + overlay->transparent_color.a * GetBValue(overlay->pPixelData[srcPixel])) / 65535);

							}
							else
							{
								gra_priv->pPixelData[destPixel] = overlay->pPixelData[srcPixel];
							}
						}

					}
#endif
				}
				overlay = overlay->next;
			}


#ifndef FAST_TRANSPARENCY
            hdc = BeginPaint(hwnd, &ps);
            BitBlt( hdc, 0, 0, gra_priv->width , gra_priv->height, gra_priv->hPrebuildDC, 0, 0, SRCCOPY );
#else
            HDC hdc = BeginPaint(hwnd, &ps);

            BitBlt( hdc, 0, 0, gra_priv->width , gra_priv->height, gra_priv->hMemDC, 0, 0, SRCCOPY );

            overlay = gra_priv->overlays;
            while ( !gra_priv->disabled && overlay && !overlay->disabled )
            {
                if ( overlay->p.x > 0 &&
                        overlay->p.y > 0 &&
                        overlay->p.x + overlay->width < gra_priv->width &&
                        overlay->p.y + overlay->height < gra_priv->height )
                {
                    BitBlt(hdc,overlay->p.x,overlay->p.y,overlay->width,overlay->height,overlay->hPrebuildDC,0,0,SRCAND);
                    BitBlt(hdc,overlay->p.x,overlay->p.y,overlay->width,overlay->height,overlay->hMemDC,0,0,SRCPAINT);
                }
                overlay = overlay->next;
            }
#endif
            EndPaint(hwnd, &ps);
            profile(0, "WM_PAINT\n");
        }
コード例 #6
0
ファイル: WiFiSvcMgr.cpp プロジェクト: NemProjects/WLAN
void RepeatSysIdleTimerResetThread()
{
	HKEY hKey = NULL;
	DWORD dwBattSuspendTimeout = 0;
	DWORD dwACSuspendTimeout = 0;
	DWORD dwIdleTimerResetPeriod = 0;

	// Timer 백업 및 Unattendedmode 에서 Sleep 진입 되지 않도록 Timer Reset Thread 생성
	if( RegOpenKeyEx(HKEY_LOCAL_MACHINE, RK_SYSTEM_TIMEOUT_PATH, 0, 0, &hKey) == ERROR_SUCCESS )
	{
		DWORD dwData = 0;
		DWORD dwDataSize = sizeof(dwData);

		if( RegQueryValueEx(hKey, RV_BATT_SUSPEND_TIMEOUT, NULL, NULL, (LPBYTE)&dwData, &dwDataSize) == ERROR_SUCCESS)
		{
			dwBattSuspendTimeout = dwData;
		}

		dwData = 0;
		if( RegQueryValueEx(hKey, RV_AC_SUSPEND_TIMEOUT, NULL, NULL, (LPBYTE)&dwData, &dwDataSize) == ERROR_SUCCESS)
		{
			dwACSuspendTimeout = dwData;
		}

		RegCloseKey(hKey);
		hKey = NULL;
	}

	RETAILMSG(1, (TEXT("[WSM] dwBattSuspendTimeout : %d \r\n"), dwBattSuspendTimeout ));
	RETAILMSG(1, (TEXT("[WSM] dwACSuspendTimeout : %d \r\n"), dwACSuspendTimeout ));


	dwIdleTimerResetPeriod = (dwBattSuspendTimeout < dwACSuspendTimeout)? dwBattSuspendTimeout:dwACSuspendTimeout;


	RETAILMSG(1, (TEXT("[WSM] dwIdleTimerResetPeriod : %d \r\n"), dwIdleTimerResetPeriod ));



	while(g_bRunningRepeatSysIdleTimerResetThread)
	{
		// dwIdleTimerResetPeriod 나누기 2 주기마다 리셋 시켜줌

		for(DWORD dwIdx = 0; dwIdx < dwIdleTimerResetPeriod / 2; dwIdx++)
		{
			if(g_bRunningRepeatSysIdleTimerResetThread == FALSE)
			{
				goto Exit;
			}
			Sleep(1000);
		}

		RETAILMSG(1, (TEXT("[WSM] System Idle Timer Reset! \r\n") ));
		SystemIdleTimerReset();
		
	}


Exit:

	RETAILMSG(1, (TEXT("[WSM] RepeatSysIdleTimerResetThread End \r\n") ));

	return;

}
コード例 #7
0
cst_utterance *flowm_utt_callback(cst_utterance *u)
{
    char rst[FL_MAX_MSG_CHARS];
    const char *tok;
    cst_item *item;
    char *space;
    int extend_length;
    
    /* In order to stop the synthesizer if the STOP button is pressed */
    /* This stops the synthesis of the next utterance */

    if ((flowm_play_status == FLOWM_PLAY) ||
        (flowm_play_status == FLOWM_SKIP))
    {
        if (TTSWindow)
        {
            rst[0] = '\0';
            space = "";
            for (item=relation_head(utt_relation(u,"Token")); 
                 item; item=item_next(item))
            {
                tok = item_feat_string(item,"name");
                if (cst_streq("",space))
                    /* Only do this on the first token/word */
                    flowm_file_pos = item_feat_int(item,"file_pos");
                extend_length = cst_strlen(rst) + 1 +
                    cst_strlen(item_feat_string(item,"prepunctuation"))+
                    cst_strlen(item_feat_string(item,"punc"));
                if (cst_strlen(tok)+extend_length+4 < FL_MAX_MSG_CHARS)
                    cst_sprintf(rst,"%s%s%s%s%s",rst,space,
                                item_feat_string(item,"prepunctuation"),
                                tok,
                                item_feat_string(item,"punc"));
                else 
                {
                    if (cst_strlen(rst)+4 < FL_MAX_MSG_CHARS)
                        cst_sprintf(rst,"%s ...",rst);
                    break;
                }
                space = " ";
            }

            if (flowm_file_pos > flowm_prev_utt_pos[flowm_utt_pos_pos])
            {
                if ((flowm_utt_pos_pos+1) >= FLOWM_NUM_UTT_POS)
                {
                    /* Filled it up, so move it down */
                    memmove(flowm_prev_utt_pos,&flowm_prev_utt_pos[1],
                            sizeof(int)*(FLOWM_NUM_UTT_POS-10));
                    flowm_utt_pos_pos = (FLOWM_NUM_UTT_POS-10);
                }
                flowm_utt_pos_pos++;
                flowm_prev_utt_pos[flowm_utt_pos_pos] = flowm_file_pos;
            }

            /* Send text to TTSWindow */
            mbstowcs(fl_tts_msg,rst,FL_MAX_MSG_CHARS);
            SetDlgItemText(TTSWindow, FL_SYNTHTEXT, fl_tts_msg);

            /* Update file pos percentage in FilePos window */
            cst_sprintf(rst,"%2.3f",flowm_find_file_percentage());
            mbstowcs(fl_fp_msg,rst,FL_MAX_MSG_CHARS);
            SetDlgItemText(TTSWindow, FL_FILEPOS, fl_fp_msg);

            SystemIdleTimerReset();  /* keep alive while synthesizing */
            if (flowm_play_status == FLOWM_SKIP)
                flowm_play_status = FLOWM_PLAY;
        }
        return u;
    }
    else
    {
        delete_utterance(u);
        return 0;
    }
}