1
0
Fork 0
Commit graph

382 commits

Author SHA1 Message Date
Micah Johnston
7d14a555e5
Expose public Window::set_mouse_cursor method (#161)
The X11 backend has a full implementation of a `Window::set_mouse_cursor` method, but it isn't exposed via any public interface, which results in a lot of warnings for unused code. Add a public `set_mouse_cursor` method, along with stubbed-out versions in the Windows and macOS backends.
2023-12-17 02:12:31 -06:00
Micah Johnston
0976a9a6a4
macOS: use interior mutability for WindowState (#157)
Forming mutable references to the WindowState is unsound given the possibility
of reentrant calls to NSView methods. Instead, form only immutable references
to the WindowState and wrap mutable fields in Cell and RefCell.

Follow-up work should use try_borrow_mut instead of borrow_mut to avoid
panicking in the case of reentrant calls.
2023-12-16 19:37:21 -06:00
Micah Johnston
1b8c8760c7
Fix warnings on windows (#159) 2023-12-17 01:33:12 +00:00
Micah Johnston
b59a67d287
Fix warnings on X11 (#160) 2023-12-17 01:31:06 +00:00
Micah Johnston
92f1a19b81
Fix warnings in example (#158) 2023-12-16 19:29:27 -06:00
Micah Johnston
348bc9fe61
Remove RawWindowHandleWrapper (#156)
RawWindowHandleWrapper is only necessary since GlContext::create takes an `impl
HasRawWindowHandle` argument, but GlContext::create is an internal unsafe API
and it is can just take a RawWindowHandle directly.
2023-12-12 11:47:32 -06:00
Micah Johnston
3ecc88f9fc
Fix warnings on macos (#155) 2023-12-12 17:40:45 +00:00
Micah Johnston
df0e3928a2
Remove Window::open_as_if_parented (#153)
The open_as_if_parented method was intended to support the use case of Audio
Unit plugin views. However, the Audio Unit API differs in important ways from
other plugin APIs (such as VST 3 and CLAP) with regard to the lifetime
management of the plugin's NSView, and trying to support both lifetime
management patterns simultaneously has been the source of complexity and bugs.
Thus, rather than implementing Audio Unit NSView management directly in
Baseview, it will be the responsibility of plugin frameworks to implement a
compatibility layer between the Audio Unit API and the Baseview API.
2023-12-12 16:45:12 +00:00
Micah Johnston
d08f7afd49
Run rustfmt (#154) 2023-12-12 10:41:03 -06:00
Nick Gideo
d8e3b52acd
Merge pull request #149 from ilmai/drag-and-drop-mac
Drag and drop for Mac OS
2023-12-09 16:13:14 -06:00
Nick Gideo
dbf4623b6e
Merge branch 'master' into drag-and-drop-mac 2023-12-09 16:12:05 -06:00
Robbert van der Helm
f0639b787b
Merge pull request #151 from Fredemus/feature/x11-cursor-enter-leave
Add logic for CursorEntered/CursorLeft on x11
2023-10-08 14:02:37 +02:00
Fredemus
486bb1f069 add MouseMoved event when ENTER_NOTIFY happens 2023-10-07 16:23:12 +02:00
Robbert van der Helm
54af726498
Merge pull request #134 from greatest-ape/raw-window-handle-0.5
Upgrade to raw-window-handle version 0.5
2023-10-07 15:12:01 +02:00
Fredemus
fd1a3a4d2e Add logic for CursorEntered/CursorLeft on x11 2023-10-03 17:14:33 +02:00
Joakim Frostegård
0df43486ba X11: provide XlibWindowHandle.visual_id 2023-09-30 17:03:20 +02:00
Joakim Frostegård
4130502a2a X11 GlContext::create: change display arg to *mut xlib::XDisplay 2023-09-30 17:03:20 +02:00
Joakim Frostegård
70f46a691d X11: set XlibDisplayHandle.screen 2023-09-30 17:03:20 +02:00
Joakim Frostegård
e35f3080f6 Fix Windows compilation issue 2023-09-30 17:03:20 +02:00
Joakim Frostegård
10c970a329 Fix X11 OpenGL issue 2023-09-30 17:03:20 +02:00
Joakim Frostegård
6f32584149 X11: set XlibWindowHandle.window and XlibDisplayhandle.display 2023-09-30 17:03:20 +02:00
Joakim Frostegård
eb94b4d7ab Impl HasRawDisplayHandle on Window, not WindowHandle 2023-09-30 17:03:20 +02:00
Joakim Frostegård
5c23c62030 Add dummy HasRawDisplayHandle impls for Windows and X11 2023-09-30 17:01:15 +02:00
Joakim Frostegård
1c0490f9ec Upgrade to raw-window-handle 0.5, impl HasRawDisplayHandle for macOS 2023-09-30 17:00:08 +02:00
Jussi Viiri
8270260382 Working drag and drop for Mac OS 2023-06-20 17:30:30 +03:00
Jussi Viiri
1921d477ff Start implementing drag and drop for Mac 2023-06-19 19:11:39 +03:00
Micah Johnston
1d9806d5bd
Merge pull request #148 from ilmai/drag-and-drop
Drag and drop
2023-06-18 13:01:57 -05:00
Jussi Viiri
9887737d8d Add comment about why we need to transmute
IDropTargetVtbl members
2023-06-18 20:40:17 +03:00
Jussi Viiri
cfa06f5b59 Move DropTarget to its own module 2023-06-10 23:20:46 +03:00
Jussi Viiri
b33398703f Walk back the previous restructuring a bit
We were leaking the DropTarget, so WindowState holds a reference to DropTarget again, so it can be dropped when the window is destroyed. Also, DropTarget now holds a Weak reference to WindowState and that's taken into account in callbacks.
2023-06-10 23:07:11 +03:00
Jussi Viiri
9028321012 Call RevokeDragDrop() before dropping WindowState 2023-06-10 23:02:25 +03:00
Jussi Viiri
481bf73293 Clean up ownership around WindowState and DropTarget
- WindowState no longer holds a reference to DropTarget
- DropTarget is passed to RegisterDragDrop() with Rc::into_raw() instead of Rc::as_ptr() so it keeps the reference
- WindowState is created with Rc instead of Box so DropTarget can hold a Rc to it
2023-06-10 22:47:22 +03:00
Jussi Viiri
eb3a02115a Change how DragTarget functions parse coordinates
Instead of working around the winapi bug by manually parsing the pointer we're (incorrectly) given, use the correct function signature and transmute the function pointer
2023-06-10 22:21:37 +03:00
Jussi Viiri
2019efde65 Use Rc instead of Arc for DropTarget 2023-06-10 22:01:23 +03:00
Jussi Viiri
4f0a71736c Remove unnecessary transmute 2023-06-10 21:58:31 +03:00
Jussi Viiri
e47f25facd DropTargetVtbl instance is const now 2023-06-10 21:52:44 +03:00
Jussi Viiri
92d7560f4b Document EventStatus::AcceptDrop 2023-06-05 22:24:29 +03:00
Jussi Viiri
ab673fe534 Comment cleanup 2023-06-05 22:20:07 +03:00
Jussi Viiri
fe03957514 Add keyboard modifiers to drag events
Remove fields from DragLeft
2023-06-05 21:00:19 +03:00
Jussi Viiri
e9a1460a5b Use Point for drag coordinates like other mouse events 2023-06-05 20:53:25 +03:00
Jussi Viiri
1a8484bc55 Add coordinates to drag events 2023-06-05 20:48:06 +03:00
Jussi Viiri
1c50c326cb Add drop data to all drag events
Add DragData::None instead of using Option<DragData>
2023-06-05 20:25:27 +03:00
Jussi Viiri
b5f3939930 Parse drop data
Only handling files for now
2023-06-04 23:43:10 +03:00
Jussi Viiri
ef64cae538 Delete some unused lines committed by accident 2023-06-04 21:40:45 +03:00
Jussi Viiri
f5840bc65b Refactor away duplicated code 2023-06-04 21:39:59 +03:00
Jussi Viiri
d8ffd4abc6 Drop effect is now set based on EventStatus 2023-06-03 22:50:39 +03:00
Jussi Viiri
0eff674319 Janky first version of drag and drop
Just recognized as a drop target
2023-05-31 22:43:30 +03:00
Micah Johnston
c129b12ead
Merge pull request #139 from wtholliday/macos-clipboard
Macos clipboard
2023-02-23 12:09:17 -06:00
Taylor Holliday
dbda356826 Use &str instead of String. 2023-02-22 10:14:54 -08:00
Taylor Holliday
2b70a08e14 Add stubs for copy_to_clipboard. 2023-02-21 17:09:17 -08:00