mirror of
https://github.com/taigrr/wails.git
synced 2026-04-16 19:55:05 -07:00
Compare commits
6 Commits
v2.0.0-bet
...
v1.16.7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3caa0f1438 | ||
|
|
b8ef90cb41 | ||
|
|
9efc648e3d | ||
|
|
baa96f47d8 | ||
|
|
184ce763c1 | ||
|
|
229ee95f91 |
16
cmd/linux.go
16
cmd/linux.go
@@ -71,6 +71,8 @@ const (
|
|||||||
Crux
|
Crux
|
||||||
// RHEL distribution
|
// RHEL distribution
|
||||||
RHEL
|
RHEL
|
||||||
|
// NixOS distribution
|
||||||
|
NixOS
|
||||||
)
|
)
|
||||||
|
|
||||||
// DistroInfo contains all the information relating to a linux distribution
|
// DistroInfo contains all the information relating to a linux distribution
|
||||||
@@ -183,6 +185,8 @@ func parseOsRelease(osRelease string) *DistroInfo {
|
|||||||
result.Distribution = EndeavourOS
|
result.Distribution = EndeavourOS
|
||||||
case "crux":
|
case "crux":
|
||||||
result.Distribution = Crux
|
result.Distribution = Crux
|
||||||
|
case "nixos":
|
||||||
|
result.Distribution = NixOS
|
||||||
default:
|
default:
|
||||||
result.Distribution = Unknown
|
result.Distribution = Unknown
|
||||||
}
|
}
|
||||||
@@ -274,6 +278,18 @@ func PrtGetInstalled(packageName string) (bool, error) {
|
|||||||
return exitCode == 0, nil
|
return exitCode == 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NixEnvInstalled uses nix-env to see if a package is installed
|
||||||
|
func NixEnvInstalled(packageName string) (bool, error) {
|
||||||
|
program := NewProgramHelper()
|
||||||
|
nixEnv := program.FindProgram("nix-env")
|
||||||
|
if nixEnv == nil {
|
||||||
|
return false, fmt.Errorf("cannot check dependencies: nix-env not found")
|
||||||
|
}
|
||||||
|
packageName = strings.ReplaceAll(packageName, "+", `\+`)
|
||||||
|
_, _, exitCode, _ := nixEnv.Run("-q", packageName)
|
||||||
|
return exitCode == 0, nil
|
||||||
|
}
|
||||||
|
|
||||||
// RequestSupportForDistribution promts the user to submit a request to support their
|
// RequestSupportForDistribution promts the user to submit a request to support their
|
||||||
// currently unsupported distribution
|
// currently unsupported distribution
|
||||||
func RequestSupportForDistribution(distroInfo *DistroInfo) error {
|
func RequestSupportForDistribution(distroInfo *DistroInfo) error {
|
||||||
|
|||||||
@@ -318,30 +318,50 @@ distributions:
|
|||||||
- name: webkit2gtk3-devel
|
- name: webkit2gtk3-devel
|
||||||
help: Please install with `sudo zypper in webkit2gtk3-devel` and try again
|
help: Please install with `sudo zypper in webkit2gtk3-devel` and try again
|
||||||
opensuse-leap:
|
opensuse-leap:
|
||||||
id: opensuse-leap
|
id: opensuse-leap
|
||||||
releases:
|
releases:
|
||||||
default:
|
default:
|
||||||
version: default
|
version: default
|
||||||
name: openSUSE Leap
|
name: openSUSE Leap
|
||||||
gccversioncommand: *gccdumpfullversion
|
gccversioncommand: *gccdumpfullversion
|
||||||
programs: *opensusedefaultprograms
|
programs: *opensusedefaultprograms
|
||||||
libraries: *opensusedefaultlibraries
|
libraries: *opensusedefaultlibraries
|
||||||
crux:
|
crux:
|
||||||
id: crux
|
id: crux
|
||||||
releases:
|
releases:
|
||||||
default:
|
default:
|
||||||
version: default
|
version: default
|
||||||
name: Crux Linux
|
name: Crux Linux
|
||||||
gccversioncommand: *gccdumpversion
|
gccversioncommand: *gccdumpversion
|
||||||
programs:
|
programs:
|
||||||
- name: gcc
|
- name: gcc
|
||||||
help: Please install with `sudo prt-get depinst gcc-c++ make` and try again
|
help: Please install with `sudo prt-get depinst gcc-c++ make` and try again
|
||||||
- name: pkg-config
|
- name: pkg-config
|
||||||
help: Please install with `sudo prt-get depinst pkg-config` and try again
|
help: Please install with `sudo prt-get depinst pkg-config` and try again
|
||||||
- name: npm
|
- name: npm
|
||||||
help: Please install with `sudo prt-get depinst nodejs` and try again
|
help: Please install with `sudo prt-get depinst nodejs` and try again
|
||||||
libraries:
|
libraries:
|
||||||
- name: gtk3
|
- name: gtk3
|
||||||
help: Please install with `sudo prt-get depinst gtk3` and try again
|
help: Please install with `sudo prt-get depinst gtk3` and try again
|
||||||
- name: webkitgtk
|
- name: webkitgtk
|
||||||
help: Please install with `sudo prt-get depinst webkitgtk` and try again
|
help: Please install with `sudo prt-get depinst webkitgtk` and try again
|
||||||
|
nixos:
|
||||||
|
id: nixos
|
||||||
|
releases:
|
||||||
|
default:
|
||||||
|
version: default
|
||||||
|
name: NixOS
|
||||||
|
gccversioncommand: *gccdumpversion
|
||||||
|
programs:
|
||||||
|
- name: gcc
|
||||||
|
help: Please install with `nix-env -iA nixos.gcc`
|
||||||
|
- name: pkg-config
|
||||||
|
help: Please install with `nix-env -iA nixos.pkg-config`
|
||||||
|
- name: npm
|
||||||
|
help: Please install with `nix-env -iA nixos.nodejs`
|
||||||
|
libraries:
|
||||||
|
- name: gtk+3
|
||||||
|
help: Please install with `nix-env -iA nixos.gtk3`
|
||||||
|
- name: webkitgtk
|
||||||
|
help: Please install with `nix-env -iA nixos.nodePackages.webkitgtk`
|
||||||
|
|
||||||
|
|||||||
@@ -293,6 +293,8 @@ func CheckDependencies(logger *Logger) (bool, error) {
|
|||||||
libraryChecker = EOpkgInstalled
|
libraryChecker = EOpkgInstalled
|
||||||
case Crux:
|
case Crux:
|
||||||
libraryChecker = PrtGetInstalled
|
libraryChecker = PrtGetInstalled
|
||||||
|
case NixOS:
|
||||||
|
libraryChecker = NixEnvInstalled
|
||||||
default:
|
default:
|
||||||
return false, RequestSupportForDistribution(distroInfo)
|
return false, RequestSupportForDistribution(distroInfo)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
// Version - Wails version
|
// Version - Wails version
|
||||||
const Version = "v1.16.5"
|
const Version = "v1.16.7"
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ func init() {
|
|||||||
projectOptions := projectHelper.NewProjectOptions()
|
projectOptions := projectHelper.NewProjectOptions()
|
||||||
commandDescription := `Generates a new Wails project using the given flags.
|
commandDescription := `Generates a new Wails project using the given flags.
|
||||||
Any flags that are required and not given will be prompted for.`
|
Any flags that are required and not given will be prompted for.`
|
||||||
|
build := false
|
||||||
|
|
||||||
initCommand := app.Command("init", "Initialises a new Wails project").
|
initCommand := app.Command("init", "Initialises a new Wails project").
|
||||||
LongDescription(commandDescription).
|
LongDescription(commandDescription).
|
||||||
@@ -23,7 +24,8 @@ Any flags that are required and not given will be prompted for.`
|
|||||||
StringFlag("template", "Template name", &projectOptions.Template).
|
StringFlag("template", "Template name", &projectOptions.Template).
|
||||||
StringFlag("name", "Project name", &projectOptions.Name).
|
StringFlag("name", "Project name", &projectOptions.Name).
|
||||||
StringFlag("description", "Project description", &projectOptions.Description).
|
StringFlag("description", "Project description", &projectOptions.Description).
|
||||||
StringFlag("output", "Output binary name", &projectOptions.BinaryName)
|
StringFlag("output", "Output binary name", &projectOptions.BinaryName).
|
||||||
|
BoolFlag("build", "Build project after generating", &build)
|
||||||
|
|
||||||
initCommand.Action(func() error {
|
initCommand.Action(func() error {
|
||||||
|
|
||||||
@@ -64,6 +66,10 @@ Any flags that are required and not given will be prompted for.`
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
genSpinner.Success()
|
genSpinner.Success()
|
||||||
|
if !build {
|
||||||
|
logger.Yellow("Project '%s' initialised. Run `wails build` to build it.", projectOptions.Name)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// Build the project
|
// Build the project
|
||||||
cwd, _ := os.Getwd()
|
cwd, _ := os.Getwd()
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ extern "C"
|
|||||||
int ready;
|
int ready;
|
||||||
int js_busy;
|
int js_busy;
|
||||||
int should_exit;
|
int should_exit;
|
||||||
|
|
||||||
int min_width;
|
int min_width;
|
||||||
int min_height;
|
int min_height;
|
||||||
int max_width;
|
int max_width;
|
||||||
@@ -179,7 +179,7 @@ struct webview_priv
|
|||||||
WEBVIEW_API int webview_inject_css(struct webview *w, const char *css);
|
WEBVIEW_API int webview_inject_css(struct webview *w, const char *css);
|
||||||
WEBVIEW_API void webview_set_title(struct webview *w, const char *title);
|
WEBVIEW_API void webview_set_title(struct webview *w, const char *title);
|
||||||
WEBVIEW_API void webview_focus(struct webview *w);
|
WEBVIEW_API void webview_focus(struct webview *w);
|
||||||
WEBVIEW_API void webview_minsize(struct webview *w, int width, int height);
|
WEBVIEW_API void webview_minsize(struct webview *w, int width, int height);
|
||||||
WEBVIEW_API void webview_maxsize(struct webview *w, int width, int height);
|
WEBVIEW_API void webview_maxsize(struct webview *w, int width, int height);
|
||||||
WEBVIEW_API void webview_set_fullscreen(struct webview *w, int fullscreen);
|
WEBVIEW_API void webview_set_fullscreen(struct webview *w, int fullscreen);
|
||||||
WEBVIEW_API void webview_set_color(struct webview *w, uint8_t r, uint8_t g,
|
WEBVIEW_API void webview_set_color(struct webview *w, uint8_t r, uint8_t g,
|
||||||
@@ -342,12 +342,12 @@ struct webview_priv
|
|||||||
w->priv.should_exit = 0;
|
w->priv.should_exit = 0;
|
||||||
w->priv.queue = g_async_queue_new();
|
w->priv.queue = g_async_queue_new();
|
||||||
w->priv.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
w->priv.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||||
|
|
||||||
w->priv.min_width = -1;
|
w->priv.min_width = -1;
|
||||||
w->priv.min_height = -1;
|
w->priv.min_height = -1;
|
||||||
w->priv.max_width = -1;
|
w->priv.max_width = -1;
|
||||||
w->priv.max_height = -1;
|
w->priv.max_height = -1;
|
||||||
|
|
||||||
gtk_window_set_title(GTK_WINDOW(w->priv.window), w->title);
|
gtk_window_set_title(GTK_WINDOW(w->priv.window), w->title);
|
||||||
|
|
||||||
if (w->resizable)
|
if (w->resizable)
|
||||||
@@ -421,13 +421,13 @@ struct webview_priv
|
|||||||
}
|
}
|
||||||
|
|
||||||
WEBVIEW_API void webview_minsize(struct webview *w, int width, int height) {
|
WEBVIEW_API void webview_minsize(struct webview *w, int width, int height) {
|
||||||
|
|
||||||
w->priv.min_width = width;
|
w->priv.min_width = width;
|
||||||
w->priv.min_height = height;
|
w->priv.min_height = height;
|
||||||
|
|
||||||
GdkGeometry hints;
|
GdkGeometry hints;
|
||||||
GdkWindowHints usedHints = (GdkWindowHints) GDK_HINT_MIN_SIZE;
|
GdkWindowHints usedHints = (GdkWindowHints) GDK_HINT_MIN_SIZE;
|
||||||
|
|
||||||
hints.min_width = w->priv.min_width;
|
hints.min_width = w->priv.min_width;
|
||||||
hints.min_height = w->priv.min_height;
|
hints.min_height = w->priv.min_height;
|
||||||
if (w->priv.max_width != -1) {
|
if (w->priv.max_width != -1) {
|
||||||
@@ -435,18 +435,18 @@ struct webview_priv
|
|||||||
hints.max_height = w->priv.max_height;
|
hints.max_height = w->priv.max_height;
|
||||||
usedHints = (GdkWindowHints)(GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE);
|
usedHints = (GdkWindowHints)(GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_window_set_geometry_hints(GTK_WINDOW(w->priv.window), w->priv.window, &hints, usedHints);
|
gtk_window_set_geometry_hints(GTK_WINDOW(w->priv.window), w->priv.window, &hints, usedHints);
|
||||||
}
|
}
|
||||||
|
|
||||||
WEBVIEW_API void webview_maxsize(struct webview *w, int width, int height) {
|
WEBVIEW_API void webview_maxsize(struct webview *w, int width, int height) {
|
||||||
|
|
||||||
w->priv.max_width = width;
|
w->priv.max_width = width;
|
||||||
w->priv.max_height = height;
|
w->priv.max_height = height;
|
||||||
|
|
||||||
GdkGeometry hints;
|
GdkGeometry hints;
|
||||||
GdkWindowHints usedHints = (GdkWindowHints) GDK_HINT_MAX_SIZE;
|
GdkWindowHints usedHints = (GdkWindowHints) GDK_HINT_MAX_SIZE;
|
||||||
|
|
||||||
if (w->priv.min_width != -1) {
|
if (w->priv.min_width != -1) {
|
||||||
hints.min_width = w->priv.min_width;
|
hints.min_width = w->priv.min_width;
|
||||||
hints.min_height = w->priv.min_height;
|
hints.min_height = w->priv.min_height;
|
||||||
@@ -454,7 +454,7 @@ struct webview_priv
|
|||||||
}
|
}
|
||||||
hints.max_width = w->priv.max_width;
|
hints.max_width = w->priv.max_width;
|
||||||
hints.max_height = w->priv.max_height;
|
hints.max_height = w->priv.max_height;
|
||||||
|
|
||||||
gtk_window_set_geometry_hints(GTK_WINDOW(w->priv.window), w->priv.window, &hints, usedHints);
|
gtk_window_set_geometry_hints(GTK_WINDOW(w->priv.window), w->priv.window, &hints, usedHints);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -514,7 +514,6 @@ struct webview_priv
|
|||||||
}
|
}
|
||||||
gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(dlg), FALSE);
|
gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(dlg), FALSE);
|
||||||
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dlg), FALSE);
|
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dlg), FALSE);
|
||||||
gtk_file_chooser_set_show_hidden(GTK_FILE_CHOOSER(dlg), TRUE);
|
|
||||||
gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dlg), TRUE);
|
gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dlg), TRUE);
|
||||||
gtk_file_chooser_set_create_folders(GTK_FILE_CHOOSER(dlg), TRUE);
|
gtk_file_chooser_set_create_folders(GTK_FILE_CHOOSER(dlg), TRUE);
|
||||||
gint response = gtk_dialog_run(GTK_DIALOG(dlg));
|
gint response = gtk_dialog_run(GTK_DIALOG(dlg));
|
||||||
@@ -1398,12 +1397,12 @@ struct webview_priv
|
|||||||
case WM_GETMINMAXINFO:
|
case WM_GETMINMAXINFO:
|
||||||
{
|
{
|
||||||
if (w != NULL) {
|
if (w != NULL) {
|
||||||
// get pixel density
|
// get pixel density
|
||||||
HDC hDC = GetDC(NULL);
|
HDC hDC = GetDC(NULL);
|
||||||
double DPIScaleX = GetDeviceCaps(hDC, 88)/96.0;
|
double DPIScaleX = GetDeviceCaps(hDC, 88)/96.0;
|
||||||
double DPIScaleY = GetDeviceCaps(hDC, 90)/96.0;
|
double DPIScaleY = GetDeviceCaps(hDC, 90)/96.0;
|
||||||
ReleaseDC(NULL, hDC);
|
ReleaseDC(NULL, hDC);
|
||||||
|
|
||||||
RECT rcClient, rcWind;
|
RECT rcClient, rcWind;
|
||||||
POINT ptDiff;
|
POINT ptDiff;
|
||||||
GetClientRect(hwnd, &rcClient);
|
GetClientRect(hwnd, &rcClient);
|
||||||
@@ -1413,7 +1412,7 @@ struct webview_priv
|
|||||||
int heightExtra = (rcWind.bottom - rcWind.top) - rcClient.bottom;
|
int heightExtra = (rcWind.bottom - rcWind.top) - rcClient.bottom;
|
||||||
|
|
||||||
LPMINMAXINFO lpMMI = (LPMINMAXINFO)lParam;
|
LPMINMAXINFO lpMMI = (LPMINMAXINFO)lParam;
|
||||||
|
|
||||||
if (w->priv.min_width != -1) {
|
if (w->priv.min_width != -1) {
|
||||||
lpMMI->ptMinTrackSize.x = w->priv.min_width * DPIScaleX + widthExtra;
|
lpMMI->ptMinTrackSize.x = w->priv.min_width * DPIScaleX + widthExtra;
|
||||||
lpMMI->ptMinTrackSize.y = w->priv.min_height * DPIScaleY + heightExtra;
|
lpMMI->ptMinTrackSize.y = w->priv.min_height * DPIScaleY + heightExtra;
|
||||||
@@ -1423,7 +1422,7 @@ struct webview_priv
|
|||||||
lpMMI->ptMaxTrackSize.y = w->priv.max_height * DPIScaleY + heightExtra;
|
lpMMI->ptMaxTrackSize.y = w->priv.max_height * DPIScaleY + heightExtra;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
@@ -2328,14 +2327,14 @@ struct webview_priv
|
|||||||
{
|
{
|
||||||
[w->priv.window makeKeyWindow];
|
[w->priv.window makeKeyWindow];
|
||||||
}
|
}
|
||||||
|
|
||||||
WEBVIEW_API void webview_minsize(struct webview *w, int width, int height) {
|
WEBVIEW_API void webview_minsize(struct webview *w, int width, int height) {
|
||||||
NSSize size;
|
NSSize size;
|
||||||
size.width = width;
|
size.width = width;
|
||||||
size.height = height;
|
size.height = height;
|
||||||
[w->priv.window setMinSize:size];
|
[w->priv.window setMinSize:size];
|
||||||
}
|
}
|
||||||
|
|
||||||
WEBVIEW_API void webview_maxsize(struct webview *w, int width, int height) {
|
WEBVIEW_API void webview_maxsize(struct webview *w, int width, int height) {
|
||||||
NSSize size;
|
NSSize size;
|
||||||
size.width = width;
|
size.width = width;
|
||||||
@@ -2346,7 +2345,7 @@ struct webview_priv
|
|||||||
[button performSelectorOnMainThread:@selector(setEnabled:) withObject:NO
|
[button performSelectorOnMainThread:@selector(setEnabled:) withObject:NO
|
||||||
waitUntilDone:NO];
|
waitUntilDone:NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
WEBVIEW_API void webview_set_fullscreen(struct webview *w, int fullscreen)
|
WEBVIEW_API void webview_set_fullscreen(struct webview *w, int fullscreen)
|
||||||
{
|
{
|
||||||
int b = ((([w->priv.window styleMask] & NSWindowStyleMaskFullScreen) ==
|
int b = ((([w->priv.window styleMask] & NSWindowStyleMaskFullScreen) ==
|
||||||
@@ -2503,4 +2502,4 @@ struct webview_priv
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* WEBVIEW_H */
|
#endif /* WEBVIEW_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user