Skip to content

Commit

Permalink
Fix windows?
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksongoode committed Sep 2, 2024
1 parent 885a155 commit 1bfaa59
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 19 deletions.
28 changes: 15 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,26 @@ jobs:
if: runner.os == 'Windows'
run: cargo build --release

- name: Cache cargo-bundle
if: runner.os == 'macOS'
id: cache-cargo-bundle
- name: Cache cargo-bundle and Homebrew
id: cache-tools
uses: actions/cache@v4
with:
path: ~/.cargo/bin/cargo-bundle
key: ${{ runner.os }}-cargo-bundle-${{ hashFiles('**/Cargo.lock') }}
path: |
~/.cargo/bin/cargo-bundle
~/Library/Caches/Homebrew
/usr/local/Cellar/create-dmg
key: ${{ runner.os }}-tools-${{ hashFiles('**/Cargo.lock', '.github/workflows/build.yml') }}
restore-keys: |
${{ runner.os }}-tools-
- name: Install cargo-bundle
if: runner.os == 'macOS' && steps.cache-cargo-bundle.outputs.cache-hit != 'true'
if: runner.os == 'macOS' && !steps.cache-tools.outputs.cache-hit
run: cargo install cargo-bundle

- name: Install create-dmg
if: runner.os == 'macOS' && !steps.cache-tools.outputs.cache-hit
run: brew install create-dmg

- name: Create macOS universal binary
if: runner.os == 'macOS'
run: |
Expand All @@ -99,12 +107,6 @@ jobs:
target/x86_64-apple-darwin/release/psst-gui \
target/aarch64-apple-darwin/release/psst-gui
- name: Verify universal binary
if: runner.os == 'macOS'
run: |
file psst-gui/target/release/psst-gui
lipo -info psst-gui/target/release/psst-gui
- name: Bundle macOS Release
if: runner.os == 'macOS'
run: cargo bundle --release
Expand Down Expand Up @@ -133,7 +135,7 @@ jobs:
if: runner.os == 'macOS'
with:
name: Psst.dmg
path: psst-gui/Psst.dmg
path: ./psst-gui/Psst.dmg

- name: Make Linux Binary Executable
if: runner.os == 'Linux'
Expand Down
11 changes: 5 additions & 6 deletions psst-gui/src/controller/playback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use psst_core::{
use souvlaki::{
MediaControlEvent, MediaControls, MediaMetadata, MediaPlayback, MediaPosition, PlatformConfig,
};
use raw_window_handle::{HasRawWindowHandle, RawWindowHandle};

use crate::{
cmd,
Expand Down Expand Up @@ -48,7 +49,7 @@ impl PlaybackController {
config: PlaybackConfig,
event_sink: ExtEventSink,
widget_id: WidgetId,
#[allow(unused_variables)] window: &WindowHandle,
window: &WindowHandle,
) {
let output = DefaultAudioOutput::open().unwrap();
let cache_dir = Config::cache_dir().unwrap();
Expand Down Expand Up @@ -123,15 +124,13 @@ impl PlaybackController {

fn create_media_controls(
sender: Sender<PlayerEvent>,
#[allow(unused_variables)] window: &WindowHandle,
window: &WindowHandle,
) -> Result<MediaControls, souvlaki::Error> {
let hwnd = {
#[cfg(target_os = "windows")]
{
use raw_window_handle::RawWindowHandle;
let handle = unsafe { window.raw_window_handle() };
match handle {
RawWindowHandle::Win32(h) => Some(h.hwnd.get() as *mut std::ffi::c_void),
match window.raw_window_handle() {
RawWindowHandle::Win32(handle) => Some(handle.hwnd.get() as *mut std::ffi::c_void),
_ => None,
}
}
Expand Down

0 comments on commit 1bfaa59

Please sign in to comment.