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 Tue 12 Dec 2017, 08:24
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Desktop
simple icon tray
Post new topic   Reply to topic View previous topic :: View next topic
Page 11 of 11 [160 Posts]   Goto page: Previous 1, 2, 3, ..., 9, 10, 11
Author Message
musher0


Joined: 04 Jan 2009
Posts: 11256
Location: Gatineau (Qc), Canada

PostPosted: Tue 10 Feb 2015, 13:41    Post subject:  

technosaurus wrote:
(...)
FWIW GTK devs do this a lot (add extra code that reduces functionality)
... another example of such is GtkIconView. It could make a perfect desktop icon replacement in ~10 lines except that they added code to the widget itself that makes the background solid white... you can only change the color, not add a background image.

A bureaucratic process has to be involved; otherwise the world be heading nowhere. Twisted Evil Wink

_________________
musher0
~~~~~~~~~~
"Logical entities must not be multiplied beyond necessity." | |
« Il ne faut pas multiplier les entités logiques sans nécessité. » (Ockham)
Back to top
View user's profile Send private message 
Argolance


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

PostPosted: Tue 10 Feb 2015, 14:22    Post subject:  

Bonsoir,
Thanks.
technosaurus wrote:
FWIW GTK devs do this a lot (add extra code that reduces functionality)

Why? Very strange indeed!: It is a pity...
Quote:
Only by completely rewriting an alternative statusicon widget.

Perhaps 'yad' could be used to make such a 'simple icon tray' and should offer more capabilities?
musher0 wrote:
A bureaucratic process has to be involved; otherwise the world be heading nowhere

?? Rolling Eyes
It is already the case and this is why the world is "heading nowhere"!
(I'm probably missing something, but I don't really see the connection with the subject of this thread). Embarassed

Cordialement.

_________________

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


Joined: 05 Dec 2014
Posts: 28

PostPosted: Tue 10 Feb 2015, 21:31    Post subject:  

I like FLTK quite a bit, it keeps improving and making things easier, rather than removing functionality.
You can make very small programs easily with FLUID to design the UX.

Might be something for other posters here to consider.
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4764
Location: Kingwood, TX

PostPosted: Fri 13 Feb 2015, 03:43    Post subject:  

Argolance wrote:
Perhaps 'yad' could be used to make such a 'simple icon tray' and should offer more capabilities?
Yad is also gtk based, so no.
torios wrote:
I like FLTK quite a bit, it keeps improving and making things easier, rather than removing functionality.
You can make very small programs easily with FLUID to design the UX.

Might be something for other posters here to consider.
Fltk doesn't have a tray icon widget.

tcl/tk does
qt does

I did find an old X11 example here :
Code:
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <stdio.h>

typedef enum systray_opcode_tag {
        SYSTEM_TRAY_REQUEST_DOCK   = 0,
        SYSTEM_TRAY_BEGIN_MESSAGE  = 1,
        SYSTEM_TRAY_CANCEL_MESSAGE = 2
} systray_opcode_t;

void send_message(
        Display *disp,
        Window dest,
        systray_opcode_t message,
        long data1,
        long data2,
        long data3)
{
        XEvent ev;

        memset( &ev, 0, sizeof(ev)) ;
        ev.xclient.type = ClientMessage ;
        ev.xclient.window = dest;
        ev.xclient.message_type = XInternAtom( disp, "_NET_SYSTEM_TRAY_OPCODE", False );
        ev.xclient.format = 32 ;
        ev.xclient.data.l[0] = CurrentTime ;
        ev.xclient.data.l[1] = message ;
        ev.xclient.data.l[2] = data1 ;
        ev.xclient.data.l[3] = data2 ;
        ev.xclient.data.l[4] = data3 ;
/* XXX handle error XXX */
        XSendEvent( disp, dest, False, NoEventMask, &ev) ;
        XSync( disp, False) ;
}


int main()
{
        Display  *disp ;
        Window  tray ;
        Window  icon ;
        Window  container = None ;
        GC  gc ;
        XEvent  ev ;
        int  icon_size = 22 ;

        disp = XOpenDisplay(NULL) ;

/* get system tray(as a embedder). */
/* XXX exec tray if it is nonexistent */
/* XXX assuming screen is 0 */
        tray = XGetSelectionOwner( disp,
                                  XInternAtom(disp, "_NET_SYSTEM_TRAY_S0", True) );
        printf("tray window = %p\n", tray) ;

/* create system tray icon window */
        icon = XCreateSimpleWindow( disp, DefaultRootWindow(disp),
                                    0,0, icon_size,icon_size, 0, 0xFF,0x0);
        printf("icon window = %p\n", icon) ;

/* select all of masks for debugging */
        XSelectInput( disp, icon, (OwnerGrabButtonMask << 1) -1 );

/* create GC */
        gc = XCreateGC( disp, icon, 0, NULL);
        XSetForeground( disp, gc, 0xFF) ;

/* set minimum size */
        {
                XSizeHints *hints;

                hints = XAllocSizeHints() ;
                hints->flags = PMinSize ;
                hints->min_width=icon_size;
                hints->min_height=icon_size;
                XSetWMNormalHints( disp, icon, hints);
                XFree( hints);
        }

/* set xembed infos */
        {
                Atom xa_xembed_info ;
                unsigned int buffer[2];

                xa_xembed_info = XInternAtom( disp, "_XEMBED_INFO", False) ;

                buffer[0]=0; /* ver 0 (0:0?) */
                buffer[1]=1; /* request mapping */
                XChangeProperty( disp, icon, xa_xembed_info,
                                 xa_xembed_info, 32, PropModeReplace,
                                 (unsigned char *)buffer, 2);
        }

/* request embedding */
        send_message( disp, tray, SYSTEM_TRAY_REQUEST_DOCK, icon,0,0);

        while(1){
                XNextEvent( disp, &ev);
                printf("type %d\n", ev.type);
                switch(ev.type)
                {
                case Expose:           /*12*/
                        XClearWindow( disp, icon);
                        XDrawLine( disp, icon, gc, 1,1, icon_size-1,icon_size-1) ;
                        printf("\texpose\n");
                        break;
                case VisibilityNotify: /*15*/
                        printf("\tvisible\n");
                        break;
                case MapNotify:        /*19*/
                        printf("\tmapped\n");
                        break;
                case ReparentNotify:    /*21*/
                        printf("\twindow %p\n", ev.xreparent.parent);
                        break;
                case ResizeRequest:    /*25*/
                        printf("\twidth %d\n", ev.xresizerequest.width);
                        printf("\theight %d\n", ev.xresizerequest.height);
                        if( ev.xresizerequest.width > ev.xresizerequest.height)
                                icon_size = ev.xresizerequest.height ;
                        else
                                icon_size = ev.xresizerequest.width ;
                        XResizeWindow( disp, icon, icon_size, icon_size);
                        if(container)
                                XResizeWindow( disp, container, icon_size, icon_size);
                        break;
                case PropertyNotify:    /*29*/
                        printf("\tatom %s\n", XGetAtomName( disp, ev.xproperty.atom));
                        break;
                case ClientMessage:    /*33*/
                        printf("\twindow %p\n", ev.xclient.window);
                        printf("\ttype %s\n", XGetAtomName( disp, ev.xclient.message_type));

                        printf("\ttime 0x%X\n", ev.xclient.data.l[0]);
                        printf("\tmajor 0x%X\n", ev.xclient.data.l[1]);
                        printf("\tdetail 0x%X\n", ev.xclient.data.l[2]);
                        printf("\tdata1 0x%X\n", ev.xclient.data.l[3]);
                        printf("\tdata2 0x%X\n", ev.xclient.data.l[4]);
/* container window could be got from ReparentNotify */
                        if( ev.xclient.data.l[1] == 0)
                                container = ev.xclient.data.l[3] ;
                        break;
                default:
                        ;
                };
        }
}

It would be a good exercise to adapt this to xcb or netsurf framebuffer and possibly use stb_image and libtinysvg for the images.

_________________
Check out my github repositories. I may eventually get around to updating my blogspot.
Back to top
View user's profile Send private message Visit poster's website 
torios


Joined: 05 Dec 2014
Posts: 28

PostPosted: Fri 13 Feb 2015, 19:39    Post subject:  

Hi,
I simply meant that FLTK is great for making simple programs to use with sdesk. It is very easy to mockup a design and keep all the code in FLUID. This makes it very simple for others to adapt the UX for their own purposes, or change it.
I have taken to causing my programs to read the .jwmrc file to set colors.

sdesk does all the work to set the tray icon, so FLTK does not need to Smile

Plus FLTK is not as crazy as GTK. It seems like more and more things change and become more complex (for no reason?) with each release.
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4764
Location: Kingwood, TX

PostPosted: Mon 23 Feb 2015, 17:07    Post subject:  

I'm thinking about adding support for apps similar to:
http://pipeglade.boundp.org

Any thoughts

_________________
Check out my github repositories. I may eventually get around to updating my blogspot.
Back to top
View user's profile Send private message Visit poster's website 
torios


Joined: 05 Dec 2014
Posts: 28

PostPosted: Wed 25 Feb 2015, 21:30    Post subject:  

