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 17 Nov 2018, 17:07
All times are UTC - 4
 Forum index » House Training » Bugs ( Submit bugs )
/usr/lib/gtkdialog/box_splash and animated gif icons?
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 3 of 4 [54 Posts]   Goto page: Previous 1, 2, 3, 4 Next
Author Message
Argolance


Joined: 06 Jan 2008
Posts: 3456
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Fri 12 Oct 2018, 06:45    Post subject:  

Bonjour à vous,
wiak wrote:
I was referring to Argolances earlier post, which did say gtkdialog3 only worked with that old Precise gtkdialog-splash (with animated gifs). But, as I said, I also found gtkdialog4 also worked fine in my test.

I'm sorry if I misled you, but that's not what I meant and tried to report:
Argolance wrote:
I imported box_splash in my Puppy Precise 5.7.3 based system [...] I see that box_splash supports animated gifs too [...]. This works as long as the /tmp/yaf-splash is linked to /usr/sbin/gtkdialog3. If I delete this link, box_splash creates automatically a link to /usr/sbin/gtkdialog which is a link to gtkdialog4 and animated gifs are not supported anymore.

So, this was concerning box_splash and not the "old" puppy precise "gtkdialog-splash". To be more accurate, I imported both /usr/lib/gtkdialog/box_splash and /usr/bin/gtkdialog-splash from Tahr 6.0.5 to my Puppy Precise based system. This /usr/bin/gtkdialog-splash is not a script like the old one but just returns to box_splash via this command:
Contents:
Code:
exec /usr/lib/gtkdialog/box_splash "$@"

As attached file, "gtk-splash" for those who might find it useful. It is the Puppy Precise gtkdialog-splash but renamed and modified to be totally stand-alone, avoiding any conflict with other programs of the same type and perhaps other unexpected problems.

[EDIT]: this may be added to /root/.jwmrc:
Code:
<Group>
<Class>gtk-splash</Class>
<Option>nolist</Option>
<Option>layer:above</Option>
<Option>nofocus</Option>
</Group>

or gtk-splash modified to work using this class if already existing:
Code:
<!-- created 130618, a class for all future popups -->
<Group>
<Class>splashwindow</Class>
<Option>nolist</Option>
<Option>layer:above</Option>
<Option>nofocus</Option>
</Group>

Cordialement.
181012_123548_582x368_easyshot.jpg
 Description   
 Filesize   58.37 KB
 Viewed   600 Time(s)

181012_123548_582x368_easyshot.jpg

gtk-splash.gz
Description  To be renamed as gtk-splash without .gz
gz

 Download 
Filename  gtk-splash.gz 
Filesize  5.55 KB 
Downloaded  77 Time(s) 

_________________


Last edited by Argolance on Fri 12 Oct 2018, 07:50; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website 
wiak

Joined: 11 Dec 2007
Posts: 996
Location: not Bulgaria

PostPosted: Fri 12 Oct 2018, 07:42    Post subject:  

Argolance wrote:
Bonjour à vous,
wiak wrote:
I was referring to Argolances earlier post, which did say gtkdialog3 only worked with that old Precise gtkdialog-splash (with animated gifs). But, as I said, I also found gtkdialog4 also worked fine in my test.

I'm sorry if I misled you, but that's not what I meant and tried to report:
Argolance wrote:
I imported box_splash in my Puppy Precise 5.7.3 based system [...] I see that box_splash supports animated gifs too [...]. This works as long as the /tmp/yaf-splash is linked to /usr/sbin/gtkdialog3. If I delete this link, box_splash creates automatically a link to /usr/sbin/gtkdialog which is a link to gtkdialog4 and animated gifs are not supported anymore.

So, this was concerning box_splash and not the "old" puppy precise "gtkdialog-splash".


Ah, sorry, my mistake entirely; I misread your earlier post.

wiak
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 3538
Location: holland

PostPosted: Fri 12 Oct 2018, 10:30    Post subject:  

ITSMERSH wrote:
fredx181 wrote:
Just experimented for fun Laughing :
......
Extract launch.tar.gz and run "launch" (inside "launch" folder)
Has 15 seconds timeout, it's using the older gtkdialog-splash that Argolance shared earlier in this thread.

Fred

Uaaahhh, that's really great.

Exactly what I need for my QTR Suite (my Music Suite to run, control and connect all the programs from a project). I have added a option to the launch script, so it combines the sound of a rocket launch (using aplay) for about 18 seconds (faded out) while displaying the gif image when starting QTR Suite.

Great, thanks!


Haha, you're welcome !

Can you share someway that rocket launch sound and the code of your setup ?
Sorry for the off-topic Argolance, but please understand, that rocket sound is a must have addition ! Smile Cool

Fred

_________________
Dog Linux website
Back to top
View user's profile Send private message 
Argolance


Joined: 06 Jan 2008
Posts: 3456
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Fri 12 Oct 2018, 13:50    Post subject:  

Bonsoir,
Quote:
Sorry for the off-topic Argolance, but please understand, that rocket sound is a must have addition !
Do not worry! On the contrary, I am delighted to see that this topic is attracting some interest...
Do as you feel like it!

Cordialement.

_________________

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


Joined: 02 May 2018
Posts: 459

PostPosted: Fri 12 Oct 2018, 13:52    Post subject:  

fredx181 wrote:
Haha, you're welcome !

Can you share someway that rocket launch sound and the code of your setup ?
Sorry for the off-topic Argolance, but please understand, that rocket sound is a must have addition ! Smile Cool

Fred

Yes, this is a must have addition! Wink

All in one package at datafilehost.com. Since they have changed the duration of keeping files it will stay at least for 90 days after last download.

_________________
RSH
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 3538
Location: holland

PostPosted: Fri 12 Oct 2018, 14:43    Post subject:  

ITSMERSH wrote:
fredx181 wrote:
Haha, you're welcome !

Can you share someway that rocket launch sound and the code of your setup ?
Sorry for the off-topic Argolance, but please understand, that rocket sound is a must have addition ! Smile Cool

Fred

Yes, this is a must have addition! Wink

All in one package at datafilehost.com. Since they have changed the duration of keeping files it will stay at least for 90 days after last download.


Ok, turned up the volume to the maximum, and went to Mars, stayed there for a while and after that traveled to Pluto, but...
My WIFI didn't work, could that be a bug in your program ?
Also I asked around there, nobody had ever heard of the Puppy Linux Discussion Forum, strange...

Hmmm.. very inconvenient, I had to travel back to Earth just to thank you, so...

Thank you !! Smile Works nicely !

P.S. Decided to stay on Earth, the food on Pluto is terrible.

Fred

_________________
Dog Linux website
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1678
Location: Japan

PostPosted: Sat 13 Oct 2018, 22:49    Post subject:  

Argolance wrote:
I imported box_splash in my Puppy Precise 5.7.3 based system [...] I see that box_splash supports animated gifs too [...]. This works as long as the /tmp/yaf-splash is linked to /usr/sbin/gtkdialog3. If I delete this link, box_splash creates automatically a link to /usr/sbin/gtkdialog which is a link to gtkdialog4 and animated gifs are not supported anymore.

If box_splash really supports animated gifs when it calls gtkdialog3 but not when it calls gtkdialog4 then my earlier suspicion that gtkdialog is to blame would be true.

That's hard to believe and it's not what I have experienced. Could it be that somehow you finally symlinked to your old gtkdialog-splash?
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 3538
Location: holland

PostPosted: Sun 14 Oct 2018, 04:55    Post subject:  

Here's what I think that is the point:

- When using box_splash with yaf-splash linked to gtkdialog3 then -icon_width value doesn't really resize, it just makes "room". (second pic)
- When using box_splash with yaf-splash linked to gtkdialog4 then -icon_width does resize, e.g. when using a .png of size 128x128 and use "-icon_width 48", it does display as 48x48 (first pic)
So when using a .gif (with yaf-splash linked to gtkdialog4), it "tries" to resize, resulting in that it doesn't display as animated.
EDIT: And if using a .gif with yaf-splash linked to gtkdialog3, then .gif animation works, just need to give it enough room by adjusting -icon_width.
BTW, I found that some systems may have gtkdialog3 as a symlink to gtkdialog. (it's the case on d-pup-Stretch from radky)

Fred
2018-10-14-103833_210x98_scrot.png
 Description   Using box_splash with yaf-splash linked to gtkdialog4, -icon_width 48
vlc.png = size 128x128 displays as 48x48
 Filesize   4.23 KB
 Viewed   406 Time(s)

2018-10-14-103833_210x98_scrot.png

2018-10-14-103536_210x178_scrot.png
 Description   Using box_splash with yaf-splash linked to gtkdialog3, -icon_width 48
vlc.png = size 128x128, the -icon_width 48 setting gives not enough "room"
 Filesize   11.67 KB
 Viewed   405 Time(s)

2018-10-14-103536_210x178_scrot.png


_________________
Dog Linux website
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1678
Location: Japan

PostPosted: Sun 14 Oct 2018, 08:13    Post subject:  

Confirmed.
gtkdialog3 doesn't understand <width> but supports width-request attribute.
width-request results in cropping but not (proportional) scaling, Since gtkdialog3 ignores <width>, the tag that results in scaling, box_splash calling gtkdialog3 can display animated gifs. Depending on the width setting animated gifs may be cropped, but they are still animated.

Suddenly everything Argolance reported makes sense: The "old" gtkdialog-splash expects gtkdialog3, the newer ones and box_splash expect gtkdialog4. When he runs box_splash in Precise where an "old" gtkdialog-splash, the one that came with Precise, had already created the symlink /tmp/yaf-splash to gtkdialog3, box_splash would meticulously check if the required gtkdialog4 is installed (which in Precise it is) , but then would gladly use any /tmp/yaf-splash it finds, without checking if it links to the correct gtkdialog.

Still box_splash needs some changes. I'll post a fixed version.
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 996
Location: not Bulgaria

PostPosted: Mon 15 Oct 2018, 05:21    Post subject:  

As mentioned above, my most recent code addition in my fork called gtkwialog was to allow preserving or not preserving aspect ratio of a pixbuf image related to the initial creation of a pixmap. The additional code I used satisfied my intention. That was a while ago, and since I've not been coding since then I had forgotten what was involved but looking at it again now I see that I did not implement similar functionality for the pixmap <input file> mechanism since that wasn't my concern at the time. However, I will try that in gtkwialog now (since the code change is very similar); I have no idea however what effect the different gtk function with additional capability to 'not-preserve-aspect-ratio' on scaling (i.e. supplying width parameter) will have on an animated gif file input loading since I can't determine that from the Gtk reference functiond description. So may well be irrelevant for this thread issue. Nevertheless, worth a try I feel, so I'll test that C code addition. It could (???) in any case be useful in other scenarios to also be able to not-preserve-aspect-ratio on input file images (EDIT: but not sure of difference in practice to what I already achieved in that regard... I believe, from re-examining gtkwialog sources, the input from file code will only come into play on refreshing the image - so doubt relevance in this thread issue - but for my earlier purposes, I probably should have that too - I forgot about refresh possibility). I'll attempt that in gtkwialog tomorrow, since late at night here just now, and report back accordingly.

There may be some other remedy regarding scaling and animated gif, of course.

wiak
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 996
Location: not Bulgaria

PostPosted: Mon 15 Oct 2018, 06:15    Post subject:  

Yeah, seems to be that any value for <width> or <height> other than -1 prevents gif animation (or of course leaving width and height values out altogether). I'm using the following simple test program (this is with gtkwialog, which accepts the preserve-aspect-ratio tag, which can of course be omitted if using gtkdialog instead).

Code:
#! /bin/sh
# Needs test.gif image in script start directory

export MAIN_DIALOG='
<window>
  <vbox>
    <pixmap preserve-aspect-ratio="false">
      <variable>IMAGEN</variable>
      <height>300</height>
      <input file>./try.gif</input>
    </pixmap>
  </vbox>
</window>'
gtkwialog  -p MAIN_DIALOG


I haven't actually tried my new code yet and also a couple of other things I'll try. For example, there is a break statement in current gtkwialog and gtkwialog and gtkdialog4 code to load only one image into pixbuf (different code altogether in gtkdialog3 for pixbuf stuff - no such break); I will try removing that break in the gtkwialog pixbuf loading loop... - not sure how that effects animated gif type file (I don't know animated gif format, except number of images in the file, so suspicious if that break statement is the problem in gtkdialog4).

gtkdialog3 uses GtkImageMenuItem [EDIT: No - that's just for menu stock/icons] functions (deprecated), gtkwialog4 on the other hand uses straight GtkImage functions.

I'm just documenting these points here to remind me when I look into it further tomorrow.

wiak

Last edited by wiak on Mon 15 Oct 2018, 19:46; edited 1 time in total
Back to top
View user's profile Send private message 
MochiMoppel


Joined: 26 Jan 2011
Posts: 1678
Location: Japan

PostPosted: Mon 15 Oct 2018, 09:42    Post subject:  

Here my proposal for a fixed box_splash.
IMO more fixed and efficient code is needed, but I tried to keep my changes to a minimum. Changes are marked in the code so they are easy to remove if you don't like them.

Animated GIFs support
This was the easiest part. Just changed ICON_WIDTH=32 to ICON_WIDTH=-1
By default icons are now displayed in their original size. Since the user is free to use the -icon_width option if resizing is required, a 32px default made no sense anyway.

Mouse cursor kills dialog
This bug drives me nuts as long as I can remember. It occurs when the mouse cursor happens to be at the same position as the opening dialog. Example: Mouse cursor near the center, box_splash (or gtkdialog-splash) opens with its default -placement (center) and -close (mouseover) options. In this case box_splash closes immediately before the user has a chance to read the message. Surely a "splash", but a useless one.
I tried to fix this idiotic behavior by adding a 150 ms grace period during which an exit is not possible. This gives the dialog the necessary time to load the image and "settle down" and prevents a phony premature "mouseover" event.

-deco
This option now works. A variable assignment was missing.

Always on top
This forces the message to pop up on top of any other window, e.g. a fullscreen youtube window. IMO should be standard for such info/alert dialogs. Note: This will not work when the -deco option is used (actually I've never seen it being used, so probably not a problem)
box_splash_fixed.gz
Description  This is a gzipped script and the extension is NOT a fake extension ;-)
gz

 Download 
Filename  box_splash_fixed.gz 
Filesize  4.24 KB 
Downloaded  57 Time(s) 
Back to top
View user's profile Send private message 
wiak

Joined: 11 Dec 2007
Posts: 996
Location: not Bulgaria

PostPosted: Mon 15 Oct 2018, 20:30    Post subject:  

wiak wrote:
My own assumption is that all will be fine if <width> is not used or set perhaps to -1 when animated gif the image
...
I'm saying that based on the C code in gtkdialog4 where, by default, width and height default to -1).


Okay, I've taken time to look at the pixmap code now and none of my previous thoughts are particularly relevant (except my quoted comment above).

It seems to me quite simply that in gtkdialog (any version) unscaled images can include animations whereas scaled images cannot.

In gtkdialog3 or in gtkdialog4 (where width and height are default -1), the GtkImage is created by the Gtk convenience function:

Code:
gtk_image_new_from_file


which has result, according to Gtk docs:

Quote:
If the file isn't found or can't be loaded, the resulting GtkImage will display a "broken image" icon. This function never returns NULL, it always returns a valid GtkImage widget.

If the file contains an animation, the image will contain an animation.


Scaled images are an enhancement of gtkdialog4 (identified by width and height not equal to default -1). For this capability, Gtk function gtk_image_new_from_file is not used since it does not include size/scaling capability built in. Rather, the image is first loaded into a pixbuf using a Gdk function:

Code:
gdk_pixbuf_new_from_file_at_size


(the result is just a re-scaled pixbuf - no animation)

followed by creating the GtkImage from the pixbuf using Gtk function:

Code:
gtk_image_new_from_pixbuf


So no animation capability for re-sized/scaled image.

So, as I said in earlier post, if you need animation with gtkdialog4, make sure width and height are set to -1 (or not set at all in which case they default to -1), which is value the gtkdialog4 code uses to determine whether or not to use animation-capable function gtk_image_new_from_file.

wiak

EDIT: This thread should really be in 'Programming' section since not actually any bug per se (well, I suppose box_splash wasn't able to animate gifs when expected, so a sort of a simple bug in that not using -1 for width for default case...). If the facility to scale gif animations was wanted, maybe it could be done by using gdk_pixbuf_animation_new_from_file, than maybe getting static frames from that (gdk_pixbuf_animation_get_static_image?) and scaling them and then iterating to next frame (gdk_pixbuf_animation_iter_advance???), each time creating a GtkImage of the frame using gtk_image_new_from_pixbuf. But I'm just guessing and clearly that is complicated. For example - the following library details seem relevant for those into doing this:

https://github.com/GNOME/gdk-pixbuf/blob/master/gdk-pixbuf/gdk-pixbuf-scaled-anim.c

Also: https://github.com/GNOME/gdk-pixbuf/blob/master/gdk-pixbuf/gdk-pixbuf-loader.c

Does anyone know an easy way in C/GTK+? Can be done in Python apparently, which internally may do something like I suggest. See the one Answer:

https://stackoverflow.com/questions/24873912/scaling-up-an-animated-gif-in-python-to-be-used-with-pygtk
Back to top
View user's profile Send private message 
fredx181


Joined: 11 Dec 2013
Posts: 3538
Location: holland

PostPosted: Wed 17 Oct 2018, 12:31    Post subject:  

MochiMoppel wrote:
Here my proposal for a fixed box_splash.
....
....


Thanks for the fixes !

There's still one (small) thing that annoys me, it is that sometimes the dialog turns out much wider than intended.
For example when I use variable for $msg to get two lines, e.g.
Code:
msg=`echo -e "Processing\nThis may take a while . . ."`
./box_splash_fixed -icon ./prefs.png -icon_width 48 -placement center -bg blue -fg white -text "$msg" -close never -timeout 5

See first pic.

I think a good "fix" would be changing line 183:
Code:
#NR_CHARS="$((${#text}+1))"
# fredx181, commented out above, in case multiple lines, find the longest line for NR_CHARS
NR_CHARS="$(echo -e "$text" | awk '{ print length }' | sort -n | tail -1)"

See second pic, gives less width.

Fred
more-width.png
 Description   Much wider than intended.
 Filesize   12.51 KB
 Viewed   181 Time(s)

more-width.png

less-width.png
 Description   Less width, used modified box_splash as described above
 Filesize   11.26 KB
 Viewed   181 Time(s)

less-width.png


_________________
Dog Linux website
Back to top
View user's profile Send private message 
Argolance


Joined: 06 Jan 2008
Posts: 3456
Location: PORT-BRILLET (Mayenne - France)

PostPosted: Thu 18 Oct 2018, 04:01    Post subject:  

Bonjour,
fredx181 wrote:
There's still one (small) thing that annoys me, it is that sometimes the dialog turns out much wider than intended

Sometimes very much more than intended to the point of filling almost the entire desktop (see picture at the beginning of this thread).
I'll add another small annoying thing: the icon is not centered horizontally (Arrow reported in this thread).

[EDIT]: something else, just as a suggestion.
I wonder if it would not be interesting to disable automatic wraping to avoid words or expressions being cut in half (as shown in the images below) or allow to get the text in a single line. Both versions, the old and the new one have this defect.

Cordialement.
181006_160413_442x62_easyshot.jpg
 Description   box_splash
 Filesize   4.24 KB
 Viewed   166 Time(s)

181006_160413_442x62_easyshot.jpg

181006_144715_272x55_easyshot.jpg
 Description   "Old" gtkdialog-splash
 Filesize   4.63 KB
 Viewed   166 Time(s)

181006_144715_272x55_easyshot.jpg


_________________

Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 3 of 4 [54 Posts]   Goto page: Previous 1, 2, 3, 4 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Bugs ( Submit bugs )
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.1899s ][ Queries: 13 (0.0137s) ][ GZIP on ]