You are not logged in.

#101 2010-07-09 20:32:55

knopwob
Member
From: Hannover, Germany
Registered: 2010-01-30
Posts: 239
Website

Re: catwm, Cute and Tiny Window Manager

and another patch. This one causes that a proper kill signal is send to every window and the wm is kept alive until every window is closed when alt+q is pressed. if a window refuses to close the shutdown of the wm is forced on another press of alt+q. But there's a problem:
This works fine, when only one window is open (for example gvim with some edits open). When alt+q is pressed, gvim asks if it should save the changes and the wm closes after pressing ok in gvim. But when there are more windows open, X crashes. It sais something like a configurerequest can't be send, because the window is invalid. I can't find the cause for that, but maybe someone else here can.

Anyway here's the patch:

--- ../catwm.c    2010-07-09 22:19:57.079640879 +0200
+++ catwm.c    2010-07-09 22:23:16.126000142 +0200
@@ -90,6 +90,7 @@ static void quit();
 static void remove_window(Window w);
 static void save_desktop(int i);
 static void select_desktop(int i);
+static void send_kill_signal(Window w);
 static void setup();
 static void sigchld(int unused);
 static void spawn(const Arg arg);
@@ -292,15 +293,7 @@ void keypress(XEvent *e) {
 
 void kill_client() {
     if(current != NULL) {
-        //send delete signal to window
-        XEvent ke;
-        ke.type = ClientMessage;
-        ke.xclient.window = current->win;
-        ke.xclient.message_type = XInternAtom(dis, "WM_PROTOCOLS", True);
-        ke.xclient.format = 32;
-        ke.xclient.data.l[0] = XInternAtom(dis, "WM_DELETE_WINDOW", True);
-        ke.xclient.data.l[1] = CurrentTime;
-        XSendEvent(dis, current->win, False, NoEventMask, &ke);
+        send_kill_signal(current->win);
     }
 }
 
@@ -399,10 +392,42 @@ void prev_win() {
 }
 
 void quit() {
+    Window root_return, parent;
+    Window *children;
+    int i;
+    unsigned int nchildren; 
+    XEvent ev;
+
+    /*
+     * if a client refuses to terminate itself,
+     * we kill every window remaining the brutal way.
+     * Since we're stuck in the while(nchildren > 0) { ... } loop
+     * we can't exit through the main method.
+     * This all happens if MOD+q is pushed a second time.
+     */
+    if(bool_quit == 1) {
+        XUngrabKey(dis, AnyKey, AnyModifier, root);
+        XDestroySubwindows(dis, root);
+        fprintf(stdout, "catwm: Thanks for using!\n");
+        XCloseDisplay(dis);
+        die("forced shutdown");
+    }
+
+    bool_quit = 1;
+    XQueryTree(dis, root, &root_return, &parent, &children, &nchildren);
+    for(i = 0; i < nchildren; i++) {
+        send_kill_signal(children[i]);
+    }
+    //keep alive until all windows are killed
+    while(nchildren > 0) {
+        XQueryTree(dis, root, &root_return, &parent, &children, &nchildren);
+        XNextEvent(dis,&ev);
+        if(events[ev.type])
+            events[ev.type](&ev);
+    }
+
     XUngrabKey(dis,AnyKey,AnyModifier,root);
-    XDestroySubwindows(dis,root);
     fprintf(stdout,"catwm: Thanks for using!\n");
-    bool_quit = 1;
 }
 
 void remove_window(Window w) {
@@ -455,6 +480,17 @@ void select_desktop(int i) {
     current_desktop = i;
 }
 
+void send_kill_signal(Window w) { 
+    XEvent ke;
+    ke.type = ClientMessage;
+    ke.xclient.window = w;
+    ke.xclient.message_type = XInternAtom(dis, "WM_PROTOCOLS", True);
+    ke.xclient.format = 32;
+    ke.xclient.data.l[0] = XInternAtom(dis, "WM_DELETE_WINDOW", True);
+    ke.xclient.data.l[1] = CurrentTime;
+    XSendEvent(dis, w, False, NoEventMask, &ke);
+}
+
 void setup() {
     // Install a signal
     sigchld(0);

EDIT:
well, i noticed some more troubles with this patch. If firefox is one of the opened windows, this code kills all windows, but catwm still keeps open until alt+q is pressed another time.
You can say, this is still better, than the behaviour without this patch, but i don't know. who closes his windowmanager anyway? :-P
@pyknite: decide for yourself if you want to include this patch or not.

Last edited by knopwob (2010-07-09 21:01:38)

Offline

#102 2010-07-09 21:12:57

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

Re: catwm, Cute and Tiny Window Manager

knopwob wrote:

and another patch. This one causes that a proper kill signal is send to every window and the wm is kept alive until every window is closed when alt+q is pressed. if a window refuses to close the shutdown of the wm is forced on another press of alt+q. But there's a problem:
This works fine, when only one window is open (for example gvim with some edits open). When alt+q is pressed, gvim asks if it should save the changes and the wm closes after pressing ok in gvim. But when there are more windows open, X crashes. It sais something like a configurerequest can't be send, because the window is invalid. I can't find the cause for that, but maybe someone else here can.

Anyway here's the patch:

--- ../catwm.c    2010-07-09 22:19:57.079640879 +0200
+++ catwm.c    2010-07-09 22:23:16.126000142 +0200
@@ -90,6 +90,7 @@ static void quit();
 static void remove_window(Window w);
 static void save_desktop(int i);
 static void select_desktop(int i);
+static void send_kill_signal(Window w);
 static void setup();
 static void sigchld(int unused);
 static void spawn(const Arg arg);
@@ -292,15 +293,7 @@ void keypress(XEvent *e) {
 
 void kill_client() {
     if(current != NULL) {
-        //send delete signal to window
-        XEvent ke;
-        ke.type = ClientMessage;
-        ke.xclient.window = current->win;
-        ke.xclient.message_type = XInternAtom(dis, "WM_PROTOCOLS", True);
-        ke.xclient.format = 32;
-        ke.xclient.data.l[0] = XInternAtom(dis, "WM_DELETE_WINDOW", True);
-        ke.xclient.data.l[1] = CurrentTime;
-        XSendEvent(dis, current->win, False, NoEventMask, &ke);
+        send_kill_signal(current->win);
     }
 }
 
@@ -399,10 +392,42 @@ void prev_win() {
 }
 
 void quit() {
+    Window root_return, parent;
+    Window *children;
+    int i;
+    unsigned int nchildren; 
+    XEvent ev;
+
+    /*
+     * if a client refuses to terminate itself,
+     * we kill every window remaining the brutal way.
+     * Since we're stuck in the while(nchildren > 0) { ... } loop
+     * we can't exit through the main method.
+     * This all happens if MOD+q is pushed a second time.
+     */
+    if(bool_quit == 1) {
+        XUngrabKey(dis, AnyKey, AnyModifier, root);
+        XDestroySubwindows(dis, root);
+        fprintf(stdout, "catwm: Thanks for using!\n");
+        XCloseDisplay(dis);
+        die("forced shutdown");
+    }
+
+    bool_quit = 1;
+    XQueryTree(dis, root, &root_return, &parent, &children, &nchildren);
+    for(i = 0; i < nchildren; i++) {
+        send_kill_signal(children[i]);
+    }
+    //keep alive until all windows are killed
+    while(nchildren > 0) {
+        XQueryTree(dis, root, &root_return, &parent, &children, &nchildren);
+        XNextEvent(dis,&ev);
+        if(events[ev.type])
+            events[ev.type](&ev);
+    }
+
     XUngrabKey(dis,AnyKey,AnyModifier,root);
-    XDestroySubwindows(dis,root);
     fprintf(stdout,"catwm: Thanks for using!\n");
-    bool_quit = 1;
 }
 
 void remove_window(Window w) {
@@ -455,6 +480,17 @@ void select_desktop(int i) {
     current_desktop = i;
 }
 
+void send_kill_signal(Window w) { 
+    XEvent ke;
+    ke.type = ClientMessage;
+    ke.xclient.window = w;
+    ke.xclient.message_type = XInternAtom(dis, "WM_PROTOCOLS", True);
+    ke.xclient.format = 32;
+    ke.xclient.data.l[0] = XInternAtom(dis, "WM_DELETE_WINDOW", True);
+    ke.xclient.data.l[1] = CurrentTime;
+    XSendEvent(dis, w, False, NoEventMask, &ke);
+}
+
 void setup() {
     // Install a signal
     sigchld(0);

EDIT:
well, i noticed some more troubles with this patch. If firefox is one of the opened windows, this code kills all windows, but catwm still keeps open until alt+q is pressed another time.
You can say, this is still better, than the behaviour without this patch, but i don't know. who closes his windowmanager anyway? :-P
@pyknite: decide for yourself if you want to include this patch or not.

NO problem for me... I need to say that I just lost the developpement these days because I'm working on my thesis... But I will take a look at th thread more seriously this weekend.

And I'm really planning to switch to the xcb lib... I think it can be great. And we will be the second wm to use it \o/ (after awesome wink )

Offline

#103 2010-07-09 21:22:22

knopwob
Member
From: Hannover, Germany
Registered: 2010-01-30
Posts: 239
Website

Re: catwm, Cute and Tiny Window Manager

Hey,

i don't have an opinion about the Xlib or xcb issue. I have no experience with either one of them (except the few hours working with Xlib for writing these patches). But since i have nothing else to do today, i can have a look into xcb.

Offline

#104 2010-07-09 22:21:47

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

Re: catwm, Cute and Tiny Window Manager

knopwob wrote:

Hey,

i don't have an opinion about the Xlib or xcb issue. I have no experience with either one of them (except the few hours working with Xlib for writing these patches). But since i have nothing else to do today, i can have a look into xcb.

Xcb is the remplacement for xlib... But for the moment not a lot of peolple are using it because a lot of project are made whit xlib.

Offline

#105 2010-07-09 23:34:14

knopwob
Member
From: Hannover, Germany
Registered: 2010-01-30
Posts: 239
Website

Re: catwm, Cute and Tiny Window Manager

i've started to move the code to xcb, just to see how well it goes. At this moment, it compiles, starts and run in an endless loop. But about 50% of the code is commented out. Basically everything that has something todo with events doesn't work at the moment.

Up to now it was pretty easy to move the code to xcb, but the difficult part comes now.

Offline

#106 2010-07-10 00:37:47

cesura
Package Maintainer (PM)
From: Tallinn, Estonia
Registered: 2010-01-23
Posts: 1,867

Re: catwm, Cute and Tiny Window Manager

knopwob wrote:

i've started to move the code to xcb, just to see how well it goes. At this moment, it compiles, starts and run in an endless loop. But about 50% of the code is commented out. Basically everything that has something todo with events doesn't work at the moment.

Up to now it was pretty easy to move the code to xcb, but the difficult part comes now.

I want to help! tongue Time to break out the ol' documentation.

Offline

#107 2010-07-10 00:47:55

knopwob
Member
From: Hannover, Germany
Registered: 2010-01-30
Posts: 239
Website

Re: catwm, Cute and Tiny Window Manager

i'm in #catwm@freenode right now ;-)

Last edited by knopwob (2010-07-10 00:48:08)

Offline

#108 2010-07-10 02:32:35

cesura
Package Maintainer (PM)
From: Tallinn, Estonia
Registered: 2010-01-23
Posts: 1,867

Re: catwm, Cute and Tiny Window Manager

This post isn't really aiding development, but it shows how much faster XCB is than Xlib:

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <sys/time.h>
#include <xcb/xcb.h>
#include <X11/Xlib.h>
#define NUM_NAMES 500
/*
    NOTE: For concision, we're going to be cheesy and use arrays where real code
    would use points and memory allocation.s
*/
#ifndef __GNUC__
char* strdup(const char* s) {
    int n = strlen(s) + 1;

    char *dup = malloc(n);

    if(dup) 
        strcpy(dup, s);

    return dup;
}
#endif

/* 
    return interval of time (uses time.h) 
*/
double
get_time (void) {
    struct timeval timev;           
    gettimeofday(&timev, NULL);
    return (double)timev.tv_sec + (((double)timev.tv_usec) / 1000000);
}

/*

*/
void
useXlib (char **names,
         Display *display ) {

    Atom atoms[NUM_NAMES];
    for (int i = 0; i < NUM_NAMES; ++i) {
        atoms[i] = XInternAtom(display, names[i], 0);
    }
}

/*
Request all atoms at once.
*/
void
useXlibProperly (char **names,
         Display *display ) {

    Atom atoms[NUM_NAMES];
    if(!XInternAtoms(display, names, NUM_NAMES, 0, atoms))
        fprintf(stderr, "XInternAtoms failed\n");
}

/*

*/
void
useXCBPoorly (char **names,
             xcb_connection_t *connection ) {
    xcb_atom_t              atoms[NUM_NAMES];
    // in this bad use of xcb, we use the cookie immediately after posting the request with xcb_intern_atom 
    for (int i = 0; i < NUM_NAMES; ++i) {
        /* make request */
        xcb_intern_atom_cookie_t cookie = xcb_intern_atom (connection, 
                                                            0, 
                                                            strlen(names[i]),
                                                            names[i] );
        /* get response */
        xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply (connection, 
                                                                cookie, 
                                                                NULL ); // normally a pointer to receive error, but we'll just ignore error handling 
        if (reply) {
            atoms[i] = reply->atom;
            free (reply);
        }
    }
    // now we have our atoms (replies), but this is just a demo, so we do nothing with them
}

/*
*/
void
useXCBProperly (char **names,
                xcb_connection_t *connection ) {
    xcb_atom_t               atoms[NUM_NAMES];
    xcb_intern_atom_cookie_t    cookies[NUM_NAMES];
    // in this good example, we make all our requests before checking for
    // replies because it's best to queue requests when we have many at once    
    /* make requests */
    for (int i = 0; i < NUM_NAMES; ++i) {
        cookies[i] = xcb_intern_atom (connection, 
                                     0, 
                                     strlen (names[i]), 
                                     names[i] );
    }
    /* get responses */
    for (int i = 0; i < NUM_NAMES; ++i) {
        xcb_intern_atom_reply_t *reply = xcb_intern_atom_reply (connection, 
                                                                cookies[i], 
                                                                NULL ); // normally a pointer to receive errors, but we'll just ignore error handling
        if (reply) {
            atoms[i] = reply->atom;
            free (reply);
        }
    }
    // now we have our atoms (replies), but this is just a demo, so we do nothing with them
}

int
main () {
    /* setup names for tests */
    char (**names) = malloc(NUM_NAMES*sizeof(*names));
    // init names to "NAME0", "NAME1", "NAME2" ... and so on
    for (int i = 0; i < NUM_NAMES; ++i) {
        char buf[100];
        sprintf (buf, "NAME%d", i);
        names[i] = strdup (buf);
    }

    /* do tests */
    double start, XlibTime, XlibGoodTime, XCBBadTime, XCBGoodTime;

    /* test Xlib */
    Display *display = XOpenDisplay (NULL);
    start = get_time ();
    useXlib (names, display);
    XlibTime = get_time () - start;
    start = get_time ();
    useXlibProperly (names, display);
    XlibGoodTime = get_time () - start;
    XCloseDisplay (display);

    /* test XCB */
    xcb_connection_t *connection = xcb_connect (NULL, NULL);
    start = get_time ();
    useXCBPoorly (names, connection);
    XCBBadTime = get_time () - start;   
    start = get_time ();
    useXCBProperly (names, connection);
    XCBGoodTime = get_time () - start;
    xcb_disconnect (connection);

    /* report times */
    printf ("Bad Xlib time : %f\n", XlibTime);
    printf ("Good Xlib time : %f\n", XlibGoodTime);
    printf ("Bad xcb time : %f\n", XCBBadTime);
    printf ("Good xcb time : %f\n", XCBGoodTime);
    printf ("ratio of good xcb time to bad xcb time: %f\n", XCBGoodTime / XCBBadTime);
    printf ("ratio of Xlib time to good xcb time: %f\n", XlibTime / XCBGoodTime);
    printf ("ratio of good Xlib time to bad Xlib time: %f\n", XlibGoodTime / XlibTime);

    return 0;
}

Compile with:

gcc test.c -o test -std=c99 -lX11

On my system, XCB was 82x faster than Xlib yikes

Last edited by cesura (2010-07-10 02:38:13)

Offline

#109 2010-07-10 05:35:51

sicpsnake
Member
From: Austin, TX.
Registered: 2010-02-25
Posts: 128
Website

Re: catwm, Cute and Tiny Window Manager

Could this be a problem when porting catwm to XCB? http://xcb.freedesktop.org/XCBToDoKeyboard/

At the moment, XCB implements only a basic and incomplete sets of keyboard functions. Therefore, it greatly restricts the usages of XCB in "real-world" applications and duplicate the efforts as most applications ported to XCB so far (such as Awesome Window Manager, VLC and others) have to write their own implementation, which is often incomplete and buggy as it is rather tricky to implement properly and entirely.

It seems like it might prove to be difficult.

Offline

#110 2010-07-10 06:03:05

cesura
Package Maintainer (PM)
From: Tallinn, Estonia
Registered: 2010-01-23
Posts: 1,867

Re: catwm, Cute and Tiny Window Manager

sicpsnake wrote:

Could this be a problem when porting catwm to XCB? http://xcb.freedesktop.org/XCBToDoKeyboard/

At the moment, XCB implements only a basic and incomplete sets of keyboard functions. Therefore, it greatly restricts the usages of XCB in "real-world" applications and duplicate the efforts as most applications ported to XCB so far (such as Awesome Window Manager, VLC and others) have to write their own implementation, which is often incomplete and buggy as it is rather tricky to implement properly and entirely.

It seems like it might prove to be difficult.

Oh shiiiiiiiiiii-----! I don't want to have to screw around with other applications! yikes

Offline

#111 2010-07-10 10:39:45

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

Re: catwm, Cute and Tiny Window Manager

Yep there is no keyboard support at this time in xcb... Need to use the X11/keysym.h,... for keyboard input

I think someone in gsoc is working on it

Offline

#112 2010-07-10 12:52:07

Lexion
Member
Registered: 2008-03-23
Posts: 510

Re: catwm, Cute and Tiny Window Manager

I've been writing a window manager for the past week, and this project has helped/inspired me a lot. Thanks.

Quick suggestion: add an option in config.h for a panel on the edge of the screen. It should be pretty easy. Heres a modified version of your void setup():

void setup() {
        // Install a signal
        sigchild(0);

        // Screen and root window
        screen = DefaultScreen(dis);
        root = RootWindow(dis, screen);

         // Screen width and height
         sw = XDisplayWidth(dis, screen);
+      sh = XDisplayHeight(dis, screen) - PANEL_HEIGHT;

         ...

And you'd have to add PANEL_HEIGHT to config.h.

Last edited by Lexion (2010-07-10 12:52:46)


urxvtc / wmii / zsh / configs / onebluecat.net
Arch will not hold your hand

Offline

#113 2010-07-10 15:19:16

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

Re: catwm, Cute and Tiny Window Manager

Lexion wrote:

I've been writing a window manager for the past week, and this project has helped/inspired me a lot. Thanks.

Quick suggestion: add an option in config.h for a panel on the edge of the screen. It should be pretty easy. Heres a modified version of your void setup():

void setup() {
        // Install a signal
        sigchild(0);

        // Screen and root window
        screen = DefaultScreen(dis);
        root = RootWindow(dis, screen);

         // Screen width and height
         sw = XDisplayWidth(dis, screen);
+      sh = XDisplayHeight(dis, screen) - PANEL_HEIGHT;

         ...

And you'd have to add PANEL_HEIGHT to config.h.

Yep, but for the moment no panel are planned...

I think at this time the most important think is to rewrite all the wm using xcb instead xlib and improve some feature (like much more support for standard, like ewmh). In the next time it can be great to develop some patch for other features, like panel,...

Offline

#114 2010-07-10 15:46:06

cesura
Package Maintainer (PM)
From: Tallinn, Estonia
Registered: 2010-01-23
Posts: 1,867

Re: catwm, Cute and Tiny Window Manager

pyknite wrote:

Yep there is no keyboard support at this time in xcb... Need to use the X11/keysym.h,... for keyboard input

I think someone in gsoc is working on it

knopwob had translated much of the code to xcb, at least from what he gave be on #catwm smile I was reading up XCB's documentation last night, and...I like Xlib better yikes *gasp*

"Did he just say he likes Xlib better?"
"I think he did! What a loser!"

I just feel Xlib has had alot more time to mature than XCB.

Offline

#115 2010-07-12 00:46:19

zenny
Member
Registered: 2008-04-15
Posts: 24

Re: catwm, Cute and Tiny Window Manager

Wonderful wm! I am liking it! Thanks for the hard work!

In the meantime, I am encoutering the following three problems (using catwm-git 20100701-1):

1) when executed killall -9 program in terminal, the user gets logged out of the session to tty1. :-(

2) even when the mouse is hovered over a tile, it does not get activated unless mod+j/k is pressed. I like the feauture with xmonad in which the tile hovered over the mouse is activated.

3) a problem is when starting cinelerra, which opens four windows in tiles making it unusable to work on.

I also miss some keybinding that I have with openbox like winkey+f opens filemanager of my choice winkey+t opens terminal, winkey+w opens browser, PrintScn prints the screen with scrot and opens with an image viewer of choice etc.which I can specifiy in the openbox's rc.xml. Maybe I am yet to understand to make it work. In the later case, please advise.

Thanks!

Offline

#116 2010-07-12 01:54:29

cesura
Package Maintainer (PM)
From: Tallinn, Estonia
Registered: 2010-01-23
Posts: 1,867

Re: catwm, Cute and Tiny Window Manager

zenny wrote:

Wonderful wm! I am liking it! Thanks for the hard work!

In the meantime, I am encoutering the following three problems (using catwm-git 20100701-1):

1) when executed killall -9 program in terminal, the user gets logged out of the session to tty1. :-(

2) even when the mouse is hovered over a tile, it does not get activated unless mod+j/k is pressed. I like the feauture with xmonad in which the tile hovered over the mouse is activated.

3) a problem is when starting cinelerra, which opens four windows in tiles making it unusable to work on.

I also miss some keybinding that I have with openbox like winkey+f opens filemanager of my choice winkey+t opens terminal, winkey+w opens browser, PrintScn prints the screen with scrot and opens with an image viewer of choice etc.which I can specifiy in the openbox's rc.xml. Maybe I am yet to understand to make it work. In the later case, please advise.

Thanks!

Hi! Thanks for the feedback (speaking for pyknite here, as he did a good amount of the work)!

1) I believe there was a fix for this recently pushed to github. I am experiencing something similar. If I kill some programs (mainly firefox) in a different workspace than the one that it is open in and then change to the workspace firefox resided in, I am pushed to tty1. I'll see if I can find the cause and post a patch if I fix it.

2) This doesn't work because it isn't implemented yet wink We would need to do a little work with mouse events, and hopefully we can add this in the future.

3) Can't say much on this one sad

4) You must edit config.h and then recompile catwm to get new keybindings. I'll edit the catwm wiki page explaining how to do that smile

