Re: [dwm] Java patch

2008-04-29 Thread Premysl Hruby
On (29/04/08 11:27), Anselm R. Garbe wrote:
 To: dynamic window manager dwm@suckless.org
 From: Anselm R. Garbe [EMAIL PROTECTED]
 Subject: Re: [dwm] Java patch
 User-Agent: Mutt/1.5.13 (2006-08-11)
 Reply-To: dynamic window manager dwm@suckless.org
 List-Id: dynamic window manager dwm.suckless.org
 
 On Sun, Apr 27, 2008 at 01:43:14PM -0700, Don Stewart wrote:

 So why not converting this patch into a standalone setwmname
 application written in C, then we can delete the patches in dwm
 and XMonad and people just run setwmname FooBarBaz to work
 around the XToolkit bug(s)?
 
 Kind regards,

Good idea imho.

-- 
Premysl Anydot Hruby, http://www.redrum.cz/



Re: [dwm] Java patch

2008-04-29 Thread Tuncer Ayaz
On Tue, Apr 29, 2008 at 11:27 AM, Anselm R. Garbe [EMAIL PROTECTED] wrote:

 On Sun, Apr 27, 2008 at 01:43:14PM -0700, Don Stewart wrote:
   luizribeiro:
On Sun, Apr 27, 2008 at 4:59 PM, Jukka Salmi [EMAIL PROTECTED] wrote:
  It doesn't work for me. Just tested with jdk 1.5.0 and netbeans...
   
I think the LG3D Java compatibility came with jdk 1.6. Remember that
the hack sets the NET_WM_NAME to LG3D.
Maybe setting it to a different name could work with jdk 1.5. But I'm
not sure about that, or what window manager name you should use.
  
   This patch has been in xmonad for a while, there's some more
   documentation here,
  
 http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-SetWMName.html
  
   Several users have reported this as useful.
  

  So why not converting this patch into a standalone setwmname
  application written in C, then we can delete the patches in dwm
  and XMonad and people just run setwmname FooBarBaz to work
  around the XToolkit bug(s)?

assuming that's possible, +1.



[dwm] Compiling dwm

2008-04-29 Thread David J. Neu
All,

I'm sure this has been addressed elsewhere, but I'm not finding the
answer.

I'm a long time dwm user on FreeBSD, but now have two Linux distros in
my world.  It looks like the required header and/or lib files as
referenced in config.mk aren't installed.

Could someone tell me the packages to install on Ubuntu and on an OLPC
XO laptop?

Many thanks!

Cheers,
David



Re: [dwm] Java patch

2008-04-29 Thread Luiz Ribeiro
Great idea!
I'll work on it and post the source code later.

On Tue, Apr 29, 2008 at 7:57 AM, Tuncer Ayaz [EMAIL PROTECTED] wrote:

 On Tue, Apr 29, 2008 at 12:56 PM, Tuncer Ayaz [EMAIL PROTECTED] wrote:
  
   On Tue, Apr 29, 2008 at 11:27 AM, Anselm R. Garbe [EMAIL PROTECTED] 
 wrote:

 On Sun, Apr 27, 2008 at 01:43:14PM -0700, Don Stewart wrote:
   luizribeiro:
On Sun, Apr 27, 2008 at 4:59 PM, Jukka Salmi [EMAIL PROTECTED] 
 wrote:
  It doesn't work for me. Just tested with jdk 1.5.0 and 
 netbeans...
   
I think the LG3D Java compatibility came with jdk 1.6. Remember 
 that
the hack sets the NET_WM_NAME to LG3D.
Maybe setting it to a different name could work with jdk 1.5. But 
 I'm
not sure about that, or what window manager name you should use.
  
   This patch has been in xmonad for a while, there's some more
   documentation here,
  
 
 http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-SetWMName.html
  
   Several users have reported this as useful.
  

  So why not converting this patch into a standalone setwmname
  application written in C, then we can delete the patches in dwm
  and XMonad and people just run setwmname FooBarBaz to work
  around the XToolkit bug(s)?
  
assuming that's possible, +1.

  I still prefer using a fixed OpenJDK-6 build, btw.





-- 
Luiz Ribeiro
http://luizribeiro.org/



Re: [dwm] Compiling dwm

