You are not logged in.

#1 2010-03-14 17:20:16

pyknite
Member
Registered: 2010-03-03
Posts: 166

[SOLVED] Xlib problem

Hi there,

I'm writting a very simple tiling window manager. It's almost working, but I still have a problem when I close or kill a program sad

The window containing the program is correctly closed but the program still working (even if I close the program via the file menu).

For example see this pstree:

init─┬─acpid
     ├─4*[agetty]
     ├─bluetoothd
     ├─crond
     ├─2*[dbus-daemon]
     ├─dbus-launch
     ├─dhcpcd
     ├─firefox───18*[{firefox}]
     ├─gconfd-2
     ├─hald───hald-runner─┬─hald-addon-acpi
     │                    ├─hald-addon-gene
     │                    ├─hald-addon-inpu
     │                    ├─hald-addon-leds
     │                    ├─hald-addon-rfki
     │                    └─hald-addon-stor
     ├─httpd───11*[httpd]
     ├─login───bash───startx───xinit─┬─X
     │                               └─scrotwm
     ├─login───bash───startx───xinit─┬─X
     │                               └─catwm─┬─setxkbmap
     │                                       ├─5*[urxvt───bash] <-- THIS IS THE INTERESTING PART!!
     │                                       └─xsetbg
     ├─mpd───3*[{mpd}]
     ├─mysqld_safe───mysqld───8*[{mysqld}]
     ├─ntpd
     ├─proftpd
     ├─screen─┬─bash───ncmpc
     │        ├─bash───irssi
     │        ├─bash───java───16*[{java}]
     │        ├─bash───vim
     │        └─bash───pstree
     ├─syslog-ng───syslog-ng
     ├─udevd───2*[udevd]
     └─urxvt───bash───screen

I have closed all urxvt, except one to make the pstree, but we can see that other urxvt still work sad

Here is my spawn function:

static void spawn(const char **command) {                                                           
    if(fork() == 0) {                                                                               
        if(dis)                                                                                     
            close(ConnectionNumber(dis));                                                           
                                                                                                    
        setsid();                                                                                   
        execvp((char*)command[0],(char**)command);                                                  
        exit(0);                                                                                    
    }                                                                                               
}

Here my kill client:

void kill_client() {
    if(current != NULL)
        XDestroyWindow(dis,current->win);
}

And the destroynotify handler:

static void destroynotify(XEvent *e) {
    XDestroyWindowEvent *ev = &e->xdestroywindow;

    remove_window(ev->window);
    tile();
    update_current();
}

And you can see the rest of the code here: http://github.com/pyknite/catwm

Thx for the help wink

Last edited by pyknite (2010-03-15 20:07:39)

Offline

#2 2010-03-15 20:06:36

pyknite
Member
Registered: 2010-03-03
Posts: 166

Re: [SOLVED] Xlib problem

Ok, problem solved... I found the solution while reading some code wink

Offline

Board footer

Powered by FluxBB