Changeset 3906

Show
Ignore:
Timestamp:
10/13/05 21:40:58 (3 years ago)
Author:
horiguti
Message:

Add mouse cursor image handling.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/ChangeLog.Meadow

    r3905 r3906  
    33        * mw32term.h (mw32_alpha_type): New enumeration. 
    44        (struct mw32_output): Remove *_alpha except current_alpha, and add 
    5         alpha[]. 
     5        alpha[]. Add new member current_cursor; 
    66 
    77        * mw32term.c (mw32_update_frame_alpha): Refine code and sadd 
    88        upport of alpha of resizing window. 
     9        (show_or_hide_mouse_cursor): Set mouse cursor. 
     10        (show_or_hide_mouse_cursor<WM_MOUSELEAVE>): Restore mouse cursor 
     11        when leaving. 
     12        (mw32_define_frame_cursor): Set current cursor. 
     13        (mw32_term_init): Initialize mouse cursor image. 
    914 
    1015        * mw32fns.c (CHECK_ALPHA_RANGE): New macro. 
    1116        (mw32_set_frame_alpha): Refine code and sadd upport of alpha of 
    12         resizing window. 
     17        resizing window. Remove excessive whitespaces. 
    1318        (mw32_WndProc<WM_SETFOCUS>): Immediately udpate alpha. 
    1419        (mw32_WndProc<WM_KILLFOCUS>): Immediately udpate alpha. 
     
    1621        (mw32_WndProc<WM_SIZING>): New event handler. 
    1722        (mw32_WndProc<WM_EXITSIZEMOVE>): Ditto. 
    18         (x-create-frame): Following changes of mw32_output. 
    19  
     23        (x-create-frame): Following changes of mw32_output.  Initialize 
     24        mouse cursor images. 
     25        (mw32_load_cursor): New function copied from w32fns.c. 
     26         
    20272005-10-12  Masayuki FUJII  <boochang@m4.kcn.ne.jp> 
    2128 
  • trunk/src/mw32fns.c

    r3905 r3906  
    778778} 
    779779 
     780Cursor 
     781mw32_load_cursor (LPCTSTR name) 
     782{ 
     783  /* Try first to load cursor from application resource.  */ 
     784  Cursor cursor = LoadImage ((HINSTANCE) GetModuleHandle(NULL), 
     785                             name, IMAGE_CURSOR, 0, 0, 
     786                             LR_DEFAULTCOLOR | LR_DEFAULTSIZE | LR_SHARED); 
     787  if (!cursor) 
     788    { 
     789      /* Then try to load a shared predefined cursor.  */ 
     790      cursor = LoadImage (NULL, name, IMAGE_CURSOR, 0, 0, 
     791                          LR_DEFAULTCOLOR | LR_DEFAULTSIZE | LR_SHARED); 
     792    } 
     793  return cursor; 
     794} 
     795 
    780796static void 
    781797mw32_set_cursor_color (FRAME_PTR f, Lisp_Object arg, Lisp_Object oldval) 
     
    941957  int i, tmp; 
    942958  Lisp_Object obj; 
    943    
     959 
    944960  if (SetLayeredWindowAttributes == NULL) 
    945961    return; 
    946    
     962 
    947963  for (i = 0 ; i < NUM_OF_ALPHAS ; i++) 
    948964    newalpha[i] = -1; 
    949    
     965 
    950966  if (!NILP (arg)) 
    951967    { 
     
    963979          for (i = 0 ; i < NUM_OF_ALPHAS ; i++) 
    964980            newalpha[i] = tmp; 
    965            
     981         
    966982          if (NUMBERP (CDR (arg))) 
    967983            { 
     
    970986                newalpha[ALPHA_INACTIVE] = tmp; 
    971987            } 
    972            
     988         
    973989          obj = CDR (arg); 
    974990          for (i = ALPHA_INACTIVE ; 
     
    9951011      f->output_data.mw32->alpha[i] = newalpha[i]; 
    9961012    } 
    997    
     1013 
    9981014  mw32_update_frame_alpha (f, TRUE); 
    9991015} 
     
    28312847#endif 
    28322848 
     2849  f->output_data.mw32->text_cursor 
     2850    = mw32_load_cursor (IDC_IBEAM); 
     2851  f->output_data.mw32->nontext_cursor 
     2852    = mw32_load_cursor (IDC_ARROW); 
     2853  f->output_data.mw32->modeline_cursor 
     2854    = mw32_load_cursor (IDC_SIZENS); 
     2855  f->output_data.mw32->hand_cursor 
     2856    = mw32_load_cursor (IDC_HAND); 
     2857  f->output_data.mw32->hourglass_cursor 
     2858    = mw32_load_cursor (IDC_WAIT); 
     2859  f->output_data.mw32->horizontal_drag_cursor 
     2860    = mw32_load_cursor (IDC_SIZEWE); 
     2861  
     2862  f->output_data.mw32->current_cursor 
     2863    = f->output_data.mw32->nontext_cursor; 
     2864  
    28332865#if 0 
    28342866  /* These colors will be set anyway later, but it's important 
  • trunk/src/mw32term.c

    r3905 r3906  
    41904190{ 
    41914191  static unsigned int mouse_hide_timer = 0; 
     4192  SetCursor (FRAME_MW32_OUTPUT (XFRAME (selected_frame))->current_cursor); 
    41924193 
    41934194  if (mw32_inhibit_hide_mouse) 
     
    42774278        }       
    42784279      dpyinfo->mouse_face_hidden = 0; 
     4280       
     4281      FRAME_MW32_OUTPUT (XFRAME (selected_frame))->current_cursor 
     4282        = FRAME_MW32_OUTPUT (XFRAME (selected_frame))->nontext_cursor; 
     4283      SetCursor (FRAME_MW32_OUTPUT (XFRAME (selected_frame))->current_cursor); 
    42794284 
    42804285      break; 
     
    51725177mw32_define_frame_cursor (struct frame *f, Cursor cursor) 
    51735178{ 
    5174 #if 0 /* TODO */ 
    5175   mw32_define_cursor (FRAME_W32_WINDOW (f), cursor); 
    5176 #endif 
     5179  FRAME_MW32_OUTPUT (f)->current_cursor = cursor; 
    51775180} 
    51785181 
     
    60026005  dpyinfo->image_cache = make_image_cache (); 
    60036006 
    6004   dpyinfo->vertical_scroll_bar_cursor = 0
     6007  dpyinfo->vertical_scroll_bar_cursor = mw32_load_cursor (IDC_SIZENS)
    60056008 
    60066009#if 0 
  • trunk/src/mw32term.h

    r3905 r3906  
    493493  int alpha[NUM_OF_ALPHAS]; 
    494494  int current_alpha;   /* Current alpha value of this frame */ 
     495 
     496  Cursor current_cursor; 
    495497}; 
    496498