nanogui: set a timer when move the window!


Previous by date: 19 Aug 2002 06:44:04 -0000 error when compiling nxzilla, wang
Next by date: 19 Aug 2002 06:44:04 -0000 NanoGTK, Chinese and Locale, Chen sheng
Previous in thread:
Next in thread: 19 Aug 2002 06:44:04 -0000 Re: set a timer when move the window!, Alex Holden

Subject: set a timer when move the window!
From: "wang" ####@####.####
Date: 19 Aug 2002 06:44:04 -0000
Message-Id:

 In nanowm, dragging window is not efficient,in former 
maillist ,Alex suggested use a timer to reduce the 
number of GrMoveWindow().now I implement this ,yes,it's
agiler than it did,and even I set the timer to 1ms ,
it should be better.
 This is what I have done:
  1.At the very time we press button down on caption,
the widow become active ,we create a timer use GrCreatetimer(),
in Wm_container_buttondown():

   window->active = GR_TRUE;
   wm_timer=GrCreateTimer(window->wid,1,1);
wm_tiemr is a globe variable ,so GrDetroyTimer() can use.
  
  2.And when button up ,the window become inactive ,
use GrDetroyTimer() to destroy the timer.
  
  3.In fuction Wm_container_mousemoved() we do not
call GrMoveWindow() ,every time we just store the 
parameter of GrMoveWindow() in a structure wm_move:

#else
        wm_move.wid=window->wid;
        wm_move.x=event->rootx - pos->xoff;
        wm_move.y=event->rooty - pos->yoff;
#endif
 
   wm_move is  defined  like this :
typedef struct {
       GR_WINDOW_ID wid;
       GR_COORD x;
       GR_COORD y;
} Wm_move;
Wm_move wm_move;(in nanowm.h)

 4.Use GrSelectEvent() select EVENT_TYPE_MASK_TIMER,
every time when we receive EVENT_TYPE_TIEMR event,we
do like this:
  case GR_EVENT_TYPE_TIMER:
    GrMoveWindow(wm_move.wid,wm_move.x,wm_move.y);
    break;
 

 Any commments are welcome.

        wang
####@####.####
          2002-08-19




Previous by date: 19 Aug 2002 06:44:04 -0000 error when compiling nxzilla, wang
Next by date: 19 Aug 2002 06:44:04 -0000 NanoGTK, Chinese and Locale, Chen sheng
Previous in thread:
Next in thread: 19 Aug 2002 06:44:04 -0000 Re: set a timer when move the window!, Alex Holden


Powered by ezmlm-browse 0.20.