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 { ...@@ -115,6 +115,8 @@ struct HTMLDocument {
BOOL has_key_path; BOOL has_key_path;
BOOL container_locked; BOOL container_locked;
DWORD update;
ConnectionPoint *cp_htmldocevents; ConnectionPoint *cp_htmldocevents;
ConnectionPoint *cp_htmldocevents2; ConnectionPoint *cp_htmldocevents2;
ConnectionPoint *cp_propnotif; ConnectionPoint *cp_propnotif;
...@@ -382,6 +384,11 @@ typedef struct { ...@@ -382,6 +384,11 @@ typedef struct {
extern const cmdtable_t editmode_cmds[]; extern const cmdtable_t editmode_cmds[];
#define UPDATE_UI 0x0001
#define UPDATE_TITLE 0x0002
void update_doc(HTMLDocument *This, DWORD flags);
/* editor */ /* editor */
void set_ns_editmode(NSContainer*); void set_ns_editmode(NSContainer*);
void handle_edit_event(HTMLDocument*,nsIDOMEvent*); void handle_edit_event(HTMLDocument*,nsIDOMEvent*);
......
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(mshtml); WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
#define TIMER_ID 0x1000
static const WCHAR wszInternetExplorer_Server[] = 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}; {'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) ...@@ -94,6 +96,45 @@ static void activate_gecko(HTMLDocument *This)
nsIWebBrowserFocus_Activate(This->nscontainer->focus); 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) static LRESULT WINAPI serverwnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{ {
HTMLDocument *This; HTMLDocument *This;
...@@ -130,6 +171,9 @@ static LRESULT WINAPI serverwnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM ...@@ -130,6 +171,9 @@ static LRESULT WINAPI serverwnd_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM
LOWORD(lParam) - 2*ew, HIWORD(lParam) - 2*eh, LOWORD(lParam) - 2*ew, HIWORD(lParam) - 2*eh,
SWP_NOZORDER | SWP_NOACTIVATE); SWP_NOZORDER | SWP_NOACTIVATE);
} }
break;
case WM_TIMER:
return on_timer(This);
} }
return DefWindowProcW(hwnd, msg, wParam, lParam); return DefWindowProcW(hwnd, msg, wParam, lParam);
...@@ -211,8 +255,8 @@ static HRESULT activate_window(HTMLDocument *This) ...@@ -211,8 +255,8 @@ static HRESULT activate_window(HTMLDocument *This)
/* NOTE: /* NOTE:
* Windows implementation calls: * Windows implementation calls:
* RegisterWindowMessage("MSWHEEL_ROLLMSG"); * RegisterWindowMessage("MSWHEEL_ROLLMSG");
* SetTimer(This->hwnd, TIMER_ID, 100, NULL);
*/ */
SetTimer(This->hwnd, TIMER_ID, 100, NULL);
} }
This->in_place_active = TRUE; This->in_place_active = TRUE;
...@@ -442,6 +486,7 @@ static HRESULT WINAPI OleDocumentView_Show(IOleDocumentView *iface, BOOL fShow) ...@@ -442,6 +486,7 @@ static HRESULT WINAPI OleDocumentView_Show(IOleDocumentView *iface, BOOL fShow)
if(FAILED(hres)) if(FAILED(hres))
return hres; return hres;
} }
update_doc(This, UPDATE_UI);
ShowWindow(This->hwnd, SW_SHOW); ShowWindow(This->hwnd, SW_SHOW);
}else { }else {
ShowWindow(This->hwnd, SW_HIDE); ShowWindow(This->hwnd, SW_HIDE);
...@@ -472,6 +517,8 @@ static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL f ...@@ -472,6 +517,8 @@ static HRESULT WINAPI OleDocumentView_UIActivate(IOleDocumentView *iface, BOOL f
return hres; return hres;
} }
update_doc(This, UPDATE_UI);
hres = IOleInPlaceSite_OnUIActivate(This->ipsite); hres = IOleInPlaceSite_OnUIActivate(This->ipsite);
if(SUCCEEDED(hres)) { if(SUCCEEDED(hres)) {
OLECHAR wszHTMLDocument[30]; OLECHAR wszHTMLDocument[30];
...@@ -682,4 +729,6 @@ void HTMLDocument_View_Init(HTMLDocument *This) ...@@ -682,4 +729,6 @@ void HTMLDocument_View_Init(HTMLDocument *This)
This->in_place_active = FALSE; This->in_place_active = FALSE;
This->ui_active = FALSE; This->ui_active = FALSE;
This->window_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