[MPlayer-cvslog] r36954 - in trunk/gui/app: app.c app.h gui.h

ib subversion at mplayerhq.hu
Fri Feb 28 15:11:25 CET 2014


Author: ib
Date: Fri Feb 28 15:11:25 2014
New Revision: 36954

Log:
Fix bug with btnSet().

Only change the pressed state
if the item actually has a button.

Additionally, change variable name.

Modified:
   trunk/gui/app/app.c
   trunk/gui/app/app.h
   trunk/gui/app/gui.h

Modified: trunk/gui/app/app.c
==============================================================================
--- trunk/gui/app/app.c	Fri Feb 28 14:30:06 2014	(r36953)
+++ trunk/gui/app/app.c	Fri Feb 28 15:11:25 2014	(r36954)
@@ -241,15 +241,17 @@ void btnModify(int event, float state)
  * @param event event
  * @param set new value
  */
-void btnSet(int event, int set)
+void btnSet(int event, int state)
 {
     int i;
 
     for (i = 0; i <= guiApp.IndexOfMainItems; i++)
         if (guiApp.mainItems[i].message == event)
-            guiApp.mainItems[i].pressed = set;
+            if (hasButton(guiApp.mainItems[i]))
+                guiApp.mainItems[i].pressed = state;
 
     for (i = 0; i <= guiApp.IndexOfPlaybarItems; i++)
         if (guiApp.playbarItems[i].message == event)
-            guiApp.playbarItems[i].pressed = set;
+            if (hasButton(guiApp.mainItems[i]))
+                guiApp.playbarItems[i].pressed = state;
 }

Modified: trunk/gui/app/app.h
==============================================================================
--- trunk/gui/app/app.h	Fri Feb 28 14:30:06 2014	(r36953)
+++ trunk/gui/app/app.h	Fri Feb 28 15:11:25 2014	(r36954)
@@ -179,6 +179,6 @@ guiItem *appFindItem(int event);
 int appFindMessage(const char *name);
 void appFreeStruct(void);
 void btnModify(int event, float state);
-void btnSet(int event, int set);
+void btnSet(int event, int state);
 
 #endif /* MPLAYER_GUI_APP_H */

Modified: trunk/gui/app/gui.h
==============================================================================
--- trunk/gui/app/gui.h	Fri Feb 28 14:30:06 2014	(r36953)
+++ trunk/gui/app/gui.h	Fri Feb 28 15:11:25 2014	(r36954)
@@ -24,6 +24,8 @@
 #ifndef MPLAYER_GUI_GUI_H
 #define MPLAYER_GUI_GUI_H
 
+#include "gui/app/app.h"
+
 #include "stream/stream.h"
 
 /// Name of the program the GUI utilizes
@@ -49,4 +51,7 @@
 /// Check whether @a x/y is inside the rectangle given by @a top @a x/y and @a bottom @a x/y.
 #define isInside(x, y, tx, ty, bx, by) ((x) > (tx) && (y) > (ty) && (x) < (bx) && (y) < (by))
 
+/// Check whether #guiItem @a item has a button (and thus a pressed state).
+#define hasButton(item) (item.type == itButton || item.type == itHPotmeter || item.type == itVPotmeter)
+
 #endif /* MPLAYER_GUI_GUI_H */


More information about the MPlayer-cvslog mailing list