Skip to content

Commit

Permalink
Merge branch 'wailsapp:v3-alpha' into v3-alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
atterpac authored Oct 28, 2023
2 parents cfbf916 + fdd8875 commit df9e653
Show file tree
Hide file tree
Showing 11 changed files with 73 additions and 54 deletions.
9 changes: 6 additions & 3 deletions mkdocs-website/docs/development/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,17 @@ The `InjectJS()` method returns JavaScript that should be injected into all
windows as they are created. This is useful for adding custom JavaScript
functions that complement the plugin.

## Misc Tasks
The built-in plugins can be found in the `v3/plugins` directory.
Check them out for inspiration.

### Upgrading Taskfile
## Tasks

The Wails CLI uses the [Task](https://taskfile.dev) build system. It is imported
as a library and used to run the tasks defined in `Taskfile.yaml`. The main
interfacing with Task happens in `v3/internal/commands/task.go`.

### Upgrading Taskfile

To check if there's an upgrade for Taskfile, run `wails3 task -version` and
check against the Task website.

Expand Down Expand Up @@ -171,7 +174,7 @@ wails3 task -version
Make sure that all PRs have a ticket associated with them providing context to
the change. If there is no ticket, please create one first. Ensure that all PRs
have updated the CHANGELOG.md file with the changes made. The CHANGELOG.md file
is located in the `v3` directory.
is located in the `mkdocs-website/docs` directory.

## Misc Tasks

Expand Down
4 changes: 3 additions & 1 deletion mkdocs-website/docs/getting-started/feedback.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ feedback:
- Please *don't* just add comments like "+1" or "me too".
- Please feel free to comment if there is more to add to the post, such as "this bug also affect ARM builds" or "Another option would be to ....."

Things we are looking for feedback on:
There is a list of known issues & work in progress can be found [here](https://github.com/orgs/wailsapp/projects/6).

## Things we are looking for feedback on

- The API
- Is it easy to use?
Expand Down
4 changes: 3 additions & 1 deletion mkdocs-website/docs/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ To install the Wails CLI, ensure you have [Go 1.21+](https://go.dev/dl/)
installed and run:

```shell
go install github.com/wailsapp/wails/v3/cmd/wails3@latest
git clone https://github.com/wailsapp/wails.git
cd wails/cmd/wails3
go install
```

## Supported Platforms
Expand Down
2 changes: 2 additions & 0 deletions mkdocs-website/docs/getting-started/next-steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ go run .

in the example directory.

The status of the examples is on the [roadmap](/roadmap).

## Creating a new project

To create a new project, you can use the `wails3 init` command. This will create
Expand Down
2 changes: 1 addition & 1 deletion mkdocs-website/docs/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ The main goal is to get most of the examples working on all platforms.
| systray | W | W | |
| video | | W | |
| window | P | W | |
| wml | | W | |
| wml | W | W | |

- Mac Dialogs work, however the file dialogs issue a warning that needs to be fixed.

Expand Down
28 changes: 14 additions & 14 deletions mkdocs-website/docs/whats-new.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# What's new in v3?

!!! note The features that will be included in the v3 release may change from
this list.
!!! note
The features that will be included in the v3 release may change from this list.

## Multiple Windows

Expand Down Expand Up @@ -311,24 +311,24 @@ An experimental feature to call runtime methods using plain html, similar to
<body style="margin-top:50px; color: white; background-color: #191919">
<h2>Wails ML Demo</h2>
<p>This application contains no Javascript!</p>
<button data-wml-event="button-pressed">Press me!</button>
<button data-wml-event="delete-things" data-wml-confirm="Are you sure?">
<button wml-event="button-pressed">Press me!</button>
<button wml-event="delete-things" wml-confirm="Are you sure?">
Delete all the things!
</button>
<button data-wml-window="Close" data-wml-confirm="Are you sure?">
<button wml-window="Close" wml-confirm="Are you sure?">
Close the Window?
</button>
<button data-wml-window="Center">Center</button>
<button data-wml-window="Minimise">Minimise</button>
<button data-wml-window="Maximise">Maximise</button>
<button data-wml-window="UnMaximise">UnMaximise</button>
<button data-wml-window="Fullscreen">Fullscreen</button>
<button data-wml-window="UnFullscreen">UnFullscreen</button>
<button data-wml-window="Restore">Restore</button>
<button wml-window="Center">Center</button>
<button wml-window="Minimise">Minimise</button>
<button wml-window="Maximise">Maximise</button>
<button wml-window="UnMaximise">UnMaximise</button>
<button wml-window="Fullscreen">Fullscreen</button>
<button wml-window="UnFullscreen">UnFullscreen</button>
<button wml-window="Restore">Restore</button>
<div
style="width: 200px; height: 200px; border: 2px solid white;"
data-wml-event="hover"
data-wml-trigger="mouseover"
wml-event="hover"
wml-trigger="mouseover"
>
Hover over me
</div>
Expand Down
5 changes: 5 additions & 0 deletions mkdocs-website/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ site_name: "alpha"
site_description: The Wails Project - Build beautiful cross-platform applications using Go
repo_url: https://github.com/wailsapp/wails
edit_uri: edit/v3-alpha/mkdocs-website/docs/
site_url: https://v3alpha.wails.io
theme:
name: material
custom_dir: overrides
Expand Down Expand Up @@ -48,6 +49,9 @@ theme:
icon: material/toggle-switch
name: Switch to light mode

#plugins:
# - info

extra:
social:
- icon: fontawesome/brands/github-alt
Expand Down Expand Up @@ -95,6 +99,7 @@ nav:
- Introduction: development/introduction.md
- Status: development/status.md
- v3 Changes: development/changes.md
- Roadmap: roadmap.md
- Change Log: changelog.md
- Sponsor❤️: https://github.com/sponsors/leaanthony

Expand Down
13 changes: 9 additions & 4 deletions mkdocs-website/overrides/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,13 @@

This site will be updated as we progress through the alpha and beta releases.<br/><br/>

v3 is a work in progress. Expect things to fail. Expect things to change. Expect the documentation to be wrong.<br/><br/>
<div class="admonition warning">
<p class="admonition-title">Warning</p>
<h3>v3 alpha is a work in progress and not ready for production. Expect things to fail. Expect things to change. Expect the documentation to be wrong.<br/><br/>
</h3>
</div>

<h2>Status</h2>
<br/>
<table border="1">
<tr>
Expand All @@ -83,15 +88,15 @@
</tr>
<tr>
<td>Windows</td>
<td>Ready for alpha testing</td>
<td>All examples are working</td>
</tr>
<tr>
<td>Mac</td>
<td>Ready for alpha testing</td>
<td>Most examples are working</td>
</tr>
<tr>
<td>Linux</td>
<td>Not ready - still a work in progress</td>
<td>Some examples are working</td>
</tr>
</table>
<br/><br/>
Expand Down
1 change: 1 addition & 0 deletions v3/examples/frameless/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ require (
github.com/go-git/go-billy/v5 v5.2.0 // indirect
github.com/go-git/go-git/v5 v5.3.0 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
Expand Down
8 changes: 5 additions & 3 deletions v3/examples/frameless/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ github.com/go-git/go-git/v5 v5.3.0 h1:8WKMtJR2j8RntEXR/uvTKagfEt4GYlwQ7mntE4+0GW
github.com/go-git/go-git/v5 v5.3.0/go.mod h1:xdX4bWJ48aOrdhnl2XqHYstHbbp6+LFS4r4X+lNVprw=
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/godbus/dbus/v5 v5.1.0 h1:4KLkAxT3aOY8Li4FRJe/KvhoNFFxo0m6fNuFUO8QJUk=
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
Expand Down Expand Up @@ -99,8 +101,7 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/wailsapp/go-webview2 v1.0.8 h1:hyoFPlMSfb/NM64wuVbgBaq1MASJjqsSUYhN+Rbcr9Y=
github.com/wailsapp/go-webview2 v1.0.8/go.mod h1:Uk2BePfCRzttBBjFrBmqKGJd41P6QIHeV9kTgIeOZNo=
github.com/wailsapp/go-webview2 v1.0.9 h1:lrU+q0cf1wgLdR69rN+ZnRtMJNaJRrcQ4ELxoO7/xjs=
github.com/wailsapp/go-webview2 v1.0.9/go.mod h1:Uk2BePfCRzttBBjFrBmqKGJd41P6QIHeV9kTgIeOZNo=
github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs=
github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o=
Expand Down Expand Up @@ -148,5 +149,6 @@ gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
51 changes: 24 additions & 27 deletions v3/pkg/application/linux_cgo.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ func init() {
gtkSignalToMenuItem = map[uint]*MenuItem{}

mainThreadId = C.g_thread_self()
fmt.Println("init mainthread=", mainThreadId)
}

// mainthread stuff
Expand All @@ -178,12 +177,10 @@ func dispatchOnMainThreadCallback(callbackID C.uint) {
//export activateLinux
func activateLinux(data pointer) {
// NOOP: Callback for now
fmt.Println("activateLinux", mainThreadId)
}

func isOnMainThread() bool {
threadId := C.g_thread_self()
// fmt.Println("isOnMainThread = ", threadId == mainThreadId)
return threadId == mainThreadId
}

Expand Down Expand Up @@ -461,27 +458,26 @@ func menuItemSetLabel(widget pointer, label string) {
C.free(unsafe.Pointer(value))
}

/*
GtkWidget *box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
GtkWidget *icon = gtk_image_new_from_icon_name ("folder-music-symbolic", GTK_ICON_SIZE_MENU);
GtkWidget *label = gtk_label_new ("Music");
GtkWidget *menu_item = gtk_menu_item_new ();
gtk_container_add (GTK_CONTAINER (box), icon);
gtk_container_add (GTK_CONTAINER (box), label);
gtk_container_add (GTK_CONTAINER (menu_item), box);
func menuItemRemoveBitmap(widget pointer) {
box := C.gtk_bin_get_child((*C.GtkBin)(widget))
if box == nil {
return
}

gtk_widget_show_all (menu_item);
*/
children := C.gtk_container_get_children((*C.GtkContainer)(unsafe.Pointer(box)))
defer C.g_list_free(children)
count := int(C.g_list_length(children))
if count == 2 {
C.gtk_container_remove((*C.GtkContainer)(unsafe.Pointer(box)),
(*C.GtkWidget)(children.data))
}
}

func menuItemSetBitmap(widget pointer, data []byte) {
parent := C.gtk_widget_get_parent((*C.GtkWidget)(widget))
fmt.Println("parent", parent)
//parent := C.gtk_widget_get_parent((*C.GtkWidget)widget)
if img, err := pngToImage(data); err == nil {
gbytes := C.g_bytes_new_static(
C.gconstpointer(unsafe.Pointer(&img.Pix[0])),
func menuItemSetBitmap(widget pointer, bitmap []byte) {
menuItemRemoveBitmap(widget)
box := C.gtk_bin_get_child((*C.GtkBin)(widget))
if img, err := pngToImage(bitmap); err == nil {
gbytes := C.g_bytes_new_static(C.gconstpointer(unsafe.Pointer(&img.Pix[0])),
C.ulong(len(img.Pix)))
defer C.g_bytes_unref(gbytes)
pixBuf := C.gdk_pixbuf_new_from_bytes(
Expand All @@ -494,9 +490,12 @@ func menuItemSetBitmap(widget pointer, data []byte) {
C.int(img.Stride),
)
image := C.gtk_image_new_from_pixbuf(pixBuf)
fmt.Println("image", image)
// C.gtk_menu_item_set_image((*C.GtkMenuItem)(widget), image)
C.gtk_widget_set_visible((*C.GtkWidget)(image), C.gboolean(1))
C.gtk_container_add(
(*C.GtkContainer)(unsafe.Pointer(box)),
(*C.GtkWidget)(unsafe.Pointer(image)))
}

}

func menuItemSetToolTip(widget pointer, tooltip string) {
Expand Down Expand Up @@ -1012,6 +1011,7 @@ func onDragNDrop(target unsafe.Pointer, context *C.GdkDragContext, x C.gint, y C
//export onKeyPressEvent
func onKeyPressEvent(widget *C.GtkWidget, event *C.GdkEventKey, userData unsafe.Pointer) C.gboolean {
windowId := uint(*((*C.uint)(userData)))
fmt.Println("onKeyPressEvent", windowId)
/*
windowKeyEvents <- &windowKeyEvent{
windowId: windowID,
Expand Down Expand Up @@ -1051,13 +1051,11 @@ func setWindowIcon(window pointer, icon []byte) {
C.ulong(len(icon)),
nil)
if written == 0 {
fmt.Println("failed to write icon")
return
}
C.gdk_pixbuf_loader_close(loader, nil)
pixbuf := C.gdk_pixbuf_loader_get_pixbuf(loader)
if pixbuf != nil {
fmt.Println("gtk_window_set_icon", window)
C.gtk_window_set_icon((*C.GtkWindow)(window), pixbuf)
}
C.g_object_unref(C.gpointer(loader))
Expand All @@ -1066,7 +1064,6 @@ func setWindowIcon(window pointer, icon []byte) {
//export messageDialogCB
func messageDialogCB(button C.int) {
fmt.Println("messageDialogCB", button)

}

func runChooserDialog(window pointer, allowMultiple, createFolders, showHidden bool, currentFolder, title string, action int, acceptLabel string, filters []FileFilter) (chan string, error) {
Expand Down

0 comments on commit df9e653

Please sign in to comment.