EDIT: Here you go smile http://wiki.archlinux.org/index.php/Cat … eybindings

EDIT EDIT: The reason this is occuring is that firefox is stored when I change desktops, and when I change back (after I killed it) it can't find it and kills X.

Last edited by cesura (2010-07-12 04:08:28)

Offline

#117 2010-07-12 04:33:01

cesura
Package Maintainer (PM)
From: Tallinn, Estonia
Registered: 2010-01-23
Posts: 1,867

Re: catwm, Cute and Tiny Window Manager

It's a problem with change_desktop(). I need to find a way to check if a window exists before it maps it.

Example:

for(c=head;c;c=c->next) {
     XEvent test;
     if(XSendEvent(dis, c->win, False, NoEventMask, &test) {
          XMapWindow(dis,c->win);
     }
}

I need a function just to somehow verify a window exists, and return a 0 if it doesn't.

Last edited by cesura (2010-07-12 04:33:57)

Offline

#118 2010-07-12 08:06:59

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

Re: catwm, Cute and Tiny Window Manager

itsbrad212 wrote:

It's a problem with change_desktop(). I need to find a way to check if a window exists before it maps it.

Example:

for(c=head;c;c=c->next) {
     XEvent test;
     if(XSendEvent(dis, c->win, False, NoEventMask, &test) {
          XMapWindow(dis,c->win);
     }
}

I need a function just to somehow verify a window exists, and return a 0 if it doesn't.

for(c=head;c;c=c->next) {
     XEvent test;
     if(XSendEvent(dis, c->win, False, NoEventMask, &test) {
          if(c-win != null)
                XMapWindow(dis,c->win);
     }
}

It should work no?

Offline

#119 2010-07-12 11:28:07

zenny
Member
Registered: 2008-04-15
Posts: 24

Re: catwm, Cute and Tiny Window Manager

Thanks, itsbrad212 and pyknite.

In the meantime, I came across pytyle (http://aur.archlinux.org/packages.php?ID=29573) based on XCB. It has two nice features: 1) It has similar key combination to Xmonad. 2) One can put some applications in ignore list to ignore tiling feature (useful for the applications like gimp and cinelerra).

How can I change the default MOD key from alt key to something else like win key or a combination of two keys like alt-shift or ctrl-shift? The reason that I am asking is the alt key combination conflicts with some of the default keys of applications like firefox (like alt+> alt+< combinations for instance).

And I liked the idea suggested by Lexicon in post #112 above, though pyknite ruled out such stuffs in post #113. ;-)

Thanks for the great work, I am just not finding stability (while killing windows) and some small features in CATWM, else it rocks!!! **** for pyknite and catwm. :-)

EDIT: I also miss resizing of windows feature (MOD+Shift+mouse drag) and horizontal windows alignment (though I read pyknite stating that it is easy to accomplish at http://github.com/pyknite/catwm/blob/master/README.md, just could not figure out how?) ;-)

Last edited by zenny (2010-07-12 11:31:34)

Offline

#120 2010-07-12 12:10:53

sicpsnake
Member
From: Austin, TX.
Registered: 2010-02-25
Posts: 128
Website

Re: catwm, Cute and Tiny Window Manager

zenny wrote:

Thanks, itsbrad212 and pyknite.

In the meantime, I came across pytyle (http://aur.archlinux.org/packages.php?ID=29573) based on XCB. It has two nice features: 1) It has similar key combination to Xmonad. 2) One can put some applications in ignore list to ignore tiling feature (useful for the applications like gimp and cinelerra).

How can I change the default MOD key from alt key to something else like win key or a combination of two keys like alt-shift or ctrl-shift? The reason that I am asking is the alt key combination conflicts with some of the default keys of applications like firefox (like alt+> alt+< combinations for instance).

And I liked the idea suggested by Lexicon in post #112 above, though pyknite ruled out such stuffs in post #113. ;-)

Thanks for the great work, I am just not finding stability (while killing windows) and some small features in CATWM, else it rocks!!! **** for pyknite and catwm. :-)

EDIT: I also miss resizing of windows feature (MOD+Shift+mouse drag) and horizontal windows alignment (though I read pyknite stating that it is easy to accomplish at http://github.com/pyknite/catwm/blob/master/README.md, just could not figure out how?) ;-)

In order to change the default MOD, change the line "#define MOD Mod1Mask" to "#define MOD Mod4Mask" in the config.h to use the Windows key.

If you would like to add shift, suffix "|ShiftMask" to the end of "MOD" in the shortcuts definitions, like so:

{  MOD|ShiftMask,   KEY,                  FUNCTION,          {ARGS}}

Last edited by sicpsnake (2010-07-12 12:12:18)

Offline

#121 2010-07-12 18:58:54

zenny
Member
Registered: 2008-04-15
Posts: 24

Re: catwm, Cute and Tiny Window Manager

Recompiled with Mod4Mask in config.h, but the default alt key combination didn't get changed. :-(

Offline

#122 2010-07-12 19:46:28

knopwob
Member
From: Hannover, Germany
Registered: 2010-01-30
Posts: 239
Website

Re: catwm, Cute and Tiny Window Manager

zenny wrote:

Recompiled with Mod4Mask in config.h, but the default alt key combination didn't get changed. :-(

Try

make clean

within the folder you compiled and compile again. If you have already compiled and only made changes to config.h but not to catwm.c the compiler things nothing has changed and doesn't compile anything. I've stumbled upon this problem too, when i tried to change some keybindings. Maybe someone should add a 'make clean' to the PKGBUILD to prevent these problems.

Offline

#123 2010-07-12 19:50:50

cesura
Package Maintainer (PM)
From: Tallinn, Estonia
Registered: 2010-01-23
Posts: 1,867

Re: catwm, Cute and Tiny Window Manager

pyknite wrote:
itsbrad212 wrote:

It's a problem with change_desktop(). I need to find a way to check if a window exists before it maps it.

Example:

for(c=head;c;c=c->next) {
     XEvent test;
     if(XSendEvent(dis, c->win, False, NoEventMask, &test) {
          XMapWindow(dis,c->win);
     }
}

I need a function just to somehow verify a window exists, and return a 0 if it doesn't.

for(c=head;c;c=c->next) {
     XEvent test;
     if(XSendEvent(dis, c->win, False, NoEventMask, &test) {
          if(c-win != null)
                XMapWindow(dis,c->win);
     }
}

It should work no?

Unfortunately it doesn't sad The WM crashes when I try to change back to a saved desktop.

Offline

#124 2010-07-12 19:54:40

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

Re: catwm, Cute and Tiny Window Manager

knopwob wrote:
zenny wrote:

Recompiled with Mod4Mask in config.h, but the default alt key combination didn't get changed. :-(

Try

make clean

within the folder you compiled and compile again. If you have already compiled and only made changes to config.h but not to catwm.c the compiler things nothing has changed and doesn't compile anything. I've stumbled upon this problem too, when i tried to change some keybindings. Maybe someone should add a 'make clean' to the PKGBUILD to prevent these problems.

It's normal... When you recompile something it only recompile source code, not the header file...

Offline

#125 2010-07-12 20:31:42

zenny
Member
Registered: 2008-04-15
Posts: 24

Re: catwm, Cute and Tiny Window Manager

I am a bit lost after trying several times :-(

1st try) I tried to recompile after executing 'make clean' and what I got was:

error: Your local changes to 'config.h' would be overwritten by merge.  Aborting.
Please, commit your changes or stash them before you can merge.
    Aborting...

2nd try) Then I tried to build and install the same with packer and yaourt, but got the error:

/tmp/packerbuild-1000/catwm-git/catwm-git/PKGBUILD: line 37: config.h: command not found
    Aborting...
The build failed.

3rd try) Then I added $srcdir/$_gitname/config.g in line 37 of the PKGBUILD and compiled to get the following error.

==> Starting make...
/tmp/packerbuild-1000/catwm-git/catwm-git/src/catwm/config.h: line 1: /bin: is a directory
/tmp/packerbuild-1000/catwm-git/catwm-git/src/catwm/config.h: line 3: syntax error near unexpected token `('
/tmp/packerbuild-1000/catwm-git/catwm-git/src/catwm/config.h: line 3: ` *  ( o   o )  Made by cat...'
    Aborting...
The build failed.

Last time too I could only compile by placing a # in front of line 37.

Offline

Board footer

Powered by FluxBB