[comp.windows.x] clx question

rick@psilocybin.UUCP (Rick Busdiecker) (12/31/87)

Has anyone written anything that does the equivalent of X10's
XUpdateMouse in CLX?  I get the impression that CLX doesn't give
nearly as much power to play with the event queue as the C Xlib.  Is
this true or am I missing something?

BTW, I have two patch files that alter CLX so that DRAWABLE, WINDOW
and PIXMAP are CLOS classes and so that CREATE-WINDOW takes a :WINDOW
keyword argument.  This makes object oriented CLX programming really
straight forward without requiring that you adopt all of the the stuff
in CLUE.  If people are interested, I'll send this to the net.

			Rick Busdiecker
			Expert Technologies Inc.

			sunpitt!eti!rick@sun.com
				or
			rfb@cs.cmu.edu

RWS@ZERMATT.LCS.MIT.EDU (Robert Scheifler) (12/31/87)

    Date: Wed, 30 Dec 87 19:28:37 EST
    From: sunpitt!eti!psilocybin!rick@Sun.COM (Rick Busdiecker)

			  I get the impression that CLX doesn't give
    nearly as much power to play with the event queue as the C Xlib.

On the contrary, I think it provides considerably more flexibility.  It
is true that CLX currently provides just two basic interfaces, and not
the 37 variations found in the C Xlib.  That may argue wrt ease of use,
but not "power".

RWS@ZERMATT.LCS.MIT.EDU (Robert Scheifler) (01/01/88)

    Date: Thu, 31 Dec 87  10:30:43 CST
    From: Kerry Kimbrough <Kimbrough%dsg.csc.ti.com@RELAY.CS.NET>

	   Implementing the effect of XWindowEvent/XCheckWindowEvent in CLX is
    certainly doable, but it is ponderous. This is because the event keyword used to
    name the event's "addressee" is different for different event types. This is a
    nit that would be worth cleaning up, preferably by using the same keyword for
    the addressee everywhere; this solution would also enable a cleaner
    implementation of event dispatching in object-oriented systems like CLUE.

Could you explain this, perhaps with an example?  Can you list where
keyword use isn't uniform?  The event names are NOT the same as the mask
names; this is true in both Xlib and CLX.  Xlib internally has a table
mapping event name to mask bit that gets used in XWindowEvent.  A
function mapping from event-name key to event-mask key (and perhaps one
from event-mask key to list of event-name key) can certainly be defined
and would be reasonable to make part of the CLX interface, if someone
wants to supply the code.

Kimbrough@dsg.csc.ti.COM (Kerry Kimbrough) (01/01/88)

Apparently, I wasn't clear about why implementing XWindowEvent/XCheckWindowEvent
in CLX is clumsy. The problem is matching the given window object against an
event. Do you compare it with the event's :window or with its :parent or with
its :event-window? It all depends on the :event-key. Something like:

(DEFUN window-event (display match-window match-event-keys handler)
  (process-event display
    #'(lambda (&rest event-keys)
	(LET* ((event-key    (GETF event-keys :event-key))
	       (event-window (GETF event-keys
				   (CASE event-key
				     ((:configure-request ...) :parent)
				     ((:circulate-notify  ...) :event-keyword)
				     (otherwise                :window)))))
	  (AND (EQ event-window match-window)
	       (FIND event-key match-event-keys)
	       (APPLY handler event-keys))))))	

Servicable, but it would be cleaner and more reliable if it was always the same
keyword (say, :event-window).  Same goes for event dispatching, too.

RWS@ZERMATT.LCS.MIT.EDU (Robert Scheifler) (01/07/88)

    Date: Thu, 31 Dec 87  17:21:13 CST
    From: Kerry Kimbrough <Kimbrough%dsg.csc.ti.com@RELAY.CS.NET>

	   (event-window (GETF event-keys
			       (CASE event-key
				 ((:configure-request ...) :parent)
				 ((:circulate-notify  ...) :event-window)
				 (otherwise                :window)))))

    Servicable, but it would be cleaner and more reliable if it was always the same
    keyword (say, :event-window).  Same goes for event dispatching, too.

(I note that the C Xlib doesn't use uniform names, but uses a
by-position-in-structure kludge when matching windows.)

I would prefer not to make an incompatible change.  Better, it seems to
me, is to simply allow use of :event-window on all window-based events,
Thus, for example, :event-window could be used as a synonym for :parent
in :configure-request events.

The only "difficulty" is whether :event-window should be permitted in
queue-event and send-event.  It could either be disallowed, or require
that if both synonyms are given they must be equal, or say it "is an
error" if synonyms with differing values are given.  Off-hand, I would
lean to "is an error".

sandra@utah-cs.UUCP (Sandra J Loosemore) (07/23/88)

In CLX, how does one determine whether a screen is monochrome or color?
The trick I've seen used in Xlib is to check how many colors the default
colormap will hold, but I can't find the equivalent accessor in CLX.  Or
is there some other test that is preferred?

-Sandra Loosemore (sandra@cs.utah.edu)

dshr@SUN.COM (David Rosenthal) (07/23/88)

> In CLX, how does one determine whether a screen is monochrome or color?
> The trick I've seen used in Xlib is to check how many colors the default
> colormap will hold, but I can't find the equivalent accessor in CLX.  Or
> is there some other test that is preferred?

Test is wrong.  You need to check the DefaultVisual(dpy,scr)->class
to see if it is {Pseudo,Direct,True}Color.  This is the only way to
find out if the image you display is in color.

	David.

Kimbrough@dsg.csc.ti.COM (Kerry Kimbrough) (07/23/88)

   > Date: 22 Jul 88 19:52:48 GMT
   > From: sandra@cs.utah.edu  (Sandra J Loosemore)
   > Subject: CLX question
   > 
   > In CLX, how does one determine whether a screen is monochrome or color?
   > The trick I've seen used in Xlib is to check how many colors the default
   > colormap will hold, but I can't find the equivalent accessor in CLX.  Or
   > is there some other test that is preferred?
   > 
   > -Sandra Loosemore (sandra@cs.utah.edu)
	
Try something like this:

(DEFUN display-color-type (display screen-number)
  (LET* (;; Get screen object
	 (screen (NTH screen-number (display-roots display)))

	 ;; Get list of supported (depth visual) entries	 
	 (depths (screen-depths screen))

	 ;; Find max screen depth supported
	 (max-depth (REDUCE #'MAX (MAPCAR #'FIRST depths)))

	 ;; Find all entries for max depth
	 (max-depths (REMOVE max-depth depths :key #'FIRST :test-not #'EQUAL)))

    ;; Return max supported depth and list of visual classes for max depth
    (VALUES max-depth
	    (MAPCAR #'(lambda (d) (visual-info-class (SECOND d))) max-depths))))


For a typical display with a single monochrome screen, the return values will
be:
	1
	(:STATIC-GRAY)


For a typical display with a single 8-bit color screen, the return values will
be:
	8
	(:PSEUDO-COLOR)

	

natraj@razor.ACA.MCC.COM (Natraj Arni) (09/22/88)

Hi!
How do you change the event mask of an existing
window in CLX ?? I want the window to 'see' different
events at various instances.

Thanks.

natraj

-- 
-Natraj Arni
ARPA: natraj@mcc.com
UUCP: {ihnp4,seismo,ctvax}!ut-sally!im4u!milano!hi3.aca.mcc.com!natraj