[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Compiling FSViewer (WAS Re: wmFilebrowser - a filebrowser in a different way)



Daniel Isenmann wrote:
> But you can have a look at FSViewer.app
> (http://www.bayernline.de/~gscholz/linux/fsviewer/), it's a file
> manager written in WINGs, it fits perfectly into Windowmaker.

To compile it you will need the patch below (which I think was written
by Alexey Voinov), and probably also feed --with-extralibs="-lXft"
to the configure script.

Good, now it compiles. But it does not work :-(

[mafra@Pilar:FSViewer.app-0.2.5]$ src/FSViewer
src/FSViewer warning: ICONDIR not found: /usr/share/fsviewer/icons

Then I made the above dir be a symlink to the xpm folder in the FSViewer
sources. After that trying to run FSViewer resulted in a segfault.

After looking at the strace I decided to create the folder 
~/GNUstep/Applications/FSViewer.app/tiff/
and put the contents of tiff/ from the fsviewer tar ball in there.

And now it works!

As I remember having trying this in the past and failing, I decided
to answer this email so that it is recorded in the archives for
later use :-)


diff -Nur FSViewer.app-0.2.5-alt/src/FSBrowser.c FSViewer.app-0.2.5/src/FSBrowser.c
--- FSViewer.app-0.2.5-alt/src/FSBrowser.c	Thu Dec 19 21:26:35 2002
+++ FSViewer.app-0.2.5/src/FSBrowser.c	Mon Dec 23 15:11:58 2002
@@ -278,13 +278,13 @@
 						   &titleLen, widthC);
 	    W_PaintText(bPtr->view, bPtr->view->window, scr->boldFont, x, 
 			(bPtr->titleHeight-WMFontHeight(scr->boldFont))/2,
-			bPtr->columnSize.width, WACenter, WMColorGC(scr->white),
+			bPtr->columnSize.width, WACenter, WMWhiteColor(scr),
 			False, titleBuf, titleLen);
 	    free (titleBuf);
 	} else {
 	    W_PaintText(bPtr->view, bPtr->view->window, scr->boldFont, x, 
 			(bPtr->titleHeight-WMFontHeight(scr->boldFont))/2,
-			bPtr->columnSize.width, WACenter, WMColorGC(scr->white),
+			bPtr->columnSize.width, WACenter, WMWhiteColor(scr),
 			False, bPtr->titles[column], titleLen);
 	}
     }
@@ -621,7 +621,7 @@
 
 
 static void
