Skip to content
Snippets Groups Projects
Commit 00b8cd32 authored by Niels Möller's avatar Niels Möller
Browse files

*** empty log message ***

Rev: lib/modules/Protocols.pmod/X.pmod/Xlib.pmod:1.4
Rev: lib/modules/Protocols.pmod/X.pmod/_Xlib.pmod:1.3
Rev: lib/modules/Protocols.pmod/X.pmod/my_struct.pmod:1.2
parent 9046d145
Branches
Tags
No related merge requests found
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* *
*/ */
#define error(x) throw( ({ (x), backtrace() }) ) #include "error.h"
constant XPORT = 6000; constant XPORT = 6000;
...@@ -353,10 +353,8 @@ class Display ...@@ -353,10 +353,8 @@ class Display
case STATE_WAIT_HEADER: case STATE_WAIT_HEADER:
{ {
received->expect(32); /* Correct for most of the cases */ received->expect(32); /* Correct for most of the cases */
string type = _Xlib.event_types[msg[0]]; string type = _Xlib.event_types[msg[0] & 0x3f];
switch(type) if (type == "Error")
{
case "Error":
{ {
mapping m = ([]); mapping m = ([]);
sscanf(msg, "%*c%c%2c%4c%2c%c", sscanf(msg, "%*c%c%2c%4c%2c%c",
...@@ -364,7 +362,7 @@ class Display ...@@ -364,7 +362,7 @@ class Display
m->minorCode, m->majorCode); m->minorCode, m->majorCode);
return ({ ACTION_ERROR, m }); return ({ ACTION_ERROR, m });
} }
case "Reply": else if (type == "Reply")
{ {
reply = ([]); reply = ([]);
int length; int length;
...@@ -377,80 +375,111 @@ class Display ...@@ -377,80 +375,111 @@ class Display
state = STATE_WAIT_REPLY; state = STATE_WAIT_REPLY;
received->expect(length*4); received->expect(length*4);
break;
} }
#if 0 else
{
mapping event = ([ "type" : type ]);
switch(type)
{
case "KeyPress": case "KeyPress":
case "KeyRelease": case "KeyRelease":
case "ButtonPress": case "ButtonPress":
case "ButtonRelease": case "ButtonRelease":
case "MotionNotify": case "MotionNotify": {
... int root, child;
sscanf(msg, "%*c%c%2c%4c" "%4c%4c%4c" "%2c%2c%2c%2c" "%2c%c",
event->detail, event->sequenceNumber, event->time,
root, event->wid, child,
event->rootX, event->rootY, event->eventx, event->eventY,
event->state, event->sameScreen);
event->root = lookup_id(root);
event->event = lookup_id(event->wid);
event->child = child && lookup_id(child);
break;
}
#if 0
case "EnterNotify": case "EnterNotify":
case "LeaveNotify": case "LeaveNotify":
... ...;
case "FocusIn": case "FocusIn":
case "FocusOut": case "FocusOut":
... ...;
#endif #endif
case "KeymapNotify": case "KeymapNotify":
return ({ ACTION_EVENT, event->map = msg[1..];
([ "type" : "KeymapNotify", break;
"map" : msg[1..] ]) }); case "Expose": {
sscanf(msg, "%*4c%4c" "%2c%2c%2c%2c" "%2c",
event->wid,
event->x, event->y, event->width, event->height,
event->count);
event->window = lookup_id(event->wid);
break;
}
#if 0 #if 0
case "Expose":
...
case "GraphicsExpose": case "GraphicsExpose":
... ...;
case "NoExpose": case "NoExpose":
... ...;
case "VisibilityNotify": case "VisibilityNotify":
... ...;
case "CreateNotify": #endif
... case "CreateNotify": {
int window;
sscanf(msg, "%*4c%4c%4c" "%2c%2c" "%2c%2c%2c" "%c",
event->wid, window,
event->x, event->y,
event->width, event->height, event->borderWidth,
event->override);
event->parent = lookup_id(event->wid);
event->window = lookup_id(window) || window;
break;
}
#if 0
case "DestroyNotify": case "DestroyNotify":
... ...;
case "UnmapNotify": case "UnmapNotify":
... ...;
case "MapNotify": case "MapNotify":
... ...;
case "MapRequest": case "MapRequest":
... ...;
case "ReparentNotify": case "ReparentNotify":
... ...;
case "ConfigureNotify": case "ConfigureNotify":
... ...;
case "ConfigureRequest": case "ConfigureRequest":
... ...;
case "GravityNotify": case "GravityNotify":
... ...;
case "ResizeRequest": case "ResizeRequest":
... ...;
case "CirculateNotify": case "CirculateNotify":
... ...;
case "CirculateRequest": case "CirculateRequest":
... ...;
case "PropertyNotify": case "PropertyNotify":
... ...;
case "SelectionClear": case "SelectionClear":
... ...;
case "SelectionRequest": case "SelectionRequest":
... ...;
case "SelectionNotify": case "SelectionNotify":
... ...;
case "ColormapNotify": case "ColormapNotify":
... ...;
case "ClientMessage": case "ClientMessage":
... ...;
case "MappingNotify": case "MappingNotify":
#endif #endif
default: /* Any other event */ default: /* Any other event */
return ({ ACTION_EVENT, event = ([ "type" : "Unimplemented",
([ "type" : "Unimplemented",
"name" : type, "name" : type,
"raw" : msg ]) }); "raw" : msg ]);
break;
}
return ({ ACTION_EVENT, event });
} }
break; break;
} }
......
...@@ -6,21 +6,48 @@ ...@@ -6,21 +6,48 @@
object display_re = Regexp("([^:]*):([0-9]+).([0-9]+)"); object display_re = Regexp("([^:]*):([0-9]+).([0-9]+)");
array(string) window_attributes = array(string) window_attributes =
({ "background_pixmap", ({ "BackPixmap",
"background_pixel", "BackPixel",
"border_pixmap", "BorderPixmap",
"border_pixel", "BorderPixel",
"bit_gravity", "BitGravity",
"win_gravity", "WinGravity",
"backing_store", "BackingStore",
"backing_bit_planes", "BackingPlanes",
"backing_pixel", "BackingPixel",
"override_redirect", "OverrideRedirect",
"save_under", "SaveUnder",
"event_mask", "EventMask",
"do_not_propagate_mask", "DontPropagate",
"colormap", "Colormap",
"cursor" }); "Cursor" });
array(string) gc_attributes =
({
"Function",
"PlaneMask",
"Foreground",
"Background",
"LineWidth",
"LineStyle",
"CapStyle",
"JoinStyle",
"FillStyle",
"FillRule",
"Tile",
"Stipple",
"TileStipXOrigin",
"TileStipYOrigin",
"Font",
"SubwindowMode",
"GraphicsExposures",
"ClipXOrigin",
"ClipYOrigin",
"ClipMask",
"DashOffset",
"DashList",
"ArcMode"
});
mapping(string:int) event_masks = mapping(string:int) event_masks =
([ ([
......
...@@ -3,8 +3,7 @@ ...@@ -3,8 +3,7 @@
* This should replace ADT.struct at some time. * This should replace ADT.struct at some time.
*/ */
#define error(x) throw( ({ (x), backtrace() }) ) #include "error.h"
// #include "error.h"
class struct { class struct {
string buffer; string buffer;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment