/[winpt]/trunk/Src/wptCurrWnd.cpp
ViewVC logotype

Diff of /trunk/Src/wptCurrWnd.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 272 by twoaday, Tue Aug 1 16:37:23 2006 UTC revision 273 by twoaday, Fri Dec 8 10:22:17 2006 UTC
# Line 29  Line 29 
29  #include "wptVersion.h"  #include "wptVersion.h"
30    
31  #define KEYDOWN(vcode, scode) keybd_event ((vcode), (scode), 0, 0)  #define KEYDOWN(vcode, scode) keybd_event ((vcode), (scode), 0, 0)
32  #define KEYUP(vcode, scode)     keybd_event ((vcode), (scode), KEYEVENTF_KEYUP, 0)  #define KEYUP(vcode, scode)   keybd_event ((vcode), (scode), KEYEVENTF_KEYUP, 0)
33    
       
34  extern "C" HWND PTD_get_curr_hwnd (void);  extern "C" HWND PTD_get_curr_hwnd (void);
35  extern "C" BOOL PTD_keyb_send (UINT *keys, UINT n_keys);  extern "C" BOOL PTD_keyb_send (UINT *keys, UINT n_keys);
36  extern "C" int PTD_is_used (void);  extern "C" int PTD_is_used (void);
# Line 74  clip_check (void) Line 73  clip_check (void)
73  static void  static void
74  wnd_msg_selectall (void)  wnd_msg_selectall (void)
75  {  {
76      unsigned keys[4] = {0};      unsigned int keys[4] = {0};
77    
78      if (PTD_is_used ()) {      if (PTD_is_used ()) {
79          keys[0] = VK_CONTROL | 0x8000;          keys[0] = VK_CONTROL | 0x8000;
# Line 97  wnd_msg_selectall (void) Line 96  wnd_msg_selectall (void)
96  static void  static void
97  wnd_msg_paste (void)  wnd_msg_paste (void)
98  {  {
99      unsigned keys[4] = {0};      unsigned int keys[4] = {0};
100    
101      if (PTD_is_used ()) {      if (PTD_is_used ()) {
102          keys[0] = VK_CONTROL | 0x8000;          keys[0] = VK_CONTROL | 0x8000;
# Line 119  wnd_msg_paste (void) Line 118  wnd_msg_paste (void)
118  static void  static void
119  wnd_msg_copy (void)  wnd_msg_copy (void)
120  {  {
121      unsigned keys[4] = {0};      unsigned int keys[4] = {0};
122    
123      if (PTD_is_used ()) {      if (PTD_is_used ()) {
124          keys[0] = VK_CONTROL | 0x8000;          keys[0] = VK_CONTROL | 0x8000;
125          keys[1] = 'C' | 0x8000;          keys[1] = 'C' | 0x8000;
126          keys[2] = 'C';          keys[2] = 'C';
127          keys[3] = VK_CONTROL;          keys[3] = VK_CONTROL;
128          PTD_keyb_send( keys, 4 );                PTD_keyb_send (keys, 4);
129      }      }
130      else {      else {
131          KEYDOWN( VK_CONTROL, 0x1d );          KEYDOWN (VK_CONTROL, 0x1d);
132          KEYDOWN( (BYTE)'C', 0x2e );          KEYDOWN ((BYTE)'C', 0x2e);
133          KEYUP( (BYTE)'C', 0x2e );          KEYUP ((BYTE)'C', 0x2e);
134          KEYUP( VK_CONTROL, 0x1d );                KEYUP (VK_CONTROL, 0x1d);
135      }      }
136  }  }
137    
# Line 175  get_curr_wnd (HWND main, int use_hotkey, Line 174  get_curr_wnd (HWND main, int use_hotkey,
174  }  }
175    
176    
177    /* Retrieve the contents of the current window based on
178       the old window handle @old_hwnd and store the information
179       in @ctx.
180       A return value of 0 indicates a problem. */
181  int  int
182  get_window_contents (HWND old_hwnd, curr_wnd_ctx *ctx, int *r_hotkey)  get_window_contents (HWND old_hwnd, curr_wnd_ctx *ctx, int *r_hotkey)
183  {  {
# Line 225  leave: Line 228  leave:
228  }  }
229    
230    
231    /* Restore the clipboard contents to the window handle given
232       in @ctx and reset the current window to @old_hwnd if possible. */
233  int  int
234  set_window_contents (HWND old_hwnd, curr_wnd_ctx *ctx)  set_window_contents (HWND old_hwnd, curr_wnd_ctx *ctx)
235  {  {
# Line 245  set_window_contents (HWND old_hwnd, curr Line 250  set_window_contents (HWND old_hwnd, curr
250      wnd_msg_paste ();      wnd_msg_paste ();
251      wnd_msg_em_set_pos (hwnd, 1);      wnd_msg_em_set_pos (hwnd, 1);
252                    
253      AttachThreadInput( GetCurrentThreadId(),      AttachThreadInput (GetCurrentThreadId(),
254                          GetWindowThreadProcessId( hwnd, NULL ),                         GetWindowThreadProcessId (hwnd, NULL),
255                          FALSE );                         FALSE);
256                    
257      SetForegroundWindow( lost );      SetForegroundWindow (lost);
258    
259      return 0;      return 0;
260  }  }

Legend:
Removed from v.272  
changed lines
  Added in v.273

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26