Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sat 20 Sep 2014, 16:20
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
GtkDialog1-1.3
Post new topic   Reply to topic View previous topic :: View next topic
Page 10 of 14 [207 Posts]   Goto page: Previous 1, 2, 3, ..., 8, 9, 10, 11, 12, 13, 14 Next
Author Message
disciple

Joined: 20 May 2006
Posts: 6435
Location: Auckland, New Zealand

PostPosted: Sun 27 May 2012, 18:23    Post subject:  

goingnuts wrote:
Also saved 73K by making a multicall binary of the 4 progs in the cdtool package

Out of interest: is that a standard option, or does it involve some trickery?

_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4351

PostPosted: Sun 27 May 2012, 20:19    Post subject:  

disciple wrote:
Out of interest: is that a standard option, or does it involve some trickery?
not standard, but the principle is straightforward - change the main() for each program to program_main() and make a new main() that calls the appropriate program_main() based on the basename of agv[0] (the /path/name of the binary as executed) or argv[1] if for instance the first arg is busybox - see the latest release of mupdf for an example that I contributed to (mubusy).

Now this is also applicable to scripts, but using $0 instead of argv[0]
for example

Code:
cdplayer(){
: code here
}

processinfo(){
: code here
}

multicall(){
$@
}

mycommand=`basename $0`
$mycommand $@

(this will run the function cdplayer if you run the script as ./cdplayer or multicall cdplayer, and is much more compressible than several small files)

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
disciple

Joined: 20 May 2006
Posts: 6435
Location: Auckland, New Zealand

PostPosted: Mon 28 May 2012, 00:01    Post subject:  

Oh, so you're actually doing it to reduce the number of executables, rather than to avoid compiling multiple copies of shared code?
Do you need to post the modified source?
What license is it under?

_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
goingnuts

Joined: 07 Dec 2008
Posts: 780

PostPosted: Mon 28 May 2012, 08:49    Post subject:  

Main purpose of doing mcb is to reduce total size...
I do not know about the license stuff and if source must be shipped along with the binary but as always source is available upon request. I seldom ship the modified source code as only very few seems interested in that...

Attached an other demo - gtkrdesktop - including rdesktop-1.2.0 static build.

The purpose of making the demos is to exercise gtkdialog1 and find missing features etc. The gtkrdesktop is a launcher for the remote desktop application rdesktop, used to connect to various windows desktops. I would have liked to include possibilities for saving/loading profiles but are missing some features in the gtkdialog1 like setting status of checkboxes via script/variable and the append action to comboboxes - added to the TODO list in first post.
snap0001.png
 Description   
 Filesize   17.26 KB
 Viewed   683 Time(s)

snap0001.png

gtkrdesktop-0.1.pet
Description  gtkdialog1 front end to rdesktop-1.2.0
pet

 Download 
Filename  gtkrdesktop-0.1.pet 
Filesize  123.91 KB 
Downloaded  293 Time(s) 
Back to top
View user's profile Send private message Visit poster's website 
disciple

Joined: 20 May 2006
Posts: 6435
Location: Auckland, New Zealand

PostPosted: Mon 28 May 2012, 18:31    Post subject:  

goingnuts wrote:
Main purpose of doing mcb is to reduce total size...

Yeah, I was really asking about how it reduces the total size.
Quote:
I do not know about the license stuff and if source must be shipped along with the binary

OK, looking at http://packages.debian.org/changelogs/pool/main/c/cdtool/cdtool_2.1.8-release-2/cdtool.copyright it seems to be under the GPL, and therefore it must.
Quote:
but as always source is available upon request.

Please provide it. Thanks.
Quote:
I seldom ship the modified source code as only very few seems interested in that...

What if someone comes along in future who wants it, but you're not around anymore? Your effort would have been wasted, as someone else would need to redo it.
I know of a case where someone released a couple of Windows builds of a program that they were working on based on a GPL library, promising to release the source when it was "finished" (a number of people want it, mostly to build on Linux). But then they disappeared from the forum it was released on, without providing the source. There are still people finding it years later, but all we can do is use the binary with Wine Sad
Quote:
Attached an other demo - gtkrdesktop - including rdesktop-1.2.0 static build.

Cool.

_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
goingnuts

Joined: 07 Dec 2008
Posts: 780

PostPosted: Tue 29 May 2012, 01:15    Post subject:  

disciple wrote:

Please provide it. Thanks
...
What if someone comes along in future who wants it, but you're not around anymore? Your effort would have been wasted, as someone else would need to redo it.
...
Is a patch OK?

The mcb is more a technique and it is described other places in this forum - but as it involves some specific new code for every binary you apply it too - I guess you are right - and I do see your point
cdtool-2.1.8.mcb.tar.gz
Description  modified source
gz

 Download 
Filename  cdtool-2.1.8.mcb.tar.gz 
Filesize  116.66 KB 
Downloaded  297 Time(s) 
cdtool-2.1.8_mcb_patch.txt.gz
Description  fake .gz-file - just rename to cdtool-2.1.8_mcb_patch.txt
run "patch -p0<cdtool-2.1.8_mcb_patch.txt"
run "./configure"
run ./build_mcb.sh"
gz

 Download 
Filename  cdtool-2.1.8_mcb_patch.txt.gz 
Filesize  7.33 KB 
Downloaded  308 Time(s) 
Back to top
View user's profile Send private message Visit poster's website 
disciple

Joined: 20 May 2006
Posts: 6435
Location: Auckland, New Zealand

PostPosted: Tue 29 May 2012, 01:46    Post subject:  

Yes, thanks, I generally prefer patches.

Actually, I think I wasn't 100% correct when I said you need to post the source with the binary. You need to either post the source or a written offer to provide the source to anyone who has the binary. (I also saw someone say that the source needs to be distributed with the binary, but not necessarily by you, and that if you provided a link to the original source that would suffice, along with patches for any changes. I'm not sure how true this is.)
Anyway, I think technically we should be distributing source with every .pet, in which case the GPL compliance around here is terrible. Providing patches should make most people happy though.

_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
goingnuts

Joined: 07 Dec 2008
Posts: 780

PostPosted: Tue 29 May 2012, 15:36    Post subject:  

disciple: Thanks for info!

Attached another demo: gtkman
Find man pages present on your system and text-format them for view in edit-widget. Need original man - busybox man will not work - so static build of man-1.6e also included.
snap0002.png
 Description   
 Filesize   24.31 KB
 Viewed   616 Time(s)

snap0002.png

gtkman-0.1.pet
Description  gtkdialog1 front end for man pages -
static build of man included
pet

 Download 
Filename  gtkman-0.1.pet 
Filesize  26.91 KB 
Downloaded  308 Time(s) 
Back to top
View user's profile Send private message Visit poster's website 
technosaurus


Joined: 18 May 2008
Posts: 4351

PostPosted: Fri 08 Jun 2012, 05:03    Post subject:  

Here is a static build with my musl toolkit (all pixbuff loaders are working except tiff ,... but only because it is kindof irrelevant here), I modified stringman.c to speed up the file search - you can now just export GTKDIALOG_PIXMAP_DIR and it will look there.

Code:
char *find_pixmap(char *filename)
{
   char tmp[128];
   static char *line = NULL;
   static uint length = 0;
   FILE *locate;

   if (access(filename, R_OK) == 0)
      return filename;

   //snprintf(tmp, 127, "/usr/share/icons/Bluecurve/16x16/stock/%s",
   snprintf(tmp, 127, "/usr/share/pixmaps/%s", filename);
   tmp[127] = '\0';
   if (access(tmp, R_OK) == 0)
      return strdup(tmp);

   snprintf(tmp, 127, "/usr/share/mini-icons/%s", filename);
   tmp[127] = '\0';
   if (access(tmp, R_OK) == 0)
      return strdup(tmp);


   snprintf(tmp, 127, "%s/%s",getenv("GTKDIALOG_PIXMAP_DIR"), filename);
   tmp[127] = '\0';
   if (access(tmp, R_OK) == 0)
      return strdup(tmp);

   return 0;
}
gtkdialog1.tar.bz2
Description 
bz2

 Download 
Filename  gtkdialog1.tar.bz2 
Filesize  492.33 KB 
Downloaded  299 Time(s) 

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
goingnuts

Joined: 07 Dec 2008
Posts: 780

PostPosted: Sat 09 Jun 2012, 05:19    Post subject:  

Thanks for the patch for the find_pixmap!
Did you use the last source of gtkdialog1 (GtkDialog1-1.1)? Your binary has some problems with setting the wmclass I think - app name wont show in window title which make the app crash if you move mouse over jwm buttonbar. Might just be my jwm that has the problem - its P412 std jwm.
The button images also seems odd - no right margin.
Below same script running with your bin left and mine right.
A second thought: I think the wmclass is gdk/gtk/tinyX11 related. I think I made a hack for it - try look into my gdk/gtk-sources and search for wmclass...
snap0004.png
 Description   
 Filesize   94.96 KB
 Viewed   564 Time(s)

snap0004.png

Back to top
View user's profile Send private message Visit poster's website 
technosaurus


Joined: 18 May 2008
Posts: 4351

PostPosted: Sat 09 Jun 2012, 11:35    Post subject:  

It was probably just a badly patched toolchain - I left out some extra utf8 stuff from tinyX11 and probably hacked something to make it compile. (I lost patience after fixing most of the compile errors and warnings in gdk, so the gtk side just got quick, hacky patches)
Btw, you can make the static gdk_pixbuf easier to work with by doing:
Code:
ar x *.a (on the loaders)
and then adding those objects to libgdk_pixbuf.a with
Code:
ar cru libgdk_pixbuf.a *.o

Side note: the gdk-pixbuf stuff reminded me that rox-1.2.2 can use imlib if available, it should work pretty similar. (the vfs stuff was interesting too)

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2247

PostPosted: Mon 11 Jun 2012, 04:32    Post subject:  

Techonosaurus, "rox-1.2.2 can use imlib if available" The older rox-1.0.0 used only imlib, but I didn't even know that 1.2.2 could use it. It may speed up loading of desktop icons and/or improve their rendering. Have you noticed either of these?

"the vfs stuff was interesting too" -Did you get this working? I always wanted it but couldn't get it to work.

About your patch to find_pixmap, There is a note in the TODO file about this function. What we really need there is to be using the users' chosen theme, if available. We now have gtkrc file being read, so 'themedir' gets set(hopefully).
The original code:
Code:

snprintf(tmp, 127, "/usr/share/icons/Bluecurve/16x16/stock/%s",

should be getting 'themedir' from the rc file and subsituting that name for the original 'Bluecurve'.

I think it's okay to be able to set the environmental variable GTKDIALOG_PIXMAP_DIR and use that first if set. But, next it should try to use the themedir from the rc file. We now can specify the rcfile on the command-line, so that should be the second choice. Otherwise, the users' default ~/.gtkrc should be read. If themedir has still not been set, then it should look under /usr/share/pixmaps or /usr/share/mini-icons. Common practice would have only *.xpm images under /usr/share/pixmaps and only *.png (or *.svg) under /usr/share/mini-icons.
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4351

PostPosted: Mon 11 Jun 2012, 19:26    Post subject:  

@amigo - imlib and gdkpixbuf are much better suited to a shared library toolchain, so I have been trying to avoid them lately while playing with my static musl toolchain. However the way the modules work reduces the memory footprint significantly in a traditional shared library system (on par with the static builds) if you want to support multiple image types. ...btw before I forget ...
@goingnuts - do you still have the pre-gdk_pixbuf sources for gtkdialog 1?
Re: VFS in ROX-Filer, I did get it to work in the 2.X series - never tried it in 1.X IIRC it needed fuse, libavfs and lib{x,t}ar and was missing support for a widely used format (don't remember which)
Re:Themedir: I _think_ glade does that too ... I will check, it may be a simple cut/paste job.

Edit:... the gtkrc stuff seemed straight forward in the tutorial, but I didn't see anything in glade1 (glade2 may be backportable, but now I'm not sure where I saw gtkrc code)
http://www.gtk.org/tutorial1.2/gtk_tut-21.html#ss21.3
Edit2: AVFS-1.0.1 was released with xz support = good time to try a rox rebuild

_________________
Web Programming - Pet Packaging 100 & 101

Last edited by technosaurus on Wed 13 Jun 2012, 12:32; edited 1 time in total
Back to top
View user's profile Send private message 
goingnuts

Joined: 07 Dec 2008
Posts: 780

PostPosted: Tue 12 Jun 2012, 00:48    Post subject:  

technosaurus: don't know if this is what you need?
gtkdlg1_source_020212.tar.gz
Description  pre -gdkpixbuf gtkdialog 0.5.8.11 source
gz

 Download 
Filename  gtkdlg1_source_020212.tar.gz 
Filesize  157.61 KB 
Downloaded  286 Time(s) 
Back to top
View user's profile Send private message Visit poster's website 
goingnuts

Joined: 07 Dec 2008
Posts: 780

PostPosted: Tue 19 Jun 2012, 15:58    Post subject: swallow  

Coming back to the gtk-swallow-widget - present source below. Needs window ID of the window to swallow passed as argument - at the moment found by using xwininfo. Attached image of static mplayer (diet build found here) playing 2001-A_Space_Odyssey.avi and swallowed by the gtk-app.
Main problem now is to have the swallow-widget to launch the program you want to swallow and swallow it. Code below mainly produced by technosaurus:
Code:
#include <gtk/gtk.h>
#include <gdk/gdkx.h>
#include <stdio.h>

void destroy(GtkWidget *widget, gpointer data){ gtk_main_quit (); }   

int main (int argc, char *argv[]) {
   int wid;   char command[255];
   ///below takes passed windowID from argument ex. 0x400063
   sprintf(command,"echo %s", argv[1]);
   fscanf(popen(command, "r"),"%x",&wid);
   g_print ("The window ID is %i\n", wid);
 
   gtk_init (&argc, &argv);
/// Create a new window
   GtkWidget* window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   gtk_signal_connect(GTK_OBJECT(window), "destroy", GTK_SIGNAL_FUNC(destroy), NULL);
/// Create main container
   GtkWidget* vbox1 = gtk_vbox_new(FALSE, 0);
   gtk_container_add(GTK_CONTAINER(window), vbox1);
   //below just some playing around
    GtkWidget* toolbar;
    GtkWidget* icon;
    GtkWidget* button;
   
    toolbar = gtk_toolbar_new(GTK_ORIENTATION_HORIZONTAL,GTK_TOOLBAR_BOTH);
    gtk_box_pack_start(GTK_BOX(vbox1), toolbar, FALSE, FALSE, 0);
    gtk_widget_show(toolbar);
 
/// Create socket
   GtkWidget* gtk_socket = gtk_socket_new ();       
   gtk_widget_set_usize (gtk_socket, 400, 400);       
/// Pack socket in vbox container
   gtk_box_pack_start(GTK_BOX(vbox1), GTK_WIDGET(gtk_socket), TRUE, TRUE, 0);     
   gtk_widget_realize (gtk_socket);
   
   gtk_socket_steal (GTK_SOCKET (gtk_socket), wid);
/// Show the window and all widgets now that everything is ready
   gtk_widget_show_all(window);
   gtk_main ();       
   return 0;       
}
snap0007.png
 Description   
 Filesize   161.44 KB
 Viewed   457 Time(s)

snap0007.png

Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 10 of 14 [207 Posts]   Goto page: Previous 1, 2, 3, ..., 8, 9, 10, 11, 12, 13, 14 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1139s ][ Queries: 12 (0.0106s) ][ GZIP on ]