Upload via GUI (293 Dateien)

This commit is contained in:
Git Manager GUI
2026-08-06 07:18:14 +02:00
parent 20b9d3a460
commit 12dfec7330
4 changed files with 92 additions and 8 deletions

View File

@@ -39,7 +39,7 @@ const aboutBody =
'const o=y("p");o.innerHTML=`Git: ${a.link().outerHTML}`,' + 'const o=y("p");o.innerHTML=`Git: ${a.link().outerHTML}`,' +
'e.appendChild(y("div",[y("div|class:version",[_t.render(),' + 'e.appendChild(y("div",[y("div|class:version",[_t.render(),' +
'y("div|class:version-details",[y("h1:MyStart|class:version-app-name"),' + 'y("div|class:version-details",[y("h1:MyStart|class:version-app-name"),' +
'y("p:Version 1.0.0|class:version-number")])]),y("hr"),s,o,y("div|id:mystart-autostart-row,class:mystart-autostart-row")]))'; 'y("p:Version 1.0.1|class:version-number")])]),y("hr"),s,o,y("div|id:mystart-autostart-row,class:mystart-autostart-row")]))';
mainJs = mainJs.slice(0, i) + aboutBody + mainJs.slice(j + aEndMarker.length); mainJs = mainJs.slice(0, i) + aboutBody + mainJs.slice(j + aEndMarker.length);
// --- 2) Rename branding (visible text + storage keys) consistently --- // --- 2) Rename branding (visible text + storage keys) consistently ---
@@ -171,6 +171,35 @@ const windowControlsJs = `(function(){
document.addEventListener('mousedown',function(ev){ document.addEventListener('mousedown',function(ev){
if(ev.button===0&&ev.altKey){ev.preventDefault();send('window-drag');} if(ev.button===0&&ev.altKey){ev.preventDefault();send('window-drag');}
},true); },true);
// Edge/corner resize: the WebView fills the whole window, so the OS never
// sees the real window border to hit-test for a resize drag -- every mouse
// event lands in the page first. Watch the pointer ourselves near the
// viewport edges and hand off to the native resize loop, same trick as
// the drag grip above.
var RM=6; // px from the true edge that counts as a resize zone
var CURSOR={n:'ns-resize',s:'ns-resize',e:'ew-resize',w:'ew-resize',
ne:'nesw-resize',sw:'nesw-resize',nw:'nwse-resize',se:'nwse-resize'};
function edgeAt(x,y){
var w=window.innerWidth,h=window.innerHeight;
var l=x<=RM,r=x>=w-RM,t=y<=RM,b=y>=h-RM;
if(t&&l)return'nw';if(t&&r)return'ne';if(b&&l)return'sw';if(b&&r)return'se';
if(l)return'w';if(r)return'e';if(t)return'n';if(b)return's';
return null;
}
document.addEventListener('mousemove',function(ev){
if(ev.buttons)return; // an active drag (e.g. scrollbar) is in progress -> leave it alone
var onCtrls=ev.target.closest&&ev.target.closest('#mystart-winctrls');
var edge=onCtrls?null:edgeAt(ev.clientX,ev.clientY);
document.documentElement.style.cursor=edge?CURSOR[edge]:'';
},true);
document.addEventListener('mousedown',function(ev){
if(ev.button!==0)return;
if(ev.target.closest&&ev.target.closest('#mystart-winctrls'))return;
var edge=edgeAt(ev.clientX,ev.clientY);
if(edge){ev.preventDefault();send2('window-resize',{edge:edge});}
},true);
document.addEventListener('mouseleave',function(){document.documentElement.style.cursor='';},true);
function send2(t,extra){try{window.chrome.webview.postMessage(Object.assign({type:t},extra));}catch(e){}}
})();`; })();`;
mainJs = trInfra + autostartJs + windowControlsJs + mainJs; mainJs = trInfra + autostartJs + windowControlsJs + mainJs;

View File

@@ -8,6 +8,7 @@
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<AssemblyName>MyStart</AssemblyName> <AssemblyName>MyStart</AssemblyName>
<RootNamespace>MyStart</RootNamespace> <RootNamespace>MyStart</RootNamespace>
<Version>1.0.1</Version>
<ApplicationIcon>app.ico</ApplicationIcon> <ApplicationIcon>app.ico</ApplicationIcon>
<RuntimeIdentifier>win-x64</RuntimeIdentifier> <RuntimeIdentifier>win-x64</RuntimeIdentifier>
<PublishSingleFile>true</PublishSingleFile> <PublishSingleFile>true</PublishSingleFile>

View File

@@ -34,6 +34,7 @@ class MainForm : Form
StartPosition = FormStartPosition.CenterScreen; StartPosition = FormStartPosition.CenterScreen;
Width = 1280; Width = 1280;
Height = 800; Height = 800;
MinimumSize = new System.Drawing.Size(480, 360);
ShowInTaskbar = true; ShowInTaskbar = true;
BackColor = System.Drawing.Color.Black; BackColor = System.Drawing.Color.Black;
// No title bar / border. Close with Alt+F4, minimize via the taskbar button. // No title bar / border. Close with Alt+F4, minimize via the taskbar button.
@@ -41,7 +42,7 @@ class MainForm : Form
if (startMinimized) if (startMinimized)
{ {
// Autostart: sit minimized on the taskbar; maximize on first open. // Autostart: sit minimized on the taskbar; restore to a normal window on first open.
WindowState = FormWindowState.Minimized; WindowState = FormWindowState.Minimized;
_pendingMaximize = true; _pendingMaximize = true;
Resize += (_, _) => Resize += (_, _) =>
@@ -49,14 +50,12 @@ class MainForm : Form
if (_pendingMaximize && WindowState != FormWindowState.Minimized) if (_pendingMaximize && WindowState != FormWindowState.Minimized)
{ {
_pendingMaximize = false; _pendingMaximize = false;
WindowState = FormWindowState.Maximized; WindowState = FormWindowState.Normal;
} }
}; };
} }
else // else: leave WindowState at its default (Normal) -> starts as a normal
{ // 1280x800 window, not maximized/fullscreen.
WindowState = FormWindowState.Maximized;
}
try try
{ {
@@ -133,6 +132,10 @@ class MainForm : Form
case "window-drag": case "window-drag":
StartWindowDrag(); StartWindowDrag();
break; break;
case "window-resize":
if (root.TryGetProperty("edge", out var edgeProp))
StartWindowResize(edgeProp.GetString());
break;
case "window-min": case "window-min":
WindowState = FormWindowState.Minimized; WindowState = FormWindowState.Minimized;
break; break;
@@ -224,6 +227,28 @@ class MainForm : Form
SendMessage(Handle, WM_NCLBUTTONDOWN, (IntPtr)HTCAPTION, IntPtr.Zero); SendMessage(Handle, WM_NCLBUTTONDOWN, (IntPtr)HTCAPTION, IntPtr.Zero);
} }
// --- Free window resize for the borderless window. The WebView2 control
// fills the entire client area, so the OS never gets a chance to hit-test
// the window's own edges for a resize cursor/drag -- every mouse message
// lands in the browser first. The page (bundle.js) instead watches the
// mouse position itself, and on mousedown within a few px of an edge/
// corner sends "window-resize" with which edge; we hand off to the same
// native resize loop Windows uses for a normal sizable window. ---
private static readonly Dictionary<string, int> ResizeEdges = new()
{
["n"] = 12, ["s"] = 15, ["e"] = 11, ["w"] = 10,
["ne"] = 14, ["nw"] = 13, ["se"] = 17, ["sw"] = 16,
};
private void StartWindowResize(string? edge)
{
// Only a normal (non-maximized, non-minimized) window can be resized this way.
if (WindowState != FormWindowState.Normal) return;
if (edge == null || !ResizeEdges.TryGetValue(edge, out var htCode)) return;
ReleaseCapture();
SendMessage(Handle, WM_NCLBUTTONDOWN, (IntPtr)htCode, IntPtr.Zero);
}
private static void OpenExternal(string uri) private static void OpenExternal(string uri)
{ {
try try

File diff suppressed because one or more lines are too long