that looks pretty interesting!
I'll have to look more into that, but it seems like a really useful program.
Back to top
View user's profile Send private message 
torios


Joined: 05 Dec 2014
Posts: 28

PostPosted: Tue 11 Aug 2015, 14:18    Post subject:  

technosaurus, I think it would be cool to modify the -t portion to allow checking for the icon theme icons, using:
gtk_icon_theme_load_icon ("icon_name")
it would be nice if this could be modified during runtime, as then things like a battery/wifi/wtc... could update the icon at will using a generic icon name that could be changed to fit the icon theme used.

So a few questions..
Is this possible in Puppy?

Would this be too hard to implement for you?
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4764
Location: Kingwood, TX

PostPosted: Tue 11 Aug 2015, 22:01    Post subject:  

It may be easier to just try that if the image file fails to load normally, just use the contents of the file as the name.

It already allows this to be changed at run time though, just touch the symlink or change it.

_________________
Check out my github repositories. I may eventually get around to updating my blogspot.
Back to top
View user's profile Send private message Visit poster's website 
tele1234567891

Joined: 15 Nov 2014
Posts: 13

PostPosted: Sun 04 Jun 2017, 13:52    Post subject:    

1. Is this last source code of sit ?
http://www.murga-linux.com/puppy/viewtopic.php?p=714677#714677

2. Can you put 64 bit support to " build " file ?
For example:

Code:
#!/bin/sh
#compile

if [ `getconf LONG_BIT` = "64" ]; then
   echo "ARCH: 64-bit"

   #compile
   gcc `pkg-config gtk+-x11-2.0 --cflags` -DGTK_NO_CHECK_CASTS -DG_DISABLE_CAST_CHECKS \
   sdesk.c -o sdesk `pkg-config gtk+-x11-2.0 --libs` && strip --strip-all -R .note -R .comment sdesk

else
   echo "ARCH: 32-bit"

   #compile
   gcc `pkg-config gtk+-x11-2.0 --cflags` -DGTK_NO_CHECK_CASTS -DG_DISABLE_CAST_CHECKS \
   -Os -fmerge-all-constants -mno-accumulate-outgoing-args -march=i486 -mtune=i686 \
   -Wl,-O2,--gc-sections,--as-needed,--sort-common,-s sdesk.c -o sdesk \
   -lgtk-x11-2.0 -lgdk-x11-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0

   strip --strip-all -R .note -R .comment sdesk

fi


3. Can you put or move source code to first post ?
4. Can you add version to source code ?


Edit:
From X11 http://murga-linux.com/puppy/viewtopic.php?p=828027#828027

Code:
$ ./buildsit
ARCH: 64-bit
sit.c: In function ‘send_message’:
sit.c:23:9: warning: incompatible implicit declaration of built-in function ‘memset’
         memset( &ev, 0, sizeof(ev)) ;
         ^
/usr/bin/ld: /tmp/cclQRUt1.o: undefined reference to symbol 'XSetForeground'
//usr/lib/x86_64-linux-gnu/libX11.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status



Edit:
sit-1.0.tar.gz from http://murga-linux.com/puppy/viewtopic.php?t=76431
I upgraded to sit-1.0-2.tele.tar.gz ( is in attachment )
- added own example with icon ( left click , right click icon tray )
- added support for 64bit in "build" script ( I get help for this on other forum )

But this have bugs:
- "right click" window sometimes is in at the top, bottom
- Working on Debian 8.8 ( Mate 64bit ) , but probably not working on Ubuntu ( I'm not sure )


Edit:
I tried rebuild sdesk to sdesk-1.0-3.tele ( file in attachment )
http://www.murga-linux.com/puppy/viewtopic.php?p=714677#714677
- added 64bit support
- added test script

but
- I can run function only from file ( this is good )
- I don't know how working <status icon> , can you add example ?


Edited:
I added to sdesk-1.0-3.tele second example ( now it is sdesk-1.0-4.tele
How get sdesk pid to kill only first or second app ?
sdesk-1.0-4.tele.tar.gz
Description 
gz

 Download 
Filename  sdesk-1.0-4.tele.tar.gz 
Filesize  9.32 KB 
Downloaded  39 Time(s) 
sit-1.0-2.tele.tar.gz
Description 
gz

 Download 
Filename  sit-1.0-2.tele.tar.gz 
Filesize  6.63 KB 
Downloaded  45 Time(s) 
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 11 of 11 [160 Posts]   Goto page: Previous 1, 2, 3, ..., 9, 10, 11
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Desktop
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.0620s ][ Queries: 14 (0.0052s) ][ GZIP on ]