2008-04-29 Thread Engin Tola

for ubuntu the package is libx11-dev

David J. Neu [EMAIL PROTECTED] writes:

 All,

 I'm sure this has been addressed elsewhere, but I'm not finding the
 answer.

 I'm a long time dwm user on FreeBSD, but now have two Linux distros in
 my world.  It looks like the required header and/or lib files as
 referenced in config.mk aren't installed.

 Could someone tell me the packages to install on Ubuntu and on an OLPC
 XO laptop?

 Many thanks!

 Cheers,
 David



-- 
engin tola - http://cvlab.epfl.ch/~tola
emacs  - http://www.gnu.org/software/emacs/tour



Re: [dwm] Compiling dwm

2008-04-29 Thread David J. Neu
Excellent - thanks!

On Tue, Apr 29, 2008 at 02:22:19PM +0200, Engin Tola wrote:
 
 for ubuntu the package is libx11-dev
 
 David J. Neu [EMAIL PROTECTED] writes:
 
  All,
 
  I'm sure this has been addressed elsewhere, but I'm not finding the
  answer.
 
  I'm a long time dwm user on FreeBSD, but now have two Linux distros in
  my world.  It looks like the required header and/or lib files as
  referenced in config.mk aren't installed.
 
  Could someone tell me the packages to install on Ubuntu and on an OLPC
  XO laptop?
 
  Many thanks!
 
  Cheers,
  David
 
 
 
 -- 
 engin tola - http://cvlab.epfl.ch/~tola
 emacs  - http://www.gnu.org/software/emacs/tour



Re: [dwm] Compiling dwm

2008-04-29 Thread Matthias-Christian Ott
David J. Neu [EMAIL PROTECTED] wrote:

 All,

 I'm sure this has been addressed elsewhere, but I'm not finding the
 answer.

 I'm a long time dwm user on FreeBSD, but now have two Linux distros in
 my world.  It looks like the required header and/or lib files as
 referenced in config.mk aren't installed.

 Could someone tell me the packages to install on Ubuntu and on an OLPC
 XO laptop?

I suppose you have install the header files separately, because (as far
as I remember) dpkg and rpm based distributions make separate packages
out of them.

 Many thanks!

 Cheers,
 David

Regards
Matthias-Christian
VERSION = 5.0
PREFIX = /usr
MANPREFIX = ${PREFIX}/man
INCS = -I.
LIBS = -lX11
CFLAGS += $(INCS) -DVERSION=\$(VERSION)\ -fwhole-program
LDFLAGS += $(LIBS)


Re: [dwm] Java patch

2008-04-29 Thread Don Stewart
arg:
 On Sun, Apr 27, 2008 at 01:43:14PM -0700, Don Stewart wrote:
  luizribeiro:
   On Sun, Apr 27, 2008 at 4:59 PM, Jukka Salmi [EMAIL PROTECTED] wrote:
 It doesn't work for me. Just tested with jdk 1.5.0 and netbeans...
   
   I think the LG3D Java compatibility came with jdk 1.6. Remember that
   the hack sets the NET_WM_NAME to LG3D.
   Maybe setting it to a different name could work with jdk 1.5. But I'm
   not sure about that, or what window manager name you should use.
  
  This patch has been in xmonad for a while, there's some more
  documentation here,
  
http://xmonad.org/xmonad-docs/xmonad-contrib/XMonad-Hooks-SetWMName.html
  
  Several users have reported this as useful.
  
 
 So why not converting this patch into a standalone setwmname
 application written in C, then we can delete the patches in dwm
 and XMonad and people just run setwmname FooBarBaz to work
 around the XToolkit bug(s)?

Good idea.

-- Don



[dwm] [dvtm] [PATCH 2/2] Fix zombie handling

2008-04-29 Thread Rainer Müller
Ask waitpid() for all zombies in sigchld_handler and put them in a list for 
later
destroying. The previous implementation might have lead to zombies when
processes were dying fast.

Signed-off-by: Rainer Müller [EMAIL PROTECTED]
---
 dvtm.c |   52 +++-
 1 files changed, 43 insertions(+), 9 deletions(-)

diff --git a/dvtm.c b/dvtm.c
index 17ac4a4..6a23ad1 100644
--- a/dvtm.c
+++ b/dvtm.c
@@ -52,6 +52,12 @@ struct Client {
Client *prev;
 };
 
