Commit d8e518eb authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

mshtml: Call UpdateUI and Exec(OLECMDID_UPDATECOMMANDS) from timer callback.

parent 03342918
......@@ -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*);
......
......@@ -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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment