profile
viewpoint

jneem/gesture 2

Gesture recognition for rust

jneem/homespring 2

Homespring interpreter and graphical debugger

jneem/bibcleaner 1

A utility for cleaning up messy bibtex files.

jneem/jneem.github.io-old 1

Build a Jekyll blog in minutes, without touching the command line.

jneem/jp-web 1

A web demo of jp

push eventjneem/scribl

Joe Neeman

commit sha 3c7ca7f2e42bedb12bddf30ff0a240f350acbc41

Use ClipBox instead of Scroll in the timeline.

view details

push time in an hour

PR opened linebender/druid

Defer context menus on gtk and windows.

Windows is currently untested -- I'll check it if CI passes.

+67 -62

0 comment

3 changed files

pr created time in 17 hours

push eventjneem/druid

Joe Neeman

commit sha 67f9ee928a2d444792335c82847bd1c205cc5904

[windows] Defer context menus to avoid re-entrancy.

view details

push time in 18 hours

create barnchjneem/druid

branch : menus-async

created branch time in 18 hours

issue commentlinebender/druid

Re-entrancy and RefCells

The open and save dialogs are done. The only other thing I'm aware of is the context menus, but they should be easier because it doesn't involve API changes to druid-shell.

  • [ ] defer windows context menus
  • [ ] defer gtk context menus
  • [ ] defer mac context menus

