🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.lang.lisp.x
6 messages
6 total messages Started by Scott Johnson Wed, 09 Sep 1992 22:30
Trouble with lcl and clx
#73
Author: Scott Johnson
Date: Wed, 09 Sep 1992 22:30
224 lines
6941 bytes
Hi,

There seems to be a problem between lcl and the xlib/clx routines. If anyone can
help, I would appreciate it.

The problem is that the lisp stuff does not succeed as does the same thing 
in c.  To demonstrate the problem, I create two decterm windows with on being
titled "talguy" and the other being titled "csc32".  The one titled "csc32"
is the one that gets popped to the top or pushed to the bottom of the stack
of windows.  Oh yeah, the windows do occlude each other. The decterm labeled 
"talguy" is on the top of and partially occludes the decterm labeled "csc32".

To perform the test using the lisp code, simply load the code and invoke
(decwindows-toggle-up) followed by a call to (decwindows-toggle-down).  The
c code will do this automatically when it is executed.  To succeed, the decterm
labeled "csc32" should pop to the top of the stack and then get pushed to the 
bottom of the stack.

Scott Johnson

-------------
test.lisp
-------------
;
; This is used to test a problem with clx.  It seems to have trouble finding
; a match for the title name when it calls clx:wm-name.  Unless it finds a 
; match, knowledge-window and driver-window are set to nil.  If
; these two variables are set to nil, then the call to circulate-window-up
; and circulate-window-down fails.
;
(IN-PACKAGE "USER")

#.(if (equal "DEC ULTRIX" (software-type))
    (rename-package "XLIB" "XLIB" '("CLX"))
)
                                                               
(progn
    (defvar display (clx:open-display (machine-instance)))
    (defvar screen (clx:display-default-screen display))
    (defvar root (clx:screen-root screen))
    (defvar knowledge-window nil)
    (defvar driver-window nil)
)

(defun windowlist (window-id)
   (if (not (null window-id))
      (progn
         (setq win (clx:wm-name window-id))
         (if (not (equal "" win))
		(format nil "The wm-name for ~D is ~A." window-id win))
         (if (equal "csc32" win)
            (setq knowledge-window window-id))
         (mapcar #'(lambda (x) 
            (if (null knowledge-window) (windowlist x))
                   )
            (clx:query-tree window-id)))))

(defun windowlist1 (window-id)
   (if (not (null window-id))
      (progn
         (setq win (clx:wm-name window-id))
         (if (not (equal "" win))
		(format nil "The wm-name for ~D is ~A." window-id win))
         (if (equal "talguy" win)
            (setq driver-window window-id))
         (mapcar #'(lambda (x) 
            (if (null driver-window) (windowlist1 x))
                   )
            (clx:query-tree window-id)))))

(progn
   (windowlist  root)
   (windowlist1 root)
   (if (equal "DEC ULTRIX" (software-type)) 
       (shell "clear")
       (spawn :command-string "set terminal/width=80" :parallel t)
)  )

(defun decwindows-toggle-up (&rest ignore) 
    (clx:circulate-window-up knowledge-window)
    (clx:set-input-focus display knowledge-window :none)
    (clx:query-tree root)
)

(defun decwindows-toggle-down (&rest ignore) 
     (clx:circulate-window-down knowledge-window)
     (clx:set-input-focus display driver-window :none)
     (clx:query-tree root)
)

---------
test.c
---------
#include <stdio.h>
#include <X11/X.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>

void windowlist();
void windowlist1();
void decwindows_toggle_up();
void decwindows_toggle_down();
Display *dpy;
Screen *screen; 
Window root;
Window knowledge_window;
Window driver_window;

main()
{

    char c;

    if (!(dpy = XOpenDisplay(NULL))) {
        printf("Can't open display.\n"); 
	exit(-1);
    }

    if (!(screen = DefaultScreenOfDisplay(dpy))) {
        printf("Can't get default screen.\n");
	exit(-1);
    }

    if (!(root = RootWindow(dpy,DefaultScreen(dpy)))) {
        printf("Can't get root window of screen.\n");
        exit(-1);
    }

    windowlist(root); 

    windowlist1(root);    

    decwindows_toggle_up();

    sleep(3);

    decwindows_toggle_down();

    sleep(3);
}

