Skip to content

Commit

Permalink
Squashed commit of the following: (rust-windowing#853)
Browse files Browse the repository at this point in the history
commit fa95f204d3c10ceca70e794870657a0f33349761
Author: Hal Gentz <zegentzy@protonmail.com>
Date:   Sun Apr 28 00:14:01 2019 -0600

    xrender

    Signed-off-by: Hal Gentz <zegentzy@protonmail.com>

commit b62cee5
Merge: 3f021ea a6551f4
Author: Hal Gentz <zegentzy@protonmail.com>
Date:   Thu Apr 25 18:13:43 2019 -0600

    Merge branch 'macos-gentz' of github.com:ZeGentzy/winit into macos-gentz

commit 3f021ea
Author: Hal Gentz <zegentzy@protonmail.com>
Date:   Thu Apr 25 18:04:02 2019 -0600

    Get rid of warnings.

    Signed-off-by: Hal Gentz <zegentzy@protonmail.com>

commit a6551f4
Author: Hal Gentz <zegentzy@protonmail.com>
Date:   Thu Apr 25 07:40:56 2019 -0600

    Fix example

    Signed-off-by: Hal Gentz <zegentzy@protonmail.com>

commit cbfda6c
Author: Hal Gentz <zegentzy@protonmail.com>
Date:   Wed Apr 24 23:47:46 2019 -0600

    Fixes

    Signed-off-by: Hal Gentz <zegentzy@protonmail.com>

commit 86bc86f
Author: Hal Gentz <zegentzy@protonmail.com>
Date:   Wed Apr 24 23:39:19 2019 -0600

    Backport rust-windowing@9a23ec3#diff-1d95fe39cdbaa708c975380a16c314cb

    Signed-off-by: Hal Gentz <zegentzy@protonmail.com>

commit 742a688
Author: Hal Gentz <zegentzy@protonmail.com>
Date:   Wed Apr 24 23:09:14 2019 -0600

    Backports rust-windowing@45a4281#diff-1d95fe39cdbaa708c975380a16c314cb

    Signed-off-by: Hal Gentz <zegentzy@protonmail.com>

commit 6c81f2a
Author: Hal Gentz <zegentzy@protonmail.com>
Date:   Wed Apr 24 23:05:57 2019 -0600

    Francesca's macos changes

    Also backports rust-windowing@bfbcab3#diff-1d95fe39cdbaa708c975380a16c314cb

commit 7c2e130
Author: Francesca Plebani <franplebani@gmail.com>
Date:   Wed Apr 24 20:58:26 2019 -0600

    Squashed commit of the following:

    commit 5f4aa9f
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Fri Dec 21 17:14:14 2018 -0500

        Protect against reentrancy (messily)

    commit b75073a
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Fri Dec 21 15:15:27 2018 -0500

        Send resize events immediately

    commit 8e9fc01
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Fri Dec 21 16:07:43 2018 -0500

        Don't use struct for window delegate

    commit c6853b0
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Wed Dec 19 21:17:48 2018 -0500

        Split up util

    commit 262c46b
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Wed Dec 19 20:55:00 2018 -0500

        Use dispatch crate

    commit 63152c2
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Wed Dec 19 20:29:13 2018 -0500

        RedrawRequested

    commit 27e475c
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Wed Dec 19 19:24:44 2018 -0500

        User events

    commit 157418d
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Tue Dec 18 22:38:05 2018 -0500

        Moved out cursor loading

    commit b492564
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Tue Dec 18 21:32:12 2018 -0500

        Fixed a bunch of threading issues

    commit 4aef63d
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Mon Dec 17 13:54:59 2018 -0500

        Wait works

    commit 72ed426
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Fri Dec 14 20:49:10 2018 -0500

        Fixed drag and dropg

    commit 658209f
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Fri Dec 14 20:42:42 2018 -0500

        Made mutexes finer for less deadlock risk

    commit 8e6b986
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Fri Dec 14 16:45:06 2018 -0500

        Dump (encapsulate) everything into AppState

    commit d2dc83d
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Thu Dec 13 17:36:47 2018 -0500

        All window events work!

    commit 7c7fcc9
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Wed Dec 12 17:11:09 2018 -0500

        Very rough usage of CFRunLoop

    commit 3c7a52f
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Tue Dec 11 15:45:23 2018 -0500

        Fixed deadlocks

    commit b74c7fe
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Mon Dec 10 18:59:46 2018 -0500

        Fix keyDown deadlock

    commit 3798f9c
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Mon Dec 10 18:44:40 2018 -0500

        It builds!

    commit 8c86202
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Fri Dec 7 21:09:55 2018 -0500

        Horribly broken so far

    commit 8269ed2
    Author: Osspial <osspial@gmail.com>
    Date:   Mon Nov 19 23:51:20 2018 -0500

        Fix crash with runner refcell not getting dropped

    commit 54ce6a2
    Author: Osspial <osspial@gmail.com>
    Date:   Sun Nov 18 19:12:45 2018 -0500

        Fix buffered events not getting dispatched

    commit 2c18b80
    Author: Osspial <osspial@gmail.com>
    Date:   Sun Nov 18 18:51:24 2018 -0500

        Fix thread executor not executing closure when called from non-loop thread

    commit 5a3a5e2
    Author: Osspial <osspial@gmail.com>
    Date:   Thu Nov 15 22:43:59 2018 -0500

        Fix some deadlocks that could occur when changing window state

    commit 2a3cefd
    Author: Osspial <osspial@gmail.com>
    Date:   Thu Nov 15 16:45:17 2018 -0500

        Document and implement Debug for EventLoopWindowTarget

    commit fa46825
    Author: Osspial <osspial@gmail.com>
    Date:   Thu Nov 15 16:40:48 2018 -0500

        Replace &EventLoop in callback with &EventLoopWindowTarget

    commit 9f36a7a
    Author: Osspial <osspial@gmail.com>
    Date:   Wed Nov 14 21:28:38 2018 -0500

        Fix freeze when setting decorations

    commit d9c3dac
    Author: Osspial <osspial@gmail.com>
    Date:   Fri Nov 9 20:41:15 2018 -0500

        Fix 1.24.1 build

    commit 5289d22
    Author: Osspial <osspial@gmail.com>
    Date:   Fri Nov 9 00:00:27 2018 -0500

        Remove serde implementations from ControlFlow

    commit 92ac3d6
    Author: Osspial <osspial@gmail.com>
    Date:   Thu Nov 8 23:46:41 2018 -0500

        Remove crossbeam dependency and make drop events work again

    commit 8299eb2
    Author: Osspial <osspial@gmail.com>
    Date:   Thu Sep 13 22:39:40 2018 -0400

        Fix crash when running in release mode

    commit bb6ab1b
    Author: Osspial <osspial@gmail.com>
    Date:   Sun Sep 9 14:28:16 2018 -0400

        Fix unreachable panic after setting ControlFlow to Poll during some RedrawRequested events.

    commit 5068ff4
    Author: Osspial <osspial@gmail.com>
    Date:   Sun Sep 9 14:14:28 2018 -0400

        Improve clarity/fix typos in docs

    commit 8ed575f
    Author: Osspial <osspial@gmail.com>
    Date:   Sun Sep 9 00:19:53 2018 -0400

        Update send test and errors that broke some examples/APIs

    commit bf7bfa8
    Author: Osspial <osspial@gmail.com>
    Date:   Wed Sep 5 22:36:05 2018 -0400

        Fix resize lag when waiting in some situations

    commit 70722cc
    Author: Osspial <osspial@gmail.com>
    Date:   Wed Sep 5 19:58:52 2018 -1100

        When SendEvent is called during event closure, buffer events

    commit 5337092
    Author: Osspial <osspial@gmail.com>
    Date:   Sun Aug 26 21:55:51 2018 -0400

        Improve WaitUntil timer precision

    commit a654400
    Author: Osspial <osspial@gmail.com>
    Date:   Thu Aug 23 21:06:19 2018 -0400

        Add CHANGELOG entry

    commit deb7d37
    Author: Osspial <osspial@gmail.com>
    Date:   Thu Aug 23 20:19:56 2018 -0400

        Rename MonitorId to MonitorHandle

    commit 8d8d9b7
    Author: Osspial <osspial@gmail.com>
    Date:   Thu Aug 23 20:16:52 2018 -0400

        Change instances of "events_loop" to "event_loop"

    commit 0f34408
    Author: Osspial <osspial@gmail.com>
    Date:   Thu Aug 23 20:13:53 2018 -0400

        Improve docs for run and run_return

    commit fba41f7
    Author: Osspial <osspial@gmail.com>
    Date:   Thu Aug 23 19:09:53 2018 -0400

        Small changes to examples

    commit 42e8a0d
    Author: Osspial <osspial@gmail.com>
    Date:   Thu Aug 23 19:09:19 2018 -0400

        Improve documentation

    commit 4377680
    Author: Osspial <osspial@gmail.com>
    Date:   Wed Aug 22 23:01:36 2018 -0400

        Re-organize into module structure

    commit f20fac9
    Author: Osspial <osspial@gmail.com>
    Date:   Wed Aug 22 22:07:39 2018 -0400

        Add platform::desktop module with EventLoopExt::run_return

    commit dad24d0
    Author: Osspial <osspial@gmail.com>
    Date:   Wed Aug 22 18:03:41 2018 -0400

        Rename os to platform, add Ext trait postfixes

    commit 7df59c6
    Author: Osspial <osspial@gmail.com>
    Date:   Wed Aug 22 17:59:36 2018 -0400

        Rename platform to platform_impl

    commit 99c0f84
    Author: Osspial <osspial@gmail.com>
    Date:   Wed Aug 22 17:55:27 2018 -0400

        Add request_redraw

    commit a0fef1a
    Author: Osspial <osspial@gmail.com>
    Date:   Mon Aug 20 01:47:11 2018 -0400

        Fully invert windows control flow so win32 calls into winit's callback

    commit 2c607ff
    Author: Osspial <osspial@gmail.com>
    Date:   Sun Aug 19 13:44:22 2018 -0400

        Add ability to send custom user events

    commit a0b2bb3
    Author: Osspial <osspial@gmail.com>
    Date:   Fri Aug 17 17:49:46 2018 -0400

        Add StartCause::Init support, timer example

    commit 02f922f
    Author: Osspial <osspial@gmail.com>
    Date:   Fri Aug 17 17:31:04 2018 -0400

        Implement new ControlFlow and associated events

    commit 8b8a767
    Author: Osspial <osspial@gmail.com>
    Date:   Fri Jul 13 01:48:26 2018 -0400

        Replace windows Mutex with parking_lot Mutex

    commit 9feada2
    Author: Osspial <osspial@gmail.com>
    Date:   Fri Jul 13 01:39:53 2018 -0400

        Update run_forever to hijack thread

    commit 2e83bac
    Author: Osspial <osspial@gmail.com>
    Date:   Thu Jul 12 23:43:58 2018 -0400

        Remove second thread from win32 backend

    commit 64b8a9c
    Author: Osspial <osspial@gmail.com>
    Date:   Thu Jul 12 22:13:07 2018 -0400

        Rename WindowEvent::Refresh to WindowEvent::Redraw

    commit 529c085
    Author: Osspial <osspial@gmail.com>
    Date:   Thu Jul 12 22:04:38 2018 -0400

        Rename EventsLoop and associated types to EventLoop

    Signed-off-by: Hal Gentz <zegentzy@protonmail.com>

    Co-authored-by: Hal Gentz <zegentzy@protonmail.com>

commit cfb929b
Author: Hal Gentz <zegentzy@protonmail.com>
Date:   Thu Apr 25 07:40:56 2019 -0600

    Fix example

    Signed-off-by: Hal Gentz <zegentzy@protonmail.com>

commit 68d3317
Author: Hal Gentz <zegentzy@protonmail.com>
Date:   Wed Apr 24 23:47:46 2019 -0600

    Fixes

    Signed-off-by: Hal Gentz <zegentzy@protonmail.com>

commit 02d1aae
Author: Hal Gentz <zegentzy@protonmail.com>
Date:   Wed Apr 24 23:39:19 2019 -0600

    Backport rust-windowing@9a23ec3#diff-1d95fe39cdbaa708c975380a16c314cb

    Signed-off-by: Hal Gentz <zegentzy@protonmail.com>

commit dd9de5a
Author: Hal Gentz <zegentzy@protonmail.com>
Date:   Wed Apr 24 23:09:14 2019 -0600

    Backports rust-windowing@45a4281#diff-1d95fe39cdbaa708c975380a16c314cb

    Signed-off-by: Hal Gentz <zegentzy@protonmail.com>

commit 533e2ad
Author: Hal Gentz <zegentzy@protonmail.com>
Date:   Wed Apr 24 23:05:57 2019 -0600

    Francesca's macos changes

    Also backports rust-windowing@bfbcab3#diff-1d95fe39cdbaa708c975380a16c314cb

commit 73b5222
Author: Hal Gentz <zegentzy@protonmail.com>
Date:   Wed Apr 24 20:58:26 2019 -0600

    Squashed commit of the following:

    commit 5f4aa9f
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Fri Dec 21 17:14:14 2018 -0500

        Protect against reentrancy (messily)

    commit b75073a
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Fri Dec 21 15:15:27 2018 -0500

        Send resize events immediately

    commit 8e9fc01
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Fri Dec 21 16:07:43 2018 -0500

        Don't use struct for window delegate

    commit c6853b0
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Wed Dec 19 21:17:48 2018 -0500

        Split up util

    commit 262c46b
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Wed Dec 19 20:55:00 2018 -0500

        Use dispatch crate

    commit 63152c2
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Wed Dec 19 20:29:13 2018 -0500

        RedrawRequested

    commit 27e475c
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Wed Dec 19 19:24:44 2018 -0500

        User events

    commit 157418d
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Tue Dec 18 22:38:05 2018 -0500

        Moved out cursor loading

    commit b492564
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Tue Dec 18 21:32:12 2018 -0500

        Fixed a bunch of threading issues

    commit 4aef63d
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Mon Dec 17 13:54:59 2018 -0500

        Wait works

    commit 72ed426
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Fri Dec 14 20:49:10 2018 -0500

        Fixed drag and dropg

    commit 658209f
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Fri Dec 14 20:42:42 2018 -0500

        Made mutexes finer for less deadlock risk

    commit 8e6b986
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Fri Dec 14 16:45:06 2018 -0500

        Dump (encapsulate) everything into AppState

    commit d2dc83d
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Thu Dec 13 17:36:47 2018 -0500

        All window events work!

    commit 7c7fcc9
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Wed Dec 12 17:11:09 2018 -0500

        Very rough usage of CFRunLoop

    commit 3c7a52f
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Tue Dec 11 15:45:23 2018 -0500

        Fixed deadlocks

    commit b74c7fe
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Mon Dec 10 18:59:46 2018 -0500

        Fix keyDown deadlock

    commit 3798f9c
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Mon Dec 10 18:44:40 2018 -0500

        It builds!

    commit 8c86202
    Author: Francesca Plebani <franplebani@gmail.com>
    Date:   Fri Dec 7 21:09:55 2018 -0500

        Horribly broken so far

    commit 8269ed2
    Author: Osspial <osspial@gmail.com>
    Date:   Mon Nov 19 23:51:20 2018 -0500

        Fix crash with runner refcell not getting dropped

    commit 54ce6a2
    Author: Osspial <osspial@gmail.com>
    Date:   Sun Nov 18 19:12:45 2018 -0500

        Fix buffered events not getting dispatched

    commit 2c18b80
    Author: Osspial <osspial@gmail.com>
    Date:   Sun Nov 18 18:51:24 2018 -0500

        Fix thread executor not executing closure when called from non-loop thread

    commit 5a3a5e2
    Author: Osspial <osspial@gmail.com>
    Date:   Thu Nov 15 22:43:59 2018 -0500

        Fix some deadlocks that could occur when changing window state

    commit 2a3cefd
    Author: Osspial <osspial@gmail.com>
    Date:   Thu Nov 15 16:45:17 2018 -0500

        Document and implement Debug for EventLoopWindowTarget

    commit fa46825
    Author: Osspial <osspial@gmail.com>
    Date:   Thu Nov 15 16:40:48 2018 -0500

        Replace &EventLoop in callback with &EventLoopWindowTarget

    commit 9f36a7a
    Author: Osspial <osspial@gmail.com>
    Date:   Wed Nov 14 21:28:38 2018 -0500

        Fix freeze when setting decorations

    commit d9c3dac
    Author: Osspial <osspial@gmail.com>
    Date:   Fri Nov 9 20:41:15 2018 -0500

        Fix 1.24.1 build

    commit 5289d22
    Author: Osspial <osspial@gmail.com>
    Date:   Fri Nov 9 00:00:27 2018 -0500

        Remove serde implementations from ControlFlow

    commit 92ac3d6
    Author: Osspial <osspial@gmail.com>
    Date:   Thu Nov 8 23:46:41 2018 -0500

        Remove crossbeam dependency and make drop events work again

    commit 8299eb2
    Author: Osspial <osspial@gmail.com>
    Date:   Thu Sep 13 22:39:40 2018 -0400

        Fix crash when running in release mode

    commit bb6ab1b
    Author: Osspial <osspial@gmail.com>
    Date:   Sun Sep 9 14:28:16 2018 -0400

        Fix unreachable panic after setting ControlFlow to Poll during some RedrawRequested events.

    commit 5068ff4
    Author: Osspial <osspial@gmail.com>
    Date:   Sun Sep 9 14:14:28 2018 -0400

        Improve clarity/fix typos in docs

    commit 8ed575f
    Author: Osspial <osspial@gmail.com>
    Date:   Sun Sep 9 00:19:53 2018 -0400

        Update send test and errors that broke some examples/APIs

    commit bf7bfa8
    Author: Osspial <osspial@gmail.com>
    Date:   Wed Sep 5 22:36:05 2018 -0400

        Fix resize lag when waiting in some situations

    commit 70722cc
    Author: Osspial <osspial@gmail.com>
    Date:   Wed Sep 5 19:58:52 2018 -1100

        When SendEvent is called during event closure, buffer events

    commit 5337092
    Author: Osspial <osspial@gmail.com>
    Date:   Sun Aug 26 21:55:51 2018 -0400

        Improve WaitUntil timer precision

    commit a654400
    Author: Osspial <osspial@gmail.com>
    Date:   Thu Aug 23 21:06:19 2018 -0400

        Add CHANGELOG entry

    commit deb7d37
    Author: Osspial <osspial@gmail.com>
    Date:   Thu Aug 23 20:19:56 2018 -0400

        Rename MonitorId to MonitorHandle

    commit 8d8d9b7
    Author: Osspial <osspial@gmail.com>
    Date:   Thu Aug 23 20:16:52 2018 -0400

        Change instances of "events_loop" to "event_loop"

    commit 0f34408
    Author: Osspial <osspial@gmail.com>
    Date:   Thu Aug 23 20:13:53 2018 -0400

        Improve docs for run and run_return

    commit fba41f7
    Author: Osspial <osspial@gmail.com>
    Date:   Thu Aug 23 19:09:53 2018 -0400

        Small changes to examples

    commit 42e8a0d
    Author: Osspial <osspial@gmail.com>
    Date:   Thu Aug 23 19:09:19 2018 -0400

        Improve documentation

    commit 4377680
    Author: Osspial <osspial@gmail.com>
    Date:   Wed Aug 22 23:01:36 2018 -0400

        Re-organize into module structure

    commit f20fac9
    Author: Osspial <osspial@gmail.com>
    Date:   Wed Aug 22 22:07:39 2018 -0400

        Add platform::desktop module with EventLoopExt::run_return

    commit dad24d0
    Author: Osspial <osspial@gmail.com>
    Date:   Wed Aug 22 18:03:41 2018 -0400

        Rename os to platform, add Ext trait postfixes

    commit 7df59c6
    Author: Osspial <osspial@gmail.com>
    Date:   Wed Aug 22 17:59:36 2018 -0400

        Rename platform to platform_impl

    commit 99c0f84
    Author: Osspial <osspial@gmail.com>
    Date:   Wed Aug 22 17:55:27 2018 -0400

        Add request_redraw

    commit a0fef1a
    Author: Osspial <osspial@gmail.com>
    Date:   Mon Aug 20 01:47:11 2018 -0400

        Fully invert windows control flow so win32 calls into winit's callback

    commit 2c607ff
    Author: Osspial <osspial@gmail.com>
    Date:   Sun Aug 19 13:44:22 2018 -0400

        Add ability to send custom user events

    commit a0b2bb3
    Author: Osspial <osspial@gmail.com>
    Date:   Fri Aug 17 17:49:46 2018 -0400

        Add StartCause::Init support, timer example

    commit 02f922f
    Author: Osspial <osspial@gmail.com>
    Date:   Fri Aug 17 17:31:04 2018 -0400

        Implement new ControlFlow and associated events

    commit 8b8a767
    Author: Osspial <osspial@gmail.com>
    Date:   Fri Jul 13 01:48:26 2018 -0400

        Replace windows Mutex with parking_lot Mutex

    commit 9feada2
    Author: Osspial <osspial@gmail.com>
    Date:   Fri Jul 13 01:39:53 2018 -0400

        Update run_forever to hijack thread

    commit 2e83bac
    Author: Osspial <osspial@gmail.com>
    Date:   Thu Jul 12 23:43:58 2018 -0400

        Remove second thread from win32 backend

    commit 64b8a9c
    Author: Osspial <osspial@gmail.com>
    Date:   Thu Jul 12 22:13:07 2018 -0400

        Rename WindowEvent::Refresh to WindowEvent::Redraw

    commit 529c085
    Author: Osspial <osspial@gmail.com>
    Date:   Thu Jul 12 22:04:38 2018 -0400

        Rename EventsLoop and associated types to EventLoop

    Signed-off-by: Hal Gentz <zegentzy@protonmail.com>

commit ab1dfaa
Author: Hal Gentz <zegentzy@protonmail.com>
Date:   Tue Apr 23 21:52:17 2019 -0600

    Minor

    Signed-off-by: Hal Gentz <zegentzy@protonmail.com>

commit 7933209
Author: Victor Berger <victor.berger@m4x.org>
Date:   Thu Apr 18 09:10:41 2019 +0200

    wayland/x11: Make ControlFlow::Exit sticky

commit 8355a75
Author: Victor Berger <victor.berger@m4x.org>
Date:   Tue Apr 16 12:21:33 2019 +0200

    x11: Implement run_return using calloop

commit f64edb6
Author: Victor Berger <victor.berger@m4x.org>
Date:   Tue Apr 16 10:42:04 2019 +0200

    x11: port to evl2 with stubs

commit be37289
Author: Victor Berger <victor.berger@m4x.org>
Date:   Mon Apr 15 17:35:59 2019 +0200

    Fix compilation on Linux.

Signed-off-by: Hal Gentz <zegentzy@protonmail.com>

Co-authored-by: Francesca Plebani <franplebani@gmail.com>
  • Loading branch information
2 people authored and felixrabe committed Jun 23, 2019
1 parent d22cc13 commit a9bbf9e
Show file tree
Hide file tree
Showing 28 changed files with 3,263 additions and 2,107 deletions.
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ serde = { version = "1", optional = true, features = ["serde_derive"] }

[dev-dependencies]
image = "0.21"
env_logger = "0.5"

[target.'cfg(target_os = "android")'.dependencies.android_glue]
version = "0.2"
Expand All @@ -29,10 +30,11 @@ version = "0.2"
objc = "0.2.3"

[target.'cfg(target_os = "macos")'.dependencies]
objc = "0.2.3"
cocoa = "0.18.4"
core-foundation = "0.6"
core-graphics = "0.17.3"
dispatch = "0.1.4"
objc = "0.2.3"

[target.'cfg(target_os = "windows")'.dependencies]
backtrace = "0.3"
Expand Down
7 changes: 3 additions & 4 deletions examples/fullscreen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,11 @@ fn main() {
#[cfg(target_os = "macos")]
{
if macos_use_simple_fullscreen {
use winit::os::macos::WindowExt;
if WindowExt::set_simple_fullscreen(&window, !is_fullscreen) {
use winit::platform::macos::WindowExtMacOS;
if WindowExtMacOS::set_simple_fullscreen(&window, !is_fullscreen) {
is_fullscreen = !is_fullscreen;
}

return ControlFlow::Continue;
return;
}
}

Expand Down
115 changes: 115 additions & 0 deletions examples/multithreaded.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
extern crate env_logger;
extern crate winit;

use std::{collections::HashMap, sync::mpsc, thread, time::Duration};

use winit::{
event::{ElementState, Event, KeyboardInput, VirtualKeyCode, WindowEvent},
event_loop::{ControlFlow, EventLoop}, window::{MouseCursor, WindowBuilder},
};

const WINDOW_COUNT: usize = 3;
const WINDOW_SIZE: (u32, u32) = (600, 400);

fn main() {
env_logger::init();
let event_loop = EventLoop::new();
let mut window_senders = HashMap::with_capacity(WINDOW_COUNT);
for _ in 0..WINDOW_COUNT {
let window = WindowBuilder::new()
.with_dimensions(WINDOW_SIZE.into())
.build(&event_loop)
.unwrap();
let (tx, rx) = mpsc::channel();
window_senders.insert(window.id(), tx);
thread::spawn(move || {
while let Ok(event) = rx.recv() {
match event {
WindowEvent::KeyboardInput { input: KeyboardInput {
state: ElementState::Released,
virtual_keycode: Some(key),
modifiers,
..
}, .. } => {
window.set_title(&format!("{:?}", key));
let state = !modifiers.shift;
use self::VirtualKeyCode::*;
match key {
A => window.set_always_on_top(state),
C => window.set_cursor(match state {
true => MouseCursor::Progress,
false => MouseCursor::Default,
}),
D => window.set_decorations(!state),
F => window.set_fullscreen(match state {
true => Some(window.get_current_monitor()),
false => None,
}),
G => window.grab_cursor(state).unwrap(),
H => window.hide_cursor(state),
I => {
println!("Info:");
println!("-> position : {:?}", window.get_position());
println!("-> inner_position : {:?}", window.get_inner_position());
println!("-> outer_size : {:?}", window.get_outer_size());
println!("-> inner_size : {:?}", window.get_inner_size());
},
L => window.set_min_dimensions(match state {
true => Some(WINDOW_SIZE.into()),
false => None,
}),
M => window.set_maximized(state),
P => window.set_position({
let mut position = window.get_position().unwrap();
let sign = if state { 1.0 } else { -1.0 };
position.x += 10.0 * sign;
position.y += 10.0 * sign;
position
}),
Q => window.request_redraw(),
R => window.set_resizable(state),
S => window.set_inner_size(match state {
true => (WINDOW_SIZE.0 + 100, WINDOW_SIZE.1 + 100),
false => WINDOW_SIZE,
}.into()),
W => window.set_cursor_position((
WINDOW_SIZE.0 as i32 / 2,
WINDOW_SIZE.1 as i32 / 2,
).into()).unwrap(),
Z => {
window.hide();
thread::sleep(Duration::from_secs(1));
window.show();
},
_ => (),
}
},
_ => (),
}
}
});
}
event_loop.run(move |event, _event_loop, control_flow| {
*control_flow = match !window_senders.is_empty() {
true => ControlFlow::Wait,
false => ControlFlow::Exit,
};
match event {
Event::WindowEvent { event, window_id } => {
match event {
WindowEvent::CloseRequested
| WindowEvent::Destroyed
| WindowEvent::KeyboardInput { input: KeyboardInput {
virtual_keycode: Some(VirtualKeyCode::Escape),
.. }, .. } => {
window_senders.remove(&window_id);
},
_ => if let Some(tx) = window_senders.get(&window_id) {
tx.send(event).unwrap();
},
}
}
_ => (),
}
})
}
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ extern crate objc;
#[cfg(target_os = "macos")]
extern crate cocoa;
#[cfg(target_os = "macos")]
extern crate dispatch;
#[cfg(target_os = "macos")]
extern crate core_foundation;
#[cfg(target_os = "macos")]
extern crate core_graphics;
Expand Down
5 changes: 4 additions & 1 deletion src/platform/macos.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
#![cfg(target_os = "macos")]

use std::os::raw::c_void;
use {LogicalSize, MonitorHandle, Window, WindowBuilder};

use crate::dpi::LogicalSize;
use crate::monitor::MonitorHandle;
use crate::window::{Window, WindowBuilder};

/// Additional methods on `Window` that are specific to MacOS.
pub trait WindowExtMacOS {
Expand Down
6 changes: 3 additions & 3 deletions src/platform/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ pub trait EventLoopExtUnix {
#[doc(hidden)]
fn get_xlib_xconnection(&self) -> Option<Arc<XConnection>>;

/// Returns a pointer to the `wl_display` object of wayland that is used by this `EventsLoop`.
/// Returns a pointer to the `wl_display` object of wayland that is used by this `EventLoop`.
///
/// Returns `None` if the `EventsLoop` doesn't use wayland (if it uses xlib for example).
/// Returns `None` if the `EventLoop` doesn't use wayland (if it uses xlib for example).
///
/// The pointer will become invalid when the glutin `EventsLoop` is destroyed.
/// The pointer will become invalid when the glutin `EventLoop` is destroyed.
fn get_wayland_display(&self) -> Option<*mut raw::c_void>;
}

Expand Down
1 change: 1 addition & 0 deletions src/platform_impl/linux/x11/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ pub use x11_dl::xinput2::*;
pub use x11_dl::xlib_xcb::*;
pub use x11_dl::error::OpenError;
pub use x11_dl::xrandr::*;
pub use x11_dl::xrender::*;
1 change: 1 addition & 0 deletions src/platform_impl/linux/x11/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ impl<T: 'static> EventLoop<T> {
sticky_exit_callback(evt, &self.target, &mut control_flow, &mut callback);
}
}

// Empty the user event buffer
{
let mut guard = self.pending_user_events.borrow_mut();
Expand Down
2 changes: 0 additions & 2 deletions src/platform_impl/linux/x11/util/window_property.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use std;

use super::*;

pub type Cardinal = c_long;
Expand Down
8 changes: 8 additions & 0 deletions src/platform_impl/linux/x11/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,14 @@ impl UnownedWindow {
None => ffi::CopyFromParent,
},
ffi::InputOutput as c_uint,
// TODO: If window wants transparency and `visual_infos` is None,
// we need to find our own visual which has an `alphaMask` which
// is > 0, like we do in glutin.
//
// It is non obvious which masks, if any, we should pass to
// `XGetVisualInfo`. winit doesn't recieve any info about what
// properties the user wants. Users should consider choosing the
// visual themselves as glutin does.
match pl_attribs.visual_infos {
Some(vi) => vi.visual,
None => ffi::CopyFromParent as *mut ffi::Visual,
Expand Down
3 changes: 3 additions & 0 deletions src/platform_impl/linux/x11/xdisplay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub struct XConnection {
pub xcursor: ffi::Xcursor,
pub xinput2: ffi::XInput2,
pub xlib_xcb: ffi::Xlib_xcb,
pub xrender: ffi::Xrender,
pub display: *mut ffi::Display,
pub x11_fd: c_int,
pub latest_error: Mutex<Option<XError>>,
Expand All @@ -37,6 +38,7 @@ impl XConnection {
let xrandr_1_5 = ffi::Xrandr::open().ok();
let xinput2 = ffi::XInput2::open()?;
let xlib_xcb = ffi::Xlib_xcb::open()?;
let xrender = ffi::Xrender::open()?;

unsafe { (xlib.XInitThreads)() };
unsafe { (xlib.XSetErrorHandler)(error_handler) };
Expand All @@ -62,6 +64,7 @@ impl XConnection {
xcursor,
xinput2,
xlib_xcb,
xrender,
display,
x11_fd: fd,
latest_error: Mutex::new(None),
Expand Down
88 changes: 88 additions & 0 deletions src/platform_impl/macos/app.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
use std::collections::VecDeque;

use cocoa::{appkit::{self, NSEvent}, base::id};
use objc::{declare::ClassDecl, runtime::{Class, Object, Sel}};

use event::{DeviceEvent, Event};
use platform_impl::platform::{app_state::AppState, DEVICE_ID, util};

pub struct AppClass(pub *const Class);
unsafe impl Send for AppClass {}
unsafe impl Sync for AppClass {}

lazy_static! {
pub static ref APP_CLASS: AppClass = unsafe {
let superclass = class!(NSApplication);
let mut decl = ClassDecl::new("WinitApp", superclass).unwrap();

decl.add_method(
sel!(sendEvent:),
send_event as extern fn(&Object, Sel, id),
);

AppClass(decl.register())
};
}

// Normally, holding Cmd + any key never sends us a `keyUp` event for that key.
// Overriding `sendEvent:` like this fixes that. (https://stackoverflow.com/a/15294196)
// Fun fact: Firefox still has this bug! (https://bugzilla.mozilla.org/show_bug.cgi?id=1299553)
extern fn send_event(this: &Object, _sel: Sel, event: id) {
unsafe {
// For posterity, there are some undocumented event types
// (https://github.com/servo/cocoa-rs/issues/155)
// but that doesn't really matter here.
let event_type = event.eventType();
let modifier_flags = event.modifierFlags();
if event_type == appkit::NSKeyUp && util::has_flag(
modifier_flags,
appkit::NSEventModifierFlags::NSCommandKeyMask,
) {
let key_window: id = msg_send![this, keyWindow];
let _: () = msg_send![key_window, sendEvent:event];
} else {
maybe_dispatch_device_event(event);
let superclass = util::superclass(this);
let _: () = msg_send![super(this, superclass), sendEvent:event];
}
}
}

unsafe fn maybe_dispatch_device_event(event: id) {
let event_type = event.eventType();
match event_type {
appkit::NSMouseMoved |
appkit::NSLeftMouseDragged |
appkit::NSOtherMouseDragged |
appkit::NSRightMouseDragged => {
let mut events = VecDeque::with_capacity(3);

let delta_x = event.deltaX() as f64;
let delta_y = event.deltaY() as f64;

if delta_x != 0.0 {
events.push_back(Event::DeviceEvent {
device_id: DEVICE_ID,
event: DeviceEvent::Motion { axis: 0, value: delta_x },
});
}

if delta_y != 0.0 {
events.push_back(Event::DeviceEvent {
device_id: DEVICE_ID,
event: DeviceEvent::Motion { axis: 1, value: delta_y },
});
}

if delta_x != 0.0 || delta_y != 0.0 {
events.push_back(Event::DeviceEvent {
device_id: DEVICE_ID,
event: DeviceEvent::MouseMotion { delta: (delta_x, delta_y) },
});
}

AppState::queue_events(events);
},
_ => (),
}
}
Loading

0 comments on commit a9bbf9e

Please sign in to comment.