changeset 33083:8c96263e0f09

Clean up cmd_window(). Assign currWinName only after it has been checked. Compare window name in full. Add currWinItemIdx and currWinItems assignments for sub windows.
author ib
date Thu, 31 Mar 2011 12:03:54 +0000
parents 8b561660a6f7
children b8779b19730e
files gui/skin/skin.c
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/gui/skin/skin.c	Thu Mar 31 11:38:30 2011 +0000
+++ b/gui/skin/skin.c	Thu Mar 31 12:03:54 2011 +0000
@@ -179,19 +179,21 @@
         return 1;
     }
 
-    av_strlcpy(currWinName, strlower(in), sizeof(currWinName));
+    strlower(in);
 
-    if (!strncmp(in, "main", 4)) {
+    if (strcmp(in, "main") == 0) {
         currWin = &appMPlayer.main;
         currWinItemIdx = &appMPlayer.IndexOfMainItems;
         currWinItems   = appMPlayer.mainItems;
-    } else if (!strncmp(in, "sub", 3))
+    } else if (strcmp(in, "sub") == 0) {
         currWin = &appMPlayer.sub;
-    else if (!strncmp(in, "playbar", 7)) {
+        currWinItemIdx = NULL;
+        currWinItems   = NULL;
+    } else if (strcmp(in, "playbar") == 0) {
         currWin = &appMPlayer.bar;
         currWinItemIdx = &appMPlayer.IndexOfBarItems;
         currWinItems   = appMPlayer.barItems;
-    } else if (!strncmp(in, "menu", 4)) {
+    } else if (strcmp(in, "menu") == 0) {
         currWin = &appMPlayer.menuBase;
         currWinItemIdx = &appMPlayer.IndexOfMenuItems;
         currWinItems   = appMPlayer.menuItems;
@@ -200,6 +202,8 @@
         return 1;
     }
 
+    av_strlcpy(currWinName, in, sizeof(currWinName));
+
     mp_dbg(MSGT_GPLAYER, MSGL_DBG2, "[skin]   window: %s\n", currWinName);
 
     return 0;