1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
diff --git a/apps/SOURCES b/apps/SOURCES
index 143d9d5..e6eecf7 100644
--- a/apps/SOURCES
+++ b/apps/SOURCES
@@ -78,6 +78,7 @@ gui/quickscreen.c
 #endif

 gui/wps.c
+gui/statusbar-skinned.c
 gui/scrollbar.c
 gui/splash.c
 gui/statusbar.c
diff --git a/apps/filetree.c b/apps/filetree.c
index ec79324..f8a6e29 100644
--- a/apps/filetree.c
+++ b/apps/filetree.c
@@ -482,7 +482,22 @@ int ft_enter(struct tree_context* c)
                 break;
 #endif

-
+#ifdef HAVE_LCD_BITMAP
+            case FILE_ATTR_SB:
+                splash(0, ID2P(LANG_WAIT));
+                set_file(buf, (char *)global_settings.sb_file,
+                         MAX_FILENAME);
+                settings_apply_skins();
+                break;
+#endif
+#ifdef HAVE_REMOTE_LCD
+            case FILE_ATTR_RSB:
+                splash(0, ID2P(LANG_WAIT));
+                set_file(buf, (char *)global_settings.rsb_file,
+                         MAX_FILENAME);
+                settings_apply_skins();
+                break;
+#endif
                 /* wps config file */
             case FILE_ATTR_WPS:
                 splash(0, ID2P(LANG_WAIT));
diff --git a/apps/filetypes.h b/apps/filetypes.h
index f872cf8..472f792 100644
--- a/apps/filetypes.h
+++ b/apps/filetypes.h
@@ -41,6 +41,8 @@
 #define FILE_ATTR_KBD   0x0C00 /* keyboard file */
 #define FILE_ATTR_FMR   0x0D00 /* preset file */
 #define FILE_ATTR_CUE   0x0E00 /* cuesheet file */
+#define FILE_ATTR_SB    0x0F00 /* cuesheet file */
+#define FILE_ATTR_RSB   0x1000 /* cuesheet file */
 #define FILE_ATTR_MASK  0xFF00 /* which bits tree.c uses for file types */

 struct filetype {
diff --git a/apps/gui/list.c b/apps/gui/list.c
index 332459c..c23fa99 100644
--- a/apps/gui/list.c
+++ b/apps/gui/list.c
@@ -29,6 +29,7 @@
 #include "kernel.h"
 #include "system.h"

+#include "appevents.h"
 #include "action.h"
 #include "screen_access.h"
 #include "list.h"
@@ -233,6 +234,9 @@ void gui_synclist_draw(struct gui_synclist *gui_list)
     {
         list_draw(&screens[i], gui_list);
     }
+/*
+    send_event(GUI_EVENT_ACTIONUPDATE, NULL);
+*/
 }

 /* sets up the list so the selection is shown correctly on the screen */
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c
index 9f31007..e01c7d9 100644
--- a/apps/gui/skin_engine/skin_display.c
+++ b/apps/gui/skin_engine/skin_display.c
@@ -148,6 +148,9 @@ static void draw_progressbar(struct gui_wps *gwps,
         y = (-y -1)*line_height + (0 > center ? 0 : center);
     }