void windowlist(window_id)
Window window_id;
{
    int status;
    XTextProperty txt;
    Window root,parent,*children,*child;
    int num_children,i,total;
   
    XGetWMName(dpy,window_id,&txt);
    if ((txt.value != NULL) && (txt.encoding == 31) && (txt.format == 8))
        if (!strcmp(txt.value,"csc32")) {
           knowledge_window = window_id;
           printf("Assigned knowledge_window\n");
        }
    if (knowledge_window == NULL) {
	if (!(status = XQueryTree(dpy,window_id,&root,&parent,
                            &children,&num_children))) 
	    printf("Failed in call to XQueryTree()\n");
	else {
		total = num_children; 
                child = children;
                for (i=0; i<total; i++, child++) windowlist(*child);
                XFree(children);
        }
    }
}

void windowlist1(window_id)
Window window_id;
{
    int status;
    XTextProperty txt;
    Window root,parent,*children,*child;
    int num_children,i,total;
   
    XGetWMName(dpy,window_id,&txt);
    if ((txt.value != NULL) && (txt.encoding == 31) && (txt.format == 8))
        if (!strcmp(txt.value,"talguy")) {
           driver_window = window_id;
           printf("Assigned driver_window\n");
        }
    if (driver_window == NULL) {
	if (!(status = XQueryTree(dpy,window_id,&root,&parent,
                            &children,&num_children))) 
	    printf("Failed in call to XQueryTree()\n");
	else {
		total = num_children; 
                child = children;
                for (i=0; i<total; i++, child++) windowlist1(*child);
                XFree(children);
        }
    }
}


void decwindows_toggle_up()
{
    int status;
    Window lroot,parent,*children;
    int num_children;

    XCirculateSubwindowsUp(dpy,knowledge_window);
    XSetInputFocus(dpy,knowledge_window,RevertToNone,CurrentTime);
    XQueryTree(dpy,root,&lroot,&parent,&children,&num_children); 
}

void decwindows_toggle_down()
{
    Window lroot,parent,*children;
    int num_children;

    XCirculateSubwindowsDown(dpy,knowledge_window);
    XSetInputFocus(dpy,driver_window,RevertToNone,CurrentTime);
    XQueryTree(dpy,root,&lroot,&parent,&children,&num_children);
}


--------------------------------------------------------------------------

   Scott Johnson
   Digital Equipment Corporation
   Colorado Springs, Co
Re: Trouble with lcl and clx
#79
Author: Tom Almy
Date: Thu, 10 Sep 1992 19:59
62 lines
590 bytes
Test message -- please ignore

























































-- 
Tom Almy
toma@sail.labs.tek.com
Standard Disclaimers Apply
test message - please ignore
#75
Author: Ron Kirkpatrick
Date: Thu, 10 Sep 1992 20:39
6 lines
599 bytes
Please ignore - testing problem with news distribution.

Ron Kirkpatrick
Tektronix, Inc.
News Administrator
503-627-6707
Re: test message - please ignore
#76
Author: Ron Kirkpatrick
Date: Thu, 10 Sep 1992 21:43
11 lines
630 bytes
Test message please ignore.

Ron Kirkpatrick
News Administrator
Tektronix, Inc
503-627-6707
-- 
Ron Kirkpatrick
Tektronix, Inc
MailBridge Postmaster
503-627-6707
Re: test message - please ignore
#77
Author: news
Date: Thu, 10 Sep 1992 22:27
6 lines
590 bytes
test please ignore.

Ron Kirkpatrick
News Administrator
Tektronix, Inc
503-627-6707
Re: Trouble with lcl and clx
#83
Author: -Network News Daemon
Date: Fri, 11 Sep 1992 16:06
14 lines
692 bytes
In article <12524@sail.LABS.TEK.COM> toma@sail.labs.tek.com writes:
>Test message -- please ignore
>
>-- 
>Tom Almy
>toma@sail.labs.tek.com
>Standard Disclaimers Apply

Sorry for the band width...We are still expriencing problems.

Ron Kirkpatrick
News Administrator
Tektronix, Inc.
503-627-6707
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads