Module: wine Branch: master Commit: d8e518eb68632d694670b6adc2b5285dc0c46958 URL: http://source.winehq.org/git/wine.git/?a=commit;h=d8e518eb68632d694670b6adc2...
Author: Jacek Caban jacek@codeweavers.com Date: Sun Jun 10 11:38:51 2007 +0200
mshtml: Call UpdateUI and Exec(OLECMDID_UPDATECOMMANDS) from timer callback.
---
dlls/mshtml/mshtml_private.h | 7 +++++ dlls/mshtml/view.c | 51 +++++++++++++++++++++++++++++++++++++++++- 2 files changed, 57 insertions(+), 1 deletions(-)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 7842e85..7dd54bd 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -115,6 +115,8 @@ struct HTMLDocument { BOOL has_key_path; BOOL container_locked;
+ DWORD update; + ConnectionPoint *cp_htmldocevents; ConnectionPoint *cp_htmldocevents2; ConnectionPoint *cp_propnotif; @@ -382,6 +384,11 @@ typedef struct {
extern const cmdtable_t editmode_cmds[];
+#define UPDATE_UI 0x0001 +#define UPDATE_TITLE 0x0002 + +void update_doc(HTMLDocument *This, DWORD flags); + /* editor */ void set_ns_editmode(NSContainer*); void handle_edit_event(HTMLDocument*,nsIDOMEvent*); diff --git a/dlls/mshtml/view.c b/dlls/mshtml/view.c index 79fe399..238ed09 100644 --- a/dlls/mshtml/view.c +++ b/dlls/mshtml/view.c @@ -37,6 +37,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
+#define TIMER_ID 0x1000 + static const WCHAR wszInternetExplorer_Server[] = {'I','n','t','e','r','n','e','t',' ','E','x','p','l','o','r','e','r','_','S','e','r','v','e','r',0};
@@ -94,6 +96,45 @@ static void activate_gecko(HTMLDocument *This) nsIWebBrowserFocus_Activate(This->nscontainer->focus); }
+void update_doc(HTMLDocument *This, DWORD flags) +{ + if(!This->update && This->hwnd) + SetTimer(This->hwnd, TIMER_ID, 100, NULL); + + This->update |= flags; +} + +static LRESULT on_timer(HTMLDocument *This) +{ + TRACE("(%p) %x\n", This, This->update); + + KillTimer(This->hwnd, TIMER_ID); + + if(!This->update) + return 0; + + if(This->update & UPDATE_UI) { + if(This->hostui) + IDocHostUIHandler_UpdateUI(This->hostui); + + if(This->client) { + IOleCommandTarget *cmdtrg; + HRESULT hres; + + hres = IOleClientSite_QueryInterface(This->client, &IID_IOleCommandTarget, + (void**)&cmdtrg); + if(SUCCEEDED(hres)) { + IOleCommandTarget_Exec(cmdtrg, NULL, OLECMDID_UPDATECOMMANDS, + OLECMDEXECOPT_DONTPROMPTUSER, NULL, NULL); + IOleCommandTarget_Release(cmdtrg); + } + } + } + + This->update = 0; + return 0; +} + static LRESULT WINAPI serverwnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { HTMLDocument *This; @@ -130,6 +171,9 @@ static LRESULT WINAPI serverwnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM LOWORD(lParam) - 2*ew, HIWORD(lParam) - 2*eh, SWP_NOZORDER | SWP_NOACTIVATE); } + break; + case WM_TIMER: + return on_timer(This); }
return DefWindowProcW(hwnd, msg, wParam, lParam); @@ -211,8 +255,8 @@ static HRESULT activate_window(HTMLDocument *This) /* NOTE: * Windows implementation calls: * RegisterWindowMessage("MSWHEEL_ROLLMSG"); - * SetTimer(This->hwnd, TIMER_ID, 100, NULL); */ + SetTimer(This->hwnd, TIMER_ID, 100, NULL); }
This->in_place_active = TRUE; @@ -442,6 +486,7 @@ static HRESULT WINAPI OleDocumentView_Show(IOleDocumentView *iface, BOOL fShow) if(FAILED(hres)) return hres; } + update_doc(This, UPDATE_UI); ShowWindow(This->hwnd, SW_SHOW); }else { ShowWindow(This->hwnd, SW_HIDE); @@ -472,6 +517,8 @@ static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL f return hres; }
+ update_doc(This, UPDATE_UI); + hres = IOleInPlaceSite_OnUIActivate(This->ipsite); if(SUCCEEDED(hres)) { OLECHAR wszHTMLDocument[30]; @@ -682,4 +729,6 @@ void HTMLDocument_View_Init(HTMLDocument *This) This->in_place_active = FALSE; This->ui_active = FALSE; This->window_active = FALSE; + + This->update = 0; }