macosx: Move float on top button handling to main video view controls bar

Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
This commit is contained in:
Claudio Cambra 2024-04-07 23:30:16 +08:00 committed by Steve Lhomme
parent ce30883606
commit b7da44b94b
5 changed files with 21 additions and 11 deletions

View File

@ -34,6 +34,7 @@
<outlet property="backwardButton" destination="V9d-hX-iyg" id="ZFn-jn-7OB"/>
<outlet property="bookmarksButton" destination="4tZ-52-1q9" id="dAN-YB-YZ5"/>
<outlet property="detailLabel" destination="5ii-yU-6Zp" id="ves-8e-T8E"/>
<outlet property="floatOnTopButton" destination="8jZ-hd-YVq" id="x53-4o-LsM"/>
<outlet property="forwardButton" destination="sF5-Z0-bef" id="H6w-Le-NAK"/>
<outlet property="fullscreenButton" destination="dYZ-ri-Kra" id="Cw2-BS-QG9"/>
<outlet property="fullscreenButtonWidthConstraint" destination="quS-fD-Od7" id="6hT-nR-yQI"/>
@ -185,7 +186,7 @@
<constraint firstAttribute="width" secondItem="8jZ-hd-YVq" secondAttribute="height" multiplier="1:1" id="iNf-6g-2uS"/>
</constraints>
<connections>
<action selector="togglePictureInPicture:" target="-2" id="l48-tv-GNg"/>
<action selector="toggleFloatOnTop:" target="3" id="BvH-qi-jx1"/>
</connections>
</button>
<button wantsLayer="YES" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="dYZ-ri-Kra" customClass="VLCImageButton">

View File

@ -30,10 +30,12 @@ NS_ASSUME_NONNULL_BEGIN
@property (readwrite, strong) IBOutlet NSButton *bookmarksButton;
@property (readwrite, strong) IBOutlet NSButton *subtitlesButton;
@property (readwrite, strong) IBOutlet NSButton *audioButton;
@property (readwrite, strong) IBOutlet NSButton *floatOnTopButton;
- (IBAction)openBookmarks:(id)sender;
- (IBAction)openSubtitlesMenu:(id)sender;
- (IBAction)openAudioMenu:(id)sender;
- (IBAction)toggleFloatOnTop:(id)sender;
@end

View File

@ -37,6 +37,9 @@
#import "views/VLCWrappableTextField.h"
#import "windows/video/VLCMainVideoViewController.h"
#import "windows/video/VLCVideoWindowCommon.h"
@interface VLCMainVideoViewControlsBar ()
{
VLCPlaylistController *_playlistController;
@ -103,4 +106,18 @@
inView:((NSView *)sender).superview];
}
- (IBAction)toggleFloatOnTop:(id)sender
{
VLCVideoWindowCommon * const window = (VLCVideoWindowCommon *)self.floatOnTopButton.window;
if (window == nil) {
return;
}
vout_thread_t * const p_vout = window.videoViewController.voutView.voutThread;
if (!p_vout) {
return;
}
var_ToggleBool(p_vout, "video-on-top");
vout_Release(p_vout);
}
@end

View File

@ -57,7 +57,6 @@ NS_ASSUME_NONNULL_BEGIN
- (IBAction)togglePlaylist:(id)sender;
- (IBAction)returnToLibrary:(id)sender;
- (IBAction)togglePictureInPicture:(id)sender;
@end

View File

@ -382,13 +382,4 @@
}
}
- (IBAction)togglePictureInPicture:(id)sender
{
vout_thread_t * const p_vout = self.voutView.voutThread;
if (p_vout) {
var_ToggleBool(p_vout, "video-on-top");
vout_Release(p_vout);
}
}
@end