WebView 2.5: open new urls in the process that already exists

git-svn-id: svn://kolibrios.org@7914 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
2020-05-11 23:02:41 +00:00
parent 7cdee9c3db
commit 9410fc9d15
8 changed files with 43 additions and 14 deletions

View File

@@ -30,6 +30,7 @@
#include "..\lib\patterns\http_downloader.h"
#include "..\lib\patterns\simple_open_dialog.h"
#include "..\lib\patterns\toolbar_button.h"
#include "..\lib\patterns\restart_process.h"
#include "texts.h"
#include "cache.h"
@@ -101,6 +102,7 @@ edit_box address_box = {, PADDING+TSZE*2+PADDING+6, PADDING+3, 0xffffff,
char editbox_icons[] = FROM "editbox_icons.raw";
dword shared_url;
void LoadLibraries()
{
@@ -130,11 +132,18 @@ void HandleParam()
source_mode = true;
history.add(#param + 8);
} else {
history.add(#param);
if (GetProcessesCount("WEBVIEW") == 1) {
history.add(#param);
} else {
shared_url = memopen(#webview_shared, URL_SIZE+1, SHM_OPEN + SHM_WRITE);
strncpy(shared_url, #param, URL_SIZE);
ExitProcess();
}
}
} else {
history.add(URL_SERVICE_HOMEPAGE);
}
shared_url = memopen(#webview_shared, URL_SIZE+1, SHM_CREATE + SHM_WRITE);
}
void main()
@@ -148,7 +157,7 @@ void main()
WB1.list.no_selection = true;
WB1.custom_encoding = -1;
SetEventMask(EVM_REDRAW + EVM_KEY + EVM_BUTTON + EVM_MOUSE + EVM_MOUSE_FILTER + EVM_STACK);
loop() switch(WaitEvent())
loop() switch(@WaitEventTimeout(30))
{
case evMouse:
edit_box_mouse stdcall (#address_box);
@@ -246,6 +255,13 @@ void main()
pages_cache.add(history.current(), http.content_pointer, http.content_received);
LoadInternalPage(http.content_pointer, http.content_received);
}
break;
default:
if (ESDWORD[shared_url] != '\0') {
EventOpenNewTab(shared_url);
ESDWORD[shared_url] = '\0';
ActivateWindow(GetProcessSlot(Form.ID));
}
}
}