+    if (!state->id3)
+        return;
+
     if (pb->have_bitmap_pb)
         gui_bitmap_scrollbar_draw(display, pb->bm,
                                   pb->x, y, pb->width, pb->bm.height,
@@ -466,7 +469,12 @@ static bool evaluate_conditional(struct gui_wps *gwps, int *token_index)
 #ifdef HAVE_LCD_BITMAP
         /* clear all pictures in the conditional and nested ones */
         if (data->tokens[i].type == WPS_TOKEN_IMAGE_PRELOAD_DISPLAY)
-            clear_image_pos(gwps, find_image(data->tokens[i].value.i&0xFF, gwps->data));
+        {
+            struct gui_img *tmp = find_image(data->tokens[i].value.i&0xFF,
+                                                data);
+            if (tmp)
+                clear_image_pos(gwps, tmp);
+        }
 #endif
 #ifdef HAVE_ALBUMART
         if (data->tokens[i].type == WPS_TOKEN_ALBUMART_DISPLAY)
@@ -479,19 +487,36 @@ static bool evaluate_conditional(struct gui_wps *gwps, int *token_index)
 #ifdef HAVE_LCD_BITMAP
 struct gui_img* find_image(int n, struct wps_data *data)
 {
+    static int i = 0;
+    struct gui_img *ret = NULL;
     struct skin_token_list *list = data->images;
+    if (data->debug)
+    {
+        DEBUGF("%s >> requesting image (id: %d)\n", __func__, n);
+        DEBUGF("%s >> first list data (p: %p\n", __func__, data->images);
+    }
     while (list)
     {
         struct gui_img *img = (struct gui_img *)list->token->value.data;
         if (img->id == n)
-            return img;
+        {
+            i = 0;
+            ret = img; goto end;
+        }
         list = list->next;
+/*
+        if (!list && data->debug)
+            DEBUGF("failed to find: %s\n", img->bm.data);
+*/
     }
-    return NULL;
+    i = 0;
+end:
+    if (data->debug)
+    DEBUGF("%s >> returning %p\n", __func__, ret);
+    return ret;
 }   
 #endif 
-            
-    
+
 /* Read a (sub)line to the given alignment format buffer.
    linebuf is the buffer where the data is actually stored.
    align is the alignment format that'll be used to display the text.
@@ -921,10 +946,9 @@ static bool skin_redraw(struct gui_wps *gwps, unsigned refresh_mode)
     if (!data || !state || !display)
         return false;

+/*
     struct mp3entry *id3 = state->id3;
-
-    if (!id3)
-        return false;
+*/

     int v, line, i, subline_idx;
     unsigned flags;
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index 20156a6..c6c7824 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -547,6 +547,8 @@ static int parse_image_load(const char *wps_bufptr,
 	    return WPS_ERROR_INVALID_PARAM;
     /* save a pointer to the filename */
     img->bm.data = (char*)filename;
+    if (wps_data->debug)
+        DEBUGF("%s >> image parsed (id: %d)\n", __func__, n);
     img->id = n;
     img->x = x;
     img->y = y;
@@ -1494,7 +1496,12 @@ static void wps_reset(struct wps_data *data)
 #ifdef HAVE_REMOTE_LCD
     bool rwps = data->remote_wps; /* remember whether the data is for a RWPS */
 #endif
+
+    bool old_debug = data->debug;
+    if (old_debug)
+        DEBUGF("%s >> wps_data trashed (%p)\n", __func__, data);
     memset(data, 0, sizeof(*data));
+    data->debug = old_debug;
     skin_data_init(data);
 #ifdef HAVE_REMOTE_LCD
     data->remote_wps = rwps;
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h
index 99b6e8a..5cc3af2 100644
--- a/apps/gui/skin_engine/wps_internals.h
+++ b/apps/gui/skin_engine/wps_internals.h
@@ -283,6 +283,7 @@ struct wps_data

     /* tick the volume button was last pressed */
     unsigned int button_time_volume;
+    bool debug;
 };


diff --git a/apps/gui/statusbar-skinned.c b/apps/gui/statusbar-skinned.c
new file mode 100644
index 0000000..311dcf4
--- /dev/null
+++ b/apps/gui/statusbar-skinned.c
@@ -0,0 +1,131 @@
+/***************************************************************************
+ *             __________               __   ___.
+ *   Open      \______   \ ____   ____ |  | _\_ |__   _______  ___
+ *   Source     |       _//  _ \_/ ___\|  |/ /| __ \ /  _ \  \/  /
+ *   Jukebox    |    |   (  <_> )  \___|    < | \_\ (  <_> > <  <
+ *   Firmware   |____|_  /\____/ \___  >__|_ \|___  /\____/__/\_ \
+ *                     \/            \/     \/    \/            \/
+ * $Id$
+ *
+ * Copyright (C) 2009 Thomas Martitz
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include "config.h"
+
+#include "system.h"
+#include "settings.h"
+#include "appevents.h"
+#include "screens.h"
+#include "screen_access.h"
+#include "skin_engine/skin_engine.h"
+#include "skin_engine/wps_internals.h"
+#include "debug.h"
+
+
+/* currently only one wps_state is needed */
+extern struct wps_state wps_state;
+static struct gui_wps sb_skin[NB_SCREENS];
+static struct wps_data sb_skin_data[NB_SCREENS];
+
+/* initial setup of wps_data  */
+static void sb_skin_update(void*);
+
+void sb_skin_data_load(enum screen_type screen, const char *buf, bool isfile)
+{
+    bool loaded_ok;
+    int statusbar;
+
+#ifdef HAVE_REMOTE_LCD
+    if (screen == SCREEN_REMOTE)
+        statusbar = global_settings.remote_statusbar;
+    else
+#endif
+        statusbar = global_settings.statusbar;
+
+    loaded_ok = buf && skin_data_load(sb_skin[screen].data,
+                                        &screens[screen], buf, isfile);
+
+
+    if (loaded_ok && statusbar == STATUSBAR_CUSTOM)
+        add_event(GUI_EVENT_ACTIONUPDATE, false, sb_skin_update);
+    else
+        remove_event(GUI_EVENT_ACTIONUPDATE, sb_skin_update);
+
+#ifdef HAVE_REMOVE_LCD
+    sb_skin[screen].data->remote_wps = !(screen == SCREEN_MAIN);
+#endif
+}
+
+void sb_skin_data_init(enum screen_type screen)
+{
+    skin_data_init(sb_skin[screen].data);
+}
+
+
+void sb_skin_update(void* param)
+{
+    int i;
+    (void)param;
+    FOR_NB_SCREENS(i)
+    {
+        skin_update(&sb_skin[i], wps_state.do_full_update?
+                    WPS_REFRESH_ALL : WPS_REFRESH_NON_STATIC);
+    }
+}
+
+void sb_skin_init(void)
+{
+    int i;
+    FOR_NB_SCREENS(i)
+    {
+        skin_data_init(&sb_skin_data[i]);
+#ifdef HAVE_ALBUMART
+        sb_skin_data[i].wps_uses_albumart = 0;
+#endif
+#ifdef HAVE_REMOTE_LCD
+        sb_skin_data[i].remote_wps = (i == SCREEN_REMOTE);
+#endif
+        sb_skin[i].data = &sb_skin_data[i];
+        sb_skin[i].display = &screens[i];
+        sb_skin[i].data->debug = true;
+        DEBUGF("data in init: %p, debug: %d\n", &sb_skin_data[i], sb_skin_data[i].debug);
+        /* Currently no seperate wps_state needed/possible
+           so use the only available ( "global" ) one */
+        sb_skin[i].state = &wps_state;
+    }
+#ifdef HAVE_LCD_BITMAP
+/*
+    add_event(GUI_EVENT_STATUSBAR_TOGGLE, false, statusbar_toggle_handler);
+*/
+#endif
+}
+
+#ifdef HAVE_ALBUMART
+bool sb_skin_uses_statusbar(int *width, int *height)
+{
+    int  i;
+    FOR_NB_SCREENS(i) {
+        struct gui_wps *gwps = &sb_skin[i];
+        if (gwps->data && (gwps->data->wps_uses_albumart != WPS_ALBUMART_NONE))
+        {
+            if (width)
+                *width = sb_skin[0].data->albumart_max_width;
+            if (height)
+                *height = sb_skin[0].data->albumart_max_height;
+            return true;
+        }
+    }
+    return false;
+}
+#endif
diff --git a/apps/gui/wps.c b/apps/gui/wps.c
index 055f8d0..46074ea 100644
--- a/apps/gui/wps.c
+++ b/apps/gui/wps.c
@@ -80,7 +80,7 @@

 static int wpsbars;
 /* currently only one wps_state is needed */
-static struct wps_state wps_state;
+struct wps_state wps_state;
 static struct gui_wps gui_wps[NB_SCREENS];
 static struct wps_data wps_datas[NB_SCREENS];

@@ -98,6 +98,7 @@ void wps_data_load(enum screen_type screen, const char *buf, bool isfile)

     loaded_ok = buf && skin_data_load(gui_wps[screen].data,
                                         &screens[screen], buf, isfile);
+    DEBUGF("%s >> wps loading\n", __func__);
     if (!loaded_ok) /* load the hardcoded default */
     {
         char *skin_buf[NB_SCREENS] = {
@@ -1268,6 +1269,7 @@ void gui_sync_wps_init(void)
 #ifdef HAVE_REMOTE_LCD
         wps_datas[i].remote_wps = (i == SCREEN_REMOTE);
 #endif
+        wps_datas[i].debug = false;
         gui_wps[i].data = &wps_datas[i];
         gui_wps[i].display = &screens[i];
         /* Currently no seperate wps_state needed/possible
diff --git a/apps/main.c b/apps/main.c
index 49542e8..b08154f 100644
--- a/apps/main.c
+++ b/apps/main.c
@@ -300,6 +300,7 @@ static void init(void)
     settings_reset();
     settings_load(SETTINGS_ALL);
     gui_sync_wps_init();
+    sb_skin_init();
     settings_apply(true);
     init_dircache(true);
     init_dircache(false);
diff --git a/apps/settings.c b/apps/settings.c
index 48571db..786c2c5 100644
--- a/apps/settings.c
+++ b/apps/settings.c
@@ -734,6 +734,7 @@ void settings_apply_skins(void)
     char buf[MAX_PATH];
     /* re-initialize the skin buffer before we start reloading skins */
     skin_buffer_init();
+    sb_skin_data_init(SCREEN_MAIN);
     if ( global_settings.wps_file[0] &&
         global_settings.wps_file[0] != 0xff ) {
         snprintf(buf, sizeof buf, WPS_DIR "/%s.wps",
@@ -745,6 +746,17 @@ void settings_apply_skins(void)
         wps_data_init(SCREEN_MAIN);
         wps_data_load(SCREEN_MAIN, NULL, true);
     }
+    if ( global_settings.sb_file[0] &&
+        global_settings.sb_file[0] != 0xff ) {
+        snprintf(buf, sizeof buf, WPS_DIR "/%s.sb",
+                global_settings.sb_file);
+        sb_skin_data_load(SCREEN_MAIN, buf, true);
+    }
+    else
+    {
+        sb_skin_data_init(SCREEN_MAIN);
+        sb_skin_data_load(SCREEN_MAIN, NULL, true);
+    }
 #if defined(HAVE_REMOTE_LCD) && (NB_SCREENS > 1)
     if ( global_settings.rwps_file[0]) {
         snprintf(buf, sizeof buf, WPS_DIR "/%s.rwps",
diff --git a/apps/settings.h b/apps/settings.h
index 998fdc1..991ff2e 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -59,6 +59,7 @@ struct opt_items {
 #define FONT_DIR    ROCKBOX_DIR "/fonts"
 #define LANG_DIR    ROCKBOX_DIR "/langs"
 #define WPS_DIR     ROCKBOX_DIR "/wps"
+#define SB_DIR      ROCKBOX_DIR "/statusbar"
 #define THEME_DIR   ROCKBOX_DIR "/themes"
 #define ICON_DIR    ROCKBOX_DIR "/icons"

@@ -543,6 +544,7 @@ struct user_settings
     int peak_meter_max; /* range maximum */

     unsigned char wps_file[MAX_FILENAME+1];  /* last wps */
+    unsigned char sb_file[MAX_FILENAME+1];  /* last wps */
     unsigned char lang_file[MAX_FILENAME+1]; /* last language */
     unsigned char playlist_catalog_dir[MAX_FILENAME+1];
     int skip_length; /* skip length */
diff --git a/apps/settings_list.c b/apps/settings_list.c
index 98dd900..379d77c 100644
--- a/apps/settings_list.c
+++ b/apps/settings_list.c
@@ -1374,6 +1374,8 @@ const struct settings_list settings[] = {
 #endif
     TEXT_SETTING(F_THEMESETTING,wps_file, "wps",
                      DEFAULT_WPSNAME, WPS_DIR "/", ".wps"),
+    TEXT_SETTING(F_THEMESETTING,sb_file, "sb",
+                     DEFAULT_WPSNAME, WPS_DIR "/", ".sb"),
     TEXT_SETTING(0,lang_file,"lang","",LANG_DIR "/",".lng"),
 #ifdef HAVE_REMOTE_LCD
     TEXT_SETTING(F_THEMESETTING,rwps_file,"rwps",
diff --git a/wps/WPSLIST b/wps/WPSLIST
index 58fa5f1..2ba3fb2 100644
--- a/wps/WPSLIST
+++ b/wps/WPSLIST
@@ -291,6 +291,8 @@ Author: Jens Arnold
 <wps>
 Name: cabbiev2.wps
 RWPS: cabbiev2.rwps
+SB: cabbiev2.sb
+RSB: cabbiev2.rsb
 # Real name of the creator of the WPS
 Author: Johannes Voggenthaler, Apoo Maha, Marc Guay, Alex Vanderpol, Jerry Lange, Keith Perri, Mark Fawcus, and Marianne Arnold with support from Rockbox developers and forums. Based on Cabbie by Yohann Misquitta.

@@ -374,6 +376,7 @@ viewers iconset.240x400x16: /.rockbox/icons/tango_small_viewers.bmp
 Statusbar: top

 # list & remote ui viewports
+ui viewport.176x220x16: 0,0,-,180,-,-,-
 ui viewport: -
 remote ui viewport: -
 </wps>
diff --git a/wps/cabbiev2.176x220x16.sb b/wps/cabbiev2.176x220x16.sb
new file mode 100644
index 0000000..505b57f
--- /dev/null
+++ b/wps/cabbiev2.176x220x16.sb
@@ -0,0 +1,20 @@
+# cabbie 2.0 default for the Sansa e200 Series by Marc Guay
+# derived from cabbie 2.0 default (C) 2007, Johannes Voggenthaler (Zinc Alloy)
+%wd
+%xl|A|lock-176x220x16.bmp|51|24|2|
+%xl|B|battery-176x220x16.bmp|73|26|10|
+%xl|C|volume-176x220x16.bmp|97|26|10|
+%xl|D|shuffle-176x220x16.bmp|119|27|
+%xl|E|repeat-176x220x16.bmp|144|24|4|
+%xl|F|playmode-176x220x16.bmp|159|24|5|
+#NowPlaying
+%V|0|180|-|-|-|-|-|
+%pb|pb-176x220x16.bmp|5|2|166|8|
+%al    %pc%ac%pp of %pe%ar%pr   
+%?mh<%xdAa|%xdAb>
+%?bp<%?bc<%xdBa|%xdBb>|%?bl<|%xdBc|%xdBd|%xdBe|%xdBf|%xdBg|%xdBh|%xdBi|%xdBj>>
+%?pv<%xdCa|%xdCb|%xdCc|%xdCd|%xdCe|%xdCf|%xdCg|%xdCh|%xdCi|%xdCj>
+%?ps<%xdD>
+%?mm<|%xdEa|%xdEb|%xdEc|%xdEd>
+%?mp<%xdFa|%xdFb|%xdFc|%xdFd|%xdFe>
+#%?C<%C>
diff --git a/wps/wpsbuild.pl b/wps/wpsbuild.pl
index e9e5c29..0492ed0 100755
--- a/wps/wpsbuild.pl
+++ b/wps/wpsbuild.pl
@@ -35,6 +35,8 @@ my @depthlist = ( 16, 8, 4, 2, 1 );
 my $wps;
 my $wps_prefix;
 my $rwps;
+my $sb;
+my $rsb;
 my $width;
 my $height;
 my $font;
@@ -195,7 +197,7 @@ sub copywps
     if($wpslist =~ /(.*)WPSLIST/) {
         $dir = $1;
 #        system("cp $dir/$wps .rockbox/wps/");
-        #print "$req_t_wps $req_g_wps\n";
+        print "$req_t_wps $req_g_wps\n";

         if (-e "$dir/$req_t_wps" ) {
           system("cp $dir/$req_t_wps $rbdir/wps/$wps");
@@ -235,7 +237,7 @@ sub copywps

 sub buildcfg {
     my $cfg = $wps;
-    my @out;
+    my @out;    

     $cfg =~ s/\.(r|)wps/.cfg/;

@@ -338,6 +340,8 @@ while(<WPS>) {
         undef $wps;
         undef $wps_prefix;
         undef $rwps;
+        undef $sb;
+        undef $rsb;
         undef $width;
         undef $height;
         undef $font;
@@ -454,6 +458,18 @@ while(<WPS>) {
         elsif($l =~ /^RWPS\.${main_width}x${main_height}x$main_depth: *(.*)/i) {
             $rwps = $1;
         }
+        elsif($l =~ /^SB: *(.*)/i) {
+            $sb = $1;
+        }
+        elsif($l =~ /^SB\.${main_width}x${main_height}x$main_depth: *(.*)/i) {
+            $sb = $1;
+        }
+        elsif($l =~ /^RSB: *(.*)/i) {
+            $rsb = $1;
+        }
+        elsif($l =~ /^RSB\.${main_width}x${main_height}x$main_depth: *(.*)/i) {
+            $rsb = $1;
+        }
         elsif($l =~ /^Author: *(.*)/i) {
             $author = $1;
         }
@@ -526,9 +542,15 @@ while(<WPS>) {
         elsif($l =~ /^ui viewport: *(.*)/i) {
             $listviewport = $1;
         }
+        elsif($l =~ /^ui viewport\.${main_width}x${main_height}x$main_depth: *(.*)/i) {
+            $listviewport = $1;
+        }
         elsif($l =~ /^remote ui viewport: *(.*)/i) {
             $remotelistviewport = $1;
         }
+        elsif($l =~ /^remote ui viewport\.${main_width}x${main_height}x$main_depth: *(.*)/i) {
+            $remotelistviewport = $1;
+        }
         else{
             #print "Unknown line:  $l!\n";
         }