-paintItem(WMList *lPtr, int index, Drawable d, char *text, int state, 
+paintItem(WMList *lPtr, int index, Drawable d, char *text, int state,
 	  WMRect *rect)
 {
     WMView *view = W_VIEW(lPtr);
@@ -630,19 +630,18 @@
 /*     WMListItem *item; */
 
 /*     item = WMGetListItem(lPtr, index); */
-    
+
     width = rect->size.width;
     height = rect->size.height;
     x = rect->pos.x;
     y = rect->pos.y;
 
     if (state & WLDSSelected)
-	XFillRectangle(scr->display, d, WMColorGC(scr->white), x, y,
+        WMPaintColorSwatch(WMWhiteColor(scr), d, x, y,
 		       width, height);
-/*     else if(item->uflags & 1) */
-/* 	XFillRectangle(scr->display, d, WMColorGC(WMCreateNamedColor(scr, "yellow", False)), x, y, width, height); */
     else
-	XClearArea(scr->display, d, x, y, width, height, False);
+        WMPaintColorSwatch(WMGetWidgetBackgroundColor(lPtr), d, x, y,
+		       width, height);
 
     if (text) {
 	/* Avoid overlaping... */
@@ -652,11 +651,11 @@
 	    char *textBuf = createTruncatedString(scr->normalFont,
 		                                  text, &textLen, widthC);
             W_PaintText(view, d, scr->normalFont,  x+4, y, widthC,
-		    	WALeft, WMColorGC(scr->black), False, textBuf, textLen);
+			WALeft, WMBlackColor(scr), False, textBuf, textLen);
 	    free(textBuf);
 	} else {
-      	    W_PaintText(view, d, scr->normalFont,  x+4, y, widthC,
-		    	WALeft, WMColorGC(scr->black), False, text, textLen);
+	    W_PaintText(view, d, scr->normalFont,  x+4, y, widthC,
+			WALeft, WMBlackColor(scr), False, text, textLen);
 	}
     }
 
diff -Nur FSViewer.app-0.2.5-alt/src/FSFileButton.c FSViewer.app-0.2.5/src/FSFileButton.c
--- FSViewer.app-0.2.5-alt/src/FSFileButton.c	Thu Dec 19 21:26:35 2002
+++ FSViewer.app-0.2.5/src/FSFileButton.c	Mon Dec 23 14:52:07 2002
@@ -518,7 +518,7 @@
     {
 	
 	W_PaintText(view, d, screen->normalFont, x+ix, y+iy,
-		    strwidth, WACenter, WMColorGC(screen->black),
+		    strwidth, WACenter, WMBlackColor(screen),
 		    True, text, strlen(text));
     }
 
@@ -711,7 +711,7 @@
     XSetWindowBackgroundPixmap(WMScreenDisplay(scr), view->window, pix);
     XClearWindow(WMScreenDisplay(scr), view->window);
     W_PaintText(view, pix, scr->normalFont, 2, 1, width, WACenter, 
-		WMColorGC(scr->black), False, text, len);
+		WMBlackColor(scr), False, text, len);
     if(pix)
 	XFreePixmap(scr->display, pix);
 