(the mac one might be ok already? I can't check...)

jneem

comment created time in 20 hours

push eventlinebender/druid

jneem

commit sha 5a127c3d414f3e891ebeeead06031aa7427a83f4

Make dialogs on windows non-sychronous. (#1328) Also removes obsolete compatibility shims, since no platforms need the sync methods.

view details

push time in 20 hours

PR merged linebender/druid

Make dialogs on windows non-sychronous. S-needs-review

This does #1068 for windows.

+240 -409

2 comments

10 changed files

jneem

pr closed time in 20 hours

push eventjneem/scribl

Joe Neeman

commit sha 787de1ab64a0c12e2fc770e864ec167fa90ac287

Fix embarrassing debug line in Cargo.toml.

view details

push time in a day

push eventjneem/scribl

Joe Neeman

commit sha a9431f0b28822eed90d43190a77c79f56b8a4b3f

Bump dependencies.

view details

push time in a day

push eventjneem/scribl

Joe Neeman

commit sha 437c4c74380bc4742211aa71469db9ae4921a040

Move StrokeInProgress and add some docs.

view details

Joe Neeman

commit sha 08464649512ec2ff4743a72d3404101e4efedbc6

Optimize the timeline painting a little.

view details

push time in a day

PR merged linebender/druid

Fixed broken doc links due to typo in container.rs

Noticed some broken links in the Container widget docs and fixed them.

Tested locally with cargo doc and Firefox.

+5 -4

0 comment

2 changed files

StarfightLP

pr closed time in a day

push eventlinebender/druid

Starfighter

commit sha ff099e9f7a4fa0e0bae1d880d7c4451ba1aab1e9

Fixed broken doc links due to typo in container.rs (#1357)

view details

push time in a day

PullRequestReviewEvent

push eventlinebender/druid

Richard Dodd (dodj)

commit sha bc960770419363f83c9c96a7fbbcdd91c0150e84

The gallery example now requires a new feature. (#1358)

view details

push time in a day

PR merged linebender/druid

The gallery example now requires a new feature.

The image create now requires a feature to be passed through to enable loading pngs, which the gallery example uses.

+1 -1

0 comment

1 changed file

derekdreery

pr closed time in a day

PullRequestReviewEvent
PullRequestReviewEvent

issue closedlinebender/druid

Segmentation fault (core dumped) when using MenuDesc widget and svg feature

I got Segmentation fault (core dumped) crash when I enabled svg feature and attaching menu to WindowDesc.

  • Using svg feature while NOT attaching a menu to window run just fine.
  • Attaching menu to window while NOT using svg will run just fine.

Replicated in

  • 63e34fa2 ( latest master, when this issue is filed)
  • 93620d1

To quickly replicate: Add svg to the default feature in druid's Cargo.toml

[features]
default = ["gtk","svg"]

then run the example which uses menu:

cargo run --example multiwin
DEBUG [druid::localization] available locales [], current en-US
DEBUG [druid::localization] resolved: [en-US]
INFO  [multiwin] Window added, id: WindowId(1)
Segmentation fault (core dumped)

OS used: Ubuntu 18.04.5 LTS x86_64 Kernel: 4.15.0-118-generic

I wasn't able to replicate this in the published 0.6.0 crate.

closed time in a day

ivanceras

issue commentlinebender/druid

Segmentation fault (core dumped) when using MenuDesc widget and svg feature

I believe this is fixed by #1356.

ivanceras

comment created time in a day

push eventjneem/druid

rhzk

commit sha 9e5f19a19a3df05e54a0e41eff972052ca4ad329

Reduce flashing on window creation (#1272)

view details

Joe Neeman

commit sha 704415f072726f492b618d89fba67bbdcf2e0dd9

Make dialogs on windows non-sychronous.

view details

Joe Neeman

commit sha b8f484a52851fa8466d8bb3a36af1bb8faf9626c

Add CHANGELOG entry.

view details

Joe Neeman

commit sha fe76a1ce0f99334c4ca92b38444e0409977affe2

Remove obsolete compatibility shims.

view details

push time in 2 days

PR closed linebender/druid

Undo the harfbuzz-sys workaround.

It seems to be unnecessary now, possibly due to the updated usvg. This might fix #1323 (although I'm unable to reproduce it right now).

+1 -4

4 comments

1 changed file

jneem

pr closed time in 2 days

pull request commentlinebender/druid

Undo the harfbuzz-sys workaround.

Closing this, because if #1356 is the right workaround then we'll still need harfbuzz-sys

jneem

comment created time in 2 days

issue openedRazrFalcon/rustybuzz

rustybuzz exports symbols that conflict with harfbuzz

We had a mysterious [https://github.com/linebender/druid/issues/1323#issuecomment-718282421](segfault in druid) that I tracked down to a version bump that brought in rustybuzz. I'm far from an expert on this stuff, but I noticed that after introducing the rustybuzz dep, druid started exporting symbols that clash with harfbuzz's symbols. Also, the crashes occurred on ubuntu (which has system harfbuzz version 2.6) but not on arch (which has system harfbuzz version 2.7). Could it be that rustybuzz's exported symbols are causing our problem, and if so is it possible not to export them?

created time in 2 days

PR opened linebender/druid

Try reverting usvg.

@justinmoon can you try this one?

+2 -2

0 comment

1 changed file

pr created time in 2 days

issue commentlinebender/druid

Segmentation fault (core dumped) when using MenuDesc widget and svg feature

Thanks for checking, I'll have another candidate PR up in a minute.

I'm more and more convinced that the issue is that rustybuzz introduces some symbols that conflict with the system harfbuzz. Latest evidence is that rustybuzz embeds harfbuzz 2.7. This is the same version that's installed on my system (and has no segfault), but ubuntu apparently is on harfbuzz 2.6.

Also, nm -gD confirms that the multiwin example (compiled with svg support) exports a bunch of harfbuzz symbols

<snip>
0000000000179f4e T hb_aat_layout_feature_type_get_name_id
0000000000179f81 T hb_aat_layout_feature_type_get_selector_infos
0000000000179f0e T hb_aat_layout_get_feature_types
0000000000179d10 T hb_aat_layout_has_positioning
0000000000179a12 T hb_aat_layout_has_substitution
0000000000179e2f T hb_aat_layout_has_tracking
<snip>

I have a pr on the way that downgrades usvg to 0.10.0, and it appears to prevent these symbols from appearing, because 0.10.0 depends on harfbuzz and not rustybuzz. By the way, this hasn't been broken for 4 months, because we only upgraded the usvg version 2 months ago.

ivanceras

comment created time in 2 days

create barnchjneem/druid

branch : harfbuzz2

created branch time in 2 days

issue commentlinebender/druid

Segmentation fault (core dumped) when using MenuDesc widget and svg feature

More wild guessing: I noticed that usvg now depends on rustybuzz instead of harfbuzz, and rustybuzz contains a vendored copy of harfbuzz in it. Could it be that the symbols are conflicting?

ivanceras

comment created time in 2 days

push eventjneem/druid

Joe Neeman

commit sha 0189c3e7f67b02268dc42fa810ce24f8a06fd8f2

Remove obsolete compatibility shims.

view details

push time in 2 days

push eventlinebender/druid

rhzk

commit sha 9e5f19a19a3df05e54a0e41eff972052ca4ad329

Reduce flashing on window creation (#1272)

view details

push time in 2 days

PR merged linebender/druid

Reduce flashing on window creation S-ready

Sets the correct window size directly after the window is built instead of adding it to the deferred queue. Since this is done before ShowWindow is called it should not be any visible "flashing" occuring. Updated Show() to handle maximized and minimized window, as this was also deferred and might have caused flashing.

+52 -42

2 comments

4 changed files

rhzk

pr closed time in 2 days

pull request commentlinebender/druid

Reduce flashing on window creation

I'm guessing it's because @rhzk doesn't have write access?

rhzk

comment created time in 2 days

PullRequestReviewEvent

push eventjneem/druid

Joe Neeman

commit sha a9f01c82c6211af944d27fbc72ad3caa5918f2b5

Remove obsolete compatibility shims.

view details

push time in 2 days

pull request commentlinebender/druid

Make dialogs on windows non-sychronous.

Now that mac support has landed, I've updated this PR to remove the backwards-compatibility glue.

jneem

comment created time in 2 days

pull request commentlinebender/druid

Make dialogs on windows non-sychronous.

Now that mac support has landed, I've updated this PR to remove the backwards-compatibility glue.

jneem

comment created time in 2 days

push eventjneem/druid

Raph Levien

commit sha d0d88653f27690b7ce6929048bb0c1faf48d4387

Display hotkeys for menu items in Windows This patch adds a string to describe hotkeys for menu items in the Windows back-end. Part of work tracked in #1306

view details

Raph Levien

commit sha 172ae3ccfce6fd37473f8549fa9f7ac8050a15e3

Merge branch 'master' into win_menu_hotkeys

view details

Colin Rofls

commit sha 775801e77c3fb29cf6df1d6fc357cfb42ba92852

Make FontDescriptor construction const

view details

Colin Rofls

commit sha fae3d045445764ebc276f0a5d5dc28c669a6cce5

Remove minimum height from TextBox A lot of this stuff with bounding the height of widgets was a consequence of us not being able to calculate the height of text, and wanting to ensure that control widgets had similar metrics; that should now be revisited. In this particular case, this minimum height just seems like extra logic with no clear benefit, and was complicating the EditableLabel stuff in runebender.

view details

Colin Rofls

commit sha 4e1727736de8a1dfe8e3b621c91250b73509b395

Add EventViewer example This adds a new example, for logging mouse and keyboard events. This is primarily intended as a debugging and testing tool.

view details

Colin Rofls

commit sha 3c5fa6374e4c33e9644080e62fc0d64a0d23f699

Only account for baseline in Flex if needed (#1325) * Only account for baseline in Flex if needed Previously we would always leave enough space for all widgets to potentially be baseline aligned, which could cause unintended layout problems when baseline alignment wasn't used. * Apply suggestions from code review Co-authored-by: Leopold Luley <git@leopoldluley.de>

view details

Colin Rofls

commit sha c5df2cb1f15bc005795205cedf05bbedf73ce817

Improve selection behaviour on focus change On windows, we persist the existing selection when focus changes. On mac, the behaviour depends on whether or not there was a click. If there was a click, we use the click to determine the selection; otherwise we select the whole buffer. In addition, on mac, we no longer draw the cursor if the selection is not a caret. - fixes #1225 (again) Update druid/src/widget/textbox.rs Co-authored-by: Leopold Luley <git@leopoldluley.de>

view details

Jaap Aarts

commit sha cb3349961209b31037b37593fcd75b49d2b2f15a

Rework `identity` example (#1330)

view details

jneem

commit sha bed8894d8d6402f9e358a6dd287c06804e9791bf

Implement a ClipBox widget as a building block for widgets that scroll.

view details

jneem

commit sha 7f1fa183c9291bc8fea4dc02412777c423b6111b

[windows] Use the PeekMessage trick to make timers less laggy. (#1332)

view details

Colin Rofls

commit sha 02a1deceb217179e3bcb5d473c57030dea8125a2

Use '=' on pre-release dependencies I'm going to do another piet pre-release shortly, and would like to avoid breakage.

view details

Colin Rofls

commit sha 4b4dfb346c87b97665ee26209c8a3a590041e621

[mac] Adopt new save/open API This implements the new save/open (#1068) API on macOS. The implementation here is slightly different; Cocoa uses the idea of 'blocks' (a c extension for callbacks) in most of their async API, so we don't need to to manually defer the work.

view details

Colin Rofls

commit sha f66642494571be5b6416d3079057caddf3ac1b55

Reuse more code in save_as/open_file

view details

Maurizio Zucchelli

commit sha 1b86cba65af42e691494349a62cc4abf2818a476

Fix docs links for LifeCycleCtx.

view details

Colin Rofls

commit sha 41c65255eedccd31c419b6240a53bd844358a267

Update piet This also adds back a method that was removed from Region, with a deprecation notice.

view details

Raph Levien

commit sha 31d4bdf9c5c97250804157ddbe88d758055b057a

Merge pull request #1310 from linebender/win_menu_hotkeys Display hotkeys for menu items in Windows

view details

Jaap Aarts

commit sha 6ab18da08969567f4e6af19db9d8f05478f52d76

Rework anim (#1333)

view details

Jaap Aarts

commit sha 62af6c40c5ec48d7bb33a1994222e406043091a8

Optional image features (#1340)

view details

Jaap Aarts

commit sha 9d166f614ba3e70d54a684e3b8f74b1e5b5ee3a3

Rework blocking functions (#1336) Co-authored-by: Colin Rofls <colin@cmyr.net>

view details

Leopold Luley

commit sha 336f5f2ee6102e717ccb31f66bdfc6c63cce79dd

Add Checkbox::set_label function.

view details

push time in 2 days

issue commentlinebender/druid

Segmentation fault (core dumped) when using MenuDesc widget and svg feature

Sorry for all the random guessing, but could you check if 67c7db6cd works? It's the last commit before the harfbuzz-sys version got bumped.

ivanceras

comment created time in 2 days

pull request commentlinebender/druid

Undo the harfbuzz-sys workaround.

Too bad :(

I still think this PR is reasonable though, since we appear not to need the workaround anymore.

jneem

comment created time in 2 days

PR opened linebender/druid

Undo the harfbuzz-sys workaround.

It seems to be unnecessary now, possibly due to the updated usvg. This might fix #1323 (although I'm unable to reproduce it right now).

+1 -4

0 comment

1 changed file

pr created time in 2 days

create barnchjneem/druid

branch : harfbuzz

created branch time in 2 days

issue commentlinebender/druid

Segmentation fault (core dumped) when using MenuDesc widget and svg feature

So I just noticed that harfbuzz-sys defaults to building its own copy of harfbuzz instead of linking to the system version. It seems likely that this is causing some issues; I'll have a PR up for testing in a minute.

ivanceras

comment created time in 2 days

issue commentlinebender/druid

Segmentation fault (core dumped) when using MenuDesc widget and svg feature

Thanks for the backtrace, but unfortunately it's a bit tricky to interpret. My wild guess is that we're somehow linking to the wrong version of harfbuzz (because it looks like the only effect of enabling "svg" is that it restricts the harfbuzz-rs version...)

ivanceras

comment created time in 3 days

issue commentlinebender/druid

Segmentation fault (core dumped) when using MenuDesc widget and svg feature

Are any of you able to get a backtrace using gdb? I found some instructions here.

ivanceras

comment created time in 3 days

push eventlinebender/druid

Jaap Aarts

commit sha 9d166f614ba3e70d54a684e3b8f74b1e5b5ee3a3

Rework blocking functions (#1336) Co-authored-by: Colin Rofls <colin@cmyr.net>

view details

push time in 7 days

PR merged linebender/druid

Rework blocking functions

Mostly reordering/commenting. I think most of these examples are like that, but for someone unfamiliar to the example/druid it can really help guide them through the example (at least from my experience.)

I also installed a spell checker, never needed it before since my projects weren't open source :tada:

+47 -38

0 comment

2 changed files

JAicewizard

pr closed time in 7 days

PullRequestReviewEvent

push eventlinebender/druid

Jaap Aarts

commit sha 62af6c40c5ec48d7bb33a1994222e406043091a8

Optional image features (#1340)

view details

push time in 7 days

PR merged linebender/druid

Optional image features

This is a follow up to https://github.com/linebender/piet/pull/342. For my simple use-case (https://martens-icons-website.netlify.app/) the WASM binary shrunk from 1.4MiB -> 0.8MiB uncompressed, making this a 60% WASM binary savings for this simple app not needing any image format. fixed #1305

+36 -1

1 comment

3 changed files

JAicewizard

pr closed time in 7 days

issue closedlinebender/druid

minimise features imported from `image` crate.

Right now using images in druid causes all default features of image to be imported. This means that I cannot disable features on my end, because druid will "need" them. I am sure druid doesn't need to encode/decode in any image format for me. The biggest one is "jpeg/rayon" which imports 20 crates or so, which is really not needed for druid. If this is something you agree with I can minimize the amount of features enabled for image and send in a PR.

closed time in 7 days

JAicewizard

pull request commentlinebender/druid

Rework anim

Thanks! The CI thing seems like it was related to version changes in piet.

JAicewizard

comment created time in 7 days

push eventlinebender/druid

Jaap Aarts

commit sha 6ab18da08969567f4e6af19db9d8f05478f52d76

Rework anim (#1333)

view details

push time in 7 days

PR merged linebender/druid

Rework anim

This is a really small one. I also retroactively added use druid::widget::prelude::* to the identity because I am pretty sure that is the recommended way of doing it, and anim.rs is a very small example.

This PR just moves the animation state to data and adds some documentation. I thought the state should usually be in data, but I might be wrong.

+23 -11

2 comments

2 changed files

JAicewizard

pr closed time in 7 days

PullRequestReviewEvent

Pull request review commentlinebender/druid

Optional image features

 image = ["druid-shell/image"] svg = ["usvg", "harfbuzz-sys"] x11 = ["druid-shell/x11"] +# passing on all the image features. AVIF is not supported because it does not+# support decoding, and thats al we use `Image` for.

that's all

JAicewizard

comment created time in 8 days

Pull request review commentlinebender/druid

Optional image features

 default = ["gtk"] gtk = ["gio", "gdk", "gdk-sys", "glib", "glib-sys", "gtk-sys", "gtk-rs", "gdk-pixbuf"] x11 = ["x11rb", "nix", "cairo-sys-rs"] +# passing on all the image features. AVIF is not supported because it does not+# support decoding, and thats al we use `Image` for.

that's all

JAicewizard

comment created time in 8 days

PullRequestReviewEvent
PullRequestReviewEvent

issue commentlinebender/druid

Druid book: what should go in `Data`?

Your "simple answer" covers 90% of the cases I've experienced. The other 10% of cases, I don't think we really have good idioms for yet.

JAicewizard

comment created time in 9 days

pull request commentlinebender/druid

Rework anim

Looks good, I just found one more typo. The () thing is definitely better than u32!

JAicewizard

comment created time in 9 days

Pull request review commentlinebender/druid

Rework anim

 // See the License for the specific language governing permissions and // limitations under the License. -//! An example of an animating widget.+//! An example of an animating widget. It is just a widget that+//! requests an animation frame when it needs to, and draws the frame in the+//! `paint` method.+//! Once the animation is over it simply stops requesting animation frames.+//! Usually we would put the state in the `Data`, but for things like animation+//! we don't. This is because the animation state is not useful to know for the+//! rest of the app. If this is something the rest of your widgets should know+//! about, you could put it in the data put it in the `data`.

put it in the in the put it in :)

JAicewizard

comment created time in 9 days

PullRequestReviewEvent

Pull request review commentlinebender/druid

Rework anim

 // See the License for the specific language governing permissions and // limitations under the License. -//! An example of an animating widget.+//! An example of an animating widget. It is just a widget that+//! requests an animation frame when it needs to, and draws the frame in the+//! `paint` method.+//! Once the animation is over it simply stops requesting animation frames.+//! In this case the animation time(t) is in the data so that other widgets+//! can also read the state of the animation if needed. This can also be in+//! the widget itself, so that it is not part of the data.  use std::f64::consts::PI;  use druid::kurbo::{Circle, Line}; use druid::widget::prelude::*; use druid::{AppLauncher, Color, LocalizedString, Point, Vec2, WindowDesc}; -struct AnimWidget {-    t: f64,-}+struct AnimWidget {} -impl Widget<u32> for AnimWidget {-    fn event(&mut self, ctx: &mut EventCtx, event: &Event, _data: &mut u32, _env: &Env) {+impl Widget<f64> for AnimWidget {+    fn event(&mut self, ctx: &mut EventCtx, event: &Event, data: &mut f64, _env: &Env) {         match event {             Event::MouseDown(_) => {-                self.t = 0.0;+                *data = 0.0;                 ctx.request_anim_frame();             }             Event::AnimFrame(interval) => {-                ctx.request_paint();-                self.t += (*interval as f64) * 1e-9;-                if self.t < 1.0 {+                *data += (*interval as f64) * 1e-9;+                if *data < 1.0 {                     ctx.request_anim_frame();+                } else {+                    *data = 0.0;                 }             }             _ => (),         }     } -    fn lifecycle(&mut self, _ctx: &mut LifeCycleCtx, _event: &LifeCycle, _data: &u32, _env: &Env) {}+    fn lifecycle(&mut self, _ctx: &mut LifeCycleCtx, _event: &LifeCycle, _data: &f64, _env: &Env) {} -    fn update(&mut self, _ctx: &mut UpdateCtx, _old_data: &u32, _data: &u32, _env: &Env) {}+    fn update(&mut self, ctx: &mut UpdateCtx, old_data: &f64, data: &f64, _env: &Env) {+        //this is just some margin of error, not very meaningfull in any real way.

meaningful

JAicewizard

comment created time in 10 days

Pull request review commentlinebender/druid

Rework anim

 // See the License for the specific language governing permissions and // limitations under the License. -//! An example of an animating widget.+//! An example of an animating widget. It is just a widget that+//! requests an animation frame when it needs to, and draws the frame in the+//! `paint` method.+//! Once the animation is over it simply stops requesting animation frames.+//! In this case the animation time(t) is in the data so that other widgets+//! can also read the state of the animation if needed. This can also be in+//! the widget itself, so that it is not part of the data.  use std::f64::consts::PI;  use druid::kurbo::{Circle, Line}; use druid::widget::prelude::*; use druid::{AppLauncher, Color, LocalizedString, Point, Vec2, WindowDesc}; -struct AnimWidget {-    t: f64,-}+struct AnimWidget {}

I think having the time in the data makes sense for this tiny example, but I think it's a better practice in larger apps to have the animation state in the widget, not the data. And then because people look at the examples to get an idea of best practices, I think it's better to have it in the widget here.

The reason animation state usually lives in the widget is because it's a piece of transient data that isn't usually interesting for the app as a whole. You can see the built-in Switch widget for an example -- it has a bool related to the animation state, and it would be annoying if every time you used Switch, you had to reserve a bool for it in your app's data.

JAicewizard

comment created time in 10 days

PullRequestReviewEvent
PullRequestReviewEvent
PullRequestReviewEvent

issue commentlinebender/druid

Animation interferes with timer

This should be fixed, with the caveat that timers might still get delayed while dragging or resizing, or during a modal dialog. Fixing those would require a more substantial rework.

bheisler

comment created time in 10 days

issue closedlinebender/druid

Animation interferes with timer

Platform: Windows 10

Code: https://gist.github.com/bheisler/f1185c6de8d8ee064fe2b3b215050aae

Druid Version: Latest git

[dependencies]
druid = { git = "https://github.com/linebender/druid.git", version = "0.6" }

I noticed that timer events don't seem to be delivered while a widget is animating. I found this surprising, as did several others on the Druid zulip, so I wrote a small test case to demonstrate this behavior.

To reproduce, run the example code and click the "Start Timer and Animation" button. About five seconds later, it will print something like this to the command line: Timer completed after 5.0059584s. Expected time: 1s. Animation time: 5s.

The timer is registered for one second, not five, so this is surprising. However, if you comment out ctx.request_anim_frame(); on either line 32 or 41, then the timer completes after about one second, as expected: Timer completed after 0.9909591s. Expected time: 1s. Animation time: 5s.

You can also adjust ANIMATION_TIME to control how long the custom widget animates for; the timer event will not be delivered until after the animation stops.

closed time in 10 days

bheisler

push eventlinebender/druid

jneem

commit sha 7f1fa183c9291bc8fea4dc02412777c423b6111b

[windows] Use the PeekMessage trick to make timers less laggy. (#1332)

view details

push time in 10 days

PR merged linebender/druid

Try using the PeekMessage trick to make timers less laggy.

This is an attempt at fixing #1277.

+19 -4

1 comment

1 changed file

jneem

pr closed time in 10 days

push eventlinebender/druid

jneem

commit sha bed8894d8d6402f9e358a6dd287c06804e9791bf

Implement a ClipBox widget as a building block for widgets that scroll.

view details

push time in 11 days

PR merged linebender/druid

Another try at a viewport widget.

Here's another stab at a viewport widget. This one differs from the previous one in that it doesn't make ScrollComponent depend on the viewport widget. It does make other changes to ScrollComponent, though. Specifically, it separates the "viewport state" (which I've called RectPort) from the scrollbar state. The scroll component no longer stores the viewport state; in methods that need to modify the viewport state, it gets a mutable reference. The reason for this was that I wanted to make these modifications explicit for the caller, because the caller will typically need to do something in response to the viewport changing.

+458 -266

9 comments

5 changed files

jneem

pr closed time in 11 days

Pull request review commentlinebender/druid

[mac] Adopt new save/open API

 impl WindowHandle {         }     } -    pub fn open_file_sync(&mut self, options: FileDialogOptions) -> Option<FileInfo> {-        dialog::get_file_dialog_path(FileDialogType::Open, options)-            .map(|s| FileInfo { path: s.into() })-    }--    pub fn open_file(&mut self, _options: FileDialogOptions) -> Option<FileDialogToken> {-        // TODO: implement this and get rid of open_file_sync+    pub fn open_file_sync(&mut self, _options: FileDialogOptions) -> Option<FileInfo> {+        log::warn!("open_file_sync should no longer be called on mac!");         None     } -    pub fn save_as_sync(&mut self, options: FileDialogOptions) -> Option<FileInfo> {-        dialog::get_file_dialog_path(FileDialogType::Save, options)-            .map(|s| FileInfo { path: s.into() })+    pub fn open_file(&mut self, options: FileDialogOptions) -> Option<FileDialogToken> {+        let token = FileDialogToken::next();+        let self_clone = self.clone();+        unsafe {+            let panel = dialog::build_panel(FileDialogType::Open, options);+            let block = ConcreteBlock::new(move |response: dialog::NSModalResponse| {+                let url = dialog::get_path(panel, response).map(|s| FileInfo { path: s.into() });+                let view = self_clone.nsview.load();+                if let Some(view) = (*view).as_ref() {+                    let view_state: *mut c_void = *view.get_ivar("viewState");+                    let view_state = &mut *(view_state as *mut ViewState);+                    (*view_state).handler.open_file(token, url);+                }+            });+            let block = block.copy();+            let () = msg_send![panel, beginWithCompletionHandler: block];+        }+        Some(token)     } -    pub fn save_as(&mut self, _options: FileDialogOptions) -> Option<FileDialogToken> {-        // TODO: implement this and get rid of save_as_sync+    pub fn save_as_sync(&mut self, _options: FileDialogOptions) -> Option<FileInfo> {+        log::warn!("save_as_sync should no longer be called on mac!");         None     } +    pub fn save_as(&mut self, options: FileDialogOptions) -> Option<FileDialogToken> {+        let token = FileDialogToken::next();+        let self_clone = self.clone();+        unsafe {+            let panel = dialog::build_panel(FileDialogType::Save, options);

Looks like except for FileDialogType::Save this is identical to open_file?

cmyr

comment created time in 11 days

PullRequestReviewEvent
PullRequestReviewEvent

pull request commentlinebender/druid

Try using the PeekMessage trick to make timers less laggy.

Ok, I've added a little warning and I'll push if the CI clears it. I confess to knowing basically nothing about how the message loop works on windows, and so for example I don't really understand your comment about WM_PAINT (because I thought we had established that we weren't clogging up the message queue with WM_PAINT messages, although I'm still mystified as to why the timer events weren't getting through).

jneem

comment created time in 11 days

push eventjneem/druid

Joe Neeman

commit sha 788326ed506678f364d0559e06a29974d31c77ca

Add a comment about when our message loop runs.

view details

push time in 11 days

issue commentlinebender/druid

Animation interferes with timer

Thanks for checking! I've opened a PR

bheisler

comment created time in 11 days

PR opened linebender/druid

Try using the PeekMessage trick to make timers less laggy.

This is an attempt at fixing #1277.

+15 -3

0 comment

1 changed file

pr created time in 11 days

issue commentlinebender/druid

Animation interferes with timer

I had a quick stab at doing what the blog post suggested, but I don't have a windows machine handy right this second for testing. @bheisler , if you have a minute to test it, does this branch help?

bheisler

comment created time in 11 days

create barnchjneem/druid

branch : win-timers

created branch time in 11 days

pull request commentlinebender/druid

Rework examples

I feel like every time I want to unmark something as draft, I spend at least 5 minutes searching for the button...

JAicewizard

comment created time in 11 days

push eventlinebender/druid

Jaap Aarts

commit sha cb3349961209b31037b37593fcd75b49d2b2f15a

Rework `identity` example (#1330)

view details

push time in 11 days

PR merged linebender/druid

Rework examples

On zulip @cmyr mentioned a cleanup of the examples would be welcome, I am not completely sure what was meant by this. This is a sample for simplefying/redocumenting the examples, if this is what was needed I can do this for all the others as well. I removed some unnecessary code, reordered it to me on-point (the widget itself is not the point of this example) and refactored some code to be more comment-friendly.

+63 -108

5 comments

1 changed file

JAicewizard

pr closed time in 11 days

PullRequestReviewEvent

issue commentlinebender/druid

Segmentation fault (core dumped) when using MenuDesc widget and svg feature

Thanks for the report! I'm having trouble reproducing, though, even with the exact same commit. Are you able to produce a backtrace?

ivanceras

comment created time in 11 days

pull request commentlinebender/druid

Rework examples

Got it, thanks. The first comment makes much more sense to me now, and it also makes the names make more sense. Can I go ahead and merge? I would have just done it, but I noticed you've still got it marked as a draft...

JAicewizard

comment created time in 11 days

Pull request review commentlinebender/druid

Rework examples

 impl Widget<OurData> for ColorWell {     }      fn update(&mut self, ctx: &mut UpdateCtx, old_data: &OurData, data: &OurData, _: &Env) {-        if !old_data.same(data) {+        if old_data.color.as_rgba_u32() != data.color.as_rgba_u32() {

Color implements PartialEq already, so you shouldn't need the as_rgba_u32

JAicewizard

comment created time in 11 days

Pull request review commentlinebender/druid

Rework examples

 const FREEZE_COLOR: Selector<Color> = Selector::new("identity-example.freeze-col const UNFREEZE_COLOR: Selector = Selector::new("identity-example.unfreeze-color");  /// Honestly: it's just a color in fancy clothing.-#[derive(Debug, Clone, Data, Lens)]+#[derive(Clone, Data)] struct OurData {-    #[data(same_fn = "color_eq")]     color: Color, } -fn color_eq(one: &Color, two: &Color) -> bool {-    one.as_rgba_u32() == two.as_rgba_u32()+pub fn main() {+    let window = WindowDesc::new(make_ui).title(+        LocalizedString::new("identity-demo-window-title").with_placeholder("Color Freezing Fun"),+    );+    let data = OurData {+        color: Color::BLACK,+    };+    AppLauncher::with_window(window)+        .launch(data)+        .expect("launch failed"); } -fn split_rgba(rgba: &Color) -> (u8, u8, u8, u8) {-    let rgba = rgba.as_rgba_u32();-    (-        (rgba >> 24 & 255) as u8,-        ((rgba >> 16) & 255) as u8,-        ((rgba >> 8) & 255) as u8,-        (rgba & 255) as u8,-    )+/// A constant `WidgetId`. This may be passed around and can be reused when+/// rebuilding a widget graph; however it should only ever be associated with+/// a single widget at a time.+const ID_ONE: WidgetId = WidgetId::reserved(1);++fn make_ui() -> impl Widget<OurData> {+    // We can also generate these dynamically whenever we need it.+    let id_two = WidgetId::next();+    let id_three = WidgetId::next();++    let mut column = Flex::column().with_flex_child(ColorWell::new(true), 1.0);+    // This doenst need to be a loop, but it allows us to seperate the creation of the buttons and the colorwell.+    for &id in &[ID_ONE, id_two, id_three] {+        // Here we can se the `id` to make sure all the buttons corelate with the colorwell.+        // We give the colorwell an id, and we use that same id to target our commands to that widget specifically.+        // This allows us to send commands to only one widget, and not the whole window for example.+        // In this case, when the buttons are clicked we send a command to the corresponding colorwell.+        let colorwell = ColorWell::new(false).with_id(id);+        let pin_button = Button::<OurData>::new("pin").on_click(move |ctx, data, _env| {

Not that I really mind, but is there a reason you changed freeze/unfreeze to pin/sync?

JAicewizard

comment created time in 11 days

PullRequestReviewEvent

Pull request review commentlinebender/druid

Rework examples

 const FREEZE_COLOR: Selector<Color> = Selector::new("identity-example.freeze-col const UNFREEZE_COLOR: Selector = Selector::new("identity-example.unfreeze-color");  /// Honestly: it's just a color in fancy clothing.-#[derive(Debug, Clone, Data, Lens)]+#[derive(Clone, Data)] struct OurData {-    #[data(same_fn = "color_eq")]     color: Color, } -fn color_eq(one: &Color, two: &Color) -> bool {-    one.as_rgba_u32() == two.as_rgba_u32()+pub fn main() {+    let window = WindowDesc::new(make_ui).title(+        LocalizedString::new("identity-demo-window-title").with_placeholder("Color Freezing Fun"),+    );+    let data = OurData {+        color: Color::BLACK,+    };+    AppLauncher::with_window(window)+        .launch(data)+        .expect("launch failed"); } -fn split_rgba(rgba: &Color) -> (u8, u8, u8, u8) {-    let rgba = rgba.as_rgba_u32();-    (-        (rgba >> 24 & 255) as u8,-        ((rgba >> 16) & 255) as u8,-        ((rgba >> 8) & 255) as u8,-        (rgba & 255) as u8,-    )+/// A constant `WidgetId`. This may be passed around and can be reused when+/// rebuilding a widget graph; however it should only ever be associated with+/// a single widget at a time.+const ID_ONE: WidgetId = WidgetId::reserved(1);++fn make_ui() -> impl Widget<OurData> {+    // We can also generate these dynamically whenever we need it.+    let id_two = WidgetId::next();+    let id_three = WidgetId::next();++    let mut column = Flex::column().with_flex_child(ColorWell::new(true), 1.0);+    // This doenst need to be a loop, but it allows us to seperate the creation of the buttons and the colorwell.+    for &id in &[ID_ONE, id_two, id_three] {+        // Here we can se the `id` to make sure all the buttons corelate with the colorwell.

see, correlate

JAicewizard

comment created time in 11 days

Pull request review commentlinebender/druid

Rework examples

 //! //! This example is fairly contrived; the basic idea is that there are three //! rows of widgets, each containing a ColorWell and two buttons. One button-//! 'freezes' the ColorWell, sending it a color to display. The second button-//! 'unfreezes' the ColorWell, which makes it start displaying random colors.+//! 'pins' the ColorWell, sending it a color to display. The second button+//! 'syncs' the ColorWell, which makes it start displaying random colors. just+//! like the top widget

I found this confusing on the first read-through because the "top widget" hasn't been mentioned yet.

JAicewizard

comment created time in 11 days

Pull request review commentlinebender/druid

Rework examples

 const FREEZE_COLOR: Selector<Color> = Selector::new("identity-example.freeze-col const UNFREEZE_COLOR: Selector = Selector::new("identity-example.unfreeze-color");  /// Honestly: it's just a color in fancy clothing.-#[derive(Debug, Clone, Data, Lens)]+#[derive(Clone, Data)] struct OurData {-    #[data(same_fn = "color_eq")]     color: Color, } -fn color_eq(one: &Color, two: &Color) -> bool {-    one.as_rgba_u32() == two.as_rgba_u32()+pub fn main() {+    let window = WindowDesc::new(make_ui).title(+        LocalizedString::new("identity-demo-window-title").with_placeholder("Color Freezing Fun"),+    );+    let data = OurData {+        color: Color::BLACK,+    };+    AppLauncher::with_window(window)+        .launch(data)+        .expect("launch failed"); } -fn split_rgba(rgba: &Color) -> (u8, u8, u8, u8) {-    let rgba = rgba.as_rgba_u32();-    (-        (rgba >> 24 & 255) as u8,-        ((rgba >> 16) & 255) as u8,-        ((rgba >> 8) & 255) as u8,-        (rgba & 255) as u8,-    )+/// A constant `WidgetId`. This may be passed around and can be reused when+/// rebuilding a widget graph; however it should only ever be associated with+/// a single widget at a time.+const ID_ONE: WidgetId = WidgetId::reserved(1);++fn make_ui() -> impl Widget<OurData> {+    // We can also generate these dynamically whenever we need it.+    let id_two = WidgetId::next();+    let id_three = WidgetId::next();++    let mut column = Flex::column().with_flex_child(ColorWell::new(true), 1.0);+    // This doenst need to be a loop, but it allows us to seperate the creation of the buttons and the colorwell.

doesn't, separate

JAicewizard

comment created time in 11 days

PullRequestReviewEvent

pull request commentlinebender/druid

Make dialogs on windows non-sychronous.

@rhzk I got an email notification that you left a comment, but I can't see it now...

jneem

comment created time in 11 days

push eventjneem/druid

Joe Neeman

commit sha e8f85c7a7e5e48f8ef9cd9a2dbf61c0f0837ba78

Add CHANGELOG entry.

view details

push time in 14 days

PR opened linebender/druid

Make dialogs on windows non-sychronous.

This does #1068 for windows.

+228 -313

0 comment

4 changed files

pr created time in 14 days

push eventjneem/druid

Joe Neeman

commit sha 6513a6058cad1e846f689e4099f501d2126da5a2

Make dialogs on windows non-sychronous.

view details

push time in 14 days

push eventjneem/druid

Joe Neeman

commit sha 3a4db4d095c21134bcd12a7c021ba1d788ce26ec

Make dialogs on windows non-sychronous.

view details

push time in 14 days

create barnchjneem/druid

branch : windows-async

created branch time in 14 days

more