1
0
Fork 0
Commit graph

411 commits

Author SHA1 Message Date
Robbert van der Helm c5867b6af6 Use interior mutability for Windows WindowState
This is a prerequisite for being able to handle reentrant messages.
2022-11-30 20:03:12 +01:00
Robbert van der Helm 3dfff613b9 Use physical sizes in X11 window resize
And update the window info for any future events.
2022-11-30 20:03:12 +01:00
Robbert van der Helm d61f21666c Add window resizing for X11 2022-11-30 20:03:12 +01:00
william light ee156fb884
Merge pull request #133 from robbert-vdh/feature/horizontal-scrolling
Support horizontal scrolling on Linux and Windows
2022-11-22 15:55:04 +01:00
Robbert van der Helm f2ca0ffa6d Support horizontal scrolling on Windows 2022-11-22 15:42:10 +01:00
Robbert van der Helm 9798d3ca86 Support horizontal scrolling on X11
This was previously bound to the mouse forwards/back
buttons (canonically mouse 4 and 5).
2022-11-22 15:39:49 +01:00
Robbert van der Helm 025f34b80f Map mouse forward and back correctly on X11
Buttons 6 and 7 are for horizontal scrolling, just like buttons 4 and 5
are for vertical scrolling. I couldn't find a list of button numbers in
the X11 protocol specs, but this is what the buttons are bound to on my
Logitech G502 and
http://xahlee.info/linux/linux_x11_mouse_button_number.html also
confirms this.
2022-11-22 15:32:43 +01:00
william light 84f10763a3
Merge pull request #132 from robbert-vdh/fix/x11-frame-pacing
Ensure a consistent frame pacing in X11 windows
2022-11-18 18:06:11 +01:00
Robbert van der Helm 13cc12d4e7 Ensure a consistent frame pacing in X11 windows
The next frame's time stamp needs to be computed based on the last
frame's, not based on the current time, unless the last frame took too
long to process.
2022-11-18 15:24:33 +01:00
William Light 1780c89baf macos/view: fix compilation 2022-11-13 02:22:53 +01:00
william light eeded04b3e
Merge pull request #110 from ingo-dsp/macos-scrollwheel
macOS: scroll event handling
2022-11-13 02:14:16 +01:00
william light eae4033e7d
Merge pull request #117 from robbert-vdh/feature/mouse-event-modifiers
Add the active keyboard modifiers to the mouse events
2022-09-22 16:36:24 +02:00
Ingo Budde 3dd255f238 Merge branch 'master' into macos-scrollwheel 2022-07-24 00:25:46 +02:00
Robbert van der Helm 5b57af2463 Add the active modifiers to the mouse event
This would solve the most important use case for #116. Only the Linux
version has been tested, but the Windows should work perfectly fine, and
I don't know anything about macOS programming but that version also
compiles so it should be fine.
2022-03-11 22:28:42 +01:00
Robbert van der Helm e46001a448 Remove unused mouse click event
Since this isn't emitted anywhere, this can only lead to confusion for
library consumers. They'd need to implement their own click detection
with the button up and button down events.
2022-03-11 22:28:42 +01:00
Micah Johnston b3712638ba
Merge pull request #115 from robbert-vdh/feature/merge-raw-gl-context
Merge raw-gl-context into baseview to allow OpenGL contexts to be created during window creation
2022-03-07 12:22:30 -06:00
Robbert van der Helm 85b6437de8 Swap out X11 error handling mutex for a RefCell 2022-03-07 18:53:07 +01:00
Robbert van der Helm 0aae938af0 Remove unnecessary unsafe blocks 2022-03-07 18:41:29 +01:00
Robbert van der Helm ef86e56ac7 Keep the first X11 error 2022-03-07 18:17:50 +01:00
Robbert van der Helm aa1ad823ce Use a thread local variable for the X11 error
So in the situation that multiple X11 clients are handling errors from
different threads they don't see and interfere with each other's errors.

