Author: tom
Date: Mon Oct 6 08:57:06 2008
New Revision: 3078
URL: http://svn.slimdevices.com?rev=3078&root=Jive&view=rev
Log:
windows multimedia key handling
Added:
7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework_nonwindows.c
7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework_windows.c
Modified:
7.3/trunk/squeezeplay/src/squeezeplay/Makefile.am
7.3/trunk/squeezeplay/src/squeezeplay/Makefile.in
7.3/trunk/squeezeplay/src/squeezeplay/VisualC/jive.vcproj
7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive.h
7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework.c
Modified: 7.3/trunk/squeezeplay/src/squeezeplay/Makefile.am
URL:
http://svn.slimdevices.com/7.3/trunk/squeezeplay/src/squeezeplay/Makefile.am?rev=3078&root=Jive&r1=3077&r2=3078&view=diff
==============================================================================
--- 7.3/trunk/squeezeplay/src/squeezeplay/Makefile.am (original)
+++ 7.3/trunk/squeezeplay/src/squeezeplay/Makefile.am Mon Oct 6 08:57:06 2008
@@ -151,6 +151,7 @@
src/ui/jive_event.c \
src/ui/jive_font.c \
src/ui/jive_framework.c \
+ src/ui/jive_framework_nonwindows.c \
src/ui/jive_group.c \
src/ui/jive_icon.c \
src/ui/jive_label.c \
Modified: 7.3/trunk/squeezeplay/src/squeezeplay/Makefile.in
URL:
http://svn.slimdevices.com/7.3/trunk/squeezeplay/src/squeezeplay/Makefile.in?rev=3078&root=Jive&r1=3077&r2=3078&view=diff
==============================================================================
--- 7.3/trunk/squeezeplay/src/squeezeplay/Makefile.in (original)
+++ 7.3/trunk/squeezeplay/src/squeezeplay/Makefile.in Mon Oct 6 08:57:06 2008
@@ -75,10 +75,11 @@
libjivenet_la_OBJECTS = $(am_libjivenet_la_OBJECTS)
libjiveui_la_DEPENDENCIES =
am_libjiveui_la_OBJECTS = jive_event.lo jive_font.lo jive_framework.lo \
- jive_group.lo jive_icon.lo jive_label.lo jive_menu.lo \
- jive_slider.lo jive_style.lo jive_surface.lo jive_textarea.lo \
- jive_textinput.lo jive_tile.lo jive_timer.lo jive_utils.lo \
- jive_widget.lo jive_window.lo lua_jiveui.lo
+ jive_framework_nonwindows.lo jive_group.lo jive_icon.lo \
+ jive_label.lo jive_menu.lo jive_slider.lo jive_style.lo \
+ jive_surface.lo jive_textarea.lo jive_textinput.lo \
+ jive_tile.lo jive_timer.lo jive_utils.lo jive_widget.lo \
+ jive_window.lo lua_jiveui.lo
libjiveui_la_OBJECTS = $(am_libjiveui_la_OBJECTS)
am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(testdir)"
binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
@@ -270,6 +271,7 @@
src/ui/jive_event.c \
src/ui/jive_font.c \
src/ui/jive_framework.c \
+ src/ui/jive_framework_nonwindows.c \
src/ui/jive_group.c \
src/ui/jive_icon.c \
src/ui/jive_label.c \
@@ -479,6 +481,7 @@
@AMDEP_TRUE@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@
@AMDEP_TRUE@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@
@AMDEP_TRUE@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@
[EMAIL PROTECTED]@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@
@AMDEP_TRUE@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@
@AMDEP_TRUE@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@
@AMDEP_TRUE@@am__include@ @[EMAIL PROTECTED]/$(DEPDIR)/[EMAIL PROTECTED]@
@@ -644,6 +647,13 @@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='src/ui/jive_framework.c'
object='jive_framework.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE)
$(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS)
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS)
$(CFLAGS) -c -o jive_framework.lo `test -f 'src/ui/jive_framework.c' || echo
'$(srcdir)/'`src/ui/jive_framework.c
+
+jive_framework_nonwindows.lo: src/ui/jive_framework_nonwindows.c
[EMAIL PROTECTED]@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS)
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS)
$(CFLAGS) -MT jive_framework_nonwindows.lo -MD -MP -MF
"$(DEPDIR)/jive_framework_nonwindows.Tpo" -c -o jive_framework_nonwindows.lo
`test -f 'src/ui/jive_framework_nonwindows.c' || echo
'$(srcdir)/'`src/ui/jive_framework_nonwindows.c; \
[EMAIL PROTECTED]@ then mv -f "$(DEPDIR)/jive_framework_nonwindows.Tpo"
"$(DEPDIR)/jive_framework_nonwindows.Plo"; else rm -f
"$(DEPDIR)/jive_framework_nonwindows.Tpo"; exit 1; fi
[EMAIL PROTECTED]@@am__fastdepCC_FALSE@
source='src/ui/jive_framework_nonwindows.c'
object='jive_framework_nonwindows.lo' libtool=yes @AMDEPBACKSLASH@
[EMAIL PROTECTED]@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE)
$(depcomp) @AMDEPBACKSLASH@
[EMAIL PROTECTED]@ $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS)
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS)
$(CFLAGS) -c -o jive_framework_nonwindows.lo `test -f
'src/ui/jive_framework_nonwindows.c' || echo
'$(srcdir)/'`src/ui/jive_framework_nonwindows.c
jive_group.lo: src/ui/jive_group.c
@am__fastdepCC_TRUE@ if $(LIBTOOL) --tag=CC --mode=compile $(CC) $(DEFS)
$(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS)
$(CFLAGS) -MT jive_group.lo -MD -MP -MF "$(DEPDIR)/jive_group.Tpo" -c -o
jive_group.lo `test -f 'src/ui/jive_group.c' || echo
'$(srcdir)/'`src/ui/jive_group.c; \
Modified: 7.3/trunk/squeezeplay/src/squeezeplay/VisualC/jive.vcproj
URL:
http://svn.slimdevices.com/7.3/trunk/squeezeplay/src/squeezeplay/VisualC/jive.vcproj?rev=3078&root=Jive&r1=3077&r2=3078&view=diff
==============================================================================
--- 7.3/trunk/squeezeplay/src/squeezeplay/VisualC/jive.vcproj (original)
+++ 7.3/trunk/squeezeplay/src/squeezeplay/VisualC/jive.vcproj Mon Oct 6
08:57:06 2008
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
@@ -311,6 +311,10 @@
>
</File>
<File
+
RelativePath="..\src\ui\jive_framework_windows.c"
+ >
+ </File>
+ <File
RelativePath="..\src\ui\jive_group.c"
>
</File>
Modified: 7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive.h
URL:
http://svn.slimdevices.com/7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive.h?rev=3078&root=Jive&r1=3077&r2=3078&view=diff
==============================================================================
--- 7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive.h (original)
+++ 7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive.h Mon Oct 6 08:57:06 2008
@@ -255,6 +255,11 @@
/* extra pump function */
extern int (*jive_sdlevent_pump)(lua_State *L);
+
+extern int (*jive_sdlfilter_pump)(const SDL_Event *event);
+void jive_platform_init(lua_State *L);
+void jive_send_key_event(JiveEventType keyType, JiveKey keyCode);
+
/* global counter used to invalidate widget */
extern Uint32 jive_origin;
Modified: 7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework.c
URL:
http://svn.slimdevices.com/7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework.c?rev=3078&root=Jive&r1=3077&r2=3078&view=diff
==============================================================================
--- 7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework.c (original)
+++ 7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework.c Mon Oct 6
08:57:06 2008
@@ -10,8 +10,10 @@
#include <time.h>
+#include <SDL_syswm.h>
int (*jive_sdlevent_pump)(lua_State *L);
+int (*jive_sdlfilter_pump)(const SDL_Event *event);
char *jive_resource_path = NULL;
@@ -93,6 +95,7 @@
static int init_path(lua_State *L);
static int process_event(lua_State *L, SDL_Event *event);
+static int filter_events(const SDL_Event *event);
int jiveL_update_screen(lua_State *L);
@@ -148,6 +151,12 @@
SDL_Quit();
exit(-1);
}
+
+ /* Register callback for additional events (used for multimedia keys)*/
+ SDL_EventState(SDL_SYSWMEVENT,SDL_ENABLE);
+ SDL_SetEventFilter(filter_events);
+
+ jive_platform_init(L);
/* open window */
SDL_WM_SetCaption("SqueezePlay Beta", "SqueezePlay Beta");
@@ -244,6 +253,24 @@
return 0;
}
+static int filter_events(const SDL_Event *event)
+{
+ if (jive_sdlfilter_pump) {
+ return jive_sdlfilter_pump(event);
+ }
+
+ return 1;
+}
+
+void jive_send_key_event(JiveEventType keyType, JiveKey keyCode) {
+ JiveEvent keyEvent;
+ memset(&keyEvent, 0, sizeof(JiveEvent));
+
+ keyEvent.type = keyType;
+ keyEvent.ticks = SDL_GetTicks();
+ keyEvent.u.key.code = keyCode;
+ jive_queue_event(&keyEvent);
+}
static int jiveL_quit(lua_State *L) {
Added: 7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework_nonwindows.c
URL:
http://svn.slimdevices.com/7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework_nonwindows.c?rev=3078&root=Jive&view=auto
==============================================================================
--- 7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework_nonwindows.c
(added)
+++ 7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework_nonwindows.c
Mon Oct 6 08:57:06 2008
@@ -1,0 +1,15 @@
+/*
+** Copyright 2007 Logitech. All Rights Reserved.
+**
+** This file is subject to the Logitech Public Source License Version 1.0.
Please see the LICENCE file for details.
+*/
+
+
+#include "common.h"
+#include "jive.h"
+
+
+void jive_platform_init(lua_State *L) {
+ //nothing to do for platforms other than windows yet
+ //jive_sdlfilter_pump = <platform>_filter_pump;
+}
Added: 7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework_windows.c
URL:
http://svn.slimdevices.com/7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework_windows.c?rev=3078&root=Jive&view=auto
==============================================================================
--- 7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework_windows.c
(added)
+++ 7.3/trunk/squeezeplay/src/squeezeplay/src/ui/jive_framework_windows.c Mon
Oct 6 08:57:06 2008
@@ -1,0 +1,54 @@
+/*
+** Copyright 2007 Logitech. All Rights Reserved.
+**
+** This file is subject to the Logitech Public Source License Version 1.0.
Please see the LICENCE file for details.
+*/
+
+
+#include "common.h"
+#include "jive.h"
+
+#include <SDL_syswm.h>
+
+#ifndef WM_APPCOMMAND
+#define WM_APPCOMMAND 0x0319
+#endif
+static int windows_filter_pump(const SDL_Event *event);
+
+static int windows_filter_pump(const SDL_Event *event) {
+ //handle multimedia button events
+ if (event->type == SDL_SYSWMEVENT)
+ {
+ SDL_SysWMmsg *wmmsg;
+ wmmsg = event->syswm.msg;
+
+ if (wmmsg->msg == WM_APPCOMMAND) {
+ switch (GET_APPCOMMAND_LPARAM(wmmsg->lParam)) {
+ case APPCOMMAND_MEDIA_NEXTTRACK:
+
jive_send_key_event(JIVE_EVENT_KEY_PRESS, JIVE_KEY_FWD);
+ return 0; // return non-zero, because
we have handled the message (see MSDN doc)
+ case APPCOMMAND_MEDIA_PREVIOUSTRACK:
+
jive_send_key_event(JIVE_EVENT_KEY_PRESS, JIVE_KEY_REW);
+ return 0;
+ case APPCOMMAND_MEDIA_PLAY_PAUSE:
+
jive_send_key_event(JIVE_EVENT_KEY_PRESS, JIVE_KEY_PAUSE);
+ return 0;
+ case APPCOMMAND_VOLUME_DOWN:
+
jive_send_key_event(JIVE_EVENT_KEY_DOWN, JIVE_KEY_VOLUME_DOWN);
+ jive_send_key_event(JIVE_EVENT_KEY_UP,
JIVE_KEY_VOLUME_DOWN);
+ return 0;
+ case APPCOMMAND_VOLUME_UP:
+
jive_send_key_event(JIVE_EVENT_KEY_DOWN, JIVE_KEY_VOLUME_UP);
+ jive_send_key_event(JIVE_EVENT_KEY_UP,
JIVE_KEY_VOLUME_UP);
+ return 0;
+ //todo: APPCOMMAND_MEDIA_STOP or
JIVE_KEY_VOLUME_UP - do anything for these?
+ default : break;
+ }
+ }
+ }
+ return 1;
+}
+
+void jive_platform_init(lua_State *L) {
+ jive_sdlfilter_pump = windows_filter_pump;
+}
_______________________________________________
Jive-checkins mailing list
[email protected]
http://lists.slimdevices.com/cgi-bin/mailman/listinfo/jive-checkins