Jacek Caban : urlmon: Moved notif window handling to bindprot.c.
Alexandre Julliard
julliard at winehq.org
Tue May 12 09:08:46 CDT 2009
Module: wine
Branch: master
Commit: 372a0f24a2257d5a271bb1778a1b1bc89ad7365b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=372a0f24a2257d5a271bb1778a1b1bc89ad7365b
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon May 11 22:02:35 2009 +0200
urlmon: Moved notif window handling to bindprot.c.
---
dlls/urlmon/binding.c | 82 --------------------------------
dlls/urlmon/bindprot.c | 114 +++++++++++++++++++++++++++++++++++++-------
dlls/urlmon/urlmon_main.h | 3 -
3 files changed, 96 insertions(+), 103 deletions(-)
diff --git a/dlls/urlmon/binding.c b/dlls/urlmon/binding.c
index 8eca0cf..913f8fa 100644
--- a/dlls/urlmon/binding.c
+++ b/dlls/urlmon/binding.c
@@ -120,9 +120,6 @@ struct Binding {
#define STREAM(x) ((IStream*) &(x)->lpStreamVtbl)
#define HTTPNEG2(x) ((IHttpNegotiate2*) &(x)->lpHttpNegotiate2Vtbl)
-#define WM_MK_CONTINUE (WM_USER+101)
-#define WM_MK_RELEASE (WM_USER+102)
-
static void fill_stgmed_buffer(stgmed_buf_t *buf)
{
DWORD read = 0;
@@ -137,85 +134,6 @@ static void fill_stgmed_buffer(stgmed_buf_t *buf)
buf->init = TRUE;
}
-static LRESULT WINAPI notif_wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch(msg) {
- case WM_MK_CONTINUE2:
- handle_bindprot_task((void*)lParam);
- return 0;
- case WM_MK_RELEASE: {
- tls_data_t *data = get_tls_data();
-
- if(!--data->notif_hwnd_cnt) {
- DestroyWindow(hwnd);
- data->notif_hwnd = NULL;
- }
- }
- }
-
- return DefWindowProcW(hwnd, msg, wParam, lParam);
-}
-
-HWND get_notif_hwnd(void)
-{
- static ATOM wnd_class = 0;
- tls_data_t *tls_data;
-
- static const WCHAR wszURLMonikerNotificationWindow[] =
- {'U','R','L',' ','M','o','n','i','k','e','r',' ',
- 'N','o','t','i','f','i','c','a','t','i','o','n',' ','W','i','n','d','o','w',0};
-
- tls_data = get_tls_data();
- if(!tls_data)
- return NULL;
-
- if(tls_data->notif_hwnd_cnt) {
- tls_data->notif_hwnd_cnt++;
- return tls_data->notif_hwnd;
- }
-
- if(!wnd_class) {
- static WNDCLASSEXW wndclass = {
- sizeof(wndclass), 0,
- notif_wnd_proc, 0, 0,
- NULL, NULL, NULL, NULL, NULL,
- wszURLMonikerNotificationWindow,
- NULL
- };
-
- wndclass.hInstance = URLMON_hInstance;
-
- wnd_class = RegisterClassExW(&wndclass);
- if (!wnd_class && GetLastError() == ERROR_CLASS_ALREADY_EXISTS)
- wnd_class = 1;
- }
-
- tls_data->notif_hwnd = CreateWindowExW(0, wszURLMonikerNotificationWindow,
- wszURLMonikerNotificationWindow, 0, 0, 0, 0, 0, HWND_MESSAGE,
- NULL, URLMON_hInstance, NULL);
- if(tls_data->notif_hwnd)
- tls_data->notif_hwnd_cnt++;
-
- TRACE("hwnd = %p\n", tls_data->notif_hwnd);
-
- return tls_data->notif_hwnd;
-}
-
-void release_notif_hwnd(HWND hwnd)
-{
- tls_data_t *data = get_tls_data();
-
- if(!data || data->notif_hwnd != hwnd) {
- PostMessageW(data->notif_hwnd, WM_MK_RELEASE, 0, 0);
- return;
- }
-
- if(!--data->notif_hwnd_cnt) {
- DestroyWindow(data->notif_hwnd);
- data->notif_hwnd = NULL;
- }
-}
-
static void dump_BINDINFO(BINDINFO *bi)
{
static const char * const BINDINFOF_str[] = {
diff --git a/dlls/urlmon/bindprot.c b/dlls/urlmon/bindprot.c
index 9203755..7235b63 100644
--- a/dlls/urlmon/bindprot.c
+++ b/dlls/urlmon/bindprot.c
@@ -67,32 +67,110 @@ struct BindProtocol {
#define SERVPROV(x) ((IServiceProvider*) &(x)->lpServiceProviderVtbl)
#define PROTSINK(x) ((IInternetProtocolSink*) &(x)->lpInternetProtocolSinkVtbl)
-void handle_bindprot_task(void *v)
+#define WM_MK_CONTINUE (WM_USER+101)
+#define WM_MK_RELEASE (WM_USER+102)
+
+static LRESULT WINAPI notif_wnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- BindProtocol *This = v;
- task_header_t *task;
+ switch(msg) {
+ case WM_MK_CONTINUE: {
+ BindProtocol *This = (BindProtocol*)lParam;
+ task_header_t *task;
+
+ while(1) {
+ EnterCriticalSection(&This->section);
+
+ task = This->task_queue_head;
+ if(task) {
+ This->task_queue_head = task->next;
+ if(!This->task_queue_head)
+ This->task_queue_tail = NULL;
+ }
+
+ LeaveCriticalSection(&This->section);
- while(1) {
- EnterCriticalSection(&This->section);
+ if(!task)
+ break;
- task = This->task_queue_head;
- if(task) {
- This->task_queue_head = task->next;
- if(!This->task_queue_head)
- This->task_queue_tail = NULL;
+ This->continue_call++;
+ task->proc(This, task);
+ This->continue_call--;
}
- LeaveCriticalSection(&This->section);
+ IInternetProtocol_Release(PROTOCOL(This));
+ return 0;
+ }
+ case WM_MK_RELEASE: {
+ tls_data_t *data = get_tls_data();
- if(!task)
- break;
+ if(!--data->notif_hwnd_cnt) {
+ DestroyWindow(hwnd);
+ data->notif_hwnd = NULL;
+ }
+ }
+ }
+
+ return DefWindowProcW(hwnd, msg, wParam, lParam);
+}
+
+HWND get_notif_hwnd(void)
+{
+ static ATOM wnd_class = 0;
+ tls_data_t *tls_data;
+
+ static const WCHAR wszURLMonikerNotificationWindow[] =
+ {'U','R','L',' ','M','o','n','i','k','e','r',' ',
+ 'N','o','t','i','f','i','c','a','t','i','o','n',' ','W','i','n','d','o','w',0};
- This->continue_call++;
- task->proc(This, task);
- This->continue_call--;
+ tls_data = get_tls_data();
+ if(!tls_data)
+ return NULL;
+
+ if(tls_data->notif_hwnd_cnt) {
+ tls_data->notif_hwnd_cnt++;
+ return tls_data->notif_hwnd;
+ }
+
+ if(!wnd_class) {
+ static WNDCLASSEXW wndclass = {
+ sizeof(wndclass), 0,
+ notif_wnd_proc, 0, 0,
+ NULL, NULL, NULL, NULL, NULL,
+ wszURLMonikerNotificationWindow,
+ NULL
+ };
+
+ wndclass.hInstance = URLMON_hInstance;
+
+ wnd_class = RegisterClassExW(&wndclass);
+ if (!wnd_class && GetLastError() == ERROR_CLASS_ALREADY_EXISTS)
+ wnd_class = 1;
+ }
+
+ tls_data->notif_hwnd = CreateWindowExW(0, wszURLMonikerNotificationWindow,
+ wszURLMonikerNotificationWindow, 0, 0, 0, 0, 0, HWND_MESSAGE,
+ NULL, URLMON_hInstance, NULL);
+ if(tls_data->notif_hwnd)
+ tls_data->notif_hwnd_cnt++;
+
+ TRACE("hwnd = %p\n", tls_data->notif_hwnd);
+
+ return tls_data->notif_hwnd;
+}
+
+void release_notif_hwnd(HWND hwnd)
+{
+ tls_data_t *data = get_tls_data();
+
+ if(!data || data->notif_hwnd != hwnd) {
+ PostMessageW(data->notif_hwnd, WM_MK_RELEASE, 0, 0);
+ return;
}
- IInternetProtocol_Release(PROTOCOL(This));
+ if(!--data->notif_hwnd_cnt) {
+ DestroyWindow(data->notif_hwnd);
+ data->notif_hwnd = NULL;
+ }
}
static void push_task(BindProtocol *This, task_header_t *task, task_proc_t proc)
@@ -116,7 +194,7 @@ static void push_task(BindProtocol *This, task_header_t *task, task_proc_t proc)
if(do_post) {
IInternetProtocol_AddRef(PROTOCOL(This));
- PostMessageW(This->notif_hwnd, WM_MK_CONTINUE2, 0, (LPARAM)This);
+ PostMessageW(This->notif_hwnd, WM_MK_CONTINUE, 0, (LPARAM)This);
}
}
diff --git a/dlls/urlmon/urlmon_main.h b/dlls/urlmon/urlmon_main.h
index 13eb4f3..c3f9448 100644
--- a/dlls/urlmon/urlmon_main.h
+++ b/dlls/urlmon/urlmon_main.h
@@ -119,9 +119,6 @@ tls_data_t *get_tls_data(void);
HWND get_notif_hwnd(void);
void release_notif_hwnd(HWND);
-#define WM_MK_CONTINUE2 (WM_USER+103)
-void handle_bindprot_task(void*);
-
static inline void *heap_alloc(size_t len)
{
return HeapAlloc(GetProcessHeap(), 0, len);
More information about the wine-cvs
mailing list