- (BOOL) isFullscreen;
- (IBAction)windowAction:(id)sender;
- (BOOL)keyEvent:(NSEvent *)o_event;
+- (void)scrollWheel:(NSEvent *)theEvent;
- (void)setupVarMenuItem:(NSMenuItem *)o_mi
target:(vlc_object_t *)p_object
#import "controls.h"
#import "playlist.h"
#include <vlc_osd.h>
+#include <vlc_keys.h>
/*****************************************************************************
* VLCControls implementation
}
+- (void)scrollWheel:(NSEvent *)theEvent
+{
+ intf_thread_t * p_intf = VLCIntf;
+ float f_absvalue = [theEvent deltaY] > 0.0f ? [theEvent deltaY] : -[theEvent deltaY];
+ int i, i_vlckey;
+
+ f_absvalue = f_absvalue/2.0f + 1.0f;
+
+ if ([theEvent deltaY] < 0.0f)
+ i_vlckey = KEY_MOUSEWHEELDOWN;
+ else
+ i_vlckey = KEY_MOUSEWHEELUP;
+
+ /* Send multiple key event, depending on the intensity of the event */
+ for (i = 0; i < (int)f_absvalue; i++)
+ var_SetInteger( p_intf->p_libvlc, "key-pressed", i_vlckey );
+}
+
- (BOOL)keyEvent:(NSEvent *)o_event
{
BOOL eventHandled = NO;
- (void)scrollWheel:(NSEvent *)theEvent
{
VLCControls * o_controls = (VLCControls *)[[NSApp delegate] getControls];
- float f_absvalue = [theEvent deltaY] > 0.0f ? [theEvent deltaY] : -[theEvent deltaY];
- int i;
- f_absvalue /= 2.0f;
- f_absvalue += 1.0f;
-
- /* Set the volume */
- if (f_absvalue > 1.1f)
- {
- for (i = 0; i < (int)f_absvalue; i++)
- {
- if ([theEvent deltaY] < 0.0f)
- [o_controls volumeDown: self];
- else
- [o_controls volumeUp: self];
- }
- }
+ [o_controls scrollWheel: theEvent];
}
- (void)keyDown:(NSEvent *)o_event
[self scaleWindowWithFactor: 1.0 animate: [o_window isVisible] && (![o_window isFullscreen])];
+ [o_window setAspectRatio:NSMakeSize([o_window frame].size.width, [o_window frame].size.height)];
+
/* Make sure our window is visible, if we are not in fullscreen */
if (![o_window isFullscreen])
[o_window makeKeyAndOrderFront: self];