Permalink
Browse files

no message

  • Loading branch information...
1 parent ece5846 commit 3dc1b4ba9ac6af582821f402ba61e6ed3f43dd2d vladdu committed Mar 1, 2003
Showing with 105 additions and 56 deletions.
  1. +17 −12 lib/ex11/README
  2. +21 −24 lib/ex11/README.developers
  3. +5 −0 lib/ex11/TODO
  4. +14 −14 lib/ex11/ex11.pub
  5. +48 −5 lib/ex11/include/ex11.hrl
  6. +0 −1 lib/ex11/src/ex11.erl
View
@@ -1,6 +1,16 @@
-*** Thu Mar 11 14:50:29 EST 1999 ***
+*** Sat Mar 01 2003 ***
+ex11-0.11B
+==========
+The 0.11 version was converted to use the binary
+features of Erlang and work is under way to
+implement more of the protocol. The project was
+also included in JungErl at SourceForge.
+
+/Vlad, vlad_dumitrescu@hotmail.com
+
+*** Thu Mar 11 1999 ***
ex11-0-11.tgz
===========
@@ -11,8 +21,7 @@ to run on Windows (assuming you have an X server).
/Tobbe, tobbe@serc.rmit.edu.au
-*** Tue Feb 23 11:10:00 EST 1999 ***
-
+*** Tue Feb 23 1999 ***
x11-0-1.tgz
===========
@@ -26,20 +35,16 @@ out with this should read README.developers. But before
anything more are implemented I suggest that we wait
for the new Erlang bit-syntax to be released.
-To compile both for JAM and BEAM, run:
+-------------------------------------
- make
+To compile, run:
-or just:
-
- make jam
- make beam
-
-if you only are running one of the machines.
+ make
Check out the code in rcube.erl for an example on how
to use ex11. Run:
+ rcube:start(), %% default host is "localhost"
rcube:start(HostName),
where HostName is the name of the machine where your
@@ -108,4 +113,4 @@ more
Numerous constant definitions:
==============================
-See ex11.hrl
+See ex11.hrl
@@ -1,6 +1,4 @@
-*** Fri Feb 19 15:21:11 EST 1999 ***
-
If you are interested in helping out implementing the full
X11 protocols + a toolkit on top of it, then let me know.
Basically to add a new request, add a record for the
@@ -15,25 +13,23 @@ EXAMPLE: We add the MapNotify event
1. Edit ex11.hrl and locate the 'EVENT MESSAGES' part.
2. Under the 'Event Codes' heading, add:
-
-define(EVENT_MAP_NOTIFY, 19).
3. Under the 'Event Records' heading, add:
-
-record(map_notify, {seqno, event, window, override_redirect}).
4. Under the 'Event guards' heading, add:
-
-define(IS_MAP_NOTIFY_EVENT(E), record(E,map_notify)).
5. Under the 'Decoding event messages', add a new function clause:
- decode_event([?EVENT_MAP_NOTIFY,_,S1,S0,E3,E2,E1,E0,W3,W2,W1,W0,V|D]) ->
- {_,Rest} = split_list(19,D), % 19 unused bytes
- E = #expose{seqno=i16(S1,S0),
- event=i32(W3,W2,W1,W0),
- window=i32(W3,W2,W1,W0),
- override_redirect=i16(V)},
+ decode_event(<<?EVENT_MAP_NOTIFY,_,SeqNo:16,
+ Event:32,Win:32,V,
+ _:152, Rest/binary]) ->
+ E = #expose{seqno=SeqNo,
+ event=Event,
+ window=Win,
+ override_redirect=V},
{E,Rest};
6. Write a test program which can receive the event.
@@ -80,7 +76,7 @@ Example: We add the PolyLine request
4. Add a suitable clause to enc/2:
- enc(X,Req) when ?IS_POLY_LINE(Req) -> poly_line(X,Req);
+ enc(X,Req) when ?IS_POLY_LINE(Req)-> poly_line(X,Req);
5. Implement the actual encode function (located in alphabetical
order in the file):
@@ -93,16 +89,17 @@ Example: We add the PolyLine request
list(R#poly_line.points) ->
PointsList = encode_points(R#poly_line.points),
{ok,
- [R#poly_line.opcode,
- R#poly_line.coord_mode,
- i16(3 + length(PointsList)),
- i32(R#poly_line.drawable),
- i32(R#poly_line.gc),
- PointsList]}.
+ <<(R#poly_line.opcode),
+ (R#poly_line.coord_mode),
+ (3 + size(PointsList) div 4):16,
+ (R#poly_line.drawable):32,
+ (R#poly_line.gc):32,
+ PointsList/binary]}.
encode_points([H|T]) when ?IS_POINT(H) ->
- [i16(H#point.x) ++ i16(H#point.y)|encode_points(T)];
- encode_points([]) -> [].
+ <<(H#point.x):16, (H#point.y):16,
+ (encode_points(T))/binary>>;
+ encode_points([]) -> <<>>.
Add as many guards as possible. Don't perform any error
checking int the encode function. An eventual crash will
@@ -112,10 +109,10 @@ Example: We add the PolyLine request
------------------------------------------------------------------------
-Good luck, and send me your additions so that I can
+Good luck, and send me your additions so that we can
add them to the standard distribution of the Erlang-
-X11 binding.
-
-/Tobbe , tnt@home.se
+X11 binding. Or better, check in them at JungErl.
+/Tobbe, tnt@home.se
+/Vlad, vlad_dumitrescu@hotmail.com
View
@@ -1 +1,6 @@
+Feel free to add more stuff here:
+
+- handle the errors in a "standard" way?
+ maybe keep a list of the errors from the last minute or so
+
View
@@ -1,22 +1,22 @@
{name, "ex11"}.
-{vsn, {0,11}}.
+{vsn, {0,12}}.
{summary, "An Erlang-X11 binding."}.
{author, "Torbj�rn T�rnkvist", "tobbe@cslab.ericsson.se", "990223"}.
+{author, "Vlad Dumitrescu", "vlad_dumitrescu@hotmail.com", "030226"}.
{keywords, ["X11","graphics programming"]}.
{needs, []}.
-{abstract,"This is an Erlang-X11 binding. Yes, that's right, a
-binding ! Not another interface to a toolkit. This is the X11
-protocol implemented solely in Erlang. The release version
-indicates how much of the protocol that has been implemented
-so far (i.e Ver: 0.1 == 10%). However, this package also
-consists of a complete framework for the protocol implementation,
-so the rest of the protocol would be very easy to implement.
-(I estimate that the remaining 90% of the protocol could be
-implemented in 2-3 weeks). However, before anymore of the
-protocol is implemented it is suggested that we await the
-new Erlang bitsyntax. A 'cool' example program comes along
-with the package. <b>NB: ex11 is the new name and replaces
-the old name x11</b>."}.
+{abstract,"This is an Erlang-X11 binding, now converted to use"
+ "the binary syntax. Yes, that's right, a binding ! Not another
+ "interface to a toolkit. This is the X11 "
+ "protocol implemented solely in Erlang. The release version "
+ "indicates how much of the protocol that has been implemented "
+ "so far (i.e Ver: 0.1 == 10%). However, this package also "
+ "consists of a complete framework for the protocol implementation, "
+ "so the rest of the protocol would be very easy to implement."
+ "(I estimate that the remaining 90% of the protocol could be "
+ "implemented in 2-3 weeks). A 'cool' example program comes along "
+ "with the package. <b>NB: ex11 is the new name and replaces "
+ "the old name x11</b>."}.
@@ -1,5 +1,6 @@
-ifndef(_EX11_H).
-define(_EX11_H, 1).
+
%%% ---------------------------------------------------------------------
%%% Created: 15 Feb 1999 by Tobbe, tobbe@cslab.ericsson.se
%%% Function: Include file, with basic X data.
@@ -34,10 +35,6 @@
-define(MSB_BYTEORDER, $B).
-define(LSB_BYTEORDER, $l).
-%% ---------------
-%% Set of events
-
-
%% ------------
%% Misc Values
@@ -76,6 +73,53 @@
-define(EVENT_COLORMAP_CHANGE, 16#00800000).
-define(EVENT_OWNER_GRAB_BUTTON, 16#01000000).
+%% ---------------
+-define(BIT_GRAVITY_FORGET, 0).
+-define(BIT_GRAVITY_NORTHWEST, 1).
+-define(BIT_GRAVITY_NORTH, 2).
+-define(BIT_GRAVITY_NORTHEAST, 3).
+-define(BIT_GRAVITY_WEST, 4).
+-define(BIT_GRAVITY_CENTER, 5).
+-define(BIT_GRAVITY_EAST, 6).
+-define(BIT_GRAVITY_SOUTHWEST, 7).
+-define(BIT_GRAVITY_SOUTH, 8).
+-define(BIT_GRAVITY_SOUTHEAST, 9).
+-define(BIT_GRAVITY_STATIC, 10).
+
+-define(WIN_GRAVITY_UNMAP, 0).
+-define(WIN_GRAVITY_NORTHWEST, 1).
+-define(WIN_GRAVITY_NORTH, 2).
+-define(WIN_GRAVITY_NORTHEAST, 3).
+-define(WIN_GRAVITY_WEST, 4).
+-define(WIN_GRAVITY_CENTER, 5).
+-define(WIN_GRAVITY_EAST, 6).
+-define(WIN_GRAVITY_SOUTHWEST, 7).
+-define(WIN_GRAVITY_SOUTH, 8).
+-define(WIN_GRAVITY_SOUTHEAST, 9).
+-define(WIN_GRAVITY_STATIC, 10).
+
+-define(KEYBUT_MASK_SHIFT, 16#0001).
+-define(KEYBUT_MASK_LOCK, 16#0002).
+-define(KEYBUT_MASK_CONTROL, 16#0004).
+-define(KEYBUT_MASK_MOD1, 16#0008).
+-define(KEYBUT_MASK_MOD2, 16#0010).
+-define(KEYBUT_MASK_MOD3, 16#0020).
+-define(KEYBUT_MASK_MOD4, 16#0040).
+-define(KEYBUT_MASK_MOD5, 16#0080).
+-define(KEYBUT_MASK_BUTTON1, 16#0100).
+-define(KEYBUT_MASK_BUTTON2, 16#0200).
+-define(KEYBUT_MASK_BUTTON3, 16#0400).
+-define(KEYBUT_MASK_BUTTON4, 16#0800).
+-define(KEYBUT_MASK_BUTTON5, 16#1000).
+
+
+-define(ATOM_PRIMARY, 1).
+-define(ATOM_SECONDARY, 2).
+-define(ATOM_ARC, 3).
+-define(ATOM_ATOM, 4).
+-define(ATOM_BITMAP, 5).
+-define(ATOM_CARDINAL, 6).
+-define(ATOM_COLORMAP, 7).
%% ----------------------
%% MAJOR DATA STRUCTURES
@@ -677,7 +721,6 @@
%% Guards test
-define(IS_WIN_VALUES(R), record(R,win_values)).
-
-record(create_window,
{opcode = 1,
depth,
@@ -39,4 +39,3 @@ get_display(X) -> ex11_client:get_display(X).
set_display(X,Dpy) -> ex11_client:set_display(X,Dpy).
-

0 comments on commit 3dc1b4b

Please sign in to comment.