As mentioned in
https://github.com/glowcoil/raw-gl-context/pull/15#pullrequestreview-891405163.
2022-03-07 18:13:47 +01:00
Robbert van der Helm ba442a4382 Fix overlapping cell borrows in Windows impl
b4a3d2bb04 missed some immutable borrows,
but these borrows need to be local anyways because of the way the
closing is implemented.
2022-02-10 03:14:01 +01:00
Robbert van der Helm 43860aba84 Fix a whackton of warnings and clippy lints
The things remaining are all of the cursor things in the X11
implementation (there's _a lot_ of it, so there's probably a reason why
it's all still there but unused), and the super unsound immutable
reference to mutable reference cast in the macOS implementation that
Clippy automatically errors out on.
2022-02-07 23:10:53 +01:00
Robbert van der Helm d83517565b Implement the OpenGL context on macOS 2022-02-07 22:43:38 +01:00
Robbert van der Helm fe107ab378 Implement the OpenGL context on Windows 2022-02-07 22:36:37 +01:00
Robbert van der Helm 2f7f177be8 Move RawWindowHandleWrapper to a shared module
We're going to need this for the other platforms as well.
2022-02-07 21:51:54 +01:00
Robbert van der Helm 690a94f9f1 Enable the glx feature for the x11 crate 2022-02-07 21:41:45 +01:00
Robbert van der Helm cb714401d8 Build both with and without opengl on CI 2022-02-07 20:25:01 +01:00
Robbert van der Helm 3551d5e253 Implement OpenGL contexts for X11
This should in theory work! When requesting an OpenGL context, the
window visual is determined based on the matched framebuffer config.
2022-02-07 20:23:13 +01:00
Robbert van der Helm b4a3d2bb04 Add stubs for creating OpenGL contexts
There are now three todo!()s when compiling with the OpenGL flag that
need to be filled in, with the only nontrivial one being the X11
version.
2022-02-07 19:00:48 +01:00
Robbert van der Helm 80802dfbe9 Make opengl context creation private for now 2022-02-07 18:05:32 +01:00
Robbert van der Helm 6105cae01d Mention OpenGL contexts in the readme 2022-02-07 17:59:40 +01:00
Robbert van der Helm d2e3d5d1ac Don't enable the OpenGL feature by default 2022-02-07 17:58:45 +01:00
Robbert van der Helm 0f1b8353d0 Patch up the raw-gl-context modules for a feature
This only needed a couple changes for the raw-window-handle migration,
and for the different module paths.
2022-02-07 17:31:19 +01:00
Robbert van der Helm 45e29b4891 Add the entire tree from raw-gl-handle
Including @prokopyl's PR that adds more X11 error handling:
https://github.com/glowcoil/raw-gl-context/pull/15

Commit: prokopyl@raw-gl-context@98cd3cf1104ee254a67e3fed30e4e6b2ae2b6821 (with `cargo fmt`)
Branch base: RustAudio/baseview@b68a05b4dc
2022-02-07 17:21:27 +01:00
Robbert van der Helm d76b02df44 Upgrade to raw-window-handle 0.4.x
The main change is that all of these types are simplified, there are
more different OS-specific window handle types, and they are no longer
gated behind the respective targets which makes the library a bit easier
to use for applications.
2022-02-07 17:13:51 +01:00
Robbert van der Helm 625fde7957 Create X11 windows with a depth of 32-bits
This should fix the inability to create OpenGL contexts with alpha
channels in raw-gl-context, but it seems like that still needs a bit
more work.
2022-02-07 13:20:46 +01:00
George Atkinson a8010016fb
Bump dependencies (#100) 2022-02-06 17:58:11 -06:00
Adrien Prokopowicz 89c051cccc
Add error checking on X11 window creation, and fix parented X11 window creation (#113) 2022-02-06 17:55:12 -06:00
Ingo Budde 912628030e Add scrollwheel support for macos 2022-01-17 20:23:36 +01:00
Joakim Frostegård 004065e9a4
macOS: clear ivar earlier to prevent double free in release (#108) 2021-12-07 18:39:54 -06:00
Billy Messenger f6e99e9aa6
add ability to close window from user code, add HostWindowHandle (#103)
* add ability to close window from user code, add HostWindowHandle

* fix manual close method for Mac, rename HostWindowHandle to ChildWindowHandle

* fix rustfmt.toml and run cargo format

* fix merge conflict mistake

* fix more merge conflict mistakes

* implement requested changes (with a non-broken commit this time)

* implement requested changes

* slight reordering of impls
2021-11-16 00:00:22 -06:00
Pedro Tacla Yamada 2a894c6bc9
Run cargo fmt on source files (#106)
* Run cargo fmt on source files

* Update with rustfmt.toml

* Change rustfmt configuration and run it again
2021-11-10 00:57:54 -06:00
glowcoil 9fbfe18f9a
NSView lifetime fixes (#104)
* drain autorelease pools in Window::open_* methods

* fixes to NSView lifetime logic:

- in open_parented and open_blocking, release NSView after adding
  it as a subview of the parent
- in open_blocking, don't call autorelease on NSWindow. previously
  it was a no-op, but now that we are actually draining our
  autorelease pools, it ends up prematurely releasing the window.

* fixes to NSView cleanup logic:

- Move retainCount check to before calling [super release].
  If [super release] happens first, then in the final call to
  release, [super release] deallocates the object and the call to
  retainCount results in a segfault.

- Move objc_disposeClassPair to dealloc. Previously we were
  calling it when retainCount == 1, but that's exactly when
  dealloc is called, so this is cleaner. Also, we need to call
  objc_disposeClassPair after [super dealloc].

NOTE: The circular-reference-breaking logic in release is
definitely broken. It's easy to thwart it by e.g. creating a
wgpu surface at some point after build() or dropping one at some
point before drop(). Need to come up with a better solution.
2021-11-07 16:57:12 -06:00
william light 6172090be3
Merge pull request #102 from DGriffin91/master
add scrollwheel support for windows
2021-10-10 02:11:07 +02:00
DGriffin91 6bfcfbb74d add scrollwheel support for windows 2021-10-09 16:52:56 -07:00
william light e7a6c661ef
Merge pull request #97 from BillyDM/master
send initial window resized event in x11
2021-07-16 12:36:40 +02:00
william light de8316c5fc
Merge pull request #98 from greatest-ape/better-ci
Build examples too in CI
2021-07-16 12:36:03 +02:00
Joakim Frostegård 5eb17ed0fd Build examples too in CI 2021-07-16 01:10:29 +02:00
Billy Messenger ae2f28c5fd add window resizing and dpi scaling support in Windows 2021-07-14 19:32:28 -05:00
Billy Messenger f7873f1854 typo 2021-07-14 11:45:06 -05:00