diff -Nur FSViewer.app-0.2.5-alt/src/FSMCList.c FSViewer.app-0.2.5/src/FSMCList.c
--- FSViewer.app-0.2.5-alt/src/FSMCList.c	Thu Dec 19 21:26:35 2002
+++ FSViewer.app-0.2.5/src/FSMCList.c	Mon Dec 23 15:13:14 2002
@@ -257,7 +257,7 @@
 {
     char        *path;
     FileInfo    *fileList;
-    FileInfo    *start;
+    FileInfo    *start = NULL;
     WMListItem  *listItem;
     FSMCList    *mPtr = (FSMCList *)(WMGetHangedData(bPtr));
     WMList      *list = FSGetBrowserListInColumn(bPtr, column);
@@ -408,7 +408,7 @@
     if (width >= 3*dLen) {
 	int dddLen = 3*dLen;
 	int tmpTextLen = *textLen;
-	
+
 	strcpy(textBuf, text);
 	while (tmpTextLen
 	       && (WMWidthOfString(font, textBuf, tmpTextLen)+dddLen > width))
@@ -429,7 +429,7 @@
 }
 
 static void
-paintItem(WMList *lPtr, int index, Drawable d, 
+paintItem(WMList *lPtr, int index, Drawable d,
 	  char *text, int state, WMRect *rect)
 {
     int i = 0;
@@ -450,17 +450,18 @@
     x = rect->pos.x;
     y = rect->pos.y;
     fontHeight = WMFontHeight(scr->normalFont);
-    
+
     /* Highlight the selected area */
     if (state & WLDSSelected)
-        XFillRectangle(scr->display, d, WMColorGC(scr->white), 
-		       x, y, width, height);
+        WMPaintColorSwatch(WMWhiteColor(scr), d, x, y,
+		       width, height);
     else
-        XClearArea(scr->display, d, x, y, width, height, False);
+        WMPaintColorSwatch(WMGetWidgetBackgroundColor(lPtr), d, x, y,
+		       width, height);
 
     if(item->clientData)
     {
-	str = wstrdup(item->clientData);	
+	str = wstrdup(item->clientData);
 	len  = strlen(str);
     }
     else
@@ -513,10 +514,10 @@
 		else
 		    image = WMCreatePixmapFromXPMData(scr, list_file_xpm);
 		size  = WMGetPixmapSize(image);
-		WMDrawPixmap(image, d, 
+		WMDrawPixmap(image, d,
 			     x+6+(20-size.width)/2, (height-size.height)/2+y);
 		WMReleasePixmap(image);
-	    
+
 	    }
 	    else
 	    {
@@ -527,52 +528,52 @@
 		else
 		    tmpStr = wstrdup("F");
 
-		W_PaintText(view, d, scr->boldFont,  
+		W_PaintText(view, d, scr->boldFont,
 			    x+6, y+(height-fontHeight)/2, widthC,
-			    WALeft, WMColorGC(scr->darkGray), False, 
+			    WALeft, WMDarkGrayColor(scr), False,
 			    tmpStr, 1);
 
 		free(tmpStr);
 	    }
-		
-	    if (WMWidthOfString(scr->normalFont, items[i], textLen) > widthC) 
+
+	    if (WMWidthOfString(scr->normalFont, items[i], textLen) > widthC)
 	    {
 		char *textBuf = createTruncatedString(scr->normalFont,
-						      items[i], &textLen, 
+						      items[i], &textLen,
 						      widthC);
-		
-		W_PaintText(view, d, scr->normalFont,  
+
+		W_PaintText(view, d, scr->normalFont,
 			    x+26, y+(height-fontHeight)/2, widthC,
-			    WALeft, WMColorGC(scr->black), False, 
+			    WALeft, WMBlackColor(scr), False,
 			    textBuf, textLen);
 
 		free(textBuf);
 	    }
-	    else 
+	    else
 	    {
-		W_PaintText(view, d, scr->normalFont,  
+		W_PaintText(view, d, scr->normalFont,
 			    x+26, y+(height-fontHeight)/2, widthC,
-			    WALeft, WMColorGC(scr->black), False, items[i],
+			    WALeft, WMBlackColor(scr), False, items[i],
 			    textLen);
 	    }
 	    x += 194;
-	}	    
+	}
 	else if(i==3)
 	{
-	    W_PaintText(view, d, scr->normalFont,  
+	    W_PaintText(view, d, scr->normalFont,
 			x+6, y+(height-fontHeight)/2, 100,
-			WALeft, WMColorGC(scr->black), False, items[i], 
+			WALeft, WMBlackColor(scr), False, items[i],
 			strlen(items[i]));
 	    x += 100;
 	}
 	else
 	{
-	    W_PaintText(view, d, scr->normalFont,  
+	    W_PaintText(view, d, scr->normalFont,
 			x+6, y+(height-fontHeight)/2, 82,
-			WALeft, WMColorGC(scr->black), False, items[i], 
+			WALeft, WMBlackColor(scr), False, items[i],
 			strlen(items[i]));
 	    x += 82;
-	}	  
+	}
 	free(items[i]);
 	items[i] = NULL;
     }
diff -Nur FSViewer.app-0.2.5-alt/src/FSPrefs.c FSViewer.app-0.2.5/src/FSPrefs.c
--- FSViewer.app-0.2.5-alt/src/FSPrefs.c	Thu Dec 19 21:26:35 2002
+++ FSViewer.app-0.2.5/src/FSPrefs.c	Mon Dec 23 15:14:09 2002
@@ -1913,25 +1913,26 @@
     WMListItem *item = WMGetListItem(lPtr, index);
 
     if (item->selected)
-	XFillRectangle(scr->display, view->window, WMColorGC(scr->white), 
-		       rect->pos.x, rect->pos.y, 
+        WMPaintColorSwatch(WMWhiteColor(scr), d,
+		       rect->pos.x, rect->pos.y,
 		       rect->size.width, rect->size.height);
     else
-	XClearArea(scr->display, view->window, rect->pos.x, rect->pos.y, 
-		   rect->size.width, rect->size.height, False);
+        WMPaintColorSwatch(WMGetWidgetBackgroundColor(lPtr), d,
+		       rect->pos.x, rect->pos.y,
+		       rect->size.width, rect->size.height);
     
     if(item->uflags)
     {
-	W_PaintText(view, view->window, scr->boldFont, 
+	W_PaintText(view, d, scr->boldFont, 
 		    rect->pos.x+4, rect->pos.y, rect->size.width,
-		    WALeft, WMColorGC(scr->black), False,
+		    WALeft, WMBlackColor(scr), False,
 		    item->text, strlen(item->text));
     }
     else
     {
-	W_PaintText(view, view->window, scr->normalFont, 
+	W_PaintText(view, d, scr->normalFont, 
 		    rect->pos.x+4, rect->pos.y, rect->size.width,
-		    WALeft, WMColorGC(scr->black), False,
+		    WALeft, WMBlackColor(scr), False,
 		    item->text, strlen(item->text));
     }
 }
diff -Nur FSViewer.app-0.2.5-alt/src/FSUtils.c FSViewer.app-0.2.5/src/FSUtils.c
--- FSViewer.app-0.2.5-alt/src/FSUtils.c	Thu Dec 19 21:26:35 2002
+++ FSViewer.app-0.2.5/src/FSUtils.c	Mon Dec 23 14:55:35 2002
@@ -976,8 +976,8 @@
     clone = RMakeCenteredImage(image, 64, 64, &color1);
     pixmap = WMCreatePixmapFromRImage(scr, clone, 0);
 
-    RDestroyImage(image);
-    RDestroyImage(clone);
+    RReleaseImage(image);
+    RReleaseImage(clone);
 
     return pixmap;
 }
@@ -1028,8 +1028,8 @@
       pixmap = WMCreatePixmapFromRImage(scr, clone, 0);
     }
 
-    RDestroyImage(clone);
-    RDestroyImage(image);
+    RReleaseImage(clone);
+    RReleaseImage(image);
 
     return pixmap;
 }
@@ -1068,7 +1068,7 @@
     RClearImage(image, &color);
     pixmap = WMCreatePixmapFromRImage(scr, image, 0);
 
-    RDestroyImage(image);
+    RReleaseImage(image);
 
     return pixmap;
 }
diff -Nur FSViewer.app-0.2.5-alt/src/timestampWidget.c FSViewer.app-0.2.5/src/timestampWidget.c
--- FSViewer.app-0.2.5-alt/src/timestampWidget.c	Thu Dec 19 21:26:35 2002
+++ FSViewer.app-0.2.5/src/timestampWidget.c	Mon Dec 23 14:52:07 2002
@@ -99,6 +99,7 @@
     XpmIcon     weekday;
     XpmIcon     asvisible;
     GC          gc;
+    WMColor     *color;
     time_t      time;
 
     struct flags
@@ -236,7 +237,8 @@
     WMCreateEventHandler(timestamp->view, ExposureMask | StructureNotifyMask, handleEvents, timestamp);
 
     /* Default GC for paint. */
-    timestamp->gc = WMColorGC(scr->gray);
+    timestamp->color = WMGrayColor(scr);
+    timestamp->gc = WMColorGC(timestamp->color);
 
     W_ResizeView(timestamp->view, TIMESTAMP_MIN_WIDTH, TIMESTAMP_MIN_HEIGHT);
     DEBUG_PRINT("Resized View");
@@ -668,14 +670,14 @@
     {
         W_PaintTextAndImage(timestamp->view,
                             False,
-                            timestamp->gc,
+                            timestamp->color,
                             scr->normalFont,
                             WRFlat,
                             NULL,
                             WACenter,
                             timestamp->image,
                             WIPImageOnly,
-                            timestamp->gc,
+                            timestamp->color,
                             offset);
         DEBUG_PRINT("Painted image");
     }