nanogui: set a timer when move the window!


Previous by date: 20 Aug 2002 07:56:16 -0000 Keep pixmap temporarily when GrMoveWindow()!, wang
Next by date: 20 Aug 2002 07:56:16 -0000 Re: set a timer when move the window!, Alex Holden
Previous in thread: 20 Aug 2002 07:56:16 -0000 Re: set a timer when move the window!, Alex Holden
Next in thread: 20 Aug 2002 07:56:16 -0000 Re: set a timer when move the window!, Alex Holden

Subject: Re: [nanogui] set a timer when move the window!
From: "wang" ####@####.####
Date: 20 Aug 2002 07:56:16 -0000
Message-Id:

Alex wrote:
>Send it to me as a context diff and I'll take a look at it.

Yep.
1.In nanowm.h add :
   /*mouse position structure */
   typedef struct {
       GR_WINDOW_ID wid;
       GR_COORD x;
       GR_COORD y;
  } Wm_move;
   ……
  extern Wm_move wm_move;
2. In actions.c add(at the very head):
   GR_TIMER_ID wm_timer;
   Wm_move wm_move;
 
 At the very end of  Wm_container_buttondown(),midify to:
  ……
  window->active = GR_TRUE;
#ifndef OUTLINE_MOVE
  wm_timer=GrCreateTimer(window->wid,1,1);
#endif
  }
			
 In fuction Wm_container_buttonup(),modify original to
  ……
  if(window->active) {
                pos = (struct Wm_pos_size *)window->data;
 #ifdef OUTLINE_MOVE
                gc = GrNewGC();
                GrSetGCMode(gc, GR_MODE_XOR|GR_MODE_EXCLUDECHILDREN);
                GrRect(GR_ROOT_WINDOW_ID,gc,pos->xorig, pos->yorig, pos->width,
                        pos->height);
                GrMoveWindow(window->wid, pos->xorig, pos->yorig);
 #endif
                free(pos);
                window->active = GR_FALSE;
                window->data = 0;
 #ifndef OUTLINE_MOVE
                GrMoveWindow(wm_move.wid,wm_move.x,wm_move.y);/*move too the final position*/
                GrDestroyTimer(wm_timer);
 #endif
        }
  ……
 
  In fuction Wm_container_mousemoved(),modify :
  ……
   #else
      	GrMoveWindow(window->wid, event->rootx - pos->xoff,
			event->rooty - pos->yoff);     	
   #endif	 
 ……
     TO
  ……
   #else
        wm_move.wid=window->wid;
        wm_move.x=event->rootx - pos->xoff;
        wm_move.y=event->rooty - pos->yoff;
  #endif
 ……

 3.In enents.c : in fuction WmHandleEvent() add: 
  ……
    case GR_EVENT_TYPE_TIMER:
#ifndef OUTLINE_MOVE
         GrMoveWindow(wm_move.wid,wm_move.x,wm_move.y);
#endif
          break;
    default:
           break;
  ……  
  4.In clinets.c in fuction Wm_new_client_window()in
GrSelectEvent() add timer event:
 ……
  GrSelectEvents(pid, GR_EVENT_MASK_CHLD_UPDATE
                | GR_EVENT_MASK_BUTTON_UP | GR_EVENT_MASK_BUTTON_DOWN
                | GR_EVENT_MASK_MOUSE_POSITION | GR_EVENT_MASK_EXPOSURE
                | GR_EVENT_MASK_TIMER);
 ……


I think that's all, any problem ,please tell me .
       wang
####@####.####
          2002-08-20





Previous by date: 20 Aug 2002 07:56:16 -0000 Keep pixmap temporarily when GrMoveWindow()!, wang
Next by date: 20 Aug 2002 07:56:16 -0000 Re: set a timer when move the window!, Alex Holden
Previous in thread: 20 Aug 2002 07:56:16 -0000 Re: set a timer when move the window!, Alex Holden
Next in thread: 20 Aug 2002 07:56:16 -0000 Re: set a timer when move the window!, Alex Holden


Powered by ezmlm-browse 0.20.