33 |
|
|
34 |
#define APP_NAME "SeamlessRDP Shell" |
#define APP_NAME "SeamlessRDP Shell" |
35 |
|
|
36 |
|
#define FOCUS_MSG_NAME "WM_SEAMLESS_FOCUS" |
37 |
|
static UINT g_wm_seamless_focus; |
38 |
|
|
39 |
#ifndef WM_WTSSESSION_CHANGE |
#ifndef WM_WTSSESSION_CHANGE |
40 |
#define WM_WTSSESSION_CHANGE 0x02B1 |
#define WM_WTSSESSION_CHANGE 0x02B1 |
41 |
#endif |
#endif |
173 |
} |
} |
174 |
|
|
175 |
static void |
static void |
176 |
|
do_focus(HWND hwnd) |
177 |
|
{ |
178 |
|
/* if (!AttachThreadInput(GetCurrentThreadId(), GetWindowThreadProcessId(hwnd, NULL), TRUE)) |
179 |
|
{ |
180 |
|
debug("Failed to attach"); |
181 |
|
return; |
182 |
|
} |
183 |
|
SetFocus(hwnd); |
184 |
|
AttachThreadInput(GetCurrentThreadId(), GetWindowThreadProcessId(hwnd, NULL), FALSE)*/ |
185 |
|
SendMessage(hwnd, g_wm_seamless_focus, 0, 0); |
186 |
|
} |
187 |
|
|
188 |
|
static void |
189 |
process_cmds(void) |
process_cmds(void) |
190 |
{ |
{ |
191 |
char line[VCHANNEL_MAX_LINE]; |
char line[VCHANNEL_MAX_LINE]; |
216 |
0)); |
0)); |
217 |
else if (strcmp(tok1, "ZCHANGE") == 0) |
else if (strcmp(tok1, "ZCHANGE") == 0) |
218 |
do_zchange((HWND) strtoul(tok2, NULL, 0), (HWND) strtoul(tok3, NULL, 0)); |
do_zchange((HWND) strtoul(tok2, NULL, 0), (HWND) strtoul(tok3, NULL, 0)); |
219 |
|
else if (strcmp(tok1, "FOCUS") == 0) |
220 |
|
do_focus((HWND) strtoul(tok2, NULL, 0)); |
221 |
} |
} |
222 |
} |
} |
223 |
|
|
318 |
return -1; |
return -1; |
319 |
} |
} |
320 |
|
|
321 |
|
g_wm_seamless_focus = RegisterWindowMessage(FOCUS_MSG_NAME); |
322 |
|
|
323 |
WTSRegisterSessionNotification(g_hwnd, NOTIFY_FOR_THIS_SESSION); |
WTSRegisterSessionNotification(g_hwnd, NOTIFY_FOR_THIS_SESSION); |
324 |
|
|
325 |
vchannel_open(); |
vchannel_open(); |