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

📄 guiloop.c

📁 这个是boot gui的程序
💻 C
字号:
/*
 *  Start of Zoran Standard Header
 *  Copyright (c) 2005 Zoran Corporation
 *  
 *  
 *  All rights reserved.  Proprietary and confidential.
 *  
 *  DESCRIPTION for guiloop.c
 *      Graphical User Interface, execution loop
 *  
 *  NEW HISTORY COMMENT (description must be followed by a blank line)
 *  <Enter change description here>

 *  ===== HISTORY of changes in //depot/imgeng/sw/se_gw/gui/guiloop.c
 *  
 *  12/Dec/05 #4  dstrauss   Implement typematic keys (automatically 
 *                           generate key presses if a key is held down).
 *   9/Dec/05 #3  dstrauss   Call GUIInitStatus() during startup.
 *   5/Dec/05 #2  dstrauss   Added code to walk the dialogs.
 *   2/Dec/05 #1  dstrauss   Created.
 *  
 *  
 *  End of Zoran Standard Header
 */

#include "standard.h"
#include "ts.h"
#include "kbdif.h"
#include "guilocal.h"
#include "guievents.h"
#include "dialogs.h"
#include "guistatus.h"          /* GUIInitStatus() */

/* keypress repeat interval */
#define REPEATKEYINTERVAL_SLOW (500/GUI_TICK_RATE) /* initial slow rate */
#define REPEATKEYINTERVAL_FAST (50/GUI_TICK_RATE) /* final fast rate */
#define REPEATKEYINTERVAL_DECREMENT (2) /* how fast to go from slow to fast */

static tsMailbox guiMailbox = -1;

static DlgRoutine *currentDialog;

static void kybdHandler(unsigned int keycode)
{
  Msg kbdMsg;

  if (guiMailbox != -1) {
    kbdMsg.msg1 = keycode;
    kbdMsg.msg2 = 0;
    kbdMsg.msg3 = 0;
    TASKMSGSEND(guiMailbox, &kbdMsg);
  }
}

void GUITaskloop()
{
  Sint32 retval;
  Uint32 guiEvent;
  DlgRoutine *nextDialog;
  Uint32 lastKeyCode;
  int repeatKeyCount;
  int repeatInterval;

  guiMailbox = TASKMSGCREATE();

  KBDIFRegisterKeyHandler(kybdHandler);
  GUIInitStatus();           /* init the GUI printer status handler */

  /* start out with the first dialog */
  nextDialog = FirstDialog;

  /* The dialog handler loop */
  while (1) {
    TimeVal loop_time;
    Msg guiMsg;

    while (nextDialog && (nextDialog != currentDialog)) {
      /* invoke the next dialog if necessary, passing it
       * the "repaint" event
       */
      currentDialog = nextDialog;
      nextDialog = (DlgRoutine *)currentDialog(GUIEVENT_REPAINT);
      repeatKeyCount = 0;       /* clear key-repetition state */
      lastKeyCode = 0;
    }

    loop_time.secs = 0;
    loop_time.usecs = (GUI_TICK_RATE * 1000);

    retval = TASKMSGTIMEOUT(guiMailbox, &guiMsg, &loop_time);
    if (retval == 1) {
      /* we timed out waiting for a message */
      guiEvent = GUIEVENT_TICK;
      if (lastKeyCode) {
        repeatKeyCount++;
        if (repeatKeyCount >= repeatInterval) {
          guiEvent = lastKeyCode;
          repeatKeyCount = 0;
          repeatInterval -= REPEATKEYINTERVAL_DECREMENT;
          if (repeatInterval < REPEATKEYINTERVAL_FAST) {
            repeatInterval = REPEATKEYINTERVAL_FAST;
          }
        }
      }
    } else {
      guiEvent = guiMsg.msg1;
      /* check if it's a keypress event */
      if (guiEvent <= MAX_KEYCODE) {
        if (guiEvent & KEY_IS_DOWN) {
          lastKeyCode = guiEvent;
        } else {
          lastKeyCode = 0;
        }
        repeatKeyCount = 0;       /* clear key-repetition state */
        repeatInterval = REPEATKEYINTERVAL_SLOW;
      }
    }
    nextDialog = (DlgRoutine *)currentDialog(guiEvent);
  }
}

⌨️ 快捷键说明

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