### Eclipse Workspace Patch 1.0
#P rockbox-devel
Index: firmware/drivers/lcd-16bit.c
===================================================================
--- firmware/drivers/lcd-16bit.c.orig
+++ firmware/drivers/lcd-16bit.c
@@ -129,6 +129,16 @@ void lcd_setmargins(int x1, int x2, int 
     ymargin = y;
 }
 
+void lcd_set_custom_width(int width)
+{
+    rightmargin = leftmargin+width;
+}
+
+int lcd_get_custom_width(void)
+{
+    return rightmargin;
+}
+
 int lcd_getleftmargin(void)
 {
     return leftmargin;
@@ -731,7 +741,7 @@ static void lcd_putsxyofs(int x, int y, 
 
     ucs = bidi_l2v(str, 1);
 
-    while ((ch = *ucs++) != 0 && x < LCD_WIDTH)
+    while ((ch = *ucs++) != 0 && x < lcd_get_custom_width())
     {
         int width;
         const unsigned char *bits;
@@ -744,10 +754,12 @@ static void lcd_putsxyofs(int x, int y, 
             ofs -= width;
             continue;
         }
-
+        
         bits = font_get_bits(pf, ch);
 
-        lcd_mono_bitmap_part(bits, ofs, 0, width, x, y, width - ofs, pf->height);
+        lcd_mono_bitmap_part(bits, ofs, 0, width, x, y, 
+        	(x+width > lcd_get_custom_width()?lcd_get_custom_width()-x:width) - ofs, 
+        	pf->height);
         
         x += width - ofs;
         ofs = 0;
Index: apps/screen_access.c
===================================================================
--- apps/screen_access.c.orig
+++ apps/screen_access.c
@@ -118,6 +118,8 @@ void screen_init(struct screen * screen,
             screen->width=LCD_WIDTH;
             screen->height=LCD_HEIGHT;
             screen->setmargins=&lcd_setmargins;
+            screen->set_custom_width=&lcd_set_custom_width;
+            screen->get_custom_width=&lcd_get_custom_width;
             screen->getymargin=&lcd_getymargin;
             screen->getleftmargin=&lcd_getleftmargin;
             screen->getrightmargin=&lcd_getrightmargin;
Index: apps/screen_access.h
===================================================================
--- apps/screen_access.h.orig
+++ apps/screen_access.h
@@ -63,6 +63,8 @@ struct screen
 
 #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) /* always bitmap */
     void (*setmargins)(int x1, int x2, int y);
+    void (*set_custom_width)(int width);
+    int (*get_custom_width)(void);
     int (*getleftmargin)(void);
     int (*getrightmargin)(void);
     int (*getymargin)(void);
Index: firmware/export/lcd.h
===================================================================
--- firmware/export/lcd.h.orig
+++ firmware/export/lcd.h
@@ -269,6 +269,12 @@ extern void lcd_setmargins(int leftmargi
 extern int  lcd_getleftmargin(void);
 extern int  lcd_getrightmargin(void);
 extern int  lcd_getymargin(void);
+
+#if HAVE_LCD_BITMAP
+extern int  lcd_get_custom_width(void);
+extern void  lcd_set_custom_width(int width);
+#endif
+
 extern void lcd_setfont(int font);
 extern int  lcd_getstringsize(const unsigned char *str, int *w, int *h);
 
