Skip to content

Commit

Permalink
tweak examples
Browse files Browse the repository at this point in the history
  • Loading branch information
jwahlstrand committed Nov 23, 2023
1 parent 7affeeb commit 1e51124
Show file tree
Hide file tree
Showing 9 changed files with 13 additions and 8 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ For auto-generated code, Gtk4.jl relies on GObject introspection data generated

Note that this package uses binaries for the GTK library and its dependencies that are built and packaged using [BinaryBuilder.jl](https://github.com/JuliaPackaging/BinaryBuilder.jl). On Linux it does **not** use the binaries that are packaged with your distribution. The build scripts for the binaries used by Gtk4.jl, including the library versions currently being used, can be found by perusing [Yggdrasil.jl](https://github.com/JuliaPackaging/Yggdrasil.jl).

### Known incompatibilities

Gtk4.jl interferes with some other packages, including [PyPlot.jl](https://github.com/JuliaPy/PyPlot.jl) and [GLMakie.jl](https://github.com/MakieOrg/Makie.jl). To use Gtk4 based packages with Makie, you can use [Gtk4Makie.jl](https://github.com/JuliaGtk/Gtk4Makie.jl).

## Enabling GTK4's EGL backend (Linux)
On Wayland, a Cairo-based fallback backend will be used unless you tell `libglvnd_jll` where to find libEGL. This can be done by setting the environment variable __EGL_VENDOR_LIBRARY_DIRS. See [here](https://gitlab.freedesktop.org/glvnd/libglvnd/-/blob/master/src/EGL/icd_enumeration.md) for details.

Expand Down
4 changes: 2 additions & 2 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
- `dialogs.jl` demonstrates various types of dialogs.

## Drawing
- `canvas.jl` demonstrates use of `GtkCanvas`, which allows drawing with Cairo. Also shows how to change the cursor when it's over a certain widget.
- `canvas_cairomakie.jl` shows how to draw a CairoMakie plot into a `GtkCanvas`.
- `canvas.jl` demonstrates use of `GtkCanvas`, which allows drawing with [Cairo](https://github.com/JuliaGraphics/Cairo.jl). Also shows how to change the cursor when it's over a certain widget.
- `canvas_cairomakie.jl` shows how to draw a [CairoMakie](https://github.com/MakieOrg/Makie.jl) plot into a `GtkCanvas`.
- `glarea.jl` shows how to use the `GtkGLArea` widget to draw using OpenGL.

## Lists
Expand Down
2 changes: 1 addition & 1 deletion examples/canvas.jl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ end
cursor(c, "crosshair")

# add the canvas to a window
win = GtkWindow("Canvas")
win = GtkWindow("Canvas", 300, 300)
win[] = c

# add an event controller to handle mouse clicks
Expand Down
2 changes: 1 addition & 1 deletion examples/canvas_cairomakie.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ t_range = 0.0:0.1:10.0
x = rand(length(t_range))
arr() = sin.(t_range) .* Gtk4.value(s) .+ x

canvas = GtkCanvas(; vexpand=true, hexpand=true)
canvas = GtkCanvas(400, 200; vexpand=true, hexpand=true)
b = push!(GtkBox(:v),canvas)
w = GtkWindow(b,"CairoMakie example")
s = GtkScale(:h,-5:5; draw_value = true)
Expand Down
2 changes: 1 addition & 1 deletion examples/columnview.jl
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ end

list = GtkColumnView(GtkSelectionModel(GtkSingleSelection(GListModel(filteredModel))); vexpand=true)
factory1 = GtkSignalListItemFactory(setup_cb, bind_cb)
col1 = GtkColumnViewColumn("name", factory1)
col1 = GtkColumnViewColumn("name", factory1; expand=true)
push!(list, col1)

factory2 = GtkSignalListItemFactory(setup_cb, bind2_cb)
Expand Down
2 changes: 1 addition & 1 deletion examples/filteredlistview.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Gtk4

win = GtkWindow("Listview demo with filter")
win = GtkWindow("Listview demo with filter", 300, 800)
box = GtkBox(:v)
entry = GtkSearchEntry()
sw = GtkScrolledWindow()
Expand Down
2 changes: 1 addition & 1 deletion examples/listbox.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Gtk4

win = GtkWindow("ListBox demo with filter")
win = GtkWindow("ListBox demo with filter", 300, 800)
box = GtkBox(:v)
entry = GtkSearchEntry()
sw = GtkScrolledWindow()
Expand Down
2 changes: 1 addition & 1 deletion src/Gtk4.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ end

import .GLib: set_gtk_property!, get_gtk_property, run,
signal_handler_is_connected, signalnames,
GListModel
GListModel, start_main_loop, stop_main_loop

# define accessor methods in Gtk4

Expand Down
1 change: 1 addition & 0 deletions src/basic_exports.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export signal_connect, signal_handler_disconnect,
signal_handler_block, signal_handler_unblock, signal_handler_is_connected,
signal_emit, g_timeout_add, g_idle_add
export @guarded, @idle_add
export start_main_loop, stop_main_loop

# Gtk-specific event handling
export signal_emit,
Expand Down

0 comments on commit 1e51124

Please sign in to comment.