1
0
Fork 0
Go to file
Joakim Frostegård 2167a091fa
macOS: basic event handling (#52)
* macOS: add basic event handling

* macos: don't store subview pointer in WindowHandle

* macOS: mention inspiration from antonok's vst_window crate, clean up

* Add Anton Lazarev and myself to author list

* macOS: fix event handling issues

- Rename EventDelegate to WindowState
- Make Window.ns_window optional, only set it if parentless
- Put our own NSView subclass in Window.ns_view
- Don't create useless "intermediate" NSView in parentless mode

* macOS: use Arc::from_raw in WindowHandler dealloc fn

* macOS: move subview code own file, handle more mouse events

* macOS: add (non-tested) support for AsIfParented window

* macOS: rename subview module to view

* macOS: rename "mouse_click_extern_fn!" to "mouse_button_extern_fn!"

This avoids confusion with the click event

* macOS: make WindowState Arc wrapping code clearer

* macOS: handle basic key press and release events

* macOS: accept mouseMoved events, don't trigger them on clicks

* macOS: fix cursor movement location conversion

* macOS: add WindowState.trigger_event fn, make fields private

* macOS: in view, set preservesContentInLiveResize to NO

* macOS: add NSTrackingArea, cursor enter/exit events, better window init

* macOS: remove unused WindowState.size field

* macOS: acceptFirstMouse = YES in view

* macOS: rename macro mouse_button_extern_fn to mouse_simple_extern_fn

* macOS: remove key event handling, it will be implemented differently

* macOS: trigger CursorMoved on right and middle mouse drag

* macOS: run NSEvent.setMouseCoalescingEnabled(NO)

* macOS: clean up

* macOS: non-parented mode: don't "activate ignoring other apps"

This is rarely necessary according to
https://developer.apple.com/documentation/appkit/nsapplication/1428468-activate
and I don't see any reason why we would need to do it.

* macOS: call NSApp() before doing more work in non-parented mode

* macOS: don't attempt to declare NSView subclass multiple times

* macOS: add random suffix to name of NSView subclass to prevent issues

* macOS: send tracking area options as a usize (objc UInt)

* macOS: use UUID for class name suffix

* macOS: fix view_will_move_to_window super call

* macOS: drop WindowState when our NSView is released

* macOS: in Window::open, autorelease an NSString that was allocated

* macOS: delete our view class when the view is released

* Upgrade cocoa dependency to version 0.24.0

* macOS: reorder some code in view.rs

* macOS: mark WindowState::from_field as unsafe, update doc comment

* macOS: in HasRawWindowHandle impl, use unwrap_or for ns_window
2020-11-11 16:04:40 -06:00
.github/workflows fix Windows build 2020-10-20 17:04:37 -05:00
examples clean up dpi features 2020-10-20 19:02:45 -05:00
src macOS: basic event handling (#52) 2020-11-11 16:04:40 -06:00
.gitignore fix Windows build 2020-10-20 17:04:37 -05:00
.rustfmt.toml fix Windows build 2020-10-20 17:04:37 -05:00
Cargo.toml macOS: basic event handling (#52) 2020-11-11 16:04:40 -06:00
README.md fix Windows build 2020-10-20 17:04:37 -05:00

baseview

A low-level windowing system geared towards making audio plugin UIs.

baseview abstracts the platform-specific windowing APIs (winapi, cocoa, xcb) into a platform-independent API, but otherwise gets out of your way so you can write plugin UIs.

Interested in learning more about the project? Join us on discord, channel #plugin-gui.

Roadmap

Below is a proposed list of milestones (roughly in-order) and their status. Subject to change at any time.

Feature Windows Mac OS Linux
Spawns a window, no parent ✔️ ✔️ ✔️
Cross-platform API for window spawning ✔️ ✔️ ✔️
Window uses an OpenGL surface ✔️ ✔️
Can find DPI scale factor ✔️
Basic event handling (mouse, keyboard) ✔️
Parent window support
(Converge on a common API for all platforms?)