+typedef struct ClientList ClientList;
+struct ClientList {
+   Client *client;
+   ClientList *next;
+};
+
 #define ALT(k)  ((k) + (161 - 'a'))
 #ifndef CTRL
   #define CTRL(k)   ((k)  0x1F)
@@ -134,7 +140,7 @@ Client *sel = NULL;
 Client *msel = NULL;
 double mwfact = MWFACT;
 Layout *layout = layouts;
-Client *client_killed = NULL;
+ClientList *kill_list = NULL;
 int statusfd = -1;
 char stext[512];
 int barpos = BARPOS;
@@ -598,6 +604,21 @@ create(const char *args[]){
 
 void
 destroy(Client *c){
+   ClientList *cl;
+   cl = malloc(sizeof(ClientList));
+   cl-client = c;
+   cl-next = NULL;
+
+   if (kill_list == NULL) {
+   kill_list = cl;
+   } else {
+   cl-next = kill_list;
+   kill_list = cl;
+   }
+}
+
+void
+destroy_really(Client *c){
if(sel == c)
focusnextnm(NULL);
detach(c);
@@ -761,12 +782,23 @@ get_client_by_pid(pid_t pid){
 void
 sigchld_handler(int sig){
int errsv = errno;
+   int status;
+   pid_t pid;
 
-   int child_status;
signal(SIGCHLD, sigchld_handler);
-   pid_t pid = wait(child_status);
-   debug(child with pid %d died\n, pid);
-   client_killed = get_client_by_pid(pid);
+
+   while ((pid = waitpid(-1, status, WNOHANG)) != 0) {
+   if (pid == -1) {
+   if (errno == ECHILD) {
+   /* no more child processes */
+   break;
+   }
+   eprint(waitpid: %s\n, strerror(errno));
+   break;
+   }
+   debug(child with pid %d died\n, pid);
+   destroy(get_client_by_pid(pid));
+   }
 
errno = errsv;
 }
@@ -927,9 +959,11 @@ main(int argc, char *argv[]) {
if(need_screen_resize)
resize_screen();
 
-   if(client_killed){
-   destroy(client_killed);
-   client_killed = NULL;
+   while(kill_list) {
+   ClientList *cl = kill_list;
+   destroy_really(cl-client);
+   kill_list = cl-next;
+   free(cl);
}
 
FD_ZERO(rd);
@@ -1025,7 +1059,7 @@ main(int argc, char *argv[]) {
if(FD_ISSET(c-pty, rd)){
if (madtty_process(c-term)  0  errno == 
EIO) {
/* client probably terminated */
-   client_killed = c;
+   destroy(c);
}
if(c != sel){
draw_content(c);
-- 
1.5.5.1




[dwm] [dvtm] [PATCH 1/2] Correct signal handling

2008-04-29 Thread Rainer Müller
The global errno variable needs to be saved at the begin of a signal handler
and to be restored at the end.

Signed-off-by: Rainer Müller [EMAIL PROTECTED]
---
 dvtm.c |   10 ++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/dvtm.c b/dvtm.c
index 6c85746..17ac4a4 100644
--- a/dvtm.c
+++ b/dvtm.c
@@ -760,15 +760,21 @@ get_client_by_pid(pid_t pid){
 
 void
 sigchld_handler(int sig){
+   int errsv = errno;
+
int child_status;
signal(SIGCHLD, sigchld_handler);
pid_t pid = wait(child_status);
debug(child with pid %d died\n, pid);
client_killed = get_client_by_pid(pid);
+
+   errno = errsv;
 }
 
 void
 sigwinch_handler(int sig){
+   int errsv = errno;
+
struct winsize ws;
signal(SIGWINCH, sigwinch_handler);
if(ioctl(0, TIOCGWINSZ, ws) == -1)
@@ -777,11 +783,15 @@ sigwinch_handler(int sig){
width = ws.ws_col;
height = ws.ws_row;
need_screen_resize = true;
+
+   errno = errsv;
 }
 
 void
 sigterm_handler(int sig){
+   int errsv = errno;
running = false;
+   errno = errsv;
 }
 
 void
-- 
1.5.5.1